Class: ECSHelper::Command::Base
- Inherits:
-
Object
- Object
- ECSHelper::Command::Base
- Includes:
- Logging
- Defined in:
- lib/ecs_helper/command/base.rb
Direct Known Subclasses
BuildAndPush, CheckExec, Deploy, ECRLogin, Exec, ExportEnvSecrets, ExportImages, RunCommand
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
-
#helper ⇒ Object
Returns the value of attribute helper.
-
#option_parser ⇒ Object
Returns the value of attribute option_parser.
-
#options ⇒ Object
Returns the value of attribute options.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #application ⇒ Object
- #check_bin(bin) ⇒ Object
-
#initialize(helper) ⇒ Base
constructor
A new instance of Base.
- #printable? ⇒ Boolean
- #project ⇒ Object
- #required ⇒ Object
- #validate ⇒ Object
Methods included from Logging
Constructor Details
#initialize(helper) ⇒ Base
Returns a new instance of Base.
10 11 12 13 14 15 |
# File 'lib/ecs_helper/command/base.rb', line 10 def initialize(helper) @client = helper.client @helper = helper @option_parser, @options = cmd_option_parser @option_parser.parse!(into: @options) end |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
7 8 9 |
# File 'lib/ecs_helper/command/base.rb', line 7 def client @client end |
#helper ⇒ Object
Returns the value of attribute helper.
7 8 9 |
# File 'lib/ecs_helper/command/base.rb', line 7 def helper @helper end |
#option_parser ⇒ Object
Returns the value of attribute option_parser.
7 8 9 |
# File 'lib/ecs_helper/command/base.rb', line 7 def option_parser @option_parser end |
#options ⇒ Object
Returns the value of attribute options.
7 8 9 |
# File 'lib/ecs_helper/command/base.rb', line 7 def @options end |
#type ⇒ Object
Returns the value of attribute type.
7 8 9 |
# File 'lib/ecs_helper/command/base.rb', line 7 def type @type end |
Instance Method Details
#application ⇒ Object
34 35 36 |
# File 'lib/ecs_helper/command/base.rb', line 34 def application helper.application end |
#check_bin(bin) ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/ecs_helper/command/base.rb', line 25 def check_bin(bin) check_cmd = Terrapin::CommandLine.new("which #{bin}") result = check_cmd.run "success" rescue Terrapin::CommandNotFoundError, Terrapin::ExitStatusError => e = ["#{bin} not found"] raise ECSHelper::Error::BinNotFound.new() end |
#printable? ⇒ Boolean
55 56 57 |
# File 'lib/ecs_helper/command/base.rb', line 55 def printable? false end |
#project ⇒ Object
21 22 23 |
# File 'lib/ecs_helper/command/base.rb', line 21 def project helper.project end |
#required ⇒ Object
51 52 53 |
# File 'lib/ecs_helper/command/base.rb', line 51 def required [] end |
#validate ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/ecs_helper/command/base.rb', line 38 def validate required.each do |r| value = [r] if value.nil? = [ "'#{r}' required for command '#{type}'".light_white, option_parser.help ] raise ECSHelper::Error::CommandValidationError.new() end end end |