epc 1.0.3 → 1.0.4
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.
- data/lib/epc.rb +25 -5
- data/lib/epc/client/json_client.rb +4 -4
- data/lib/epc/command/archive_command.rb +7 -6
- data/lib/epc/command/attachto_command.rb +13 -0
- data/lib/epc/command/base_command.rb +120 -29
- data/lib/epc/command/config/create_config_command.rb +7 -11
- data/lib/epc/command/config/delete_config_command.rb +5 -5
- data/lib/epc/command/config/list_configs_command.rb +5 -5
- data/lib/epc/command/config/update_config_command.rb +11 -10
- data/lib/epc/command/copy_command.rb +14 -0
- data/lib/epc/command/create_command.rb +9 -5
- data/lib/epc/command/delete_command.rb +9 -9
- data/lib/epc/command/{copy_deployment_command.rb → deployment/copy_deployment_command.rb} +6 -5
- data/lib/epc/command/deployment/create_deployment_command.rb +15 -15
- data/lib/epc/command/deployment/list_deployments_command.rb +2 -4
- data/lib/epc/command/deployment/show_deployment_command.rb +5 -7
- data/lib/epc/command/deployment/submit_deployment_command.rb +15 -0
- data/lib/epc/command/deployment/update_deployment_command.rb +5 -14
- data/lib/epc/command/deployment/vote_deployment_command.rb +23 -0
- data/lib/epc/command/deploymentstage/list_deploymentstages_command.rb +1 -1
- data/lib/epc/command/detachfrom_command.rb +13 -0
- data/lib/epc/command/group/create_group_command.rb +3 -3
- data/lib/epc/command/group/delete_group_command.rb +4 -5
- data/lib/epc/command/group/show_group_command.rb +2 -3
- data/lib/epc/command/group/update_group_command.rb +9 -7
- data/lib/epc/command/library/create_library_command.rb +1 -2
- data/lib/epc/command/library/delete_library_command.rb +4 -5
- data/lib/epc/command/library/list_libraries_command.rb +1 -1
- data/lib/epc/command/librarylanguage/create_librarylanguage_command.rb +1 -1
- data/lib/epc/command/librarylanguage/delete_librarylanguage_command.rb +3 -5
- data/lib/epc/command/librarylanguage/list_librarylanguages_command.rb +1 -1
- data/lib/epc/command/librarylanguage/update_librarylanguage_command.rb +4 -5
- data/lib/epc/command/libraryset/create_libraryset_command.rb +5 -4
- data/lib/epc/command/libraryset/delete_libraryset_command.rb +4 -6
- data/lib/epc/command/libraryset/list_librarysets_command.rb +2 -2
- data/lib/epc/command/libraryset/show_libraryset_command.rb +3 -3
- data/lib/epc/command/libraryset/update_libraryset_command.rb +4 -3
- data/lib/epc/command/list_command.rb +10 -14
- data/lib/epc/command/list_objecttypes_command.rb +1 -1
- data/lib/epc/command/objectrole/create_objectrole_command.rb +4 -5
- data/lib/epc/command/objectrole/list_objectroles_command.rb +3 -8
- data/lib/epc/command/objectrole/update_objectrole_command.rb +3 -1
- data/lib/epc/command/permission/list_permissions_command.rb +1 -1
- data/lib/epc/command/permissiongroup/list_permissiongroups_command.rb +1 -1
- data/lib/epc/command/plugin/create_plugin_command.rb +1 -2
- data/lib/epc/command/plugin/delete_plugin_command.rb +4 -6
- data/lib/epc/command/plugin/list_plugins_command.rb +1 -1
- data/lib/epc/command/plugin/show_plugin_command.rb +2 -5
- data/lib/epc/command/plugin/update_plugin_command.rb +2 -6
- data/lib/epc/command/project/archive_project_command.rb +3 -12
- data/lib/epc/command/project/attachto_project_command.rb +133 -0
- data/lib/epc/command/project/create_project_command.rb +6 -6
- data/lib/epc/command/project/delete_project_command.rb +3 -24
- data/lib/epc/command/project/detachfrom_project_command.rb +66 -0
- data/lib/epc/command/project/list_projects_command.rb +12 -7
- data/lib/epc/command/project/show_project_command.rb +26 -25
- data/lib/epc/command/project/show_project_snapshot_command.rb +41 -0
- data/lib/epc/command/project/unarchive_project_command.rb +3 -10
- data/lib/epc/command/project/update_project_command.rb +5 -18
- data/lib/epc/command/projecttype/create_projecttype_command.rb +37 -0
- data/lib/epc/command/projecttype/delete_projecttype_command.rb +24 -0
- data/lib/epc/command/projecttype/list_projecttypes_command.rb +1 -1
- data/lib/epc/command/projecttype/show_projecttype_command.rb +2 -4
- data/lib/epc/command/projecttype/update_projecttype_command.rb +61 -0
- data/lib/epc/command/push_command.rb +14 -8
- data/lib/epc/command/role/create_role_command.rb +26 -3
- data/lib/epc/command/role/delete_role_command.rb +3 -5
- data/lib/epc/command/role/list_roles_command.rb +7 -3
- data/lib/epc/command/role/show_role_command.rb +8 -5
- data/lib/epc/command/role/update_role_command.rb +14 -66
- data/lib/epc/command/runtime/create_runtime_command.rb +34 -0
- data/lib/epc/command/runtime/delete_runtime_command.rb +24 -0
- data/lib/epc/command/runtime/list_runtimes_command.rb +2 -2
- data/lib/epc/command/runtime/update_runtime_command.rb +49 -0
- data/lib/epc/command/runtimetype/list_runtimetypes_command.rb +17 -0
- data/lib/epc/command/servicedefinition/create_servicedefinition_command.rb +5 -6
- data/lib/epc/command/servicedefinition/delete_servicedefinition_command.rb +18 -0
- data/lib/epc/command/servicedefinition/list_servicedefinitions_command.rb +2 -2
- data/lib/epc/command/servicetype/list_servicetypes_command.rb +1 -1
- data/lib/epc/command/serviceversion/create_serviceversion_command.rb +8 -12
- data/lib/epc/command/serviceversion/delete_serviceversion_command.rb +3 -5
- data/lib/epc/command/serviceversion/list_serviceversions_command.rb +8 -1
- data/lib/epc/command/show_command.rb +8 -9
- data/lib/epc/command/show_metrics_command.rb +3 -3
- data/lib/epc/command/solution/archive_solution_command.rb +3 -10
- data/lib/epc/command/solution/create_solution_command.rb +2 -2
- data/lib/epc/command/solution/delete_solution_command.rb +3 -7
- data/lib/epc/command/solution/list_solutions_command.rb +11 -3
- data/lib/epc/command/solution/show_solution_command.rb +4 -6
- data/lib/epc/command/solution/unarchive_solution_command.rb +3 -8
- data/lib/epc/command/solution/update_solution_command.rb +4 -6
- data/lib/epc/command/submit_command.rb +16 -0
- data/lib/epc/command/unarchive_command.rb +7 -6
- data/lib/epc/command/update_command.rb +9 -8
- data/lib/epc/command/user/create_user_command.rb +2 -3
- data/lib/epc/command/user/delete_user_command.rb +3 -5
- data/lib/epc/command/user/list_users_command.rb +1 -1
- data/lib/epc/command/user/show_user_command.rb +2 -4
- data/lib/epc/command/user/update_user_command.rb +3 -14
- data/lib/epc/command/userproperty/list_user_properties_command.rb +23 -0
- data/lib/epc/command/vote_command.rb +16 -0
- data/lib/epc/config.rb +7 -1
- data/lib/epc/help.rb +51 -48
- data/lib/epc/modules/config.rb +39 -0
- data/lib/epc/modules/role.rb +133 -0
- data/lib/epc/runner.rb +23 -12
- data/lib/epc/version.rb +1 -1
- data/test/command/archive_project_command_test.rb +2 -13
- data/test/command/archive_solution_command_test.rb +4 -14
- data/test/command/copy_deployment_command_test.rb +4 -8
- data/test/command/create_config_command_test.rb +23 -23
- data/test/command/create_deployment_command_test.rb +33 -32
- data/test/command/create_group_command_test.rb +2 -2
- data/test/command/create_library_command_test.rb +6 -6
- data/test/command/create_librarylanguage_command_test.rb +3 -3
- data/test/command/create_libraryset_command_test.rb +6 -26
- data/test/command/create_objectrole_command_test.rb +4 -13
- data/test/command/create_project_command_test.rb +27 -13
- data/test/command/create_role_command_test.rb +3 -2
- data/test/command/create_runtime_command_test.rb +37 -0
- data/test/command/create_servicedefinition_command_test.rb +4 -17
- data/test/command/create_serviceversion_command_test.rb +8 -22
- data/test/command/create_solution_command_test.rb +5 -5
- data/test/command/create_user_command_test.rb +4 -4
- data/test/command/delete_config_command_test.rb +8 -15
- data/test/command/delete_library_command_test.rb +3 -4
- data/test/command/delete_librarylanguage_command_test.rb +3 -4
- data/test/command/delete_libraryset_command_test.rb +3 -4
- data/test/command/delete_plugin_command_test.rb +3 -4
- data/test/command/delete_project_command_test.rb +2 -10
- data/test/command/delete_projecttype_command_test.rb +31 -0
- data/test/command/delete_role_command_test.rb +5 -14
- data/test/command/delete_runtime_command_test.rb +31 -0
- data/test/command/delete_servicedefinition_command_test.rb +31 -0
- data/test/command/delete_serviceversion_command_test.rb +3 -2
- data/test/command/delete_solution_command_test.rb +3 -16
- data/test/command/delete_user_command_test.rb +3 -3
- data/test/command/list_config_command_test.rb +1 -0
- data/test/command/list_deployments_command_test.rb +11 -41
- data/test/command/list_objectroles_command_test.rb +4 -14
- data/test/command/list_projects_command_test.rb +0 -14
- data/test/command/list_roles_command_test.rb +3 -1
- data/test/command/list_runtimes_command_test.rb +2 -3
- data/test/command/list_runtimetypes_command_test.rb +29 -0
- data/test/command/list_userproperties_command_test.rb +33 -0
- data/test/command/push_command_test.rb +9 -1
- data/test/command/show_deployment_command_test.rb +36 -0
- data/test/command/show_group_command_test.rb +2 -1
- data/test/command/show_libraryset_command_test.rb +5 -3
- data/test/command/show_metrics_command_test.rb +4 -4
- data/test/command/show_plugin_command_test.rb +4 -4
- data/test/command/show_project_command_test.rb +5 -17
- data/test/command/show_project_snapshot_test.rb +33 -0
- data/test/command/show_projecttype_command_test.rb +5 -11
- data/test/command/show_role_command_test.rb +5 -12
- data/test/command/show_solution_command_test.rb +2 -15
- data/test/command/show_user_command_test.rb +4 -3
- data/test/command/submit_deployment_command_test.rb +4 -11
- data/test/command/unarchive_project_command_test.rb +2 -14
- data/test/command/unarchive_solution_command_test.rb +6 -16
- data/test/command/update_config_command_test.rb +14 -3
- data/test/command/update_deployment_command_test.rb +12 -26
- data/test/command/update_group_command_test.rb +2 -10
- data/test/command/update_librarylanguage_command_test.rb +5 -3
- data/test/command/update_libraryset_command_test.rb +4 -2
- data/test/command/update_plugin_command_test.rb +5 -4
- data/test/command/update_project_command_test.rb +6 -20
- data/test/command/update_role_command_test.rb +11 -8
- data/test/command/update_solution_command_test.rb +6 -12
- data/test/command/update_user_command_test.rb +3 -19
- data/test/command/vote_deployment_command_test.rb +2 -6
- metadata +66 -63
- data/lib/epc/command/attach_library_command.rb +0 -82
- data/lib/epc/command/attach_libraryset_command.rb +0 -31
- data/lib/epc/command/attach_runtime_command.rb +0 -26
- data/lib/epc/command/bind_service_command.rb +0 -35
- data/lib/epc/command/create_dependency_command.rb +0 -43
- data/lib/epc/command/dependency/delete_dependency_command.rb +0 -38
- data/lib/epc/command/detach_library_command.rb +0 -35
- data/lib/epc/command/detach_libraryset_command.rb +0 -8
- data/lib/epc/command/list_versions_command.rb +0 -38
- data/lib/epc/command/submit_deployment_command.rb +0 -19
- data/lib/epc/command/unbind_service_command.rb +0 -42
- data/lib/epc/command/undefine_service_command.rb +0 -33
- data/lib/epc/command/update_rolepermissions_command.rb +0 -83
- data/lib/epc/command/vote_deployment_command.rb +0 -29
- data/test/command/attach_library_command_test.rb +0 -124
- data/test/command/attach_libraryset_command_test.rb +0 -49
- data/test/command/attach_runtime_command_test.rb +0 -44
- data/test/command/bind_service_command_test.rb +0 -46
- data/test/command/create_dependency_command_test.rb +0 -55
- data/test/command/create_plugin_command_test.rb +0 -44
- data/test/command/delete_dependency_command_test.rb +0 -42
- data/test/command/detach_library_command_test.rb +0 -53
- data/test/command/unbind_service_command_test.rb +0 -48
- data/test/command/undefine_service_command_test.rb +0 -49
@@ -0,0 +1,133 @@
|
|
1
|
+
module EPC::Command
|
2
|
+
class AttachtoProjectCommand < AttachtoCommand
|
3
|
+
|
4
|
+
def execute(args = [])
|
5
|
+
require_target unless target_type.downcase == "library"
|
6
|
+
return case target_type
|
7
|
+
when "Library" then attach_library
|
8
|
+
when "LibrarySet" then attach_library_set
|
9
|
+
when "Runtime" then attach_runtime
|
10
|
+
when "ServiceVersion" then attach_service_version
|
11
|
+
when "Dependency" then attach_dependency
|
12
|
+
else
|
13
|
+
say("Incorrect attachable specified")
|
14
|
+
1
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def attach_library
|
21
|
+
library_ids = []
|
22
|
+
|
23
|
+
if @options[:file].present?
|
24
|
+
libs = EPC::Config.read_content_as_json(@options[:file])
|
25
|
+
library_ids = libs.map{|h| h.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}}
|
26
|
+
library_ids = retrieve_libraries(library_ids.compact)
|
27
|
+
elsif !@options[:pom].nil?
|
28
|
+
library_ids = parse_pom(@options[:pom])
|
29
|
+
else
|
30
|
+
raise FatalError, "You must specify the library to be attached" if target_id.nil?
|
31
|
+
library_ids << target_id
|
32
|
+
end
|
33
|
+
|
34
|
+
status = nil
|
35
|
+
|
36
|
+
library_ids.each do |library_id|
|
37
|
+
status, response, headers = client.post(EPC::Config::PROJECTS_PATH + "/#{object_id}/attach_library/#{library_id}")
|
38
|
+
|
39
|
+
if status.successful?
|
40
|
+
say("Library [#{library_id}] attached to project.")
|
41
|
+
else
|
42
|
+
say("Failed to attach library [#{library_id}]: [#{response[:message]}]")
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
return status
|
47
|
+
end
|
48
|
+
|
49
|
+
def attach_library_set
|
50
|
+
|
51
|
+
status, response, headers = client.post(EPC::Config::PROJECTS_PATH + "/#{object_id}/attach_set/#{target_id}")
|
52
|
+
|
53
|
+
if status.successful?
|
54
|
+
say("Library set attached")
|
55
|
+
else
|
56
|
+
say("Request failed: [#{response[:message]}]")
|
57
|
+
end
|
58
|
+
|
59
|
+
return status
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
def attach_runtime
|
64
|
+
raise InputError, "You need to specify the stage you want the runtime to be attached on" if @options[:stage].blank?
|
65
|
+
status, response, headers = client.put(EPC::Config::PROJECTS_PATH + "/#{object_id}/set_runtime_env", {:runtime_env_id => target_id, :stage_name => @options[:stage]})
|
66
|
+
|
67
|
+
if status.successful?
|
68
|
+
say("Runtime attached")
|
69
|
+
else
|
70
|
+
say("Request failed: [#{response[:message]}]")
|
71
|
+
end
|
72
|
+
return status
|
73
|
+
end
|
74
|
+
|
75
|
+
def attach_service_version
|
76
|
+
status, response, headers = client.post(EPC::Config::PROJECTS_PATH + "/#{object_id}/add_service_version", {:version_id => target_id})
|
77
|
+
|
78
|
+
if status.successful?
|
79
|
+
say("Service bound.")
|
80
|
+
else
|
81
|
+
say("Request failed: [#{response[:message]}]")
|
82
|
+
end
|
83
|
+
|
84
|
+
return status
|
85
|
+
end
|
86
|
+
|
87
|
+
|
88
|
+
def attach_dependency
|
89
|
+
dependency_type = @options[:dependency_type] || 1
|
90
|
+
|
91
|
+
status, response, headers = client.post(EPC::Config::PROJECTS_PATH + "/#{object_id}/add_dependency",
|
92
|
+
{:dependency_id => target_id, :dependency_kind => dependency_type})
|
93
|
+
if status.successful?
|
94
|
+
say("Dependency defined")
|
95
|
+
else
|
96
|
+
say("Request failed: [#{response[:message]}]")
|
97
|
+
end
|
98
|
+
return status
|
99
|
+
|
100
|
+
end
|
101
|
+
|
102
|
+
|
103
|
+
def parse_pom(pom_file)
|
104
|
+
begin
|
105
|
+
pom_file = File.read(File.expand_path(pom_file))
|
106
|
+
xml = REXML::Document.new(pom_file)
|
107
|
+
rescue REXML::ParseException => ex
|
108
|
+
raise FatalError, "Invalid xml supplied. Line: #{ex.line.to_s}. Context: #{ex.context.to_s}"
|
109
|
+
rescue Exception => ex
|
110
|
+
raise FatalError, ex.to_s
|
111
|
+
end
|
112
|
+
|
113
|
+
libraries = []
|
114
|
+
xml.elements[1].elements.each('dependencies/dependency') do |element|
|
115
|
+
lib = {}
|
116
|
+
element.each_child do |child|
|
117
|
+
next if child.is_a? REXML::Text
|
118
|
+
lib[child.name] = child.text
|
119
|
+
end
|
120
|
+
libraries << lib
|
121
|
+
end
|
122
|
+
libraries
|
123
|
+
|
124
|
+
libraries.each do |lib|
|
125
|
+
lib[:name] = lib['artifactId']
|
126
|
+
lib[:library_version] = lib['version']
|
127
|
+
lib[:group] = lib['groupId']
|
128
|
+
end
|
129
|
+
retrieve_libraries(libraries)
|
130
|
+
end
|
131
|
+
|
132
|
+
end
|
133
|
+
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
module EPC::Command
|
2
2
|
class CreateProjectCommand < BaseCommand
|
3
|
-
def execute(
|
3
|
+
def execute(params = [])
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
project_name = params[0]
|
6
|
+
uri_name = params[1]
|
7
|
+
memory = params[2]
|
8
8
|
|
9
9
|
raise FatalError, "You have to specify a project name to run this command" if project_name.blank?
|
10
10
|
raise InputError, "Target type must be: [Solution]" if target_type.present? && target_type.downcase != "solution"
|
@@ -17,7 +17,7 @@ module EPC::Command
|
|
17
17
|
|
18
18
|
if type_id.blank? || type_id == 0
|
19
19
|
choose do |menu|
|
20
|
-
menu.prompt = "Please choose the project type: "
|
20
|
+
menu.prompt = "Please choose the project type: "
|
21
21
|
|
22
22
|
status, response, headers = client.get(EPC::Config::PROJECT_TYPES_PATH)
|
23
23
|
if status.failure?
|
@@ -52,7 +52,7 @@ module EPC::Command
|
|
52
52
|
|
53
53
|
begin
|
54
54
|
status, response, headers = client.post("#{EPC::Config::PROJECTS_PATH}",
|
55
|
-
{ :
|
55
|
+
{ :name => project_name, :solution_name => solution_name, :uri_name => uri_name, :project_type_id => type_id, :runtime_memory => memory})
|
56
56
|
if status.successful?
|
57
57
|
if options[:nodir]
|
58
58
|
say("Successfully created the project with [#{target_url}]")
|
@@ -1,30 +1,10 @@
|
|
1
1
|
module EPC::Command
|
2
2
|
class DeleteProjectCommand < BaseCommand
|
3
|
-
def execute(
|
3
|
+
def execute(args = [])
|
4
4
|
path = "."
|
5
5
|
path = File.expand_path(path)
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
if ids.size == 1
|
10
|
-
project_name = ids[0]
|
11
|
-
solution_name = nil
|
12
|
-
elsif ids.size == 2
|
13
|
-
solution_name, project_name = ids
|
14
|
-
end
|
15
|
-
|
16
|
-
solution_id, solution_name = infer_solution_context(solution_name, path, :get_solution_name => true)
|
17
|
-
project_id, project_name = infer_project_context(project_name, path, solution_id, {:get_project_name => true})
|
18
|
-
|
19
|
-
|
20
|
-
raise FatalError, "Project name could not be inferred" if project_id.nil?
|
21
|
-
|
22
|
-
question = "You are deleting the project [#{project_id}"
|
23
|
-
if project_name.nil?
|
24
|
-
question += "] Correct? [Yn] "
|
25
|
-
else
|
26
|
-
question += " - #{project_name}].Correct? [Yn] "
|
27
|
-
end
|
7
|
+
question = "You are deleting the project [#{object_id}].Correct? [Yn] "
|
28
8
|
|
29
9
|
unless @options[:force]
|
30
10
|
proceed = ask_yn(question)
|
@@ -33,9 +13,8 @@ module EPC::Command
|
|
33
13
|
end
|
34
14
|
end
|
35
15
|
|
36
|
-
status, response, message = client.delete(EPC::Config::PROJECTS_PATH + "/#{
|
16
|
+
status, response, message = client.delete(EPC::Config::PROJECTS_PATH + "/#{object_id}")
|
37
17
|
if status.successful?
|
38
|
-
remove_project_metadata(path, project_name) if EPC::Config.is_project_dir?(path) || EPC::Config.is_solution_dir?(path)
|
39
18
|
say("Project deleted.")
|
40
19
|
else
|
41
20
|
say("Project could not be deleted. Delete failed with: [#{response[:message]}]")
|
@@ -0,0 +1,66 @@
|
|
1
|
+
module EPC::Command
|
2
|
+
class DetachfromProjectCommand < DetachfromCommand
|
3
|
+
|
4
|
+
def execute(args = [])
|
5
|
+
require_target
|
6
|
+
return case target_type
|
7
|
+
when "Library" then detach_library
|
8
|
+
when "LibrarySet" then detach_library_set
|
9
|
+
when "Runtime" then detach_runtime
|
10
|
+
when "ServiceVersion" then detach_service_version
|
11
|
+
when "Dependency" then detach_dependency
|
12
|
+
else
|
13
|
+
say("Incorrect attachable specified")
|
14
|
+
1
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def detach_library
|
21
|
+
status, response, headers = client.delete(EPC::Config::PROJECTS_PATH + "/#{object_id}/detach_library/#{target_id}")
|
22
|
+
|
23
|
+
if status.successful?
|
24
|
+
say("Library detached from project.")
|
25
|
+
else
|
26
|
+
say("Request failed: [#{response[:message]}]")
|
27
|
+
end
|
28
|
+
return status
|
29
|
+
end
|
30
|
+
|
31
|
+
def detach_library_set
|
32
|
+
status, response, headers = client.delete(EPC::Config::PROJECTS_PATH + "/#{object_id}/detach_set/#{target_id}")
|
33
|
+
|
34
|
+
if status.successful?
|
35
|
+
say("Library set detached")
|
36
|
+
else
|
37
|
+
say("Request failed: [#{response[:message]}]")
|
38
|
+
end
|
39
|
+
|
40
|
+
return status
|
41
|
+
end
|
42
|
+
|
43
|
+
def detach_service_version
|
44
|
+
status, response, headers = client.delete(EPC::Config::PROJECTS_PATH + "/#{object_id}/remove_service_version/#{target_id}")
|
45
|
+
|
46
|
+
if status.successful?
|
47
|
+
say("Service version detached.")
|
48
|
+
else
|
49
|
+
say("Request failed: [#{response[:message]}]")
|
50
|
+
end
|
51
|
+
return status
|
52
|
+
end
|
53
|
+
|
54
|
+
def detach_dependency
|
55
|
+
status, response, headers = client.delete(EPC::Config::PROJECTS_PATH + "/#{object_id}/remove_dependency/#{target_id}")
|
56
|
+
if status.successful?
|
57
|
+
say("Dependency detached")
|
58
|
+
else
|
59
|
+
say("Request failed: [#{response[:message]}]")
|
60
|
+
end
|
61
|
+
return status
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
@@ -1,13 +1,17 @@
|
|
1
1
|
module EPC::Command
|
2
2
|
class ListProjectsCommand < BaseCommand
|
3
3
|
|
4
|
-
def execute(
|
4
|
+
def execute(args = [])
|
5
|
+
fields = {:id => "ID", :name => "NAME", :last_build_status => "BUILD_STATUS", :type => "TYPE"}
|
6
|
+
include = if @options[:archived]
|
7
|
+
fields[:archived] = "ARCHIVED"
|
8
|
+
"?include=archived"
|
9
|
+
else
|
10
|
+
""
|
11
|
+
end
|
5
12
|
path = File.expand_path(".")
|
6
13
|
|
7
|
-
|
8
|
-
target_type, target_id = target.split(":")
|
9
|
-
solution_id = retrieve_identifier_for("Solution", target_id)
|
10
|
-
end
|
14
|
+
solution_id = target_id
|
11
15
|
|
12
16
|
if solution_id.blank?
|
13
17
|
solution_id, solution_name = infer_solution_context(nil, path)
|
@@ -15,7 +19,7 @@ module EPC::Command
|
|
15
19
|
|
16
20
|
raise InputError, "Solution could not be inferred" if solution_id.nil?
|
17
21
|
|
18
|
-
status, response, headers = client.get(EPC::Config::SOLUTIONS_PATH + "/#{solution_id}/projects")
|
22
|
+
status, response, headers = client.get(EPC::Config::SOLUTIONS_PATH + "/#{solution_id}/projects#{include}")
|
19
23
|
|
20
24
|
if status.failure?
|
21
25
|
say("Projects retrieval failed with [#{response[:message]}]")
|
@@ -25,7 +29,8 @@ module EPC::Command
|
|
25
29
|
response.each {|project| project[:last_build_status] = nil if project[:last_build_status] == "N/A"}
|
26
30
|
response.each {|project| project[:last_build_status] = (project[:last_build_status] ? "BUILT" : "FAILED" rescue "") unless project[:last_build_status].nil?}
|
27
31
|
response.each { |resp| resp[:type] = resp[:project_type][:name] }
|
28
|
-
|
32
|
+
response.each {|project| project[:archived] = (project[:archived].to_s == "true" ? 't': 'f')}
|
33
|
+
projects_table = EPC::TabularOutputter.new(response, fields)
|
29
34
|
say(projects_table.print)
|
30
35
|
end
|
31
36
|
return status
|
@@ -3,31 +3,16 @@ module EPC::Command
|
|
3
3
|
class ShowProjectCommand < ShowCommand
|
4
4
|
|
5
5
|
|
6
|
-
def execute(
|
6
|
+
def execute(args = [])
|
7
7
|
@showable_translations = {
|
8
8
|
:config => :config_values,
|
9
|
-
:services => :service_versions
|
9
|
+
:services => :service_versions,
|
10
|
+
:versions => :pushed_versions
|
10
11
|
}
|
11
12
|
|
12
|
-
|
13
|
+
@showables = args.map(&:to_sym) rescue []
|
13
14
|
|
14
|
-
|
15
|
-
|
16
|
-
if ids.size == 1
|
17
|
-
project_name = ids[0]
|
18
|
-
solution_name = nil
|
19
|
-
elsif ids.size == 2
|
20
|
-
solution_name, project_name = ids
|
21
|
-
end
|
22
|
-
|
23
|
-
solution_id, solution_name = infer_solution_context(solution_name, path)
|
24
|
-
project_id, project_name = infer_project_context(project_name, path, solution_id)
|
25
|
-
|
26
|
-
raise FatalError, "Project could not be found" if project_id.nil? || project_id == 0
|
27
|
-
|
28
|
-
@showables = args[1..-1].map(&:to_sym) rescue []
|
29
|
-
|
30
|
-
status, response, message = client.get(EPC::Config::PROJECTS_PATH + "/#{project_id}?include=dependencies,roles,config_values,service_versions,libraries")
|
15
|
+
status, response, message = client.get(EPC::Config::PROJECTS_PATH + "/#{object_id}?include=dependencies,roles,config_values,service_versions,libraries,pushed_versions")
|
31
16
|
if status.failure?
|
32
17
|
say("Request failed: [#{response[:message]}]")
|
33
18
|
return status
|
@@ -41,13 +26,22 @@ module EPC::Command
|
|
41
26
|
response[:last_push_by_id] = response[:last_push_by][:id]
|
42
27
|
response[:last_push_by_name] = response[:last_push_by][:name]
|
43
28
|
|
29
|
+
response[:pushed_versions].each do |resp|
|
30
|
+
resp[:build_date] = Time.parse(resp[:build_date]).strftime("%m/%d/%Y %I:%M%p") rescue "N/A"
|
31
|
+
resp[:created_at] = Time.parse(resp[:created_at]).strftime("%m/%d/%Y %I:%M%p") rescue "N/A"
|
32
|
+
resp[:built] = resp[:built] == 't' ? "BUILT" : "" rescue ""
|
33
|
+
resp[:build_note] = "N/A" if resp[:build_note].blank?
|
34
|
+
end
|
35
|
+
|
36
|
+
|
44
37
|
response[:dependencies] = []
|
45
38
|
response[:dependency_definitions].each do |dep_def|
|
46
39
|
response[:dependencies] << {
|
47
|
-
id:
|
48
|
-
|
49
|
-
|
50
|
-
|
40
|
+
id: dep_def[:id],
|
41
|
+
parent_id: dep_def[:parent_id],
|
42
|
+
dependency_id: dep_def[:dependency][:id],
|
43
|
+
dependency_name: dep_def[:dependency][:name],
|
44
|
+
type: dep_def[:dependency_kind]
|
51
45
|
}
|
52
46
|
end
|
53
47
|
|
@@ -57,7 +51,7 @@ module EPC::Command
|
|
57
51
|
|
58
52
|
last_push_table = EPC::TabularOutputter.new([response], {:last_push_by_id => "USER ID", :last_push_by_name => "USER NAME", :last_push_date => "DATE"})
|
59
53
|
|
60
|
-
dependencies_table = EPC::TabularOutputter.new(response[:dependencies], [:id, :
|
54
|
+
dependencies_table = EPC::TabularOutputter.new(response[:dependencies], [:id, :parent_id, :dependency_id, :dependency_name, :type])
|
61
55
|
|
62
56
|
config_values_table = EPC::TabularOutputter.new(response[:config_values], [:id, :name, :no_override, :value, :value_type, :required])
|
63
57
|
|
@@ -67,6 +61,8 @@ module EPC::Command
|
|
67
61
|
|
68
62
|
libraries_table = EPC::TabularOutputter.new(response[:libraries], [:id, :name, :language, :library_version, :group])
|
69
63
|
|
64
|
+
versions_table = EPC::TabularOutputter.new(response[:pushed_versions], {:id => "VERSION", :user_name => "USER", :built => "BUILD STATUS", :build_date => "BUILD DATE", :push_note => "PUSH NOTE", :build_note => "BUILD NOTE"})
|
65
|
+
|
70
66
|
if @showables.blank?
|
71
67
|
say("\nProject details:")
|
72
68
|
say(projects_table.print)
|
@@ -100,6 +96,11 @@ module EPC::Command
|
|
100
96
|
say(libraries_table.print)
|
101
97
|
end
|
102
98
|
|
99
|
+
if show? :versions
|
100
|
+
say("\nVersions")
|
101
|
+
say(versions_table.print)
|
102
|
+
end
|
103
|
+
|
103
104
|
return status
|
104
105
|
end
|
105
106
|
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module EPC::Command
|
2
|
+
class ShowProjectSnapshotCommand < ShowCommand
|
3
|
+
|
4
|
+
|
5
|
+
def execute(*args)
|
6
|
+
object_id, version = (args[0].split(':') rescue [nil,nil])
|
7
|
+
|
8
|
+
status, response, message = client.get(EPC::Config::PROJECTS_PATH + "/#{object_id}/snapshot/#{version}")
|
9
|
+
if status.failure?
|
10
|
+
say("Request failed: [#{response[:message]}]")
|
11
|
+
return status
|
12
|
+
end
|
13
|
+
|
14
|
+
project_table = EPC::TabularOutputter.new([response], {:id => "ID", :name => "NAME", :uri_name => "URI NAME", :archived => "ARCHIVED", :runtime_memory => "RUNTIME MEMORY"})
|
15
|
+
|
16
|
+
libraries_table = EPC::TabularOutputter.new(response[:libraries], {:id => "ID", :name => "NAME", :group => "GROUP", :library_version => "LIBRARY VERSION", :scope => "SCOPE"})
|
17
|
+
|
18
|
+
plugins_table = EPC::TabularOutputter.new(response[:plugins], [:id, :name, :group, :plugin_version, :extensions, :inherited])
|
19
|
+
|
20
|
+
dependencies_table = EPC::TabularOutputter.new(response[:dependencies], {:id => "ID", :name => "NAME", :uri_name => "URI NAME", :archived => "ARCHIVED", :runtime_memory => "RUNTIME MEMORY"})
|
21
|
+
|
22
|
+
|
23
|
+
say("\nProject details:")
|
24
|
+
say(project_table.print)
|
25
|
+
|
26
|
+
say("\nLibraries:")
|
27
|
+
say(libraries_table.print)
|
28
|
+
|
29
|
+
say("\nDependencies:")
|
30
|
+
say(dependencies_table.print)
|
31
|
+
|
32
|
+
say("\nPlugins:")
|
33
|
+
say(plugins_table.print)
|
34
|
+
|
35
|
+
return status
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
|