diff options
author | The Bundler Bot <bot@bundler.io> | 2018-03-18 17:18:12 +0000 |
---|---|---|
committer | Colby Swandale <me@colby.fyi> | 2018-04-20 10:28:36 +1000 |
commit | 35b665c08df90b4ebdc821096159313ca0d91aa6 (patch) | |
tree | 816896f08ba70303602ccf1796804a8e54dfb542 | |
parent | 55dd64414c5c25d02d10383fa9874193845db0d5 (diff) | |
download | bundler-35b665c08df90b4ebdc821096159313ca0d91aa6.tar.gz |
Auto merge of #6444 - greysteil:handle-gem-specific-updates-non-local-platform, r=segiddins
Handle updating a specific gem for a non-local platform
Fixes https://github.com/bundler/bundler/issues/6350.
Kudos to @segiddins for the test.
(cherry picked from commit 91a3e3fd69bfb2fa5e5293dbe012c4ada0c7b49b)
-rw-r--r-- | lib/bundler/definition.rb | 4 | ||||
-rw-r--r-- | spec/commands/update_spec.rb | 41 |
2 files changed, 43 insertions, 2 deletions
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb index 4c4b90ef37..84c0682f61 100644 --- a/lib/bundler/definition.rb +++ b/lib/bundler/definition.rb @@ -121,8 +121,8 @@ module Bundler @source_changes = converge_sources unless @unlock[:lock_shared_dependencies] - eager_unlock = expand_dependencies(@unlock[:gems]) - @unlock[:gems] = @locked_specs.for(eager_unlock).map(&:name) + eager_unlock = expand_dependencies(@unlock[:gems], true) + @unlock[:gems] = @locked_specs.for(eager_unlock, [], false, false, false).map(&:name) end @gem_version_promoter = create_gem_version_promoter diff --git a/spec/commands/update_spec.rb b/spec/commands/update_spec.rb index 33679dd649..6b18d0c8c1 100644 --- a/spec/commands/update_spec.rb +++ b/spec/commands/update_spec.rb @@ -424,6 +424,47 @@ RSpec.describe "bundle update in more complicated situations" do bundle "update" expect(the_bundle).to include_gems "thin 1.0" end + + context "when the lockfile is for a different platform" do + before do + build_repo4 do + build_gem("a", "0.9") + build_gem("a", "0.9") {|s| s.platform = "java" } + build_gem("a", "1.1") + build_gem("a", "1.1") {|s| s.platform = "java" } + end + + gemfile <<-G + source "file://#{gem_repo4}" + gem "a" + G + + lockfile <<-L + GEM + remote: file://#{gem_repo4} + specs: + a (0.9-java) + + PLATFORMS + java + + DEPENDENCIES + a + L + + simulate_platform linux + end + + it "allows updating" do + bundle! :update, :all => true + expect(the_bundle).to include_gem "a 1.1" + end + + it "allows updating a specific gem" do + bundle! "update a" + expect(the_bundle).to include_gem "a 1.1" + end + end end RSpec.describe "bundle update without a Gemfile.lock" do |