Module | Gem |
In: |
lib/rubygems/test_case.rb
lib/rubygems/gem_openssl.rb lib/rubygems/defaults.rb lib/rubygems.rb |
RubyGems is the Ruby standard for publishing and managing third party libraries.
For user documentation, see:
For gem developer documentation see:
Further RubyGems documentation can be found at:
As of RubyGems 1.3.2, RubyGems will load plugins installed in gems or $LOAD_PATH. Plugins must be named ‘rubygems_plugin’ (.rb, .so, etc) and placed at the root of your gem‘s require_path. Plugins are discovered via Gem::find_files then loaded. Take care when implementing a plugin as your plugin file may be loaded multiple times if multiple versions of your gem are installed.
For an example plugin, see the graph gem which adds a `gem graph` command.
RubyGems defaults are stored in rubygems/defaults.rb. If you‘re packaging RubyGems or implementing Ruby you can change RubyGems’ defaults.
For RubyGems packagers, provide lib/rubygems/operating_system.rb and override any defaults from lib/rubygems/defaults.rb.
For Ruby implementers, provide lib/rubygems/#{RUBY_ENGINE}.rb and override any defaults from lib/rubygems/defaults.rb.
If you need RubyGems to perform extra work on install or uninstall, your defaults override file can set pre and post install and uninstall hooks. See Gem::pre_install, Gem::pre_uninstall, Gem::post_install, Gem::post_uninstall.
You can submit bugs to the RubyGems bug tracker on RubyForge
RubyGems is currently maintained by Eric Hodel.
RubyGems was originally developed at RubyConf 2003 by:
Contributors:
(If your name is missing, PLEASE let us know!)
Thanks!
-The RubyGems Team
QUICKLOADER_SUCKAGE | = | RUBY_VERSION =~ /^1\.9\.1/ | ||
GEM_PRELUDE_SUCKAGE | = | RUBY_VERSION =~ /^1\.9\.2/ | ||
RubyGemsVersion | = | VERSION = '1.5.3' | ||
RbConfigPriorities | = | %w[ EXEEXT RUBY_SO_NAME arch bindir datadir libdir ruby_install_name ruby_version rubylibprefix sitedir sitelibdir vendordir vendorlibdir ] | ||
ConfigMap | = | Hash.new do |cm, key| cm[key] = RbConfig::CONFIG[key.to_s] | Configuration settings from ::RbConfig |
ssl_available | [W] | Is SSL available? |
The default directory for binaries Puppet patch:
/opt/puppet/bin is the default path in Debian based systems
# File lib/rubygems/defaults.rb, line 66 66: def self.default_bindir 67: ConfigMap[:bindir] 68: end
Default home directory path to be used if an alternate value is not specified in the environment
Puppet patch: search order of this directory.
1. GEM_HOME enviroment variable (Using this, Gems are to be installed in any path as you like) 2. /opt/puppet/lib/gems/{ruby version} (This is the default path in Debian system)
# File lib/rubygems/defaults.rb, line 25 25: def self.default_dir 26: File.join('/', 'opt', 'puppet', 'lib', 'gems', ConfigMap[:ruby_version]) 27: end
Deduce Ruby‘s —program-prefix and —program-suffix from its install name
# File lib/rubygems/defaults.rb, line 50 50: def self.default_exec_format 51: exec_format = ConfigMap[:ruby_install_name].sub('ruby', '%s') rescue '%s' 52: 53: unless exec_format =~ /%s/ then 54: raise Gem::Exception, 55: "[BUG] invalid exec_format #{exec_format.inspect}, no %s" 56: end 57: 58: exec_format 59: end
Default gem load path
# File lib/rubygems/defaults.rb, line 39 39: def self.default_path 40: if File.exist? Gem.user_home then 41: [user_dir, default_dir] 42: else 43: [default_dir] 44: end 45: end
An Array of the default sources that come with RubyGems
# File lib/rubygems/defaults.rb, line 11 11: def self.default_sources 12: %w[http://rubygems.org/] 13: end
The default system-wide source info cache directory
# File lib/rubygems/defaults.rb, line 73 73: def self.default_system_source_cache_dir 74: File.join Gem.dir, 'source_cache' 75: end
The default user-specific source info cache directory
# File lib/rubygems/defaults.rb, line 80 80: def self.default_user_source_cache_dir 81: File.join Gem.user_home, '.gem', 'source_cache' 82: end
Ensure that SSL is available. Throw an exception if it is not.
# File lib/rubygems/gem_openssl.rb, line 31 31: def ensure_ssl_available 32: unless ssl_available? 33: raise Gem::Exception, "SSL is not installed on this system" 34: end 35: end
Allows setting path to ruby. This method is available when requiring ‘rubygems/test_case‘
# File lib/rubygems/test_case.rb, line 63 63: def self.ruby= ruby 64: @ruby = ruby 65: end
A wrapper around RUBY_ENGINE const that may not be defined
# File lib/rubygems/defaults.rb, line 87 87: def self.ruby_engine 88: if defined? RUBY_ENGINE then 89: RUBY_ENGINE 90: else 91: 'ruby' 92: end 93: end
Allows setting the gem path searcher. This method is available when requiring ‘rubygems/test_case‘
# File lib/rubygems/test_case.rb, line 39 39: def self.searcher=(searcher) 40: @searcher = searcher 41: end
Allows setting the default SourceIndex. This method is available when requiring ‘rubygems/test_case‘
# File lib/rubygems/test_case.rb, line 47 47: def self.source_index=(si) 48: @@source_index = si 49: end
Is SSL (used by the signing commands) available on this platform?
# File lib/rubygems/gem_openssl.rb, line 19 19: def ssl_available? 20: @ssl_available 21: end
Path for gems in the user‘s home directory
# File lib/rubygems/defaults.rb, line 32 32: def self.user_dir 33: File.join Gem.user_home, '.gem', ruby_engine, ConfigMap[:ruby_version] 34: end