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:

RubyGems Plugins

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, Packaging

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.

Bugs

You can submit bugs to the RubyGems bug tracker on RubyForge

Credits

RubyGems is currently maintained by Eric Hodel.

RubyGems was originally developed at RubyConf 2003 by:

  • Rich Kilmer — rich(at)infoether.com
  • Chad Fowler — chad(at)chadfowler.com
  • David Black — dblack(at)wobblini.net
  • Paul Brannan — paul(at)atdesk.com
  • Jim Weirch — jim(at)weirichhouse.org

Contributors:

  • Gavin Sinclair — gsinclair(at)soyabean.com.au
  • George Marrows — george.marrows(at)ntlworld.com
  • Dick Davies — rasputnik(at)hellooperator.net
  • Mauricio Fernandez — batsman.geo(at)yahoo.com
  • Simon Strandgaard — neoneye(at)adslhome.dk
  • Dave Glasser — glasser(at)mit.edu
  • Paul Duncan — pabs(at)pablotron.org
  • Ville Aine — vaine(at)cs.helsinki.fi
  • Eric Hodel — drbrain(at)segment7.net
  • Daniel Berger — djberg96(at)gmail.com
  • Phil Hagelberg — technomancy(at)gmail.com
  • Ryan Davis — ryand-ruby(at)zenspider.com

(If your name is missing, PLEASE let us know!)

Thanks!

-The RubyGems Team

Methods

Classes and Modules

Module Gem::Commands
Module Gem::DefaultUserInteraction
Module Gem::Ext
Module Gem::GemcutterUtilities
Module Gem::InstallUpdateOptions
Module Gem::LocalRemoteOptions
Module Gem::Package
Module Gem::RequirePathsBuilder
Module Gem::Text
Module Gem::UserInteraction
Module Gem::VersionOption
Class Gem::Builder
Class Gem::Command
Class Gem::CommandLineError
Class Gem::CommandManager
Class Gem::ConfigFile
Class Gem::ConsoleUI
Class Gem::Dependency
Class Gem::DependencyError
Class Gem::DependencyInstaller
Class Gem::DependencyList
Class Gem::DependencyRemovalException
Class Gem::DocManager
Class Gem::DocumentError
Class Gem::EndOfYAMLException
Class Gem::ErrorReason
Class Gem::Exception
Class Gem::FakeFetcher
Class Gem::FileOperations
Class Gem::FilePermissionError
Class Gem::Format
Class Gem::FormatException
Class Gem::GemNotFoundException
Class Gem::GemNotInHomeException
Class Gem::GemPathSearcher
Class Gem::GemRunner
Class Gem::Indexer
Class Gem::InstallError
Class Gem::Installer
Class Gem::InstallerTestCase
Class Gem::InvalidSpecificationException
Class Gem::LoadError
Class Gem::MockGemUi
Class Gem::OldFormat
Class Gem::OperationNotSupportedError
Class Gem::PackageTask
Class Gem::Platform
Class Gem::PlatformMismatch
Class Gem::RemoteError
Class Gem::RemoteFetcher
Class Gem::RemoteInstallationCancelled
Class Gem::RemoteInstallationSkipped
Class Gem::RemoteSourceException
Class Gem::Requirement
Class Gem::Server
Class Gem::SilentUI
Class Gem::SourceIndex
Class Gem::SpecFetcher
Class Gem::Specification
Class Gem::StreamUI
Class Gem::SystemExitException
Class Gem::TestCase
Class Gem::Uninstaller
Class Gem::Validator
Class Gem::VerificationError
Class Gem::Version

Constants

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

Attributes

ssl_available  [W]  Is SSL available?

Public Class methods

The default directory for binaries Puppet patch:

  /opt/puppet/bin is the default path in Debian based systems

[Source]

    # 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)

[Source]

    # 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

[Source]

    # 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

[Source]

    # 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

[Source]

    # 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

[Source]

    # 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

[Source]

    # 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.

[Source]

    # 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‘

[Source]

    # 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

[Source]

    # 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‘

[Source]

    # 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‘

[Source]

    # 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?

[Source]

    # 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

[Source]

    # 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

Allows toggling Windows behavior. This method is available when requiring ‘rubygems/test_case‘

[Source]

    # File lib/rubygems/test_case.rb, line 55
55:   def self.win_platform=(val)
56:     @@win_platform = val
57:   end

[Validate]