Module: CdnBacon
- Defined in:
- lib/cdn_bacon.rb,
lib/cdn_bacon/railtie.rb,
lib/cdn_bacon/version.rb,
lib/cdn_bacon/action_view_extensions.rb
Defined Under Namespace
Modules: ActionViewExtensions Classes: MissingConfiguration, Railtie
Constant Summary collapse
- APP_ROOT =
File.((defined?(Rails) && !Rails.root.blank?) ? Rails.root : ENV['RAILS_ROOT'] || ".")
- DEFAULT_CONFIG_PATH =
File.join(APP_ROOT, 'config', 'cdn_assets.yml')
- VERSION =
"0.0.1"
Class Attribute Summary collapse
-
.configuration ⇒ Object
readonly
Returns the value of attribute configuration.
-
.only_fallbacks_in_dev ⇒ Object
readonly
Returns the value of attribute only_fallbacks_in_dev.
-
.rails_env ⇒ Object
readonly
Returns the value of attribute rails_env.
Class Method Summary collapse
-
.load_configuration(config_path) ⇒ Object
Load the configuration from the specified @config_path@.
Class Attribute Details
.configuration ⇒ Object (readonly)
Returns the value of attribute configuration.
12 13 14 |
# File 'lib/cdn_bacon.rb', line 12 def configuration @configuration end |
.only_fallbacks_in_dev ⇒ Object (readonly)
Returns the value of attribute only_fallbacks_in_dev.
12 13 14 |
# File 'lib/cdn_bacon.rb', line 12 def only_fallbacks_in_dev @only_fallbacks_in_dev end |
.rails_env ⇒ Object (readonly)
Returns the value of attribute rails_env.
12 13 14 |
# File 'lib/cdn_bacon.rb', line 12 def rails_env @rails_env end |
Class Method Details
.load_configuration(config_path) ⇒ Object
Load the configuration from the specified @config_path@
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/cdn_bacon.rb', line 18 def self.load_configuration(config_path) exists = config_path && File.exists?(config_path) raise MissingConfiguration, "could not find the \"#{config_path}\" configuration file" unless exists conf = YAML.load(ERB.new(File.read(config_path)).result) @rails_env = (defined?(Rails) ? ::Rails.env : ENV['RAILS_ENV'] || "development") @configuration = symbolize_keys(conf) @only_fallbacks_in_dev = conf[:only_fallbacks_in_dev] || false symbolize_keys(conf[:javascripts]) if conf[:javascripts] symbolize_keys(conf[:stylesheets]) if conf[:stylehseets] self end |