From 2e9846e62eaa7942a43965f363891e71c759b12a Mon Sep 17 00:00:00 2001 From: Samuel Giddins Date: Sat, 21 Jan 2017 16:30:39 -0600 Subject: [Definition] Switch path sources after checking them for changes --- lib/bundler/definition.rb | 11 +++++++---- spec/install/deploy_spec.rb | 13 ++++++------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb index 0031d0748e..15383a22c5 100644 --- a/lib/bundler/definition.rb +++ b/lib/bundler/definition.rb @@ -104,8 +104,9 @@ module Bundler add_current_platform unless Bundler.settings[:frozen] - @source_changes = converge_sources + converge_gemspec_sources @path_changes = converge_paths + @source_changes = converge_sources unless @unlock[:lock_shared_dependencies] eager_unlock = expand_dependencies(@unlock[:gems]) @@ -627,9 +628,7 @@ module Bundler gemspec_source || source end - def converge_sources - changes = false - + def converge_gemspec_sources @locked_sources.map! do |source| converge_path_source_to_gemspec_source(source) end @@ -639,6 +638,10 @@ module Bundler @locked_deps.each do |dep| dep.source &&= converge_path_source_to_gemspec_source(dep.source) end + end + + def converge_sources + changes = false # Get the Rubygems sources from the Gemfile.lock locked_gem_sources = @locked_sources.select {|s| s.is_a?(Source::Rubygems) } diff --git a/spec/install/deploy_spec.rb b/spec/install/deploy_spec.rb index 1d97ceb401..1e54204e70 100644 --- a/spec/install/deploy_spec.rb +++ b/spec/install/deploy_spec.rb @@ -267,22 +267,21 @@ RSpec.describe "install with --deployment or --frozen" do context "with path in Gemfile and packed" do it "works fine after bundle package and bundle install --local" do build_lib "foo", :path => lib_path("foo") - install_gemfile <<-G - gem "foo", :path => "#{lib_path("foo")}" + install_gemfile! <<-G + gem "foo", :path => "#{lib_path("foo")}" G - bundle :install + bundle! :install expect(the_bundle).to include_gems "foo 1.0" - bundle "package --all" + bundle! "package --all" expect(bundled_app("vendor/cache/foo")).to be_directory - bundle "install --local" + bundle! "install --local" expect(out).to include("Using foo 1.0 from source at") expect(out).to include("vendor/cache/foo") - expect(exitstatus).to eq(0) if exitstatus simulate_new_machine - bundle "install --deployment" + bundle! "install --deployment --verbose" expect(out).not_to include("You are trying to install in deployment mode after changing your Gemfile") expect(out).not_to include("You have added to the Gemfile") expect(out).not_to include("You have deleted from the Gemfile") -- cgit v1.2.1