epc 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (152) hide show
  1. data/lib/epc.rb +71 -54
  2. data/lib/epc/command/archive_command.rb +12 -0
  3. data/lib/epc/command/attach_libraryset_command.rb +1 -2
  4. data/lib/epc/command/attach_runtime_command.rb +0 -1
  5. data/lib/epc/command/base_command.rb +52 -63
  6. data/lib/epc/command/config/delete_config_command.rb +57 -0
  7. data/lib/epc/command/{list_config_command.rb → config/list_configs_command.rb} +1 -1
  8. data/lib/epc/command/config/update_config_command.rb +56 -0
  9. data/lib/epc/command/create_command.rb +0 -1
  10. data/lib/epc/command/delete_command.rb +16 -0
  11. data/lib/epc/command/{delete_dependency_command.rb → dependency/delete_dependency_command.rb} +14 -16
  12. data/lib/epc/command/deploy_command.rb +1 -2
  13. data/lib/epc/command/deployment/list_deployments_command.rb +49 -0
  14. data/lib/epc/command/deployment/show_deployment_command.rb +61 -0
  15. data/lib/epc/command/{update_deploymentproject_command.rb → deployment/update_deployment_command.rb} +3 -3
  16. data/lib/epc/command/{list_stages_command.rb → deploymentstage/list_deploymentstages_command.rb} +1 -1
  17. data/lib/epc/command/group/delete_group_command.rb +25 -0
  18. data/lib/epc/command/{list_groups_command.rb → group/list_groups_command.rb} +1 -1
  19. data/lib/epc/command/{show_group_command.rb → group/show_group_command.rb} +2 -9
  20. data/lib/epc/command/{update_group_command.rb → group/update_group_command.rb} +3 -20
  21. data/lib/epc/command/library/create_library_command.rb +2 -5
  22. data/lib/epc/command/library/delete_library_command.rb +23 -0
  23. data/lib/epc/command/{list_libraries_command.rb → library/list_libraries_command.rb} +1 -1
  24. data/lib/epc/command/librarylanguage/delete_librarylanguage_command.rb +24 -0
  25. data/lib/epc/command/{list_librarylanguages_command.rb → librarylanguage/list_librarylanguages_command.rb} +1 -1
  26. data/lib/epc/command/{update_librarylanguage_command.rb → librarylanguage/update_librarylanguage_command.rb} +6 -10
  27. data/lib/epc/command/libraryset/create_libraryset_command.rb +1 -6
  28. data/lib/epc/command/{delete_libraryset_command.rb → libraryset/delete_libraryset_command.rb} +2 -18
  29. data/lib/epc/command/{list_librarysets_command.rb → libraryset/list_librarysets_command.rb} +1 -1
  30. data/lib/epc/command/{show_libraryset_command.rb → libraryset/show_libraryset_command.rb} +2 -17
  31. data/lib/epc/command/{update_libraryset_command.rb → libraryset/update_libraryset_command.rb} +4 -16
  32. data/lib/epc/command/list_command.rb +22 -0
  33. data/lib/epc/command/list_metrics_command.rb +25 -0
  34. data/lib/epc/command/list_objecttypes_command.rb +2 -4
  35. data/lib/epc/command/list_versions_command.rb +0 -1
  36. data/lib/epc/command/{list_objectroles_command.rb → objectrole/list_objectroles_command.rb} +3 -3
  37. data/lib/epc/command/objectrole/update_objectrole_command.rb +14 -0
  38. data/lib/epc/command/{list_rolepermissions_command.rb → permission/list_permissions_command.rb} +2 -2
  39. data/lib/epc/command/{list_permissiongroups_command.rb → permissiongroup/list_permissiongroups_command.rb} +1 -1
  40. data/lib/epc/command/plugin/create_plugin_command.rb +42 -0
  41. data/lib/epc/command/plugin/delete_plugin_command.rb +26 -0
  42. data/lib/epc/command/plugin/list_plugins_command.rb +19 -0
  43. data/lib/epc/command/plugin/show_plugin_command.rb +29 -0
  44. data/lib/epc/command/plugin/update_plugin_command.rb +53 -0
  45. data/lib/epc/command/{archive_project_command.rb → project/archive_project_command.rb} +4 -3
  46. data/lib/epc/command/{delete_project_command.rb → project/delete_project_command.rb} +11 -7
  47. data/lib/epc/command/{list_projects_command.rb → project/list_projects_command.rb} +8 -9
  48. data/lib/epc/command/{show_project_command.rb → project/show_project_command.rb} +64 -29
  49. data/lib/epc/command/{unarchive_project_command.rb → project/unarchive_project_command.rb} +5 -4
  50. data/lib/epc/command/{update_project_command.rb → project/update_project_command.rb} +11 -5
  51. data/lib/epc/command/{list_projecttypes_command.rb → projecttype/list_projecttypes_command.rb} +1 -1
  52. data/lib/epc/command/{show_projecttype_command.rb → projecttype/show_projecttype_command.rb} +4 -3
  53. data/lib/epc/command/pull_command.rb +33 -35
  54. data/lib/epc/command/{delete_role_command.rb → role/delete_role_command.rb} +3 -4
  55. data/lib/epc/command/{list_roles_command.rb → role/list_roles_command.rb} +4 -3
  56. data/lib/epc/command/{show_role_command.rb → role/show_role_command.rb} +18 -10
  57. data/lib/epc/command/role/update_role_command.rb +95 -0
  58. data/lib/epc/command/{list_runtimes_command.rb → runtime/list_runtimes_command.rb} +0 -0
  59. data/lib/epc/command/servicedefinition/create_servicedefinition_command.rb +23 -0
  60. data/lib/epc/command/{list_servicedefinitions_command.rb → servicedefinition/list_servicedefinitions_command.rb} +1 -0
  61. data/lib/epc/command/{list_service_types_command.rb → servicetype/list_servicetypes_command.rb} +0 -0
  62. data/lib/epc/command/serviceversion/delete_serviceversion_command.rb +24 -0
  63. data/lib/epc/command/{list_serviceversions_command.rb → serviceversion/list_serviceversions_command.rb} +1 -1
  64. data/lib/epc/command/show_command.rb +27 -0
  65. data/lib/epc/command/show_instances_command.rb +33 -0
  66. data/lib/epc/command/show_metrics_command.rb +55 -0
  67. data/lib/epc/command/{archive_solution_command.rb → solution/archive_solution_command.rb} +2 -1
  68. data/lib/epc/command/solution/create_solution_command.rb +0 -1
  69. data/lib/epc/command/{delete_solution_command.rb → solution/delete_solution_command.rb} +5 -10
  70. data/lib/epc/command/solution/list_solutions_command.rb +1 -1
  71. data/lib/epc/command/{show_solution_command.rb → solution/show_solution_command.rb} +12 -7
  72. data/lib/epc/command/{unarchive_solution_command.rb → solution/unarchive_solution_command.rb} +1 -1
  73. data/lib/epc/command/solution/update_solution_command.rb +2 -1
  74. data/lib/epc/command/unarchive_command.rb +12 -0
  75. data/lib/epc/command/update_command.rb +15 -0
  76. data/lib/epc/command/update_rolepermissions_command.rb +2 -2
  77. data/lib/epc/command/{delete_user_command.rb → user/delete_user_command.rb} +4 -12
  78. data/lib/epc/command/{list_users_command.rb → user/list_users_command.rb} +1 -1
  79. data/lib/epc/command/{show_user_command.rb → user/show_user_command.rb} +3 -17
  80. data/lib/epc/command/{update_user_command.rb → user/update_user_command.rb} +2 -4
  81. data/lib/epc/config.rb +4 -1
  82. data/lib/epc/help.rb +50 -35
  83. data/lib/epc/runner.rb +16 -5
  84. data/lib/epc/version.rb +1 -1
  85. data/lib/epc/vertical_bar.rb +40 -0
  86. data/test/command/create_library_command_test.rb +5 -2
  87. data/test/command/create_libraryset_command_test.rb +1 -1
  88. data/test/command/create_plugin_command_test.rb +44 -0
  89. data/test/command/create_servicedefinition_command_test.rb +43 -0
  90. data/test/command/delete_config_command_test.rb +0 -11
  91. data/test/command/delete_dependency_command_test.rb +3 -11
  92. data/test/command/delete_library_command_test.rb +2 -15
  93. data/test/command/delete_librarylanguage_command_test.rb +2 -24
  94. data/test/command/delete_libraryset_command_test.rb +2 -24
  95. data/test/command/delete_plugin_command_test.rb +32 -0
  96. data/test/command/delete_project_command_test.rb +0 -6
  97. data/test/command/delete_role_command_test.rb +1 -1
  98. data/test/command/delete_serviceversion_command_test.rb +0 -22
  99. data/test/command/delete_solution_command_test.rb +4 -4
  100. data/test/command/delete_user_command_test.rb +2 -24
  101. data/test/command/list_config_command_test.rb +3 -3
  102. data/test/command/list_deployments_command_test.rb +17 -20
  103. data/test/command/list_deploymentstages_command_test.rb +2 -2
  104. data/test/command/list_metrics_command_test.rb +40 -0
  105. data/test/command/{list_rolepermissions_command_test.rb → list_permissions_command_test.rb} +2 -2
  106. data/test/command/list_plugins_command_test.rb +27 -0
  107. data/test/command/list_projects_command_test.rb +3 -5
  108. data/test/command/list_roles_command_test.rb +2 -3
  109. data/test/command/pull_command_test.rb +13 -9
  110. data/test/command/show_group_command_test.rb +1 -23
  111. data/test/command/show_instances_command_test.rb +33 -0
  112. data/test/command/show_libraryset_command_test.rb +0 -11
  113. data/test/command/show_metrics_command_test.rb +51 -0
  114. data/test/command/show_plugin_command_test.rb +28 -0
  115. data/test/command/show_project_command_test.rb +1 -1
  116. data/test/command/show_projecttype_command_test.rb +0 -5
  117. data/test/command/show_role_command_test.rb +1 -1
  118. data/test/command/show_solution_command_test.rb +1 -1
  119. data/test/command/show_user_command_test.rb +2 -22
  120. data/test/command/update_config_command_test.rb +3 -9
  121. data/test/command/{update_deploymentproject_command_test.rb → update_deployment_command_test.rb} +6 -11
  122. data/test/command/update_group_command_test.rb +1 -20
  123. data/test/command/update_librarylanguage_command_test.rb +0 -15
  124. data/test/command/update_libraryset_command_test.rb +0 -13
  125. data/test/command/update_plugin_command_test.rb +41 -0
  126. data/test/command/update_project_command_test.rb +3 -3
  127. data/test/command/update_role_command_test.rb +2 -1
  128. data/test/command/update_solution_command_test.rb +3 -9
  129. data/test/command/update_user_command_test.rb +0 -6
  130. metadata +177 -165
  131. data/lib/epc/command/define_service_command.rb +0 -37
  132. data/lib/epc/command/delete_config_command.rb +0 -63
  133. data/lib/epc/command/delete_group_command.rb +0 -40
  134. data/lib/epc/command/delete_library_command.rb +0 -30
  135. data/lib/epc/command/delete_librarylanguage_command.rb +0 -40
  136. data/lib/epc/command/delete_serviceversion_command.rb +0 -52
  137. data/lib/epc/command/list_approvals_command.rb +0 -27
  138. data/lib/epc/command/list_attachedlibraries_command.rb +0 -42
  139. data/lib/epc/command/list_boundservices_command.rb +0 -40
  140. data/lib/epc/command/list_dependencies_command.rb +0 -43
  141. data/lib/epc/command/list_deployments_command.rb +0 -68
  142. data/lib/epc/command/list_solutions_command.rb +0 -25
  143. data/lib/epc/command/show_deployment_command.rb +0 -57
  144. data/lib/epc/command/update_config_command.rb +0 -62
  145. data/lib/epc/command/update_role_command.rb +0 -47
  146. data/lib/epc/command/update_solution_command.rb +0 -45
  147. data/test/command/define_service_command_test.rb +0 -55
  148. data/test/command/delete_group_command_test.rb +0 -56
  149. data/test/command/list_approvals_command_test.rb +0 -41
  150. data/test/command/list_boundservices_command_test.rb +0 -46
  151. data/test/command/list_dependencies_command_test.rb +0 -46
  152. data/test/command/update_rolepermissions_command_test.rb +0 -54
@@ -0,0 +1,95 @@
1
+ module EPC::Command
2
+ class UpdateRoleCommand < UpdateCommand
3
+
4
+ required_options :add_user, :remove_user, :add_group, :remove_group, :add_grant, :remove_grant, :mode => :any?, :message => "You must specify a user/group/grant to added or removed"
5
+
6
+ def execute(role = nil, *args)
7
+ role_id = retrieve_identifier_for("Role", role)
8
+
9
+ if @options[:add_user].present?
10
+ user_id = retrieve_identifier_for("User", @options[:add_user])
11
+ params = []
12
+ params << {:member_id => user_id.to_i, :member_type => "User"}
13
+
14
+ status, response, headers = client.put(EPC::Config::ROLES_PATH + "/#{role_id}/assign_members", {:role_memberships => params})
15
+ say("User added to role") if status.successful?
16
+ end
17
+
18
+
19
+ if @options[:remove_user].present?
20
+ user_id = retrieve_identifier_for("User", @options[:add_user])
21
+ status, response, headers = client.delete(EPC::Config::ROLES_PATH + "/#{role_id}/remove_member", {:member_id => @options[:remove_user], :member_type => "User"})
22
+ say("User removed from role") if status.successful?
23
+ end
24
+
25
+ if @options[:add_group].present?
26
+ group_id = retrieve_identifier_for("UserGroup", @options[:add_group])
27
+ params = []
28
+ params << {:member_id => group_id.to_i, :member_type => "UserGroup"}
29
+
30
+ status, response, headers = client.put(EPC::Config::ROLES_PATH + "/#{role_id}/assign_members", {:role_memberships => params})
31
+ say("UserGroup added to role") if status.successful?
32
+ end
33
+
34
+
35
+ if @options[:remove_group].present?
36
+ group_id = retrieve_identifier_for("UserGroup", @options[:remove_group])
37
+ status, response, headers = client.delete(EPC::Config::ROLES_PATH + "/#{role_id}/remove_member", {:member_id => group_id, :member_type => "UserGroup"})
38
+ say("UserGroup removed from role") if status.successful?
39
+ end
40
+
41
+
42
+
43
+ if @options[:add_grant].present?
44
+ secured_type, action, secured_id = @options[:add_grant].split(":")
45
+ raise FatalError, "Grant incorrectly specified" if secured_type.blank? || action.blank?
46
+
47
+ params = {}
48
+ params[:grant_action] = action
49
+ params[:permitted_type] = "Role"
50
+ params[:permitted_id] = role_id.to_i
51
+ params[:secured_type] = secured_type
52
+ params[:secured_id] = secured_id if secured_id.present?
53
+
54
+
55
+ status, response, headers = client.post(EPC::Config::GRANTS_PATH, params)
56
+
57
+ if status.successful?
58
+ say("Role permission updated")
59
+ end
60
+ end
61
+
62
+
63
+ if @options[:remove_grant].present?
64
+ secured_type, action, secured_id = @options[:remove_grant].split(":")
65
+ status, response, headers = client.get(EPC::Config::ROLES_PATH + "/#{role_id}/grants")
66
+
67
+ if status.successful?
68
+ grant_id = response.detect do |g|
69
+ found = (g[:action] == action)
70
+ found = found && (g[:secured_type].to_s == secured_type)
71
+ if secured_id.blank?
72
+ found = found && g[:secured_id].blank?
73
+ else
74
+ found = found && (g[:secured_id].to_s == secured_id)
75
+ end
76
+ found
77
+ end[:id] rescue nil
78
+
79
+ raise FatalError, "Permission couldn't be determined" if grant_id.blank?
80
+
81
+ status, response, headers = client.delete(EPC::Config::GRANTS_PATH + "/#{grant_id}")
82
+
83
+ if status.successful?
84
+ say("Role permission deleted")
85
+ end
86
+ end
87
+ end
88
+
89
+
90
+
91
+ say("Request failed: [#{response[:message]}]") unless status.successful?
92
+ return status
93
+ end
94
+ end
95
+ end
@@ -0,0 +1,23 @@
1
+ module EPC::Command
2
+ class CreateServicedefinitionCommand < BaseCommand
3
+
4
+ def execute(target, *args)
5
+
6
+ service_name = args.first
7
+ service_type = args[1]
8
+
9
+ raise FatalError, "You must specify both the service definition name and service type" if service_name.blank? || service_type.blank?
10
+
11
+ service_type_id = retrieve_identifier_for("ServiceType", service_type)
12
+
13
+ status, response, headers = client.post(EPC::Config::SERVICE_DEFINITIONS_PATH, {:name => service_name, :type_id => service_type_id})
14
+ if status.failure?
15
+ say("Service definition failed with: [#{response[:message]}]")
16
+ else
17
+ say("#{service_name} has been defined.")
18
+ end
19
+ return status
20
+ end
21
+ end
22
+
23
+ end
@@ -2,6 +2,7 @@ module EPC::Command
2
2
  class ListServicedefinitionsCommand < BaseCommand
3
3
 
4
4
  def execute(*args)
5
+
5
6
  status, response, headers = client.get(EPC::Config::SERVICE_DEFINITIONS_PATH)
6
7
  if status.failure?
7
8
  say("Request failed with: [#{response['message']}]")
@@ -0,0 +1,24 @@
1
+ module EPC::Command
2
+ class DeleteServiceversionCommand < DeleteCommand
3
+
4
+ def execute(service_version = nil, *args)
5
+
6
+ proceed = ask_yn("Are you sure you want to delete the [#{service_version}] service_version. Correct? [Yn] ")
7
+ if proceed.upcase == 'N'
8
+ return 1
9
+ end
10
+
11
+ service_version_id = retrieve_identifier_for("ServiceVersion", (service_version.split(":") rescue service_version))
12
+
13
+ status, response, headers = client.delete(EPC::Config::SERVICE_VERSIONS_PATH + "/#{service_version_id}")
14
+
15
+ if status.successful?
16
+ say("Service version deleted.")
17
+ else
18
+ say("Request failed: [#{response[:message]}]")
19
+ end
20
+ return status
21
+
22
+ end
23
+ end
24
+ end
@@ -1,7 +1,7 @@
1
1
  module EPC::Command
2
2
  class ListServiceversionsCommand < BaseCommand
3
3
 
4
- def execute()
4
+ def execute(target = nil)
5
5
  status, response, headers = client.get(EPC::Config::SERVICE_VERSIONS_PATH)
6
6
 
7
7
  if status.failure?
@@ -0,0 +1,27 @@
1
+ module EPC::Command
2
+ class ShowCommand < BaseCommand
3
+
4
+ def execute(object = nil, *params)
5
+ @object_type = object.split(":").first rescue nil
6
+ @object_id = object.split(":")[1..-1].join(":") rescue nil
7
+ raise FatalError, "Object incorrectly specified" if @object_type.blank?
8
+ klass = "EPC::Command::Show#{@object_type.to_s.gsub("-","").capitalize}Command"
9
+ params = normalize_params(params)
10
+ command = eval(klass).new(client, @options)
11
+ check_params
12
+ command.go(@object_id, *params)
13
+ end
14
+
15
+ private
16
+
17
+ def show?(entity)
18
+ translated_entity = translate_showparam(entity)
19
+ return @response[translated_entity].present? && (@showables.include?(entity) || @showables.blank?)
20
+ end
21
+
22
+ def translate_showparam(entity)
23
+ return @showable_translations[entity] if @showable_translations.present? && @showable_translations.include?(entity)
24
+ return entity
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,33 @@
1
+ module EPC::Command
2
+ class ShowInstancesCommand < BaseCommand
3
+
4
+ def execute(deployed_project_id=nil, *args)
5
+ deployed_project_id = args[1]
6
+
7
+ if deployed_project_id.nil?
8
+ say("You must specify the deployed project id.")
9
+ say(EPC::Help::COMMAND_USAGES[:show_instances])
10
+ return 1
11
+ end
12
+
13
+ opts = options[:include_inactive] ? '?include_inactive=true' : ''
14
+ path = "#{deployed_project_id}/instances#{opts}"
15
+ url = "#{EPC::Config::INSTANCES_PATH}/#{path}"
16
+
17
+ status, response, headers = client.get(url)
18
+ unless status.successful?
19
+ say("Request failed: [#{response[:message]}]")
20
+ return status
21
+ end
22
+
23
+ values = []
24
+ response.each_pair do |k,v|
25
+ values << {instance_id: "#{k}", active: "#{v[:active]}"}
26
+ end
27
+ table = EPC::TabularOutputter.new(values, [:instance_id, :active])
28
+ say(table.print(:line_separator => true))
29
+
30
+ status
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,55 @@
1
+ module EPC::Command
2
+ class ShowMetricsCommand < BaseCommand
3
+
4
+ def execute(*args)
5
+
6
+ id = args[2]
7
+ metrics = args[3]
8
+
9
+ if id.nil?
10
+ say("You must specify the target object id.")
11
+ say(EPC::Help::COMMAND_USAGES[:show_metrics])
12
+ return 1
13
+ end
14
+
15
+ if metrics.nil?
16
+ say("You must specify the metrics to display.")
17
+ say(EPC::Help::COMMAND_USAGES[:show_metrics])
18
+ return 1
19
+ end
20
+
21
+ path = "#{CGI.escape(id)}/metrics/#{CGI.escape(metrics)}"
22
+ opts = []
23
+ opts << "start=#{CGI.escape(options[:start])}" if options[:start]
24
+ opts << "stop=#{CGI.escape(options[:stop])}" if options[:stop]
25
+ opts << "step=#{CGI.escape(options[:step])}" if options[:step]
26
+ path += "?#{opts.join('&')}" unless opts.empty?
27
+ url = "#{EPC::Config::MONITORED_PATH}/#{path}"
28
+
29
+ # todo: why doesn't this auto-follow the redirect?
30
+ status, response, headers = client.get(url)
31
+ unless status == 302
32
+ say("Request failed: [#{response[:message]}]")
33
+ return status
34
+ end
35
+
36
+ status, response, headers = http_client.get(headers[:uri])
37
+ unless status.successful?
38
+ say("Request failed: [#{response[:message]}]")
39
+ return status
40
+ end
41
+
42
+ response = JSON.parse(response) if response
43
+ say response.inspect
44
+
45
+ response.each_pair do |id,v|
46
+ v.each_pair do |metric, details|
47
+ say "#{id} #{metric} start: #{details['start']} stop: #{details['stop']} step: #{details['step']}"
48
+ say(EPC::VerticalBar.new(details['data']).print)
49
+ end
50
+ end if @options[:graph]
51
+
52
+ status
53
+ end
54
+ end
55
+ end
@@ -1,6 +1,7 @@
1
1
  module EPC::Command
2
- class ArchiveSolutionCommand < BaseCommand
2
+ class ArchiveSolutionCommand < ArchiveCommand
3
3
  def execute(solution_name = nil)
4
+
4
5
  path = "."
5
6
  path = File.expand_path(path)
6
7
 
@@ -1,6 +1,5 @@
1
1
  module EPC::Command
2
2
  class CreateSolutionCommand < BaseCommand
3
- required_arguments_count 2, :message => "You must enter a solution name to run this command"
4
3
 
5
4
  def execute(*params)
6
5
  name = params[1]
@@ -1,16 +1,11 @@
1
1
  module EPC::Command
2
- class DeleteSolutionCommand < BaseCommand
3
- def execute(solution_name = nil)
4
- path = "."
5
- path = File.expand_path(path)
6
-
7
-
2
+ class DeleteSolutionCommand < DeleteCommand
3
+ def execute(solution_name = nil, *args)
4
+ path = File.expand_path(".")
5
+ solution_name = nil if solution_name.blank?
8
6
  solution_id, solution_name = infer_solution_context(solution_name, path, :get_solution_name => true)
9
7
 
10
- if solution_id.nil?
11
- say("Solution could not be inferred")
12
- return 1
13
- end
8
+ raise FatalError, "Solution could not be inferred" if solution_id.blank?
14
9
 
15
10
  proceed = ask_yn("Are you sure you want to delete [#{solution_id} - #{solution_name}]. Correct? [Yn] ")
16
11
  if proceed.upcase == 'N'
@@ -6,7 +6,7 @@ module EPC::Command
6
6
  status, response, headers = client.get(EPC::Config::SOLUTIONS_PATH)
7
7
 
8
8
  if status.failure?
9
- say("Request failed: [#{response[:message]}]")
9
+ say("Solutions retrieval failed with [#{response[:message]}]")
10
10
  elsif response.empty?
11
11
  say("You have no solutions created. You can create them with epc create solution.")
12
12
  else
@@ -1,8 +1,8 @@
1
1
  require 'time'
2
2
  module EPC::Command
3
- class ShowSolutionCommand < BaseCommand
3
+ class ShowSolutionCommand < ShowCommand
4
4
 
5
- def execute(solution_name = nil)
5
+ def execute(solution_name = nil, *args)
6
6
  path = File.expand_path(".")
7
7
 
8
8
  solution_id, solution_name = infer_solution_context(solution_name, path, {:get_solution_name => true})
@@ -14,7 +14,8 @@ module EPC::Command
14
14
  say("Request failed: [#{response[:message]}]")
15
15
  return status
16
16
  end
17
-
17
+
18
+ @showables = args[1..-1].map(&:to_sym) rescue []
18
19
 
19
20
  response[:build_date] = Time.parse(response[:build_date]).strftime("%m/%d/%Y %I:%M%p") rescue nil
20
21
  response[:updated_at] = Time.parse(response[:updated_at]).strftime("%m/%d/%Y %I:%M%p") rescue nil
@@ -34,15 +35,19 @@ module EPC::Command
34
35
  deployments_table = EPC::TabularOutputter.new(response[:deployments], {:id => "ID", :deployment_stage_name => "STAGE", :status => "STATUS", :updated_at => "LAST UPDATE"})
35
36
  config_values_table = EPC::TabularOutputter.new(response[:config_values], [:name, :value, :require, :value_type])
36
37
 
37
- say("\nSolution details:")
38
- say(solution_table.print)
38
+ @response = response
39
+
40
+ if @showables.blank?
41
+ say("\nSolution details:")
42
+ say(solution_table.print)
43
+ end
39
44
 
40
- unless response[:projects].nil? || response[:projects].empty?
45
+ if show? :projects
41
46
  say("\nProjects:")
42
47
  say(projects_table.print)
43
48
  end
44
49
 
45
- unless response[:deployments].nil? || response[:deployments].empty?
50
+ if show? :deployments
46
51
  say("\nDeployments:")
47
52
  say(deployments_table.print)
48
53
  end
@@ -1,5 +1,5 @@
1
1
  module EPC::Command
2
- class UnarchiveSolutionCommand < BaseCommand
2
+ class UnarchiveSolutionCommand < UnarchiveCommand
3
3
  def execute(solution_name = nil)
4
4
  path = "."
5
5
  path = File.expand_path(path)
@@ -2,7 +2,7 @@ module EPC::Command
2
2
  class UpdateSolutionCommand < BaseCommand
3
3
  UPDATABLE_ATTRIBUTES = ["name"]
4
4
 
5
- def execute(*args)
5
+ def execute(solution = nil, *args)
6
6
  path = File.expand_path(".")
7
7
  path = project_solution_path(path)
8
8
 
@@ -13,6 +13,7 @@ module EPC::Command
13
13
  args_hash = {}
14
14
  args.each do |arg|
15
15
  key, val = arg.split("=")
16
+ next if key.nil?
16
17
  args_hash[key] = val
17
18
  end
18
19
 
@@ -0,0 +1,12 @@
1
+ module EPC::Command
2
+ class UnarchiveCommand < BaseCommand
3
+
4
+ def execute(object = nil)
5
+ @object_type, @object_id = object.split(":") rescue [nil, nil]
6
+ raise FatalError, "Object incorrectly specified" if @object_type.blank?
7
+ klass = "EPC::Command::Unarchive#{@object_type.to_s.gsub("-","").capitalize}Command"
8
+ command = eval(klass).new(client, @options)
9
+ command.go(@object_id)
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,15 @@
1
+ module EPC::Command
2
+ class UpdateCommand < BaseCommand
3
+
4
+ def execute(object = nil, *params)
5
+ @object_type, @object_id = object.split(":") rescue [nil, nil]
6
+ raise FatalError, "Object incorrectly specified" if @object_type.blank?
7
+ klass = "EPC::Command::Update#{@object_type.to_s.gsub("-","").capitalize}Command"
8
+ params = normalize_params(params)
9
+ command = eval(klass).new(client, @options)
10
+ check_params
11
+ command.go(@object_id, *params)
12
+ end
13
+
14
+ end
15
+ end
@@ -1,6 +1,6 @@
1
1
  module EPC::Command
2
- class UpdateRolepermissionsCommand < BaseCommand
3
- def execute(role = nil)
2
+ class UpdatePermissionCommand < UpdateCommand
3
+ def execute(role = nil, *args)
4
4
  raise FatalError, "You have to specify a role" if role.blank?
5
5
 
6
6