Module: Typus::Configuration
- Defined in:
- lib/typus/configuration.rb
Constant Summary collapse
- @@options =
.merge()
Class Method Summary collapse
-
.config! ⇒ Object
Read Typus Configuration files placed on
config/typus/*/.yml. -
.roles! ⇒ Object
Read Typus Roles from configuration files placed on
config/typus/*/_roles.yml.
Class Method Details
.config! ⇒ Object
Read Typus Configuration files placed on config/typus/*/.yml.
Typus::Configuration.config! overwrites @@config
62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/typus/configuration.rb', line 62 def self.config! files = Dir["#{Rails.root}/#{options[:config_folder]}/**/*.yml"].sort files = files.delete_if { |x| x.include?('_roles.yml') } @@config = {} files.each do |file| data = YAML.load_file(file) @@config = @@config.merge(data) if data end return @@config end |
.roles! ⇒ Object
Read Typus Roles from configuration files placed on config/typus/*/_roles.yml.
Typus::Configuration.roles! overwrites @@roles
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/typus/configuration.rb', line 84 def self.roles! files = Dir["#{Rails.root}/#{options[:config_folder]}/**/*_roles.yml"].sort @@roles = { [:root] => {} } files.each do |file| data = YAML.load_file(file) next unless data data.each do |key, value| next unless value begin @@roles[key] = @@roles[key].merge(value) rescue @@roles[key] = value end end end return @@roles.compact end |