[前][次][番号順一覧][スレッド一覧]

ruby-changes:64020

From: Hiroshi <ko1@a...>
Date: Tue, 8 Dec 2020 17:30:22 +0900 (JST)
Subject: [ruby-changes:64020] 473f9d2df0 (master): Merge prepare version of Bundler 2.2.0

https://git.ruby-lang.org/ruby.git/commit/?id=473f9d2df0

From 473f9d2df0ddd7fdb5cc73fa3ad49b2f19f22b06 Mon Sep 17 00:00:00 2001
From: Hiroshi SHIBATA <hsbt@r...>
Date: Tue, 8 Dec 2020 16:36:29 +0900
Subject: Merge prepare version of Bundler 2.2.0


diff --git a/lib/bundler.rb b/lib/bundler.rb
index f6ad7cc..0ddd2c7 100644
--- a/lib/bundler.rb
+++ b/lib/bundler.rb
@@ -602,6 +602,10 @@ EOF https://github.com/ruby/ruby/blob/trunk/lib/bundler.rb#L602
       reset_rubygems!
     end
 
+    def reset_settings!
+      @settings = nil
+    end
+
     def reset_paths!
       @bin_path = nil
       @bundler_major_version = nil
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb
index b419662..e2dceb9 100644
--- a/lib/bundler/cli.rb
+++ b/lib/bundler/cli.rb
@@ -57,7 +57,7 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/cli.rb#L57
       custom_gemfile = options[:gemfile] || Bundler.settings[:gemfile]
       if custom_gemfile && !custom_gemfile.empty?
         Bundler::SharedHelpers.set_env "BUNDLE_GEMFILE", File.expand_path(custom_gemfile)
-        Bundler.reset_paths!
+        Bundler.reset_settings!
       end
 
       Bundler.settings.set_command_option_if_given :retry, options[:retry]
@@ -134,7 +134,8 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/cli.rb#L134
         if Bundler.which("man") && man_path !~ %r{^file:/.+!/META-INF/jruby.home/.+}
           Kernel.exec "man #{man_page}"
         else
-          puts File.read("#{File.dirname(man_page)}/#{File.basename(man_page)}.ronn")
+          fallback_man_path = File.expand_path("../man", __FILE__)
+          puts File.read("#{fallback_man_path}/#{File.basename(man_page)}.ronn")
         end
       elsif command_path = Bundler.which("bundler-#{cli}")
         Kernel.exec(command_path, "--help")
@@ -380,6 +381,8 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/cli.rb#L381
       "Make binstubs that can work without the Bundler runtime"
     method_option "all", :type => :boolean, :banner =>
       "Install binstubs for all gems"
+    method_option "all-platforms", :type => :boolean, :default => false, :banner =>
+      "Install binstubs for all platforms"
     def binstubs(*gems)
       require_relative "cli/binstubs"
       Binstubs.new(options, gems).run
diff --git a/lib/bundler/cli/binstubs.rb b/lib/bundler/cli/binstubs.rb
index 266396e..639c01f 100644
--- a/lib/bundler/cli/binstubs.rb
+++ b/lib/bundler/cli/binstubs.rb
@@ -16,7 +16,11 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/cli/binstubs.rb#L16
       Bundler.settings.set_command_option_if_given :shebang, options["shebang"]
       installer = Installer.new(Bundler.root, Bundler.definition)
 
-      installer_opts = { :force => options[:force], :binstubs_cmd => true }
+      installer_opts = {
+        :force => options[:force],
+        :binstubs_cmd => true,
+        :all_platforms => options["all-platforms"],
+      }
 
       if options[:all]
         raise InvalidOption, "Cannot specify --all with specific gems" unless gems.empty?
@@ -38,7 +42,7 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/cli/binstubs.rb#L42
         if options[:standalone]
           next Bundler.ui.warn("Sorry, Bundler can only be run via RubyGems.") if gem_name == "bundler"
           Bundler.settings.temporary(:path => (Bundler.settings[:path] || Bundler.root)) do
-            installer.generate_standalone_bundler_executable_stubs(spec)
+            installer.generate_standalone_bundler_executable_stubs(spec, installer_opts)
           end
         else
           installer.generate_bundler_executable_stubs(spec, installer_opts)
diff --git a/lib/bundler/cli/exec.rb b/lib/bundler/cli/exec.rb
index 0412d3a..318d57f 100644
--- a/lib/bundler/cli/exec.rb
+++ b/lib/bundler/cli/exec.rb
@@ -63,10 +63,10 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/cli/exec.rb#L63
       Kernel.load(file)
     rescue SystemExit, SignalException
       raise
-    rescue Exception => e # rubocop:disable Lint/RescueException
+    rescue Exception # rubocop:disable Lint/RescueException
       Bundler.ui.error "bundler: failed to load command: #{cmd} (#{file})"
-      backtrace = e.backtrace ? e.backtrace.take_while {|bt| !bt.start_with?(__FILE__) } : []
-      abort "#{e.class}: #{e.message}\n  #{backtrace.join("\n  ")}"
+      Bundler::FriendlyErrors.disable!
+      raise
     end
 
     def process_title(file, args)
diff --git a/lib/bundler/cli/outdated.rb b/lib/bundler/cli/outdated.rb
index 109c5f4..b8d9be2 100644
--- a/lib/bundler/cli/outdated.rb
+++ b/lib/bundler/cli/outdated.rb
@@ -76,8 +76,6 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/cli/outdated.rb#L76
         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 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/cli/outdated.rb#L144
     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 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/cli/outdated.rb#L229
     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/lib/bundler/compact_index_client/updater.rb b/lib/bundler/compact_index_client/updater.rb
index 4023201..66d1735 100644
--- a/lib/bundler/compact_index_client/updater.rb
+++ b/lib/bundler/compact_index_client/updater.rb
@@ -22,13 +22,13 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/compact_index_client/updater.rb#L22
 
       def initialize(fetcher)
         @fetcher = fetcher
-        require "tmpdir"
+        require_relative "../vendored_tmpdir"
       end
 
       def update(local_path, remote_path, retrying = nil)
         headers = {}
 
-        Dir.mktmpdir("bundler-compact-index-") do |local_temp_dir|
+        Bundler::Dir.mktmpdir("bundler-compact-index-") do |local_temp_dir|
           local_temp_path = Pathname.new(local_temp_dir).join(local_path.basename)
 
           # first try to fetch any new bytes on the existing file
@@ -66,8 +66,8 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/compact_index_client/updater.rb#L66
             end
           end
 
-          response_etag = (response["ETag"] || "").gsub(%r{\AW/}, "")
-          if etag_for(local_temp_path) == response_etag
+          etag = (response["ETag"] || "").gsub(%r{\AW/}, "")
+          if etag.length.zero? || etag_for(local_temp_path) == etag
             SharedHelpers.filesystem_access(local_path) do
               FileUtils.mv(local_temp_path, local_path)
             end
@@ -75,7 +75,7 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/compact_index_client/updater.rb#L75
           end
 
           if retrying
-            raise MisMatchedChecksumError.new(remote_path, response_etag, etag_for(local_temp_path))
+            raise MisMatchedChecksumError.new(remote_path, etag, etag_for(local_temp_path))
           end
 
           update(local_path, remote_path, :retrying)
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb
index 1a4b703..4cf4f76 100644
--- a/lib/bundler/definition.rb
+++ b/lib/bundler/definition.rb
@@ -118,7 +118,7 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/definition.rb#L118
       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
@@ -547,17 +547,12 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/definition.rb#L547
 
     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
-      [].tap do |platforms|
-        platforms << local_platform if Bundler.feature_flag.specific_platform?
-        platforms << generic_local_platform
-      end
+      [local_platform, generic_local_platform].uniq
     end
 
     def change_reason
diff --git a/lib/bundler/env.rb b/lib/bundler/env.rb
index 17624b4..00d4ef2 100644
--- a/lib/bundler/env.rb
+++ b/lib/bundler/env.rb
@@ -105,7 +105,7 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/env.rb#L105
       out << ["  User Home", Gem.user_home]
       out << ["  User Path", Gem.user_dir]
       out << ["  Bin Dir", Gem.bindir]
-      if defined?(OpenSSL)
+      if defined?(OpenSSL::SSL)
         out << ["OpenSSL"]
         out << ["  Compiled", OpenSSL::OPENSSL_VERSION] if defined?(OpenSSL::OPENSSL_VERSION)
         out << ["  Loaded", OpenSSL::OPENSSL_LIBRARY_VERSION] if defined?(OpenSSL::OPENSSL_LIBRARY_VERSION)
diff --git a/lib/bundler/feature_flag.rb b/lib/bundler/feature_flag.rb
index fd76d9e..a92ec87 100644
--- a/lib/bundler/feature_flag.rb
+++ b/lib/bundler/feature_flag.rb
@@ -41,7 +41,6 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/feature_flag.rb#L41
     settings_flag(:plugins) { @bundler_version >= Gem::Version.new("1.14") }
     settings_flag(:print_only_version_number) { bundler_3_mode? }
     settin (... truncated)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]