diff --git a/bundler/lib/bundler/cli/outdated.rb b/bundler/lib/bundler/cli/outdated.rb index 109c5f417ffd..b8d9be20b6a6 100644 --- a/bundler/lib/bundler/cli/outdated.rb +++ b/bundler/lib/bundler/cli/outdated.rb @@ -76,8 +76,6 @@ def run next unless gems.empty? || gems.include?(current_spec.name) active_spec = retrieve_active_spec(definition, current_spec) - next unless active_spec - next unless filter_options_patch.empty? || update_present_via_semver_portions(current_spec, active_spec, options) gem_outdated = Gem::Version.new(active_spec.version) > Gem::Version.new(current_spec.version) @@ -146,8 +144,6 @@ def nothing_outdated_message end def retrieve_active_spec(definition, current_spec) - return unless current_spec.match_platform(Bundler.local_platform) - if strict active_spec = definition.find_resolved_spec(current_spec) else @@ -233,6 +229,8 @@ def check_for_deployment_mode! end def update_present_via_semver_portions(current_spec, active_spec, options) + return false if active_spec.nil? + current_major = current_spec.version.segments.first active_major = active_spec.version.segments.first diff --git a/bundler/lib/bundler/definition.rb b/bundler/lib/bundler/definition.rb index fc35f31be16c..9760887eeadd 100644 --- a/bundler/lib/bundler/definition.rb +++ b/bundler/lib/bundler/definition.rb @@ -123,7 +123,7 @@ def initialize(lockfile, dependencies, sources, unlock, ruby_version = nil, opti end @unlocking ||= @unlock[:ruby] ||= (!@locked_ruby_version ^ !@ruby_version) - add_platforms unless Bundler.frozen_bundle? + add_current_platform unless Bundler.frozen_bundle? converge_path_sources_to_gemspec_sources @path_changes = converge_paths @@ -554,10 +554,8 @@ def unlocking? private - def add_platforms - (@dependencies.flat_map(&:expanded_platforms) + current_platforms).uniq.each do |platform| - add_platform(platform) - end + def add_current_platform + current_platforms.each {|platform| add_platform(platform) } end def current_platforms diff --git a/bundler/spec/install/gemfile/platform_spec.rb b/bundler/spec/install/gemfile/platform_spec.rb index 456237372b41..729b6e0106fd 100644 --- a/bundler/spec/install/gemfile/platform_spec.rb +++ b/bundler/spec/install/gemfile/platform_spec.rb @@ -430,7 +430,7 @@ expect(out).not_to match(/Could not find gem 'some_gem/) end - it "resolves all platforms by default and without warning messages" do + it "does not print a warning when a dependency is unused on a platform different from the current one" do simulate_platform "ruby" gemfile <<-G @@ -447,14 +447,9 @@ GEM remote: #{file_uri_for(gem_repo1)}/ specs: - rack (1.0.0) PLATFORMS - java ruby - x64-mingw32 - x86-mingw32 - x86-mswin32 DEPENDENCIES rack