module ConfConf
Constants
- VERSION
Public Class Methods
configuration(environment_name=nil, &block)
click to toggle source
TODO: This could be cleaned up considerably.
# File lib/conf_conf.rb, line 29 def configuration(environment_name=nil, &block) if environment_name # Load ENV project = ConfConf::Project.new environment = project.environments[environment_name] environment.variables.each do |name, value| ENV[name] = value end end # Run configuration block, if given configuration = ConfConf::Configuration.new if block configuration.run(block) references = configuration.references else references = {} end if environment_name # Find references to variables that aren't defaulted here inconsistencies = project.inconsistencies(environment) inconsistencies.each do |inconsistency| if references[inconsistency] && references[inconsistency].default_value? inconsistencies.delete(inconsistency) end end if inconsistencies.length > 0 raise ConfConf::InconsistentConfigurationError.new(inconsistencies) end end OpenStruct.new(configuration.parsed_values) end
load(environment_name)
click to toggle source
# File lib/conf_conf.rb, line 76 def load(environment_name) configuration(environment_name) end
rails_configuration(environment_name=nil, &block)
click to toggle source
# File lib/conf_conf.rb, line 68 def rails_configuration(environment_name=nil, &block) configuration = configuration(environment_name, block) configuration.parsed_values.each do |name, value| Rails.configuration.send("#{key}=", value) end end