Merge pull request #1 from timlinquist/master

Remove strict dependency on rubygems 1.8
This commit is contained in:
John Bintz 2012-07-31 10:49:27 -07:00
commit 4145ff4c89
3 changed files with 17 additions and 4 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 }

View File

@ -13,10 +13,9 @@ Gem::Specification.new do |gem|
gem.require_paths = ["lib"]
gem.version = '0.1.1'
gem.required_rubygems_version = '>= 1.8.0'
gem.add_dependency 'sprockets'
gem.add_development_dependency 'rake'
gem.add_development_dependency 'rspec'
gem.add_development_dependency 'mocha'
gem.add_development_dependency 'fakefs'