Class: Gem::Commands::DefaultCommand
- Inherits:
-
Gem::Command
- Object
- Gem::Command
- Gem::Commands::DefaultCommand
- Defined in:
- lib/rubygems/commands/default_command.rb
Instance Method Summary collapse
- #description ⇒ Object
- #execute ⇒ Object
-
#initialize(output = STDOUT) ⇒ DefaultCommand
constructor
A new instance of DefaultCommand.
- #usage ⇒ Object
Constructor Details
#initialize(output = STDOUT) ⇒ DefaultCommand
Returns a new instance of DefaultCommand.
5 6 7 8 9 10 11 12 |
# File 'lib/rubygems/commands/default_command.rb', line 5 def initialize(output = STDOUT) super 'default', description @output = output add_option('-v', '--version VERSION', 'Gem version to be a default gem') do |version, | [:version] = version end end |
Instance Method Details
#description ⇒ Object
18 19 20 |
# File 'lib/rubygems/commands/default_command.rb', line 18 def description 'Allows you to change an arbitrary installed gem to a default gem' end |
#execute ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/rubygems/commands/default_command.rb', line 22 def execute gem_name = [:args][0] if gem_name.nil? abort 'gem name is not specified. Usage: `gem default gem_name -v 1.2.3`' end DefaultGemInstaller.new( gem_home: Gem.paths.home, ruby_arch_dir: RbConfig::CONFIG['rubyarchdir'], ruby_bin_dir: RbConfig::CONFIG['bindir'], ruby_lib_dir: RbConfig::CONFIG['rubylibdir'], dlext: RbConfig::CONFIG['DLEXT'], ).install(gem_name, version: [:version]) end |
#usage ⇒ Object
14 15 16 |
# File 'lib/rubygems/commands/default_command.rb', line 14 def usage "#{program_name} GEMNAME" end |