Sha256: 336bd433d3a7a4859518ba393a46c519a9a5cfcf56dea11cea4d6bf7fe442033
Contents?: true
Size: 779 Bytes
Versions: 31
Compression:
Stored size: 779 Bytes
Contents
module Terraspace::Compiler class Select def initialize(path) @path = path @stack_name = extract_stack_name(path) end def selected? all = Terraspace.config.all # Key difference between include_stacks vs all.include_stacks option is that # the option can be nil. The local variable is guaranteed to be an Array. # This simplifies the logic. include_stacks = all.include_stacks || [] ignore_stacks = all.ignore_stacks || [] if all.include_stacks.nil? !ignore_stacks.include?(@stack_name) else stacks = include_stacks - ignore_stacks stacks.include?(@stack_name) end end def extract_stack_name(path) path.sub(%r{.*(app|vendor)/stacks/}, '') end end end
Version data entries
31 entries across 31 versions & 1 rubygems