Class: EPC::Command::BaseCommand
- Includes:
- Error, PersistentAttributes
- Defined in:
- lib/epc/command/base_command.rb
Direct Known Subclasses
ArchiveCommand, AttachLibraryCommand, AttachLibrarysetCommand, AttachRuntimeCommand, BindServiceCommand, BuildCommand, CopyDeploymentCommand, CreateCommand, CreateConfigCommand, CreateDependencyCommand, CreateDeploymentCommand, CreateGroupCommand, CreateLibraryCommand, CreateLibrarylanguageCommand, CreateLibrarysetCommand, CreateObjectroleCommand, CreateProjectCommand, CreateRoleCommand, CreateServicedefinitionCommand, CreateServiceversionCommand, CreateSolutionCommand, CreateUserCommand, DeleteCommand, DeleteLibraryCommand, DeleteLibrarysetCommand, DeleteProjectCommand, DeployCommand, DetachLibraryCommand, DetachLibrarysetCommand, InfoCommand, ListCommand, ListConfigsCommand, ListDeploymentsCommand, ListDeploymentstagesCommand, ListGroupsCommand, ListLibrariesCommand, ListLibrarylanguagesCommand, ListLibrarysetsCommand, ListMetricsCommand, ListObjectrolesCommand, ListObjecttypesCommand, ListPermissiongroupsCommand, ListPermissionsCommand, ListPluginsCommand, ListProjectsCommand, ListProjecttypesCommand, ListRolesCommand, ListRuntimesCommand, ListServicedefinitionsCommand, ListServicetypesCommand, ListServiceversionsCommand, ListSolutionsCommand, ListUsersCommand, ListVersionsCommand, LoginCommand, LogoutCommand, PullCommand, PushCommand, RefreshSolutionCommand, RenewCommand, RequestPasswordchangeCommand, ShowCommand, ShowGroupCommand, ShowInstancesCommand, ShowLibrarysetCommand, ShowMetricsCommand, ShowProjecttypeCommand, SubmitDeploymentCommand, TargetCommand, UnarchiveCommand, UnbindServiceCommand, UndefineServiceCommand, UndeployCommand, UpdateCommand, UpdateDeploymentCommand, UpdateGroupCommand, UpdateLibrarylanguageCommand, UpdateLibrarysetCommand, UpdateProjectCommand, UpdateSolutionCommand, UpdateUserCommand, VoteDeploymentCommand
Constant Summary collapse
- SLEEP_TIME =
1
- TICKER_TICKS =
Numerators are in secs
25/SLEEP_TIME
- GIVEUP_TICKS =
120/SLEEP_TIME
- @@retrieval_rules =
{ :Role => { :required_type => :numeric, }, :User => { :required_type => :numeric, }, :UserGroup => { :required_type => :numeric, }, :LibrarySet => { :required_type => :numeric, } }
- @@required_options =
[]
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
Instance Method Summary collapse
- #go(*args) ⇒ Object
-
#initialize(client, options = {}) ⇒ BaseCommand
constructor
A new instance of BaseCommand.
Methods included from PersistentAttributes
#auth_token, #caller_id, #target_url
Constructor Details
#initialize(client, options = {}) ⇒ BaseCommand
50 51 52 53 54 55 56 |
# File 'lib/epc/command/base_command.rb', line 50 def initialize(client, = {}) @client = client = .dup if [:skip_prompts].present? create_method(:ask) {|text, arr| return "Y"} end end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
11 12 13 |
# File 'lib/epc/command/base_command.rb', line 11 def client @client end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
12 13 14 |
# File 'lib/epc/command/base_command.rb', line 12 def end |
Class Method Details
.inherited(subklass) ⇒ Object
37 38 39 40 |
# File 'lib/epc/command/base_command.rb', line 37 def self.inherited(subklass) # Here login is required for all commands that inherit subklass.require_login end |
.required_options(*opts, opt_hash) ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/epc/command/base_command.rb', line 42 def self.(*opts, opt_hash) = { :mode => :any?, :message => "You need to specify all required options" }.merge(opt_hash) << {:name => opts, :mode => [:mode], :message => [:message]} end |
Instance Method Details
#go(*args) ⇒ Object
58 59 60 61 62 63 64 65 |
# File 'lib/epc/command/base_command.rb', line 58 def go(*args) if (login_required?) && (!logged_in?) say("You must be logged in to run this command") return 1 else return translate_status_to_exit_code(execute(*args)) end end |