Sha256: 56c0367c75d634761d9de2566d3e086abbe737712cf3a9f97b474ca7a3be0423

Contents?: true

Size: 945 Bytes

Versions: 6

Compression:

Stored size: 945 Bytes

Contents

require 'active_support'

module Motr
  ##
  # Motr::Dash is basically a dashboard for an entire rails app. 
  # It does things like setting up app-wide configurations etc.
  # 
  module Dash
    
    ##
    # Defines an application-wide configuration hash created from config/config.yml
    # 
    def config
      return @motr_application_config unless @motr_application_config.nil?
      begin
        config_data = YAML::load(File.open("#{Rails.root}/config/config.yml")) 
      rescue
        warn("Motr::Dash: Application configuration not found, please create a config.yml at #{Rails.root}/config/config.yml")
        config_data = {}
      end
      @motr_application_config = ActiveSupport::HashWithIndifferentAccess::new(config_data[Rails.env] ||= {})
    end
    
    ##
    # Force reload of application configuration (without server restart)
    # 
    def reconfigure!
      @motr_application_config = nil
    end
    
  end
  
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
motr-0.1.1 lib/motr/dash.rb
motr-0.1.0 lib/motr/dash.rb
motr-0.0.9 lib/motr/dash.rb
motr-0.0.8 lib/motr/dash.rb
motr-0.0.7 lib/motr/dash.rb
motr-0.0.6 lib/motr/dash.rb