Class: Terraspace::CLI::Build::Placeholder
- Inherits:
-
Object
- Object
- Terraspace::CLI::Build::Placeholder
- Includes:
- Terraspace::Compiler::DirsConcern, Util::Logging
- Defined in:
- lib/terraspace/cli/build/placeholder.rb
Instance Method Summary collapse
-
#build ⇒ Object
Grab the last module and build that.
-
#find_stack ⇒ Object
Used by: terraspace build placeholder.
-
#initialize(options = {}) ⇒ Placeholder
constructor
A new instance of Placeholder.
Methods included from Util::Logging
Methods included from Terraspace::Compiler::DirsConcern
#cache_dirs, #dirs, #extract_stack_name, #local_paths, #mod_names, #select_stack?, #stack_names, #with_each_mod
Constructor Details
#initialize(options = {}) ⇒ Placeholder
Returns a new instance of Placeholder.
9 10 11 |
# File 'lib/terraspace/cli/build/placeholder.rb', line 9 def initialize(={}) @options = end |
Instance Method Details
#build ⇒ Object
Grab the last module and build that. Assume the backend key has the same prefix Note: Tried building a empty “null” stack but with TFC a null space workspace is created, which is undesired.
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/terraspace/cli/build/placeholder.rb', line 16 def build return if ENV['TS_SUMMARY_BUILD'] == '0' mod = @options[:mod] if !mod or %w[placeholder].include?(mod) logger.info "Building one of the modules to get backend.tf info" mod = find_stack end Terraspace::Builder.new(@options.merge(mod: mod, init: false)).run # generate and init Terraspace::Mod.new(mod, @options) # mod metadata end |
#find_stack ⇒ Object
Used by: terraspace build placeholder
29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/terraspace/cli/build/placeholder.rb', line 29 def find_stack stack_paths = Dir.glob("{app,vendor}/stacks/*") stack_paths.select! do |path| stack_name = extract_stack_name(path) select = Terraspace::Compiler::Select.new(stack_name) select.selected? end mod_path = stack_paths.last unless mod_path logger.info "No stacks found." exit 0 end File.basename(mod_path) # mod name end |