Sha256: f37d2360098305f29f1dfb541703c87a863bff367fed104b3208d58e4eac3a5f
Contents?: true
Size: 1.17 KB
Versions: 1
Compression:
Stored size: 1.17 KB
Contents
class TerraspaceBundler::Mod module StackConcern def stacks stacks = @props[:stacks] || @props[:stack] return unless stacks if all_stacks?(stacks) stacks = all_stacks end normalize_stacks(stacks) end alias_method :stack, :stacks # important to have alias for VersionCheck def all_stacks?(*stacks) stacks.flatten == [:all] end def all_stacks stack = TerraspaceBundler::Exporter::Stacks::Stack.new(self) # to get the mod src path expr = "#{stack.examples_folder}/*" Dir.glob(expr).map do |path| example = File.basename(path) # Set name so multiple app/stacks are created instead of just one app/stack/MOD { name: example, src: example, } end end # Normalizes stack options to an Array of Hashes or just a single Hash def normalize_stacks(option) defaults = TB.config.stack_options.dup result = case option when String [defaults.merge(src: option)] when Array option.map! {|s| normalize_stacks(s) } else # Hash [defaults.merge!(option)] end result.flatten end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
terraspace-bundler-0.3.0 | lib/terraspace_bundler/mod/stack_concern.rb |