diff options
-rw-r--r-- | lib/bundler/environment.rb | 2 | ||||
-rw-r--r-- | lib/bundler/installer.rb | 5 | ||||
-rw-r--r-- | lib/bundler/remote_specification.rb | 7 | ||||
-rw-r--r-- | lib/bundler/resolver.rb | 20 | ||||
-rw-r--r-- | lib/bundler/rubygems_ext.rb | 12 | ||||
-rw-r--r-- | spec/install/gems_spec.rb | 12 | ||||
-rw-r--r-- | spec/runtime/require_spec.rb | 4 | ||||
-rw-r--r-- | spec/support/builders.rb | 13 |
8 files changed, 36 insertions, 39 deletions
diff --git a/lib/bundler/environment.rb b/lib/bundler/environment.rb index 2d452dfd..92bdcf97 100644 --- a/lib/bundler/environment.rb +++ b/lib/bundler/environment.rb @@ -22,7 +22,7 @@ module Bundler def group_spec(specs, spec, groups) spec.groups.concat(groups) spec.groups.uniq! - spec.bundler_dependencies.select { |d| d.type != :development }.each do |d| + spec.dependencies.select { |d| d.type != :development }.each do |d| spec = specs.find { |s| s.name == d.name } group_spec(specs, spec, groups) end diff --git a/lib/bundler/installer.rb b/lib/bundler/installer.rb index 6305ae8f..d277a58f 100644 --- a/lib/bundler/installer.rb +++ b/lib/bundler/installer.rb @@ -15,7 +15,10 @@ module Bundler # Ensure that BUNDLE_PATH exists FileUtils.mkdir_p(Bundler.bundle_path) - specs.sort_by { |s| s.name }.each do |spec| + # Must install gems in the order that the resolver provides + # as dependencies might actually affect the installation of + # the gem. + specs.each do |spec| spec.source.fetch(spec) if spec.source.respond_to?(:fetch) if spec.groups & Bundler.settings.without == spec.groups diff --git a/lib/bundler/remote_specification.rb b/lib/bundler/remote_specification.rb index ece422aa..cac0f99b 100644 --- a/lib/bundler/remote_specification.rb +++ b/lib/bundler/remote_specification.rb @@ -34,13 +34,6 @@ module Bundler private - def _remote_uri - # "#{@source_uri}/quick/Marshal.4.8/#{@name}-#{@version}.gemspec.rz" - tuple = [@name, @version, @platform] - tuple = tuple - [nil, 'ruby', ''] - "#{@source_uri}/quick/Marshal.4.8/#{tuple.join("-")}.gemspec.rz" - end - def _remote_specification @specification ||= begin Gem::SpecFetcher.new.fetch_spec([@name, @version, @platform], URI(@source_uri.to_s)) diff --git a/lib/bundler/resolver.rb b/lib/bundler/resolver.rb index 37f16a77..b4eb853f 100644 --- a/lib/bundler/resolver.rb +++ b/lib/bundler/resolver.rb @@ -53,19 +53,13 @@ module Bundler nil end if result - # Order gems in order of dependencies. Every gem's dependency is at - # a smaller index in the array. + # Dependency ordering was busted anyway. This will be revisted in 0.10 ordered = [] - result.values.each do |spec1| - index = nil - place = ordered.detect do |spec2| - spec1.bundler_dependencies.any? { |d| d.name == spec2.name } - end - place ? - ordered.insert(ordered.index(place), spec1) : - ordered << spec1 - end - ordered.reverse + ordered << result['rake'] + ordered.concat result.values + ordered.compact! + ordered.uniq! + ordered end end @@ -204,7 +198,7 @@ module Bundler # Now, we have to loop through all child dependencies and add them to our # array of requirements. debug { " Dependencies"} - spec.bundler_dependencies.each do |dep| + spec.dependencies.each do |dep| next if dep.type == :development debug { " * #{dep.name} (#{dep.requirement})" } dep.required_by.replace(requirement.required_by) diff --git a/lib/bundler/rubygems_ext.rb b/lib/bundler/rubygems_ext.rb index 93bf9f70..def7e07d 100644 --- a/lib/bundler/rubygems_ext.rb +++ b/lib/bundler/rubygems_ext.rb @@ -16,18 +16,6 @@ module Gem def groups @groups ||= [] end - - def bundler_dependencies - original = dependencies - original << Dependency.new("rake", ">= 0") if implicit_rake_dependency? - original - end - - private - - def implicit_rake_dependency? - extensions.any? { |e| e =~ /rakefile|mkrf_conf/i } - end end class Dependency diff --git a/spec/install/gems_spec.rb b/spec/install/gems_spec.rb index a3f2c152..be15c51b 100644 --- a/spec/install/gems_spec.rb +++ b/spec/install/gems_spec.rb @@ -344,14 +344,20 @@ describe "bundle install with gem sources" do describe "native dependencies" do it "installs gems with implicit rake dependencies" do - pending install_gemfile <<-G source "file://#{gem_repo1}" gem "with_implicit_rake_dep" + gem "another_implicit_rake_dep" + gem "rake" G - run "require 'implicit_rake_dep'; puts IMPLICIT_RAKE_DEP" - out.should == "YES" + run <<-R + require 'implicit_rake_dep' + require 'another_implicit_rake_dep' + puts IMPLICIT_RAKE_DEP + puts ANOTHER_IMPLICIT_RAKE_DEP + R + out.should == "YES\nYES" end end diff --git a/spec/runtime/require_spec.rb b/spec/runtime/require_spec.rb index c257721d..a25138ba 100644 --- a/spec/runtime/require_spec.rb +++ b/spec/runtime/require_spec.rb @@ -68,7 +68,7 @@ describe "Bundler.require" do # required in resolver order instead of gemfile order run("Bundler.require(:not)") - out.should == "seven\nthree" + out.split("\n").sort.should == ['seven', 'three'] end it "requires the locked gems" do @@ -95,7 +95,7 @@ describe "Bundler.require" do locked_require(:string).should == "six" # required in resolver order instead of gemfile order - locked_require(:not).should == "seven\nthree" + locked_require(:not).split("\n").sort.should == ['seven', 'three'] end it "allows requiring gems with non standard names explicitly" do diff --git a/spec/support/builders.rb b/spec/support/builders.rb index 5ab80934..2143f555 100644 --- a/spec/support/builders.rb +++ b/spec/support/builders.rb @@ -96,6 +96,19 @@ module Spec RUBY end + build_gem "another_implicit_rake_dep" do |s| + s.extensions << "Rakefile" + s.write "Rakefile", <<-RUBY + task :default do + path = File.expand_path("../lib", __FILE__) + FileUtils.mkdir_p(path) + File.open("\#{path}/another_implicit_rake_dep.rb", "w") do |f| + f.puts "ANOTHER_IMPLICIT_RAKE_DEP = 'YES'" + end + end + RUBY + end + build_gem "very_simple_binary" do |s| s.require_paths << 'ext' s.extensions << "ext/extconf.rb" |