Class: ECSHelper::Command
- Inherits:
-
Object
- Object
- ECSHelper::Command
- Defined in:
- lib/ecs_helper/command.rb
Defined Under Namespace
Classes: Base, BuildAndPush, CheckExec, Deploy, ECRLogin, Exec, ExportEnvSecrets, ExportImages, RunCommand
Constant Summary collapse
- CMD_MAPPING =
{ "build_and_push" => BuildAndPush, "deploy" => Deploy, "export_images" => ExportImages, "ecr_login" => ECRLogin, "run_command" => RunCommand, "export_env_secrets" => ExportEnvSecrets, "exec" => Exec, "check_exec" => CheckExec, }
- AVAILABLE_COMMANDS =
CMD_MAPPING.keys
Instance Attribute Summary collapse
-
#command ⇒ Object
Returns the value of attribute command.
-
#helper ⇒ Object
Returns the value of attribute helper.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(helper) ⇒ Command
constructor
A new instance of Command.
- #klass ⇒ Object
- #options ⇒ Object
- #run ⇒ Object
Constructor Details
#initialize(helper) ⇒ Command
Returns a new instance of Command.
27 28 29 30 31 |
# File 'lib/ecs_helper/command.rb', line 27 def initialize(helper) @helper = helper @type = ARGV.shift @command = klass.new(helper) end |
Instance Attribute Details
#command ⇒ Object
Returns the value of attribute command.
25 26 27 |
# File 'lib/ecs_helper/command.rb', line 25 def command @command end |
#helper ⇒ Object
Returns the value of attribute helper.
25 26 27 |
# File 'lib/ecs_helper/command.rb', line 25 def helper @helper end |
#type ⇒ Object
Returns the value of attribute type.
25 26 27 |
# File 'lib/ecs_helper/command.rb', line 25 def type @type end |
Instance Method Details
#klass ⇒ Object
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/ecs_helper/command.rb', line 33 def klass CMD_MAPPING[type] || begin = [ "Command not found".light_white, "Available commands are #{AVAILABLE_COMMANDS}".light_white, global_option_parser ] raise ECSHelper::Error::CommandNotFound.new() end end |
#options ⇒ Object
44 45 46 |
# File 'lib/ecs_helper/command.rb', line 44 def command. end |
#run ⇒ Object
48 49 50 51 52 53 |
# File 'lib/ecs_helper/command.rb', line 48 def run command.validate result = command.run puts result if command.printable? result end |