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
@@ -1,82 +0,0 @@
|
|
1
|
-
require 'rexml/document'
|
2
|
-
|
3
|
-
module EPC::Command
|
4
|
-
class AttachLibraryCommand < BaseCommand
|
5
|
-
|
6
|
-
def execute(name = nil, version = nil, group = nil)
|
7
|
-
path = File.expand_path(".")
|
8
|
-
|
9
|
-
library_ids = []
|
10
|
-
|
11
|
-
if @options[:file].present?
|
12
|
-
libs = EPC::Config.read_content_as_json(@options[:file])
|
13
|
-
library_ids = libs.map{|h| h.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}}
|
14
|
-
library_ids = retrieve_libraries(library_ids.compact)
|
15
|
-
elsif !@options[:pom].nil?
|
16
|
-
library_ids = parse_pom(@options[:pom])
|
17
|
-
else
|
18
|
-
raise FatalError, "You must specify the library to be attached" if name.nil?
|
19
|
-
end
|
20
|
-
|
21
|
-
solution_id, solution_name = infer_solution_context(@options[:solution_name], path)
|
22
|
-
project_id, project_name = infer_project_context(@options[:project_name], path, solution_id)
|
23
|
-
|
24
|
-
raise FatalError, "Project could not be determined" if project_id.nil?
|
25
|
-
|
26
|
-
if library_ids.empty?
|
27
|
-
if numeric?(name)
|
28
|
-
library_ids << name.to_i
|
29
|
-
else
|
30
|
-
library_ids = retrieve_libraries([{:name => name, :library_version => version, :group => group}])
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
raise InputError, "Library incorrectly specified" if library_ids.nil?
|
35
|
-
|
36
|
-
status = nil
|
37
|
-
|
38
|
-
library_ids.each do |library_id|
|
39
|
-
status, response, headers = client.post(EPC::Config::PROJECTS_PATH + "/#{project_id}/attach_library/#{library_id}")
|
40
|
-
|
41
|
-
if status.successful?
|
42
|
-
say("Library [#{library_id}] attached to project.")
|
43
|
-
else
|
44
|
-
say("Failed to attach library [#{library_id}]: [#{response[:message]}]")
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
return status
|
49
|
-
|
50
|
-
end
|
51
|
-
|
52
|
-
def parse_pom(pom_file)
|
53
|
-
begin
|
54
|
-
pom_file = File.read(File.expand_path(pom_file))
|
55
|
-
xml = REXML::Document.new(pom_file)
|
56
|
-
rescue REXML::ParseException => ex
|
57
|
-
raise FatalError, "Invalid xml supplied. Line: #{ex.line.to_s}. Context: #{ex.context.to_s}"
|
58
|
-
rescue Exception => ex
|
59
|
-
raise FatalError, ex.to_s
|
60
|
-
end
|
61
|
-
|
62
|
-
libraries = []
|
63
|
-
xml.elements[1].elements.each('dependencies/dependency') do |element|
|
64
|
-
lib = {}
|
65
|
-
element.each_child do |child|
|
66
|
-
next if child.is_a? REXML::Text
|
67
|
-
lib[child.name] = child.text
|
68
|
-
end
|
69
|
-
libraries << lib
|
70
|
-
end
|
71
|
-
libraries
|
72
|
-
|
73
|
-
libraries.each do |lib|
|
74
|
-
lib[:name] = lib['artifactId']
|
75
|
-
lib[:library_version] = lib['version']
|
76
|
-
lib[:group] = lib['groupId']
|
77
|
-
end
|
78
|
-
retrieve_libraries(libraries)
|
79
|
-
end
|
80
|
-
|
81
|
-
end
|
82
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
module EPC::Command
|
2
|
-
class AttachLibrarysetCommand < BaseCommand
|
3
|
-
|
4
|
-
def execute(set = nil)
|
5
|
-
path = File.expand_path(".")
|
6
|
-
solution_id, solution_name = infer_solution_context(@options[:solution_name], path)
|
7
|
-
project_id, project_name = infer_project_context(@options[:project_name], path, solution_id)
|
8
|
-
|
9
|
-
raise InputError, "Project could not be inferred" if project_id.nil?
|
10
|
-
|
11
|
-
set_id = retrieve_identifier_for("LibrarySet", set)
|
12
|
-
|
13
|
-
if @options[:detach].present? && @options[:detach]
|
14
|
-
status, response, headers = client.delete(EPC::Config::PROJECTS_PATH + "/#{project_id}/detach_set/#{set_id}")
|
15
|
-
else
|
16
|
-
status, response, headers = client.post(EPC::Config::PROJECTS_PATH + "/#{project_id}/attach_set/#{set_id}")
|
17
|
-
end
|
18
|
-
|
19
|
-
if status.successful?
|
20
|
-
say("Library set #{@options[:detach] ? "detached" : "attached"}")
|
21
|
-
else
|
22
|
-
say("Request failed: [#{response[:message]}]")
|
23
|
-
end
|
24
|
-
|
25
|
-
return status
|
26
|
-
|
27
|
-
|
28
|
-
end
|
29
|
-
|
30
|
-
end
|
31
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
module EPC::Command
|
2
|
-
class AttachRuntimeCommand < BaseCommand
|
3
|
-
required_options :stage, :mode => :any?, :message => "You must specify the stage"
|
4
|
-
|
5
|
-
def execute(runtime = nil)
|
6
|
-
|
7
|
-
path = File.expand_path(".")
|
8
|
-
|
9
|
-
solution_id, solution_name = infer_solution_context(@options[:solution_name], path)
|
10
|
-
project_id, project_name = infer_project_context(@options[:project_name], path, solution_id)
|
11
|
-
|
12
|
-
raise InputError, "Project could not be inferred" if project_id.nil?
|
13
|
-
|
14
|
-
status, response, headers = client.put(EPC::Config::PROJECTS_PATH + "/#{project_id}/set_runtime_env", {:runtime_env_id => runtime, :stage_name => @options[:stage]})
|
15
|
-
|
16
|
-
if status.successful?
|
17
|
-
say("Runtime attached")
|
18
|
-
else
|
19
|
-
say("Request failed: [#{response[:message]}]")
|
20
|
-
end
|
21
|
-
|
22
|
-
return status
|
23
|
-
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
module EPC::Command
|
2
|
-
class BindServiceCommand < BaseCommand
|
3
|
-
|
4
|
-
def execute(service = nil)
|
5
|
-
path = File.expand_path(".")
|
6
|
-
|
7
|
-
raise FatalError, "You must specify the service to be bound" if service.blank?
|
8
|
-
|
9
|
-
solution_name = @options[:solution_name]
|
10
|
-
project_name = @options[:project_name]
|
11
|
-
|
12
|
-
solution_id, solution_name = infer_solution_context(solution_name, path)
|
13
|
-
project_id, project_name = infer_project_context(project_name, path, solution_id)
|
14
|
-
|
15
|
-
if numeric?(service)
|
16
|
-
service_version_id = service.to_i
|
17
|
-
else
|
18
|
-
service_version_id = get_resource_id(EPC::Config::SERVICE_VERSIONS_PATH, :label, service)
|
19
|
-
end
|
20
|
-
|
21
|
-
raise FatalError, "Project or service incorrectly specified" if service.nil? || service == 0 || project_id.nil?
|
22
|
-
|
23
|
-
status, response, headers = client.post(EPC::Config::PROJECTS_PATH + "/#{project_id}/add_service_version", {:version_id => service_version_id})
|
24
|
-
|
25
|
-
if status.successful?
|
26
|
-
say("Service bound.")
|
27
|
-
else
|
28
|
-
say("Request failed: [#{response[:message]}]")
|
29
|
-
end
|
30
|
-
|
31
|
-
return status
|
32
|
-
end
|
33
|
-
|
34
|
-
end
|
35
|
-
end
|
@@ -1,43 +0,0 @@
|
|
1
|
-
module EPC::Command
|
2
|
-
class CreateDependencyCommand < BaseCommand
|
3
|
-
|
4
|
-
def execute(parent = nil)
|
5
|
-
path = File.expand_path(".")
|
6
|
-
|
7
|
-
solution_name = @options[:solution_name]
|
8
|
-
project_name = parent
|
9
|
-
|
10
|
-
solution_id, solution_name = infer_solution_context(solution_name, path)
|
11
|
-
project_id, project_name = infer_project_context(project_name, path, solution_id)
|
12
|
-
|
13
|
-
if project_id.nil? || project_id == 0 || solution_id.nil? || solution_id == 0
|
14
|
-
say("Project/solution could not be inferred")
|
15
|
-
say(EPC::Help::COMMAND_USAGES[:create_dependency])
|
16
|
-
return 1
|
17
|
-
end
|
18
|
-
|
19
|
-
if numeric?(@options[:dependency])
|
20
|
-
dependency_id = @options[:dependency].to_i
|
21
|
-
else
|
22
|
-
dependency_id = get_resource_id(EPC::Config::SOLUTIONS_PATH + "/#{solution_id}/projects", "name", @options[:dependency] )
|
23
|
-
end
|
24
|
-
|
25
|
-
if dependency_id.nil? || dependency_id == 0
|
26
|
-
say("Dependency could not be inferred")
|
27
|
-
say(EPC::Help::COMMAND_USAGES[:create_dependency])
|
28
|
-
return 1
|
29
|
-
end
|
30
|
-
|
31
|
-
dependency_type = @options[:dependency_type] || 1
|
32
|
-
|
33
|
-
status, response, headers = client.post(EPC::Config::PROJECTS_PATH + "/#{project_id}/add_dependency",
|
34
|
-
{:dependency_id => dependency_id, :dependency_kind => dependency_type})
|
35
|
-
if status.successful?
|
36
|
-
say("Dependency defined")
|
37
|
-
else
|
38
|
-
say("Request failed: [#{response[:message]}]")
|
39
|
-
end
|
40
|
-
return status
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
module EPC::Command
|
2
|
-
class DeleteDependencyCommand < DeleteCommand
|
3
|
-
|
4
|
-
def execute(dependency_id = nil, target = nil)
|
5
|
-
path = File.expand_path(".")
|
6
|
-
|
7
|
-
project = target.split(":")[1] rescue nil
|
8
|
-
|
9
|
-
ids = project.split(":") rescue [nil, nil]
|
10
|
-
|
11
|
-
if ids.size == 1
|
12
|
-
project_name = ids[0]
|
13
|
-
solution_name = nil
|
14
|
-
elsif ids.size == 2
|
15
|
-
solution_name, project_name = ids
|
16
|
-
end
|
17
|
-
|
18
|
-
solution_id, solution_name = infer_solution_context(solution_name, path)
|
19
|
-
project_id, project_name = infer_project_context(project_name, path, solution_id)
|
20
|
-
|
21
|
-
raise FatalError, "Project could not be inferred" if project_id.blank? || project_id == 0
|
22
|
-
|
23
|
-
proceed = ask_yn("Are you sure you want to delete the dependency with id = [#{dependency_id}]. Correct? [Yn] ")
|
24
|
-
if proceed.upcase == 'N'
|
25
|
-
return 1
|
26
|
-
end
|
27
|
-
|
28
|
-
status, response, headers = client.delete(EPC::Config::PROJECTS_PATH + "/#{project_id}/remove_dependency/#{dependency_id}")
|
29
|
-
if status.successful?
|
30
|
-
say("Dependency deleted")
|
31
|
-
else
|
32
|
-
say("Request failed: [#{response[:message]}]")
|
33
|
-
end
|
34
|
-
return status
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|
38
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
module EPC::Command
|
2
|
-
class DetachLibraryCommand < BaseCommand
|
3
|
-
|
4
|
-
def execute(name = nil, version = nil, group = nil)
|
5
|
-
path = File.expand_path(".")
|
6
|
-
|
7
|
-
raise FatalError, "You must specify the library to be detached." if name.nil?
|
8
|
-
|
9
|
-
solution_name = @options[:solution_name]
|
10
|
-
project_name = @options[:project_name]
|
11
|
-
|
12
|
-
solution_id, solution_name = infer_solution_context(solution_name, path)
|
13
|
-
project_id, project_name = infer_project_context(project_name, path, solution_id)
|
14
|
-
|
15
|
-
raise FatalError, "Project could not be inferred" if project_id.nil?
|
16
|
-
|
17
|
-
if numeric?(name)
|
18
|
-
library_id = name.to_i
|
19
|
-
else
|
20
|
-
library_id = retrieve_libraries([{:name => name, :library_version => version, :group => group}]).first rescue nil
|
21
|
-
end
|
22
|
-
|
23
|
-
raise FatalError, "Could not determine library" if library_id.nil?
|
24
|
-
|
25
|
-
status, response, headers = client.delete(EPC::Config::PROJECTS_PATH + "/#{project_id}/detach_library/#{library_id}")
|
26
|
-
|
27
|
-
if status.successful?
|
28
|
-
say("Library detached from project.")
|
29
|
-
else
|
30
|
-
say("Request failed: [#{response[:message]}]")
|
31
|
-
end
|
32
|
-
return status
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
require 'time'
|
2
|
-
module EPC::Command
|
3
|
-
class ListVersionsCommand < BaseCommand
|
4
|
-
|
5
|
-
def execute(project = nil)
|
6
|
-
solution = @options[:solution_name]
|
7
|
-
path = File.expand_path(".")
|
8
|
-
|
9
|
-
|
10
|
-
solution_id, solution_name = infer_solution_context(solution, path, :get_solution_name => true)
|
11
|
-
project_id, project_name = infer_project_context(project, path, solution_id, {:get_project_name => true})
|
12
|
-
|
13
|
-
if project_id.nil?
|
14
|
-
say("Project could not be inferred")
|
15
|
-
say(EPC::Help::COMMAND_USAGES[:list_versions])
|
16
|
-
return 1
|
17
|
-
end
|
18
|
-
|
19
|
-
status, response, headers = client.get(EPC::Config::PROJECTS_PATH + "/#{project_id}/versions")
|
20
|
-
|
21
|
-
if status.failure?
|
22
|
-
say("Request failed: [#{response[:message]}]")
|
23
|
-
elsif response.empty?
|
24
|
-
say("There are no project versions available")
|
25
|
-
else
|
26
|
-
response.each do |resp|
|
27
|
-
resp[:build_date] = Time.parse(resp[:build_date]).strftime("%m/%d/%Y %I:%M%p") rescue "N/A"
|
28
|
-
resp[:created_at] = Time.parse(resp[:created_at]).strftime("%m/%d/%Y %I:%M%p") rescue "N/A"
|
29
|
-
resp[:built] = resp[:built] == 't' ? "BUILT" : "" rescue ""
|
30
|
-
end
|
31
|
-
versions_table = EPC::TabularOutputter.new(response, {:id => "VERSION", :event => "EVENT", :whodunnit => "USER", :created_at => "DATE", :built => "BUILD STATUS", :build_date => "BUILD DATE"})
|
32
|
-
say(versions_table.print)
|
33
|
-
end
|
34
|
-
return status
|
35
|
-
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
module EPC::Command
|
2
|
-
class SubmitDeploymentCommand < BaseCommand
|
3
|
-
def execute(deployment_id = nil)
|
4
|
-
if deployment_id.nil?
|
5
|
-
say("You must specify a deployment id")
|
6
|
-
say(EPC::Help::COMMAND_USAGES[:submit_deployment])
|
7
|
-
return 1
|
8
|
-
end
|
9
|
-
|
10
|
-
status, response, headers = client.put(EPC::Config::DEPLOYMENTS_PATH + "/#{deployment_id}/submit")
|
11
|
-
if status.successful?
|
12
|
-
say("Deployment submitted for approval")
|
13
|
-
else
|
14
|
-
say("Request failed: [#{response[:message]}]")
|
15
|
-
end
|
16
|
-
return status
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
module EPC::Command
|
2
|
-
class UnbindServiceCommand < BaseCommand
|
3
|
-
|
4
|
-
def execute(version = nil)
|
5
|
-
if version.nil?
|
6
|
-
say("You must specify the service version to be unbound.")
|
7
|
-
say(EPC::Help::COMMAND_USAGES[:unbind_service])
|
8
|
-
return 1
|
9
|
-
end
|
10
|
-
|
11
|
-
path = File.expand_path(".")
|
12
|
-
|
13
|
-
solution_name = @options[:solution_name]
|
14
|
-
project_name = @options[:project_name]
|
15
|
-
|
16
|
-
solution_id, solution_name = infer_solution_context(solution_name, path)
|
17
|
-
project_id, project_name = infer_project_context(project_name, path, solution_id)
|
18
|
-
|
19
|
-
if numeric?(version)
|
20
|
-
service_version_id = version.to_i
|
21
|
-
else
|
22
|
-
service_version_id = get_resource_id(EPC::Config::SERVICE_VERSIONS_PATH, :label, version)
|
23
|
-
end
|
24
|
-
|
25
|
-
if service_version_id.nil? || project_id.nil?
|
26
|
-
say("Project or service incorrectly specified.")
|
27
|
-
say(EPC::Help::COMMAND_USAGES[:unbind_service])
|
28
|
-
return 1
|
29
|
-
end
|
30
|
-
|
31
|
-
status, response, headers = client.delete(EPC::Config::PROJECTS_PATH + "/#{project_id}/remove_service_version/#{service_version_id}")
|
32
|
-
|
33
|
-
if status.successful?
|
34
|
-
say("Service version unbound.")
|
35
|
-
else
|
36
|
-
say("Request failed: [#{response[:message]}]")
|
37
|
-
end
|
38
|
-
return status
|
39
|
-
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
module EPC::Command
|
2
|
-
class UndefineServiceCommand < BaseCommand
|
3
|
-
|
4
|
-
def execute(service_name = nil)
|
5
|
-
if service_name.nil?
|
6
|
-
say("You must specify a name for the service")
|
7
|
-
say(EPC::Help::COMMAND_USAGES[:undefine_service])
|
8
|
-
return 1
|
9
|
-
end
|
10
|
-
|
11
|
-
if numeric?(service_name)
|
12
|
-
service_id = service_name.to_i
|
13
|
-
else
|
14
|
-
service_id = get_resource_id(EPC::Config::SERVICE_DEFINITIONS_PATH, :name, service_name)
|
15
|
-
end
|
16
|
-
|
17
|
-
if service_id.nil? || service_id == 0
|
18
|
-
say("#{service_name} service could not be found.")
|
19
|
-
return 1
|
20
|
-
end
|
21
|
-
|
22
|
-
status, response, headers = client.delete(EPC::Config::SERVICE_DEFINITIONS_PATH + "/#{service_id}")
|
23
|
-
|
24
|
-
if status.failure?
|
25
|
-
say("Service removal failed with: [#{response['message']}]")
|
26
|
-
else
|
27
|
-
say("#{service_name} has been undefined.")
|
28
|
-
end
|
29
|
-
return status
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|