gem
- 1_8_6_287
- 1_8_7_72
- 1_8_7_330
- 1_9_1_378
- 1_9_2_180
- 1_9_3_125 (0)
- 1_9_3_392 (0)
- 2_1_10 (0)
- 2_2_9 (38)
- 2_4_6 (0)
- 2_5_5 (0)
- 2_6_3 (0)
- What's this?
gem(gem_name, *requirements)
private
Use Kernel#gem to activate a specific version of gem_name.
requirements is a list of version requirements that the specified gem must match, most commonly “= example.version.number”. See Gem::Requirement for how to specify a version requirement.
If you will be activating the latest version of a gem, there is no need to call Kernel#gem, Kernel#require will do the right thing for you.
Kernel#gem returns true if the gem was activated, otherwise false. If the gem could not be found, didn’t match the version requirements, or a different version was already activated, an exception will be raised.
Kernel#gem should be called before any require statements (otherwise RubyGems may load a conflicting library version).
Kernel#gem only loads prerelease versions when prerelease requirements are given:
gem 'rake', '>= 1.1.a', '< 2'
In older RubyGems versions, the environment variable GEM_SKIP could be used to skip activation of specified gems, for example to test out changes that haven’t been installed yet. Now RubyGems defers to -I and the RUBYLIB environment variable to skip activation of a gem.
Example:
GEM_SKIP=libA:libB ruby -I../libA -I../libB ./mycode.rb