Class: Gem::Commands::SnapshotCommand
- Inherits:
-
Gem::Command
- Object
- Gem::Command
- Gem::Commands::SnapshotCommand
- Defined in:
- lib/commands/snapshot_command.rb
Instance Method Summary collapse
-
#arguments ⇒ Object
:nodoc:.
-
#defaults_str ⇒ Object
:nodoc:.
-
#description ⇒ Object
:nodoc:.
- #execute ⇒ Object
-
#initialize ⇒ SnapshotCommand
constructor
A new instance of SnapshotCommand.
-
#usage ⇒ Object
:nodoc:.
Constructor Details
#initialize ⇒ SnapshotCommand
Returns a new instance of SnapshotCommand.
5 6 7 8 9 10 11 12 |
# File 'lib/commands/snapshot_command.rb', line 5 def initialize super 'snapshot', 'Export/Import your gems.', :format => "tar" add_option('-f', '--format FORMAT', 'Snapshot format. Default is "tar". Can be "yml" too.') do |value, | [:format] = value end end |
Instance Method Details
#arguments ⇒ Object
:nodoc:
18 19 20 21 22 23 24 |
# File 'lib/commands/snapshot_command.rb', line 18 def arguments # :nodoc: args = <<-EOF ACTION 'export' or 'import' as action arguments FILENAME file used to export/import actions EOF return args.gsub(/^\s+/, '') end |
#defaults_str ⇒ Object
:nodoc:
14 15 16 |
# File 'lib/commands/snapshot_command.rb', line 14 def defaults_str # :nodoc: '--format "tar"' end |
#description ⇒ Object
:nodoc:
26 27 28 29 30 31 |
# File 'lib/commands/snapshot_command.rb', line 26 def description # :nodoc: <<-EOF Describe here what snapshot does. Updated description at: http://github.com/rogerleite/rubygems_snapshot EOF end |
#execute ⇒ Object
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/commands/snapshot_command.rb', line 37 def execute action, filename = extract_action([:args]) () if action == "export" export(filename) else import(filename) end end |
#usage ⇒ Object
:nodoc:
33 34 35 |
# File 'lib/commands/snapshot_command.rb', line 33 def usage # :nodoc: "#{program_name} ACTION(export|import) FILENAME" end |