class Frizz::Configuration
Constants
- YAML_FILENAME
Attributes
access_key_id[RW]
current_environment[RW]
environments[RW]
secret_access_key[RW]
Public Class Methods
new()
click to toggle source
# File lib/frizz/configuration.rb, line 10 def initialize self.environments = {} # Attempt to load defaults from ENV self.access_key_id = ENV["AWS_ACCESS_KEY_ID"] self.secret_access_key = ENV["AWS_SECRET_ACCESS_KEY"] self.current_environment = ENV["FRIZZ_ENV"] || "development" # Allow to be overridden in yaml if yaml_exists? load_yaml! start_yaml_listener end end
Public Instance Methods
environment()
click to toggle source
# File lib/frizz/configuration.rb, line 25 def environment environments[current_environment] || NullEnvironment.new end
environments=(environments_data)
click to toggle source
# File lib/frizz/configuration.rb, line 29 def environments=(environments_data) @environments = environments_data.each_with_object({}) do |(name, data), obj| obj[name] = Environment.new(name, data) end end
Private Instance Methods
load_yaml!()
click to toggle source
# File lib/frizz/configuration.rb, line 41 def load_yaml! YAML.load_file(YAML_FILENAME).each do |key, value| send "#{key}=", value end end
start_yaml_listener()
click to toggle source
# File lib/frizz/configuration.rb, line 47 def start_yaml_listener require "listen" Listen.to(Dir.pwd) do |modified, added, removed| load_yaml! if modified.include? File.expand_path(YAML_FILENAME) end.start end
yaml_exists?()
click to toggle source
# File lib/frizz/configuration.rb, line 37 def yaml_exists? File.exists?(YAML_FILENAME) end