diff options
author | Grey Baker <greysteil@gmail.com> | 2018-03-18 12:06:34 +0000 |
---|---|---|
committer | Grey Baker <greysteil@gmail.com> | 2018-03-18 12:06:34 +0000 |
commit | 25be4c9f5e1d61e782f4599cece08ba1bc8c7bac (patch) | |
tree | fc2e14822219cceaafc6b1e628aa2cd52d9104f4 | |
parent | ff6b8712a0337305ba9617e35545b9e8f8cd4a53 (diff) | |
download | bundler-25be4c9f5e1d61e782f4599cece08ba1bc8c7bac.tar.gz |
Handle updating a specific gem for a non-local platform
-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 a50806ba4b..91d34ad150 100644 --- a/lib/bundler/definition.rb +++ b/lib/bundler/definition.rb @@ -120,8 +120,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 @dependency_changes = converge_dependencies diff --git a/spec/commands/update_spec.rb b/spec/commands/update_spec.rb index 799aac1f54..af09c145c1 100644 --- a/spec/commands/update_spec.rb +++ b/spec/commands/update_spec.rb @@ -437,6 +437,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 |