Sha256: 87992647beaaa93c0359da1e4fb87cd7649e73d6f8a16374fc0bf1358b64a45f

Contents?: true

Size: 818 Bytes

Versions: 4

Compression:

Stored size: 818 Bytes

Contents

require 'active_support'
require 'taza/options'

module Taza
  class Settings
    #   Taza::Settings.Config('google')
    def self.config(site_name)
      site_file(site_name).merge(Options.new.execute)
    end

    # Loads the config file for the entire project and returns the hash.
    # Does not override settings from the ENV variables.
    def self.config_file
      YAML.load_file(config_file_path)
    end

    def self.config_file_path # :nodoc:
      File.join(config_folder,'config.yml')
    end
    
    def self.config_folder # :nodoc:
      File.join(path,'config')
    end
    
    def self.site_file(site_name) # :nodoc:
      YAML.load(ERB.new(File.read(File.join(config_folder,"#{site_name.underscore}.yml"))).result)[ENV['TAZA_ENV']]
    end

    def self.path # :nodoc:
      '.'
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
taza-3.0.0 lib/taza/settings.rb
taza-2.1.0 lib/taza/settings.rb
taza-2.0 lib/taza/settings.rb
taza-1.0 lib/taza/settings.rb