lib/milkshake/rails_extentions/configuration.rb in milkshake-0.1.6 vs lib/milkshake/rails_extentions/configuration.rb in milkshake-0.1.7

- old
+ new

@@ -2,13 +2,13 @@ module Milkshake module RailsExtentions module Configuration def self.included(base) - %w( default_gems default_i18n default_load_paths ).each do |m| - base.send :alias_method, "#{m}_without_milkshake", m - base.send :alias_method, m, "#{m}_with_milkshake" + %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 # inject gem dependecies def default_gems_with_milkshake @@ -25,9 +25,16 @@ default_i18n end # inject fallback application controller 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.expand_path(File.join(File.dirname(__FILE__), *%w( .. rails_fallbacks ))) default_load_paths_without_milkshake.push(path) end end