Class: Terraspace::CLI::Commander

Inherits:
Base
  • Object
show all
Defined in:
lib/terraspace/cli/commander.rb

Instance Method Summary collapse

Methods included from Util

#pretty_path

Methods included from Util::Sure

#sure?

Methods included from Util::Sh

#sh

Methods included from Util::Logging

#logger

Constructor Details

#initialize(name, options = {}) ⇒ Commander

Returns a new instance of Commander.



3
4
5
6
# File 'lib/terraspace/cli/commander.rb', line 3

def initialize(name, options={})
  @name = name
  super(options)
end

Instance Method Details

#auto_create_backendObject



16
17
18
19
# File 'lib/terraspace/cli/commander.rb', line 16

def auto_create_backend
  return unless @name == "apply"
  Terraspace::Compiler::Backend.new(@mod).create
end

#runObject

Commander always runs Build#run



9
10
11
12
13
14
# File 'lib/terraspace/cli/commander.rb', line 9

def run
  Terraspace::Builder.new(@options).run # generate and init
  auto_create_backend
  Init.new(@options.merge(calling_command: @name)).run
  Terraspace::Terraform::Runner.new(@name, @options).run
end