diff options
author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2019-04-28 15:00:39 +0200 |
---|---|---|
committer | David RodrÃguez <deivid.rodriguez@riseup.net> | 2019-04-28 15:00:39 +0200 |
commit | f143b3744afd2293d340ea8c90601d3dc48e0b54 (patch) | |
tree | 26121556601b85658d5050fc92eaa6a73b0d454b | |
parent | d190f337c2f410ee7e3deedd5052aa0351afa19f (diff) | |
download | bundler-fix_bundle_update_crash.tar.gz |
Properly detect the platform mismatch casefix_bundle_update_crash
And show a proper warning. The other case already shows a message
somewhere else ("Gems for group <bla> were not updated/installed"), so I
just skip any warning in that case.
-rw-r--r-- | lib/bundler/cli/update.rb | 11 | ||||
-rw-r--r-- | spec/commands/update_spec.rb | 1 |
2 files changed, 10 insertions, 2 deletions
diff --git a/lib/bundler/cli/update.rb b/lib/bundler/cli/update.rb index bd2093f125..ae5b8444d7 100644 --- a/lib/bundler/cli/update.rb +++ b/lib/bundler/cli/update.rb @@ -61,7 +61,7 @@ module Bundler if locked_gems = Bundler.definition.locked_gems previous_locked_info = locked_gems.specs.reduce({}) do |h, s| - h[s.name] = { :version => s.version, :source => s.source.to_s } + h[s.name] = { :spec => s, :version => s.version, :source => s.source.to_s } h end end @@ -79,8 +79,15 @@ module Bundler locked_info = previous_locked_info[name] next unless locked_info + locked_spec = locked_info[:spec] new_spec = Bundler.definition.specs[name].first - next unless new_spec + unless new_spec + if Bundler.rubygems.platforms.none? {|p| locked_spec.match_platform(p) } + Bundler.ui.warn "Bundler attempted to update #{name} but it was not considered because it is for a different platform from the current one" + end + + next + end locked_source = locked_info[:source] new_source = new_spec.source.to_s diff --git a/spec/commands/update_spec.rb b/spec/commands/update_spec.rb index bf5cd32ca1..61a5a1d1f1 100644 --- a/spec/commands/update_spec.rb +++ b/spec/commands/update_spec.rb @@ -594,6 +594,7 @@ RSpec.describe "bundle update in more complicated situations" do it "is not updated because it is not actually included in the bundle" do bundle! "update a" + expect(last_command.stdboth).to include "Bundler attempted to update a but it was not considered because it is for a different platform from the current one" expect(the_bundle).to_not include_gem "a" end end |