epc 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/epc.rb +71 -54
- data/lib/epc/command/archive_command.rb +12 -0
- data/lib/epc/command/attach_libraryset_command.rb +1 -2
- data/lib/epc/command/attach_runtime_command.rb +0 -1
- data/lib/epc/command/base_command.rb +52 -63
- data/lib/epc/command/config/delete_config_command.rb +57 -0
- data/lib/epc/command/{list_config_command.rb → config/list_configs_command.rb} +1 -1
- data/lib/epc/command/config/update_config_command.rb +56 -0
- data/lib/epc/command/create_command.rb +0 -1
- data/lib/epc/command/delete_command.rb +16 -0
- data/lib/epc/command/{delete_dependency_command.rb → dependency/delete_dependency_command.rb} +14 -16
- data/lib/epc/command/deploy_command.rb +1 -2
- data/lib/epc/command/deployment/list_deployments_command.rb +49 -0
- data/lib/epc/command/deployment/show_deployment_command.rb +61 -0
- data/lib/epc/command/{update_deploymentproject_command.rb → deployment/update_deployment_command.rb} +3 -3
- data/lib/epc/command/{list_stages_command.rb → deploymentstage/list_deploymentstages_command.rb} +1 -1
- data/lib/epc/command/group/delete_group_command.rb +25 -0
- data/lib/epc/command/{list_groups_command.rb → group/list_groups_command.rb} +1 -1
- data/lib/epc/command/{show_group_command.rb → group/show_group_command.rb} +2 -9
- data/lib/epc/command/{update_group_command.rb → group/update_group_command.rb} +3 -20
- data/lib/epc/command/library/create_library_command.rb +2 -5
- data/lib/epc/command/library/delete_library_command.rb +23 -0
- data/lib/epc/command/{list_libraries_command.rb → library/list_libraries_command.rb} +1 -1
- data/lib/epc/command/librarylanguage/delete_librarylanguage_command.rb +24 -0
- data/lib/epc/command/{list_librarylanguages_command.rb → librarylanguage/list_librarylanguages_command.rb} +1 -1
- data/lib/epc/command/{update_librarylanguage_command.rb → librarylanguage/update_librarylanguage_command.rb} +6 -10
- data/lib/epc/command/libraryset/create_libraryset_command.rb +1 -6
- data/lib/epc/command/{delete_libraryset_command.rb → libraryset/delete_libraryset_command.rb} +2 -18
- data/lib/epc/command/{list_librarysets_command.rb → libraryset/list_librarysets_command.rb} +1 -1
- data/lib/epc/command/{show_libraryset_command.rb → libraryset/show_libraryset_command.rb} +2 -17
- data/lib/epc/command/{update_libraryset_command.rb → libraryset/update_libraryset_command.rb} +4 -16
- data/lib/epc/command/list_command.rb +22 -0
- data/lib/epc/command/list_metrics_command.rb +25 -0
- data/lib/epc/command/list_objecttypes_command.rb +2 -4
- data/lib/epc/command/list_versions_command.rb +0 -1
- data/lib/epc/command/{list_objectroles_command.rb → objectrole/list_objectroles_command.rb} +3 -3
- data/lib/epc/command/objectrole/update_objectrole_command.rb +14 -0
- data/lib/epc/command/{list_rolepermissions_command.rb → permission/list_permissions_command.rb} +2 -2
- data/lib/epc/command/{list_permissiongroups_command.rb → permissiongroup/list_permissiongroups_command.rb} +1 -1
- data/lib/epc/command/plugin/create_plugin_command.rb +42 -0
- data/lib/epc/command/plugin/delete_plugin_command.rb +26 -0
- data/lib/epc/command/plugin/list_plugins_command.rb +19 -0
- data/lib/epc/command/plugin/show_plugin_command.rb +29 -0
- data/lib/epc/command/plugin/update_plugin_command.rb +53 -0
- data/lib/epc/command/{archive_project_command.rb → project/archive_project_command.rb} +4 -3
- data/lib/epc/command/{delete_project_command.rb → project/delete_project_command.rb} +11 -7
- data/lib/epc/command/{list_projects_command.rb → project/list_projects_command.rb} +8 -9
- data/lib/epc/command/{show_project_command.rb → project/show_project_command.rb} +64 -29
- data/lib/epc/command/{unarchive_project_command.rb → project/unarchive_project_command.rb} +5 -4
- data/lib/epc/command/{update_project_command.rb → project/update_project_command.rb} +11 -5
- data/lib/epc/command/{list_projecttypes_command.rb → projecttype/list_projecttypes_command.rb} +1 -1
- data/lib/epc/command/{show_projecttype_command.rb → projecttype/show_projecttype_command.rb} +4 -3
- data/lib/epc/command/pull_command.rb +33 -35
- data/lib/epc/command/{delete_role_command.rb → role/delete_role_command.rb} +3 -4
- data/lib/epc/command/{list_roles_command.rb → role/list_roles_command.rb} +4 -3
- data/lib/epc/command/{show_role_command.rb → role/show_role_command.rb} +18 -10
- data/lib/epc/command/role/update_role_command.rb +95 -0
- data/lib/epc/command/{list_runtimes_command.rb → runtime/list_runtimes_command.rb} +0 -0
- data/lib/epc/command/servicedefinition/create_servicedefinition_command.rb +23 -0
- data/lib/epc/command/{list_servicedefinitions_command.rb → servicedefinition/list_servicedefinitions_command.rb} +1 -0
- data/lib/epc/command/{list_service_types_command.rb → servicetype/list_servicetypes_command.rb} +0 -0
- data/lib/epc/command/serviceversion/delete_serviceversion_command.rb +24 -0
- data/lib/epc/command/{list_serviceversions_command.rb → serviceversion/list_serviceversions_command.rb} +1 -1
- data/lib/epc/command/show_command.rb +27 -0
- data/lib/epc/command/show_instances_command.rb +33 -0
- data/lib/epc/command/show_metrics_command.rb +55 -0
- data/lib/epc/command/{archive_solution_command.rb → solution/archive_solution_command.rb} +2 -1
- data/lib/epc/command/solution/create_solution_command.rb +0 -1
- data/lib/epc/command/{delete_solution_command.rb → solution/delete_solution_command.rb} +5 -10
- data/lib/epc/command/solution/list_solutions_command.rb +1 -1
- data/lib/epc/command/{show_solution_command.rb → solution/show_solution_command.rb} +12 -7
- data/lib/epc/command/{unarchive_solution_command.rb → solution/unarchive_solution_command.rb} +1 -1
- data/lib/epc/command/solution/update_solution_command.rb +2 -1
- data/lib/epc/command/unarchive_command.rb +12 -0
- data/lib/epc/command/update_command.rb +15 -0
- data/lib/epc/command/update_rolepermissions_command.rb +2 -2
- data/lib/epc/command/{delete_user_command.rb → user/delete_user_command.rb} +4 -12
- data/lib/epc/command/{list_users_command.rb → user/list_users_command.rb} +1 -1
- data/lib/epc/command/{show_user_command.rb → user/show_user_command.rb} +3 -17
- data/lib/epc/command/{update_user_command.rb → user/update_user_command.rb} +2 -4
- data/lib/epc/config.rb +4 -1
- data/lib/epc/help.rb +50 -35
- data/lib/epc/runner.rb +16 -5
- data/lib/epc/version.rb +1 -1
- data/lib/epc/vertical_bar.rb +40 -0
- data/test/command/create_library_command_test.rb +5 -2
- data/test/command/create_libraryset_command_test.rb +1 -1
- data/test/command/create_plugin_command_test.rb +44 -0
- data/test/command/create_servicedefinition_command_test.rb +43 -0
- data/test/command/delete_config_command_test.rb +0 -11
- data/test/command/delete_dependency_command_test.rb +3 -11
- data/test/command/delete_library_command_test.rb +2 -15
- data/test/command/delete_librarylanguage_command_test.rb +2 -24
- data/test/command/delete_libraryset_command_test.rb +2 -24
- data/test/command/delete_plugin_command_test.rb +32 -0
- data/test/command/delete_project_command_test.rb +0 -6
- data/test/command/delete_role_command_test.rb +1 -1
- data/test/command/delete_serviceversion_command_test.rb +0 -22
- data/test/command/delete_solution_command_test.rb +4 -4
- data/test/command/delete_user_command_test.rb +2 -24
- data/test/command/list_config_command_test.rb +3 -3
- data/test/command/list_deployments_command_test.rb +17 -20
- data/test/command/list_deploymentstages_command_test.rb +2 -2
- data/test/command/list_metrics_command_test.rb +40 -0
- data/test/command/{list_rolepermissions_command_test.rb → list_permissions_command_test.rb} +2 -2
- data/test/command/list_plugins_command_test.rb +27 -0
- data/test/command/list_projects_command_test.rb +3 -5
- data/test/command/list_roles_command_test.rb +2 -3
- data/test/command/pull_command_test.rb +13 -9
- data/test/command/show_group_command_test.rb +1 -23
- data/test/command/show_instances_command_test.rb +33 -0
- data/test/command/show_libraryset_command_test.rb +0 -11
- data/test/command/show_metrics_command_test.rb +51 -0
- data/test/command/show_plugin_command_test.rb +28 -0
- data/test/command/show_project_command_test.rb +1 -1
- data/test/command/show_projecttype_command_test.rb +0 -5
- data/test/command/show_role_command_test.rb +1 -1
- data/test/command/show_solution_command_test.rb +1 -1
- data/test/command/show_user_command_test.rb +2 -22
- data/test/command/update_config_command_test.rb +3 -9
- data/test/command/{update_deploymentproject_command_test.rb → update_deployment_command_test.rb} +6 -11
- data/test/command/update_group_command_test.rb +1 -20
- data/test/command/update_librarylanguage_command_test.rb +0 -15
- data/test/command/update_libraryset_command_test.rb +0 -13
- data/test/command/update_plugin_command_test.rb +41 -0
- data/test/command/update_project_command_test.rb +3 -3
- data/test/command/update_role_command_test.rb +2 -1
- data/test/command/update_solution_command_test.rb +3 -9
- data/test/command/update_user_command_test.rb +0 -6
- metadata +177 -165
- data/lib/epc/command/define_service_command.rb +0 -37
- data/lib/epc/command/delete_config_command.rb +0 -63
- data/lib/epc/command/delete_group_command.rb +0 -40
- data/lib/epc/command/delete_library_command.rb +0 -30
- data/lib/epc/command/delete_librarylanguage_command.rb +0 -40
- data/lib/epc/command/delete_serviceversion_command.rb +0 -52
- data/lib/epc/command/list_approvals_command.rb +0 -27
- data/lib/epc/command/list_attachedlibraries_command.rb +0 -42
- data/lib/epc/command/list_boundservices_command.rb +0 -40
- data/lib/epc/command/list_dependencies_command.rb +0 -43
- data/lib/epc/command/list_deployments_command.rb +0 -68
- data/lib/epc/command/list_solutions_command.rb +0 -25
- data/lib/epc/command/show_deployment_command.rb +0 -57
- data/lib/epc/command/update_config_command.rb +0 -62
- data/lib/epc/command/update_role_command.rb +0 -47
- data/lib/epc/command/update_solution_command.rb +0 -45
- data/test/command/define_service_command_test.rb +0 -55
- data/test/command/delete_group_command_test.rb +0 -56
- data/test/command/list_approvals_command_test.rb +0 -41
- data/test/command/list_boundservices_command_test.rb +0 -46
- data/test/command/list_dependencies_command_test.rb +0 -46
- data/test/command/update_rolepermissions_command_test.rb +0 -54
@@ -1,10 +1,11 @@
|
|
1
1
|
module EPC::Command
|
2
|
-
class ArchiveProjectCommand <
|
3
|
-
|
2
|
+
class ArchiveProjectCommand < ArchiveCommand
|
3
|
+
|
4
|
+
def execute(project = nil)
|
4
5
|
path = "."
|
5
6
|
path = File.expand_path(path)
|
6
7
|
|
7
|
-
solution_name =
|
8
|
+
solution_name, project_name = project.split(":") rescue [nil, nil]
|
8
9
|
|
9
10
|
solution_id, solution_name = infer_solution_context(solution_name, path, {:get_solution_name => true})
|
10
11
|
project_id, project_name = infer_project_context(project_name, path, solution_id, {:get_project_name => true})
|
@@ -1,19 +1,23 @@
|
|
1
1
|
module EPC::Command
|
2
2
|
class DeleteProjectCommand < BaseCommand
|
3
|
-
def execute(
|
3
|
+
def execute(project = nil, target = nil)
|
4
4
|
path = "."
|
5
5
|
path = File.expand_path(path)
|
6
6
|
|
7
|
-
|
7
|
+
ids = project.split(":") rescue [nil, nil]
|
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
|
8
15
|
|
9
16
|
solution_id, solution_name = infer_solution_context(solution_name, path, :get_solution_name => true)
|
10
17
|
project_id, project_name = infer_project_context(project_name, path, solution_id, {:get_project_name => true})
|
11
18
|
|
12
|
-
|
13
|
-
|
14
|
-
say(EPC::Help::COMMAND_USAGES[:delete_project])
|
15
|
-
return 1
|
16
|
-
end
|
19
|
+
|
20
|
+
raise FatalError, "Project name could not be inferred" if project_id.nil?
|
17
21
|
|
18
22
|
question = "You are deleting the project [#{project_id}"
|
19
23
|
if project_name.nil?
|
@@ -1,21 +1,20 @@
|
|
1
1
|
module EPC::Command
|
2
2
|
class ListProjectsCommand < BaseCommand
|
3
3
|
|
4
|
-
def execute(
|
4
|
+
def execute(target = nil)
|
5
5
|
path = File.expand_path(".")
|
6
6
|
|
7
|
-
if
|
8
|
-
|
9
|
-
|
10
|
-
solution_id, solution_name = infer_solution_context(solution_name, path)
|
7
|
+
if target.present?
|
8
|
+
target_type, target_id = target.split(":")
|
9
|
+
solution_id = retrieve_identifier_for("Solution", target_id)
|
11
10
|
end
|
12
11
|
|
13
|
-
if solution_id.
|
14
|
-
|
15
|
-
say(EPC::Help::COMMAND_USAGES[:list_projects])
|
16
|
-
return 1
|
12
|
+
if solution_id.blank?
|
13
|
+
solution_id, solution_name = infer_solution_context(nil, path)
|
17
14
|
end
|
18
15
|
|
16
|
+
raise InputError, "Solution could not be inferred" if solution_id.nil?
|
17
|
+
|
19
18
|
status, response, headers = client.get(EPC::Config::SOLUTIONS_PATH + "/#{solution_id}/projects")
|
20
19
|
|
21
20
|
if status.failure?
|
@@ -1,19 +1,33 @@
|
|
1
1
|
require 'time'
|
2
2
|
module EPC::Command
|
3
|
-
class ShowProjectCommand <
|
3
|
+
class ShowProjectCommand < ShowCommand
|
4
|
+
|
4
5
|
|
5
|
-
def execute(
|
6
|
-
|
7
|
-
|
6
|
+
def execute(object_id = nil, *args)
|
7
|
+
@showable_translations = {
|
8
|
+
:config => :config_values,
|
9
|
+
:services => :service_versions
|
10
|
+
}
|
11
|
+
|
12
|
+
path = File.expand_path(".")
|
8
13
|
|
9
|
-
|
14
|
+
ids = object_id.split(":") rescue [nil, nil]
|
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
|
10
22
|
|
11
23
|
solution_id, solution_name = infer_solution_context(solution_name, path)
|
12
24
|
project_id, project_name = infer_project_context(project_name, path, solution_id)
|
13
25
|
|
14
26
|
raise FatalError, "Project could not be found" if project_id.nil? || project_id == 0
|
15
27
|
|
16
|
-
|
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")
|
17
31
|
if status.failure?
|
18
32
|
say("Request failed: [#{response[:message]}]")
|
19
33
|
return status
|
@@ -24,51 +38,72 @@ module EPC::Command
|
|
24
38
|
response[:last_push_date] = Time.parse(response[:last_push_date]).strftime("%m/%d/%Y %I:%M%p") unless response[:last_push_date].nil? || response[:last_push_date] == "N/A"
|
25
39
|
response[:last_build_status] = nil if response[:last_build_status] == "N/A" # temp hack
|
26
40
|
response[:last_build_status] = (response[:last_build_status] ? "BUILT" : "FAILED" rescue nil) unless response[:last_build_status].nil?
|
41
|
+
response[:last_push_by_id] = response[:last_push_by][:id]
|
42
|
+
response[:last_push_by_name] = response[:last_push_by][:name]
|
27
43
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
name: dep_def[:dependency][:name],
|
37
|
-
type: dep_def[:dependency_kind]
|
38
|
-
}
|
39
|
-
end
|
44
|
+
response[:dependencies] = []
|
45
|
+
response[:dependency_definitions].each do |dep_def|
|
46
|
+
response[:dependencies] << {
|
47
|
+
id: dep_def[:dependency_id],
|
48
|
+
project_id: dep_def[:dependency][:id],
|
49
|
+
name: dep_def[:dependency][:name],
|
50
|
+
type: dep_def[:dependency_kind]
|
51
|
+
}
|
40
52
|
end
|
41
53
|
|
42
|
-
response
|
43
|
-
|
54
|
+
@response = response
|
55
|
+
|
56
|
+
projects_table = EPC::TabularOutputter.new([response], {:id => "ID", :name => "NAME", :uri_name => "URI NAME", :created_at => "CREATED AT", :last_build_status => "BUILD STATUS", :last_build_date => "BUILD DATE", :last_build_version => "BUILD VERSION"})
|
57
|
+
|
44
58
|
last_push_table = EPC::TabularOutputter.new([response], {:last_push_by_id => "USER ID", :last_push_by_name => "USER NAME", :last_push_date => "DATE"})
|
45
|
-
|
59
|
+
|
60
|
+
dependencies_table = EPC::TabularOutputter.new(response[:dependencies], [:id, :project_id, :name, :type])
|
46
61
|
|
47
62
|
config_values_table = EPC::TabularOutputter.new(response[:config_values], [:id, :name, :no_override, :value, :value_type, :required])
|
63
|
+
|
48
64
|
roles_table = EPC::TabularOutputter.new(response[:roles], [:id, :name])
|
49
65
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
say("\nLast push info:")
|
54
|
-
say(last_push_table.print)
|
66
|
+
services_table = EPC::TabularOutputter.new(response[:service_versions], [:id, :label, :definition_name])
|
67
|
+
|
68
|
+
libraries_table = EPC::TabularOutputter.new(response[:libraries], [:id, :name, :language, :library_version, :group])
|
55
69
|
|
56
|
-
|
70
|
+
if @showables.blank?
|
71
|
+
say("\nProject details:")
|
72
|
+
say(projects_table.print)
|
73
|
+
|
74
|
+
say("\nLast push info:")
|
75
|
+
say(last_push_table.print)
|
76
|
+
end
|
77
|
+
|
78
|
+
if show? :dependencies
|
57
79
|
say("\nDependencies:")
|
58
80
|
say(dependencies_table.print)
|
59
81
|
end
|
60
82
|
|
61
|
-
|
83
|
+
if show? :config
|
62
84
|
say("\nConfig values:")
|
63
85
|
say(config_values_table.print)
|
64
86
|
end
|
65
87
|
|
66
|
-
|
88
|
+
if show? :roles
|
67
89
|
say("\nRoles:")
|
68
90
|
say(roles_table.print)
|
69
91
|
end
|
92
|
+
|
93
|
+
if show? :services
|
94
|
+
say("\nServices:")
|
95
|
+
say(services_table.print)
|
96
|
+
end
|
97
|
+
|
98
|
+
if show? :libraries
|
99
|
+
say("\nLibraries:")
|
100
|
+
say(libraries_table.print)
|
101
|
+
end
|
102
|
+
|
70
103
|
return status
|
71
104
|
end
|
105
|
+
|
72
106
|
end
|
107
|
+
|
73
108
|
end
|
74
109
|
|
@@ -1,9 +1,10 @@
|
|
1
1
|
module EPC::Command
|
2
|
-
class UnarchiveProjectCommand <
|
3
|
-
def execute(project_name = nil)
|
4
|
-
path = File.expand_path(".")
|
2
|
+
class UnarchiveProjectCommand < UnarchiveCommand
|
5
3
|
|
6
|
-
|
4
|
+
def execute(project = nil)
|
5
|
+
path = File.expand_path(":")
|
6
|
+
|
7
|
+
solution_name, project_name = project.split(".") rescue [nil, nil]
|
7
8
|
|
8
9
|
solution_id, solution_name = infer_solution_context(solution_name, path, {:get_solution_name => true})
|
9
10
|
project_id, project_name = infer_project_context(project_name, path, solution_id, {:get_solution_name => true})
|
@@ -2,22 +2,28 @@ module EPC::Command
|
|
2
2
|
class UpdateProjectCommand < BaseCommand
|
3
3
|
UPDATABLE_ATTRIBUTES = ["project_name", "project_type"]
|
4
4
|
|
5
|
-
def execute(*args)
|
5
|
+
def execute(project = nil, *args)
|
6
6
|
path = "."
|
7
7
|
path = File.expand_path(path)
|
8
8
|
|
9
|
-
|
10
|
-
|
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
|
11
17
|
|
12
18
|
solution_id, solution_name = infer_solution_context(solution_name, path, :get_solution_name => true)
|
13
19
|
project_id, project_name = infer_project_context(project_name, path, solution_id, {:get_project_name => true})
|
14
20
|
|
15
|
-
|
16
21
|
raise FatalError, "Project could not be inferred" if project_id.nil? || project_id == 0
|
17
22
|
|
18
23
|
args_hash = {}
|
19
24
|
args.each do |arg|
|
20
25
|
key, val = arg.split("=")
|
26
|
+
next if key.nil?
|
21
27
|
args_hash[key] = val
|
22
28
|
end
|
23
29
|
|
@@ -26,7 +32,7 @@ module EPC::Command
|
|
26
32
|
end
|
27
33
|
|
28
34
|
args_hash.each do |attr, val|
|
29
|
-
|
35
|
+
unless UPDATABLE_ATTRIBUTES.include?(attr)
|
30
36
|
args_hash.delete(attr)
|
31
37
|
say("Cannot update #{attr}. Updatable attributes are: [#{UPDATABLE_ATTRIBUTES.join(', ')}]")
|
32
38
|
next
|
data/lib/epc/command/{show_projecttype_command.rb → projecttype/show_projecttype_command.rb}
RENAMED
@@ -1,10 +1,11 @@
|
|
1
1
|
module EPC::Command
|
2
2
|
class ShowProjecttypeCommand < BaseCommand
|
3
3
|
|
4
|
-
def execute(project_type = nil)
|
5
|
-
raise FatalError, "You must specify a project type id" if project_type.nil?
|
4
|
+
def execute(project_type = nil, *args)
|
6
5
|
|
7
|
-
|
6
|
+
project_type_id = retrieve_identifier_for("ProjectType", project_type)
|
7
|
+
|
8
|
+
status, response, headers = client.get(EPC::Config::PROJECT_TYPES_PATH + "/#{project_type_id}")
|
8
9
|
|
9
10
|
if status.failure?
|
10
11
|
say("Request failed: [#{response[:message]}]")
|
@@ -45,22 +45,26 @@ module EPC::Command
|
|
45
45
|
status, id = create_pull(solution_name)
|
46
46
|
if status.successful?
|
47
47
|
say("Pulling - ")
|
48
|
-
|
49
|
-
if
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
48
|
+
success, url, response = poll_for_pull_url(id)
|
49
|
+
if success
|
50
|
+
zip_path = nil
|
51
|
+
if url
|
52
|
+
tmpdir = Dir.tmpdir
|
53
|
+
pulled, zip_path = pull_zip(url, tmpdir)
|
54
|
+
return 1 unless pulled
|
55
|
+
end
|
56
|
+
if create_dir
|
57
|
+
return 1 unless prep_solution_directory(path, solution_name)
|
58
|
+
path = File.join(path, solution_name)
|
59
|
+
end
|
60
|
+
if zip_path
|
57
61
|
unzip_solution(zip_path, path)
|
58
62
|
confirm_pull(id)
|
59
|
-
refresh_command = EPC::Command::RefreshSolutionCommand.new(client, @options)
|
60
|
-
refresh_command.options[:prompt_refresh] = false if first_time_pull
|
61
|
-
refresh_command.execute(path)
|
62
|
-
return 0
|
63
63
|
end
|
64
|
+
refresh_command = EPC::Command::RefreshSolutionCommand.new(client, @options)
|
65
|
+
refresh_command.options[:prompt_refresh] = false if first_time_pull
|
66
|
+
refresh_command.execute(path)
|
67
|
+
return 0
|
64
68
|
end
|
65
69
|
end
|
66
70
|
rescue Exception => ex
|
@@ -93,15 +97,6 @@ module EPC::Command
|
|
93
97
|
end
|
94
98
|
end
|
95
99
|
|
96
|
-
def sign_pull(id)
|
97
|
-
status, response, headers = client.put("#{EPC::Config::PULLS_PATH}/#{id}/sign")
|
98
|
-
if status.successful?
|
99
|
-
return status, nil, response[:signed_url]
|
100
|
-
else
|
101
|
-
return status, response[:error_code], nil
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
100
|
def prep_solution_directory(path, solution_name)
|
106
101
|
solution_id = get_resource_id(EPC::Config::SOLUTIONS_PATH, :name, solution_name)
|
107
102
|
if solution_id.nil?
|
@@ -138,10 +133,16 @@ module EPC::Command
|
|
138
133
|
end
|
139
134
|
sleep(SLEEP_TIME)
|
140
135
|
|
141
|
-
status,
|
142
|
-
|
136
|
+
status, response, headers = sign_pull(id)
|
137
|
+
|
138
|
+
if status.successful?
|
139
|
+
say("\n")
|
140
|
+
return true, response[:signed_url], response
|
141
|
+
end
|
142
|
+
|
143
|
+
if status == 404 && response[:error_code] == 801
|
144
|
+
|
143
145
|
count += 1
|
144
|
-
next if url.nil? || url.empty?
|
145
146
|
break
|
146
147
|
else
|
147
148
|
say("Poller failed to get the pull URL. Aborting.")
|
@@ -150,17 +151,14 @@ module EPC::Command
|
|
150
151
|
end
|
151
152
|
end
|
152
153
|
|
153
|
-
|
154
|
-
|
155
|
-
[true, url]
|
156
|
-
elsif failed
|
157
|
-
[false, nil]
|
158
|
-
else
|
159
|
-
if count > GIVEUP_TICKS
|
160
|
-
say("\nServer is taking too long to update the pull URL. Please contact the AgileMethods support team.")
|
161
|
-
end
|
162
|
-
[false, nil]
|
154
|
+
if count > GIVEUP_TICKS
|
155
|
+
say("\nServer is taking too long to update the pull URL. Please contact the AgileMethods support team.")
|
163
156
|
end
|
157
|
+
[false, nil, nil]
|
158
|
+
end
|
159
|
+
|
160
|
+
def sign_pull(id)
|
161
|
+
client.put("#{EPC::Config::PULLS_PATH}/#{id}/sign")
|
164
162
|
end
|
165
163
|
|
166
164
|
def check_pull_directory(path)
|
@@ -1,15 +1,14 @@
|
|
1
1
|
module EPC::Command
|
2
|
-
class DeleteRoleCommand <
|
3
|
-
required_arguments_count 1, :message => "You must specify the role id/name"
|
2
|
+
class DeleteRoleCommand < DeleteCommand
|
4
3
|
|
5
|
-
def execute(role = nil)
|
4
|
+
def execute(role = nil, *args)
|
6
5
|
|
7
6
|
proceed = ask_yn("Are you sure you want to delete the [#{role}] role? [Yn] ")
|
8
7
|
if proceed.upcase == "N"
|
9
8
|
return 1
|
10
9
|
end
|
11
10
|
|
12
|
-
role_id =
|
11
|
+
role_id = retrieve_identifier_for("Role", role)
|
13
12
|
|
14
13
|
status, response, headers = client.delete(EPC::Config::ROLES_PATH + "/#{role_id}/system/true")
|
15
14
|
|
@@ -1,9 +1,10 @@
|
|
1
1
|
module EPC::Command
|
2
2
|
class ListRolesCommand < BaseCommand
|
3
|
-
def execute
|
3
|
+
def execute(target = nil)
|
4
4
|
|
5
|
-
if
|
6
|
-
|
5
|
+
if target.present?
|
6
|
+
target_type, target_id = target.split(":")
|
7
|
+
status, response, headers = client.get(EPC::Config::USERS_PATH + "/#{target_id}?include=roles")
|
7
8
|
response = response[:roles]
|
8
9
|
else
|
9
10
|
status, response, headers = client.get(EPC::Config::ROLES_PATH + "?system_roles=true")
|
@@ -1,13 +1,17 @@
|
|
1
1
|
module EPC::Command
|
2
|
-
class ShowRoleCommand <
|
3
|
-
required_arguments_count 1, :message => "You need to specify a role id/name"
|
2
|
+
class ShowRoleCommand < ShowCommand
|
4
3
|
|
5
|
-
def execute(role = nil)
|
4
|
+
def execute(role = nil, *args)
|
5
|
+
@showable_translations = {
|
6
|
+
:groups => :user_groups
|
7
|
+
}
|
6
8
|
|
7
|
-
role_id =
|
9
|
+
role_id = retrieve_identifier_for("Role", role)
|
8
10
|
|
9
11
|
status, response, headers = client.get(EPC::Config::ROLES_PATH + "/#{role_id}?include=users,user_groups,grants")
|
10
12
|
|
13
|
+
@showables = args[1..-1].map(&:to_sym) rescue []
|
14
|
+
|
11
15
|
unless status.successful?
|
12
16
|
say("Request failed: [#{response[:message]}]")
|
13
17
|
return 1
|
@@ -18,23 +22,27 @@ module EPC::Command
|
|
18
22
|
user_groups_table = EPC::TabularOutputter.new(response[:user_groups], [:id, :name])
|
19
23
|
grants_table = EPC::TabularOutputter.new(response[:grants], [:id, :action, :secured_type, :secured_id])
|
20
24
|
|
21
|
-
|
22
|
-
|
23
|
-
|
25
|
+
@response = response
|
26
|
+
|
27
|
+
if @showables.blank?
|
28
|
+
say("Role:")
|
29
|
+
say(role_table.print)
|
30
|
+
say("\n")
|
31
|
+
end
|
24
32
|
|
25
|
-
if
|
33
|
+
if show? :users
|
26
34
|
say("Users:")
|
27
35
|
say(users_table.print)
|
28
36
|
say("\n")
|
29
37
|
end
|
30
38
|
|
31
|
-
if
|
39
|
+
if show? :groups
|
32
40
|
say("User groups:")
|
33
41
|
say(user_groups_table.print)
|
34
42
|
say("\n")
|
35
43
|
end
|
36
44
|
|
37
|
-
if
|
45
|
+
if show? :grants
|
38
46
|
say("Grants:")
|
39
47
|
say(grants_table.print)
|
40
48
|
say("\n")
|