
module Milkshake
  class Loader
    
    attr_accessor :environment, :cache
    
    def initialize(environment, cache)
      @environment = environment
      @cache       = cache
    end
    
    def load_gem_initializers!
      initializers.each do |initializer|
        load(initializer)
      end
    end
    
  private
    
    def initializers
      @cache.key('loader.initializers') do
        relative_path = %w( rails initializers ** *.rb )
        paths = []
        self.environment.gemspecs.each do |gemspec|
          paths.concat Dir.glob(File.join(gemspec.full_gem_path, *relative_path))
        end
        paths.concat Dir.glob(File.join(Rails.root, *relative_path))
        paths
      end
    end
    
  end
end



module Milkshake
  class Loader
    
    attr_accessor :environment, :cache
    
    def initialize(environment, cache)
      @environment = environment
      @cache       = cache
    end
    
    def load_gem_initializers!
      initializers.each do |initializer|
        load(initializer)
      end
    end
    
  private
    
    def initializers
      @cache.key('loader.initializers') do
        relative_path = %w( rails initializers ** *.rb )
        paths = []
        self.environment.gemspecs.each do |gemspec|
          paths.concat Dir.glob(File.join(gemspec.full_gem_path, *relative_path))
        end
        paths.concat Dir.glob(File.join(Rails.root, 'rails/init.rb'))
        paths.concat Dir.glob(File.join(Rails.root, *relative_path))
        paths
      end
    end
    
  end
end


Load the local rail/init.rb file
Load the local rail/init.rb file
