module CloudFormationTool::CLI::ParamSupport
Public Class Methods
included(o)
click to toggle source
# File lib/cloud_formation_tool/cli/param_support.rb, line 8 def self.included o o.extend ClassMethods end
Public Instance Methods
get_params()
click to toggle source
# File lib/cloud_formation_tool/cli/param_support.rb, line 38 def get_params params = if param_file yaml = YAML.load(read_param_file param_file).to_h if param_key raise "Missing parameter section '#{param_key}' in '#{param_file}'!" unless yaml[param_key].is_a? Hash yaml[param_key] else yaml end else Hash.new end # allow param_list to override parameters from the param file param_list.inject(params) do |h, param| k,v = param.split /\s*[=:]\s*/ h[k] = v h end end
read_param_file(file)
click to toggle source
# File lib/cloud_formation_tool/cli/param_support.rb, line 28 def read_param_file(file) param_uri = URI(file) case param_uri.scheme when /^http/ Net::HTTP.get(param_uri) else File.read(file) end end