module Stackr::TemplateHelpers
Public Instance Methods
find_in_env(name)
click to toggle source
# File lib/stackr/template_helpers.rb, line 24 def find_in_env(name) if ENV['ENVIRONMENT'].nil? raise Stackr::EnvironmentMissingError, 'Please set ENVIRONMENT environment variable.' end map = load_environment_map() return map[ ENV['ENVIRONMENT'].to_sym ][name.to_sym] end
find_in_env_map(name)
click to toggle source
DEPRECATED: This is the old version of find_in_env
() It fails when there are more than 64 attributes in the map. Use new find_in_env
() instead
# File lib/stackr/template_helpers.rb, line 11 def find_in_env_map(name) find_in_map('EnvironmentMap', ref('Environment'), name) end
include_file(filepath, locals={})
click to toggle source
# File lib/stackr/template_helpers.rb, line 32 def include_file(filepath, locals={}) interpolate(file(filepath), locals) end
load_environment_map(includes_path='includes')
click to toggle source
# File lib/stackr/template_helpers.rb, line 15 def load_environment_map(includes_path='includes') if @environment_map.nil? map_path = File.join(includes_path, 'environment_map.rb') mappings = eval(File.read(map_path)) @environment_map = mappings['Mappings']['EnvironmentMap'] end @environment_map end