Class: ECSUtil::Runner
- Inherits:
-
Object
- Object
- ECSUtil::Runner
- Includes:
- Terraform
- Defined in:
- lib/ecsutil/runner.rb
Instance Method Summary collapse
-
#initialize(dir, args) ⇒ Runner
constructor
A new instance of Runner.
- #run ⇒ Object
Methods included from Terraform
Constructor Details
#initialize(dir, args) ⇒ Runner
Returns a new instance of Runner.
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/ecsutil/runner.rb', line 18 def initialize(dir, args) stage = args.shift command = args.shift command_parts = command&.split(":", 2) @dir = dir @stage = stage @command = command_parts&.shift @args = args @action = command_parts&.shift @config_path = File.join(@dir, "deploy", "#{stage}.yml") end |
Instance Method Details
#run ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/ecsutil/runner.rb', line 31 def run return print_help unless @command return terminate("Please provide stage") unless @stage config = read_config klass = command_class(@command) if !klass terminate "Invalid command: #{@command}" end klass.new(config, @action, @args).run end |