Class: Gem::Commands::DumpCommand
- Inherits:
-
Gem::Command
- Object
- Gem::Command
- Gem::Commands::DumpCommand
- Defined in:
- lib/rubygems/commands/dump_command.rb
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize ⇒ DumpCommand
constructor
A new instance of DumpCommand.
Constructor Details
#initialize ⇒ DumpCommand
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
#execute ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/rubygems/commands/dump_command.rb', line 9 def execute sudo = [:args].delete('sudo') || '' args = [: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 |