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,24 +1,26 @@
|
|
1
1
|
module EPC::Command
|
2
2
|
class UpdateGroupCommand < BaseCommand
|
3
3
|
|
4
|
-
required_options :add_user, :remove_user, :mode => :any?, :message => "You must specify a user
|
4
|
+
required_options :add_user, :remove_user, :mode => :any?, :message => "You must specify a user to added or removed"
|
5
5
|
|
6
|
-
def execute(
|
7
|
-
|
8
|
-
group_id = retrieve_identifier_for("UserGroup", group)
|
6
|
+
def execute(args)
|
9
7
|
|
10
8
|
failures = []
|
11
9
|
if @options[:add_user].present?
|
12
|
-
|
10
|
+
user_id = retrieve_identifier_for("User", @options[:add_user])
|
11
|
+
raise FatalError, "User not found" if user_id.blank?
|
12
|
+
status, response, headers = client.put(EPC::Config::GROUPS_PATH + "/#{object_id}/add_user", {:user_id => user_id})
|
13
13
|
say("User added to group") if status.successful?
|
14
14
|
end
|
15
15
|
|
16
16
|
if @options[:remove_user].present?
|
17
|
-
|
17
|
+
user_id = retrieve_identifier_for("User", @options[:remove_user])
|
18
|
+
raise FatalError, "User not found" if user_id.blank?
|
19
|
+
status, response, headers = client.put(EPC::Config::GROUPS_PATH + "/#{object_id}/remove_user", {:user_id => user_id})
|
18
20
|
say("User removed from group") if status.successful?
|
19
21
|
end
|
20
22
|
|
21
|
-
say("Request failed: [#{response[:message]}]")
|
23
|
+
say("Request failed: [#{response[:message]}]") unless status.successful?
|
22
24
|
return status
|
23
25
|
end
|
24
26
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module EPC::Command
|
2
2
|
class CreateLibraryCommand < BaseCommand
|
3
3
|
|
4
|
-
def execute(
|
4
|
+
def execute(args = [])
|
5
5
|
|
6
6
|
raise FatalError, "Parameters incorrectly specified" if args.size < 3
|
7
7
|
|
@@ -9,7 +9,6 @@ module EPC::Command
|
|
9
9
|
params[:name] = args[0]
|
10
10
|
|
11
11
|
params[:language_id] = retrieve_identifier_for("LibraryLanguage", args[1])
|
12
|
-
|
13
12
|
|
14
13
|
raise InputError, "Unable to determine library language" if params[:language_id].nil? || params[:language_id] == 0
|
15
14
|
|
@@ -1,16 +1,15 @@
|
|
1
1
|
module EPC::Command
|
2
2
|
class DeleteLibraryCommand < BaseCommand
|
3
3
|
|
4
|
-
def execute(
|
4
|
+
def execute(args)
|
5
|
+
require_object
|
5
6
|
|
6
|
-
proceed = ask_yn("Are you sure you want to delete the [#{
|
7
|
+
proceed = ask_yn("Are you sure you want to delete the [#{object_id}] library? [Yn] ")
|
7
8
|
if proceed.upcase == 'N'
|
8
9
|
return 1
|
9
10
|
end
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
status, response, headers = client.delete(EPC::Config::LIBRARIES_PATH + "/#{library_id}")
|
12
|
+
status, response, headers = client.delete(EPC::Config::LIBRARIES_PATH + "/#{object_id}")
|
14
13
|
if status.successful?
|
15
14
|
say("Library deleted")
|
16
15
|
else
|
@@ -1,15 +1,13 @@
|
|
1
1
|
module EPC::Command
|
2
2
|
class DeleteLibrarylanguageCommand < DeleteCommand
|
3
3
|
|
4
|
-
def execute(
|
5
|
-
proceed = ask_yn("Are you sure you want to delete the [#{
|
4
|
+
def execute(args = [])
|
5
|
+
proceed = ask_yn("Are you sure you want to delete the [#{object_id}] language? [Yn] ")
|
6
6
|
if proceed.upcase == "N"
|
7
7
|
return 1
|
8
8
|
end
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
status, response, headers = client.delete(EPC::Config::LIBRARY_LANGUAGES_PATH + "/#{language_id}")
|
10
|
+
status, response, headers = client.delete(EPC::Config::LIBRARY_LANGUAGES_PATH + "/#{object_id}")
|
13
11
|
|
14
12
|
if status.successful?
|
15
13
|
say("Language deleted")
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module EPC::Command
|
2
2
|
class ListLibrarylanguagesCommand < BaseCommand
|
3
3
|
|
4
|
-
def execute(
|
4
|
+
def execute(args = [])
|
5
5
|
status, response, headers = client.get(EPC::Config::LIBRARY_LANGUAGES_PATH)
|
6
6
|
if status.failure?
|
7
7
|
say("Request failed: [#{response[:message]}]")
|
@@ -1,15 +1,14 @@
|
|
1
1
|
module EPC::Command
|
2
|
-
class UpdateLibrarylanguageCommand <
|
2
|
+
class UpdateLibrarylanguageCommand < UpdateCommand
|
3
3
|
|
4
|
-
def execute(
|
4
|
+
def execute(args = [])
|
5
|
+
require_object
|
5
6
|
|
6
7
|
new_name = args[0] rescue nil
|
7
8
|
|
8
9
|
raise FatalError, "You need to specify the new library language name" if new_name.blank?
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
status, response, headers = client.put(EPC::Config::LIBRARY_LANGUAGES_PATH + "/#{language_id}", :name => new_name )
|
11
|
+
status, response, headers = client.put(EPC::Config::LIBRARY_LANGUAGES_PATH + "/#{object_id}", :name => new_name )
|
13
12
|
|
14
13
|
if status.successful?
|
15
14
|
say("Language updated")
|
@@ -1,13 +1,12 @@
|
|
1
1
|
module EPC::Command
|
2
2
|
class CreateLibrarysetCommand < BaseCommand
|
3
3
|
|
4
|
-
def execute(
|
4
|
+
def execute(params = [])
|
5
5
|
|
6
|
-
set = params[
|
7
|
-
language = params[
|
6
|
+
set = params[0]
|
7
|
+
language = params[1]
|
8
8
|
|
9
9
|
raise FatalError, "You need to specify a name for the set" if set.blank?
|
10
|
-
|
11
10
|
raise FatalError, "You need to specify a language" if language.blank?
|
12
11
|
|
13
12
|
params = {}
|
@@ -15,6 +14,8 @@ module EPC::Command
|
|
15
14
|
|
16
15
|
params[:language_id] = retrieve_identifier_for("LibraryLanguage", language)
|
17
16
|
|
17
|
+
raise InputError, "Request failed: Language [#{language}] not found" if params[:language_id].blank? && @options[:file].blank?
|
18
|
+
|
18
19
|
status, response, headers = client.post(EPC::Config::LIBRARY_SETS_PATH, params)
|
19
20
|
if status.successful?
|
20
21
|
say("Set [#{set}] created")
|
@@ -1,15 +1,13 @@
|
|
1
1
|
module EPC::Command
|
2
|
-
class DeleteLibrarysetCommand <
|
2
|
+
class DeleteLibrarysetCommand < DeleteCommand
|
3
3
|
|
4
|
-
def execute(
|
5
|
-
proceed = ask_yn("Are you sure you want to delete the [#{
|
4
|
+
def execute(args = [])
|
5
|
+
proceed = ask_yn("Are you sure you want to delete the [#{object_id}] set? [Yn] ")
|
6
6
|
if proceed.upcase == "N"
|
7
7
|
return 1
|
8
8
|
end
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
status, response, headers = client.delete(EPC::Config::LIBRARY_SETS_PATH + "/#{set_id}")
|
10
|
+
status, response, headers = client.delete(EPC::Config::LIBRARY_SETS_PATH + "/#{object_id}")
|
13
11
|
|
14
12
|
if status.successful?
|
15
13
|
say("Set deleted")
|
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'time'
|
2
2
|
module EPC::Command
|
3
|
-
class ListLibrarysetsCommand <
|
3
|
+
class ListLibrarysetsCommand < ListCommand
|
4
4
|
|
5
|
-
def execute(
|
5
|
+
def execute(args = [])
|
6
6
|
status, response, headers = client.get(EPC::Config::LIBRARY_SETS_PATH)
|
7
7
|
if status.failure?
|
8
8
|
say("Request failed: [#{response[:message]}]")
|
@@ -2,10 +2,10 @@ require 'time'
|
|
2
2
|
module EPC::Command
|
3
3
|
class ShowLibrarysetCommand < BaseCommand
|
4
4
|
|
5
|
-
def execute(
|
6
|
-
|
5
|
+
def execute(args = [])
|
6
|
+
require_object
|
7
7
|
|
8
|
-
status, response, headers = client.get(EPC::Config::LIBRARY_SETS_PATH + "/#{
|
8
|
+
status, response, headers = client.get(EPC::Config::LIBRARY_SETS_PATH + "/#{object_id}")
|
9
9
|
|
10
10
|
if status.failure?
|
11
11
|
say("Request failed: [#{response[:message]}]")
|
@@ -3,9 +3,10 @@ module EPC::Command
|
|
3
3
|
|
4
4
|
required_options :add_library, :remove_library, :mode => :any?, :message => "You must specify a library to added or removed"
|
5
5
|
|
6
|
-
def execute(
|
6
|
+
def execute(args)
|
7
|
+
require_object
|
7
8
|
|
8
|
-
set_id =
|
9
|
+
set_id = object_id
|
9
10
|
|
10
11
|
if @options[:add_library].present?
|
11
12
|
lib = @options[:add_library]
|
@@ -24,7 +25,7 @@ module EPC::Command
|
|
24
25
|
lib = @options[:remove_library]
|
25
26
|
lib_id = extract_library_id(lib)
|
26
27
|
|
27
|
-
status, response, headers = client.
|
28
|
+
status, response, headers = client.delete(EPC::Config::LIBRARY_SETS_PATH + "/#{set_id}/detach_library/#{lib_id}")
|
28
29
|
if status.successful?
|
29
30
|
say("Library [#{lib}] removed from set")
|
30
31
|
else
|
@@ -1,21 +1,17 @@
|
|
1
1
|
module EPC::Command
|
2
2
|
class ListCommand < BaseCommand
|
3
3
|
|
4
|
-
def execute(
|
5
|
-
|
6
|
-
params =
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
4
|
+
def execute(*args)
|
5
|
+
raise FatalError, "You need to specify the object for the command" if args.blank?
|
6
|
+
params = resolve_context(args, {:skip_object_resolution => Proc.new{|type, id| type.downcase == "versions"}})
|
7
|
+
raise FatalError, "Object type cound not be determined" if @object_type.blank?
|
8
|
+
@klass_name = "EPC::Command::List#{@object_type.to_s.gsub("-","").capitalize}Command"
|
9
|
+
command = eval(@klass_name)
|
10
|
+
command.include_module("config") if object_type.downcase == "configs"
|
11
|
+
command = command.new(client, @options)
|
12
|
+
command.context_params = context_params
|
13
|
+
command.execute(params)
|
12
14
|
|
13
|
-
def pluralize(string)
|
14
|
-
case string.downcase
|
15
|
-
when "library"
|
16
|
-
return "Libraries"
|
17
|
-
end
|
18
|
-
return string + "s"
|
19
15
|
end
|
20
16
|
|
21
17
|
end
|
@@ -1,12 +1,11 @@
|
|
1
1
|
module EPC::Command
|
2
2
|
class CreateObjectroleCommand < BaseCommand
|
3
|
-
def execute(
|
4
|
-
|
5
|
-
name = params[1]
|
3
|
+
def execute(args = [])
|
4
|
+
name = args[0]
|
6
5
|
|
7
|
-
raise FatalError, "
|
6
|
+
raise FatalError, "Name is required" if name.blank?
|
8
7
|
|
9
|
-
status, response, headers = client.post(EPC::Config::ROLES_PATH, {:name => name, :owner_type =>
|
8
|
+
status, response, headers = client.post(EPC::Config::ROLES_PATH, {:name => name, :owner_type => target_type, :owner_id => target_id})
|
10
9
|
|
11
10
|
if status.successful?
|
12
11
|
say("Role [#{name}] created")
|
@@ -1,15 +1,10 @@
|
|
1
1
|
module EPC::Command
|
2
2
|
class ListObjectrolesCommand < BaseCommand
|
3
3
|
|
4
|
-
def execute(
|
5
|
-
|
6
|
-
raise FatalError, "You must specify an TargetType and TargetId" if target.blank?
|
7
|
-
|
8
|
-
obj_type, obj_id = target.split(":")
|
9
|
-
|
10
|
-
raise FatalError, "Parameters specified incorrectly" if obj_type.blank? || obj_id.blank?
|
4
|
+
def execute(args = [])
|
5
|
+
require_target
|
11
6
|
|
12
|
-
status, response, headers = client.get(EPC::Config::ROLES_PATH + "/for_object/#{
|
7
|
+
status, response, headers = client.get(EPC::Config::ROLES_PATH + "/for_object/#{target_type}/#{target_id}")
|
13
8
|
|
14
9
|
if status.successful?
|
15
10
|
roles_table = EPC::TabularOutputter.new(response, [:id, :name])
|
@@ -4,9 +4,11 @@ module EPC::Command
|
|
4
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
5
|
|
6
6
|
def execute(role = nil, *args)
|
7
|
-
role_id = retrieve_identifier_for("Role",
|
7
|
+
role_id = retrieve_identifier_for("Role", object_id.split(":"))
|
8
8
|
|
9
9
|
cmd = UpdateRoleCommand.new(client, @options)
|
10
|
+
cmd.object_id = role_id
|
11
|
+
cmd.object_type = "Role"
|
10
12
|
return cmd.execute(role_id)
|
11
13
|
|
12
14
|
end
|
@@ -1,9 +1,8 @@
|
|
1
1
|
module EPC::Command
|
2
2
|
class CreatePluginCommand < CreateCommand
|
3
3
|
|
4
|
-
def execute(
|
4
|
+
def execute(args = [])
|
5
5
|
keys = [:name, :plugin_version, :group]
|
6
|
-
args = args[1..3] rescue nil
|
7
6
|
|
8
7
|
raise FatalError, "You need to specify the name, version and group for the plugin" if args.size < 3
|
9
8
|
params = {}
|
@@ -1,16 +1,14 @@
|
|
1
1
|
module EPC::Command
|
2
|
-
class DeletePluginCommand <
|
2
|
+
class DeletePluginCommand < DeleteCommand
|
3
3
|
|
4
|
-
def execute(
|
4
|
+
def execute(argss = [])
|
5
5
|
|
6
|
-
proceed = ask_yn("Are you sure you want to delete the [#{
|
6
|
+
proceed = ask_yn("Are you sure you want to delete the [#{object_id}] plugin? [Yn] ")
|
7
7
|
if proceed.upcase == 'N'
|
8
8
|
return 1
|
9
9
|
end
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
status, response, headers = client.delete(EPC::Config::PLUGINS_PATH + "/#{plugin_id}")
|
11
|
+
status, response, headers = client.delete(EPC::Config::PLUGINS_PATH + "/#{object_id}")
|
14
12
|
|
15
13
|
if status.successful?
|
16
14
|
say("Plugin deleted")
|
@@ -1,12 +1,9 @@
|
|
1
1
|
module EPC::Command
|
2
2
|
class ShowPluginCommand < ShowCommand
|
3
3
|
|
4
|
-
def execute(
|
4
|
+
def execute(args = [])
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
status, response, headers = client.get(EPC::Config::PLUGINS_PATH + "/#{plugin_id}")
|
6
|
+
status, response, headers = client.get(EPC::Config::PLUGINS_PATH + "/#{object_id}")
|
10
7
|
|
11
8
|
if status.successful?
|
12
9
|
plugin_table = EPC::TabularOutputter.new([response], [:id, :name, :plugin_version, :group, :inherited, :extensions])
|
@@ -2,11 +2,7 @@ module EPC::Command
|
|
2
2
|
class UpdatePluginCommand < UpdateCommand
|
3
3
|
UPDATABLE_ATTRIBUTES = ["name", "plugin_version", "group", "inherited", "extensions", "executions", "configuration"]
|
4
4
|
|
5
|
-
def execute(
|
6
|
-
|
7
|
-
plugin_id = retrieve_identifier_for("Plugin", plugin)
|
8
|
-
|
9
|
-
args = args[1..3] rescue nil
|
5
|
+
def execute(args)
|
10
6
|
|
11
7
|
raise FatalError, "You need to specify at least one attribute to update" if args.size < 1
|
12
8
|
params = {}
|
@@ -27,7 +23,7 @@ module EPC::Command
|
|
27
23
|
|
28
24
|
raise InputError, "You need to specify at least one attribute to update" if params.blank?
|
29
25
|
|
30
|
-
status, response, headers = client.put(EPC::Config::PLUGINS_PATH + "/#{
|
26
|
+
status, response, headers = client.put(EPC::Config::PLUGINS_PATH + "/#{object_id}", params)
|
31
27
|
|
32
28
|
if status.successful?
|
33
29
|
say("Plugin updated")
|
@@ -1,18 +1,10 @@
|
|
1
1
|
module EPC::Command
|
2
2
|
class ArchiveProjectCommand < ArchiveCommand
|
3
3
|
|
4
|
-
def execute(
|
5
|
-
|
6
|
-
path = File.expand_path(path)
|
4
|
+
def execute(args = [])
|
5
|
+
require_object
|
7
6
|
|
8
|
-
|
9
|
-
|
10
|
-
solution_id, solution_name = infer_solution_context(solution_name, path, {:get_solution_name => true})
|
11
|
-
project_id, project_name = infer_project_context(project_name, path, solution_id, {:get_project_name => true})
|
12
|
-
|
13
|
-
raise FatalError, "Project could not be inferred" if project_id.nil?
|
14
|
-
|
15
|
-
status, response, message = client.put(EPC::Config::PROJECTS_PATH + "/#{project_id}", {:archived => true})
|
7
|
+
status, response, message = client.put(EPC::Config::PROJECTS_PATH + "/#{object_id}", {:archived => true})
|
16
8
|
if status.successful?
|
17
9
|
say("Project has been archived.")
|
18
10
|
else
|
@@ -22,4 +14,3 @@ module EPC::Command
|
|
22
14
|
end
|
23
15
|
end
|
24
16
|
end
|
25
|
-
|