Module: Milkshake::RailsExtentions::Configuration
- Defined in:
- lib/milkshake/rails_extentions/configuration.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#default_gems_with_milkshake ⇒ Object
inject gem dependecies.
-
#default_i18n_with_milkshake ⇒ Object
inject locales from gem dependecies.
-
#default_load_paths_with_milkshake ⇒ Object
inject fallback application controller.
Class Method Details
.included(base) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/milkshake/rails_extentions/configuration.rb', line 6 def self.included(base) %w( default_gems default_i18n default_load_paths ).each do |meth| base.send :alias_method, "#{meth}_without_milkshake", meth base.send :alias_method, meth, "#{meth}_with_milkshake" end end |
Instance Method Details
#default_gems_with_milkshake ⇒ Object
inject gem dependecies
14 15 16 17 18 |
# File 'lib/milkshake/rails_extentions/configuration.rb', line 14 def default_gems_with_milkshake default_gems = default_gems_without_milkshake default_gems.concat(Milkshake.environment.gem_dependencies) default_gems end |
#default_i18n_with_milkshake ⇒ Object
inject locales from gem dependecies
21 22 23 24 25 26 |
# File 'lib/milkshake/rails_extentions/configuration.rb', line 21 def default_i18n_with_milkshake default_i18n = default_i18n_without_milkshake default_i18n.load_path.concat(Milkshake.environment.locale_paths) default_i18n.load_path.uniq! default_i18n end |
#default_load_paths_with_milkshake ⇒ Object
inject fallback application controller
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/milkshake/rails_extentions/configuration.rb', line 29 def default_load_paths_with_milkshake Milkshake.environment.gemspecs.each do |gemspec| app_path = File.join(gemspec.full_gem_path, 'app', 'controllers', 'application_controller.rb') if File.file?(app_path) return default_load_paths_without_milkshake end end path = File.(File.join(File.dirname(__FILE__), *%w( .. rails_fallbacks ))) default_load_paths_without_milkshake.push(path) end |