Class: EPC::Command::ShowProjectSnapshotCommand

Inherits:
ShowCommand show all
Defined in:
lib/epc/command/project/show_project_snapshot_command.rb

Constant Summary

Constants inherited from BaseCommand

BaseCommand::GIVEUP_TICKS, BaseCommand::SLEEP_TIME, BaseCommand::TICKER_TICKS

Instance Attribute Summary

Attributes inherited from BaseCommand

#client, #klass_name, #object_id, #object_type, #options, #target_id, #target_type

Instance Method Summary collapse

Methods inherited from BaseCommand

#check_options, #context_params, #context_params=, #go, include_module, inherited, #initialize, required_options, #say_err

Methods included from PersistentAttributes

#auth_token, #caller_id, #target_url

Constructor Details

This class inherits a constructor from EPC::Command::BaseCommand

Instance Method Details

#execute(*args) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/epc/command/project/show_project_snapshot_command.rb', line 5

def execute(*args)
  object_id, version = (args[0].split(':') rescue [nil,nil])

  status, response, message = client.get(EPC::Config::PROJECTS_PATH + "/#{object_id}/snapshot/#{version}")
  if status.failure?
    say("Request failed: [#{response[:message]}]")
    return status
  end

  project_table = EPC::TabularOutputter.new([response], {:id => "ID", :name => "NAME", :uri_name => "URI NAME", :archived => "ARCHIVED", :runtime_memory => "RUNTIME MEMORY"})
  
  libraries_table = EPC::TabularOutputter.new(response[:libraries], {:id => "ID", :name => "NAME", :group => "GROUP", :library_version => "LIBRARY VERSION", :scope => "SCOPE"})

  plugins_table = EPC::TabularOutputter.new(response[:plugins], [:id, :name, :group, :plugin_version, :extensions, :inherited])

  dependencies_table = EPC::TabularOutputter.new(response[:dependencies], {:id => "ID", :name => "NAME", :uri_name => "URI NAME", :archived => "ARCHIVED", :runtime_memory => "RUNTIME MEMORY"})


    say("\nProject details:")
    say(project_table.print)
    
    say("\nLibraries:")
    say(libraries_table.print)
    
    say("\nDependencies:")
    say(dependencies_table.print)

    say("\nPlugins:")
    say(plugins_table.print)

  return status
end