Sha256: 87b8250df02a8bb03b0458ac42dabe07eeb8809c088352b2d93afc3bad127f19
Contents?: true
Size: 1.36 KB
Versions: 4
Compression:
Stored size: 1.36 KB
Contents
module Typus module Configuration # Read configuration from <tt>config/typus/**/*.yml</tt>. def self.config! application = Dir[File.join(Typus.config_folder, "**", "*.yml").to_s] plugins = Dir[File.join("vendor", "plugins", "*", "config", "typus", "*.yml").to_s] files = (application + plugins).reject { |f| f.include?("_roles.yml") } @@config = {} files.each do |file| if data = YAML::load_file(file) @@config.merge!(data) end end @@config end mattr_accessor :config # Read roles from files <tt>config/typus/**/*_roles.yml</tt>. def self.roles! application = Dir[File.join(Typus.config_folder, "**", "*_roles.yml").to_s] plugins = Dir[File.join("vendor", "plugins", "*", "config", "typus", "*_roles.yml").to_s] files = (application + plugins).sort @@roles = {} files.each do |file| if data = YAML::load_file(file) data.compact.each do |key, value| @@roles[key] ? @@roles[key].merge!(value) : (@@roles[key] = value) end end end @@roles end mattr_accessor :roles def self.models_constantized! @@models_constantized = config.map { |i| i.first }.inject({}) { |result, model| result[model] = model.constantize; result } end mattr_accessor :models_constantized end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
typus-3.0.7 | lib/typus/configuration.rb |
typus-3.0.6 | lib/typus/configuration.rb |
typus-3.0.5 | lib/typus/configuration.rb |
typus-3.0.4 | lib/typus/configuration.rb |