class StackMaster::StackDefinition
Attributes
additional_parameter_lookup_dirs[RW]
allowed_accounts[RW]
base_dir[RW]
compiler[R]
compiler_options[RW]
ejson_file[RW]
ejson_file_kms[RW]
ejson_file_region[RW]
files[RW]
notification_arns[RW]
parameter_files[RW]
parameters[RW]
parameters_dir[RW]
region[RW]
role_arn[RW]
s3[RW]
stack_name[RW]
stack_policy_file[RW]
template[RW]
template_dir[RW]
Public Class Methods
new(attributes = {})
click to toggle source
Calls superclass method
StackMaster::Utils::Initializable::new
# File lib/stack_master/stack_definition.rb, line 28 def initialize(attributes = {}) @compiler_options = {} @notification_arns = [] @s3 = {} @files = [] @allowed_accounts = nil @ejson_file_kms = true @compiler = nil super @additional_parameter_lookup_dirs ||= [] @base_dir ||= "" @template_dir ||= File.join(@base_dir, 'templates') @parameters_dir ||= File.join(@base_dir, 'parameters') @allowed_accounts = Array(@allowed_accounts) @parameters ||= {} @parameter_files ||= [] end
Public Instance Methods
==(other)
click to toggle source
# File lib/stack_master/stack_definition.rb, line 46 def ==(other) self.class === other && @region == other.region && @stack_name == other.stack_name && @template == other.template && @tags == other.tags && @role_arn == other.role_arn && @allowed_accounts == other.allowed_accounts && @notification_arns == other.notification_arns && @base_dir == other.base_dir && @ejson_file == other.ejson_file && @ejson_file_region == other.ejson_file_region && @ejson_file_kms == other.ejson_file_kms && @stack_policy_file == other.stack_policy_file && @additional_parameter_lookup_dirs == other.additional_parameter_lookup_dirs && @s3 == other.s3 && @compiler == other.compiler && @compiler_options == other.compiler_options end
all_parameter_files()
click to toggle source
# File lib/stack_master/stack_definition.rb, line 91 def all_parameter_files if parameter_files.empty? parameter_files_from_globs else parameter_files end end
files_dir()
click to toggle source
# File lib/stack_master/stack_definition.rb, line 71 def files_dir File.join(base_dir, 'files') end
parameter_file_globs()
click to toggle source
# File lib/stack_master/stack_definition.rb, line 103 def parameter_file_globs [ default_parameter_glob, region_parameter_glob ] + additional_parameter_lookup_globs end
parameter_files_from_globs()
click to toggle source
# File lib/stack_master/stack_definition.rb, line 99 def parameter_files_from_globs parameter_file_globs.map(&Dir.method(:glob)).flatten end
s3_configured?()
click to toggle source
# File lib/stack_master/stack_definition.rb, line 111 def s3_configured? !s3.nil? end
s3_files()
click to toggle source
# File lib/stack_master/stack_definition.rb, line 75 def s3_files files.inject({}) do |hash, file| path = File.join(files_dir, file) hash[file] = { path: path, body: File.read(path) } hash end end
s3_template_file_name()
click to toggle source
# File lib/stack_master/stack_definition.rb, line 86 def s3_template_file_name return template if ['.json', '.yaml', '.yml'].include?(File.extname(template)) Utils.change_extension(template, 'json') end
stack_policy_file_path()
click to toggle source
# File lib/stack_master/stack_definition.rb, line 107 def stack_policy_file_path File.join(base_dir, 'policies', stack_policy_file) if stack_policy_file end
template_file_path()
click to toggle source
# File lib/stack_master/stack_definition.rb, line 66 def template_file_path return unless template File.expand_path(template, template_dir) end
Private Instance Methods
additional_parameter_lookup_globs()
click to toggle source
# File lib/stack_master/stack_definition.rb, line 123 def additional_parameter_lookup_globs additional_parameter_lookup_dirs.map do |a| File.join(parameters_dir, a, "#{stack_name_glob}.y*ml") end end
default_parameter_glob()
click to toggle source
# File lib/stack_master/stack_definition.rb, line 133 def default_parameter_glob File.join(parameters_dir, "#{stack_name_glob}.y*ml") end
region_parameter_glob()
click to toggle source
# File lib/stack_master/stack_definition.rb, line 129 def region_parameter_glob File.join(parameters_dir, "#{region}", "#{stack_name_glob}.y*ml") end
stack_name_glob()
click to toggle source
# File lib/stack_master/stack_definition.rb, line 137 def stack_name_glob stack_name.gsub('-', '[-_]') end