Class: Gem::Commands::ExportCommand

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

Instance Method Summary collapse

Constructor Details

#initializeExportCommand

new, #execute, #arguments, #defaults_str, #description and #usage



6
7
8
# File 'lib/rubygems/commands/export_command.rb', line 6

def initialize # :nodoc:
  super 'export', 'Export installed gems to a yaml file format'
end

Instance Method Details

#argumentsObject

:nodoc:



20
21
22
# File 'lib/rubygems/commands/export_command.rb', line 20

def arguments # :nodoc:
  ""
end

#descriptionObject

:nodoc:



24
25
26
27
28
# File 'lib/rubygems/commands/export_command.rb', line 24

def description # :nodoc:
  <<-EOF
Exports all installed gems to a YAML file
  EOF
end

#executeObject

:nodoc:



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

def execute # :nodoc:
  puts "Exporting to gems.yml"
  # TODO: This is a huge hack to work with current version of GemInstaller.  Need to modify
  # geminstaller to have a proper --export [FILE] option to export all installed gems 
  # to a specified yaml file, with no required input geminstaller.yml file
  system('touch /tmp/gems-to-exclude.yml') || raise
  output = `geminstaller --print-rogue-gems --config=/tmp/gems-to-exclude.yml`
  File.open('gems.yml', 'w') {|f| f.write(output) }
end

#usageObject

:nodoc:



30
31
32
# File 'lib/rubygems/commands/export_command.rb', line 30

def usage # :nodoc:
  "#{program_name}"
end