Use backwards compatible rubygems api

Following Bundler's lead, use loaded_specs api to look for possible
javascript / stylesheets to inform Sprockets of in
jasmine-headless-webkit.
This commit is contained in:
Tim Linquist 2012-07-31 10:00:42 -07:00
parent fe6031aa67
commit 8bb51f0227
2 changed files with 16 additions and 2 deletions

View File

@ -9,7 +9,7 @@ module ::Sprockets
paths = []
Gem::Specification.each do |gemspec|
GemEnvironment.each do |gemspec|
options[:paths].product(for_types).each do |base_dir, type|
path = File.join(gemspec.gem_dir, base_dir, "assets", type.to_s)
@ -27,5 +27,19 @@ module ::Sprockets
Sprockets.find_gem_vendor_paths.each { |path| append_path(path) }
end
end
class GemEnvironment
extend Enumerable
def self.gemspecs
Gem.loaded_specs.map(&:last)
end
def self.each(&block)
return enum_for(:each) unless block_given?
gemspecs.each {|spec| yield spec }
end
end
end

View File

@ -17,7 +17,7 @@ describe Sprockets do
before do
paths.each { |path| FileUtils.mkdir_p path }
Gem::Specification.stubs(:each).yields(gemspec)
Sprockets::GemEnvironment.stubs(:each).yields(gemspec)
end
subject { described_class.find_gem_vendor_paths }