Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Commit

Permalink
Auto merge of #6444 - greysteil:handle-gem-specific-updates-non-local…
Browse files Browse the repository at this point in the history
…-platform, r=segiddins

Handle updating a specific gem for a non-local platform

Fixes #6350.

Kudos to @segiddins for the test.
  • Loading branch information
bundlerbot committed Mar 18, 2018
2 parents ff6b871 + 25be4c9 commit 91a3e3f
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/bundler/definition.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ def initialize(lockfile, dependencies, sources, unlock, ruby_version = nil, opti
@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
Expand Down
41 changes: 41 additions & 0 deletions spec/commands/update_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,47 @@
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
Expand Down

0 comments on commit 91a3e3f

Please sign in to comment.