diff options
-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 |