Sha256: 4819b9014c68925a5510b146b8bcea42927ca1d7651621ff61d96aebaa8103cf

Contents?: true

Size: 844 Bytes

Versions: 1

Compression:

Stored size: 844 Bytes

Contents

require 'configatron'
require 'yaml'

module Rake::Funnel::Tasks::EnvironmentsSupport
  class Loader
    class << self
      def load_configuration(config, store = configatron)
        log("Configuring for #{config[:name]}")
        store.unlock!
        store.reset!

        store.env = config[:name]

        operation = 'Loading'
        config.fetch(:config_files, []).each do |file|
          log("#{operation} #{file}")
          operation = 'Merging'

          yaml = File.read(file)
          yaml = ERB.new(yaml).result
          yaml = YAML.load(yaml) || {}
          store.configure_from_hash(yaml)
        end

        store.lock!

        log('')
        log(store.inspect)
      end

      private
      def log(message)
        Rake.rake_output_message(message)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rake-funnel-0.0.1.pre lib/rake/funnel/tasks/environments_support/loader.rb