Sha256: b8dd493c304b33706e5e0b8d43d9b11373dd634e07fe930b43ffca919a00c79e

Contents?: true

Size: 601 Bytes

Versions: 1

Compression:

Stored size: 601 Bytes

Contents

class Profigure
  class << self
    def load(configs_dir, environment=nil)
      hash = YAML.load(file_contents("defaults", configs_dir))
      if environment
        contents = file_contents(environment, configs_dir)
        yaml_result = YAML.load(contents)
        hash.recursive_merge! yaml_result
      end
      hash["environment"] = environment
      MoStash.new hash
    end 

    def file_contents(environment, configs_dir)
      file = "#{configs_dir}/#{environment}.yml"
      content = run_erb IO.read(file)
    end 

    def run_erb(data)
      ERB.new( data ).result
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
profigure-0.0.2 lib/profigure/profigure.rb