Class: Gem::Commands::DumpCommand

Inherits:
Gem::Command
  • Object
show all
Defined in:
lib/rubygems/commands/dump_command.rb

Instance Method Summary collapse

Constructor Details

#initializeDumpCommand

Returns a new instance of DumpCommand.



5
6
7
# File 'lib/rubygems/commands/dump_command.rb', line 5

def initialize
  super 'dump', 'dump a list of rubygems formatted as gem install <gemname> <version>'
end

Instance Method Details

#executeObject



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/rubygems/commands/dump_command.rb', line 9

def execute
  sudo = options[:args].delete('sudo') || ''
  args = options[:args].map do |arg| 
    "--#{arg}" 
  end.join(' ')

  gems =  Gem.source_index.gems.values
  gems.each do |gem|  
    say "#{sudo} gem install #{gem.name} --version #{gem.version} #{args}"
  end
end