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

ruby-changes:62249

From: David <ko1@a...>
Date: Wed, 15 Jul 2020 16:06:06 +0900 (JST)
Subject: [ruby-changes:62249] 5783d0dbfc (master): Import remaining changes

https://git.ruby-lang.org/ruby.git/commit/?id=5783d0dbfc

From 5783d0dbfc517c7c9e1fc7d6c10134a36e50449e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <deivid.rodriguez@r...>
Date: Wed, 1 Jul 2020 20:22:40 +0200
Subject: Import remaining changes

The "sync with commits" scripts failed to properly import these for some
reason.

diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb
index 5470eb7..9256fa2 100644
--- a/lib/bundler/rubygems_integration.rb
+++ b/lib/bundler/rubygems_integration.rb
@@ -136,14 +136,10 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/rubygems_integration.rb#L136
     end
 
     def inflate(obj)
-      require "rubygems/util"
-
       Gem::Util.inflate(obj)
     end
 
     def correct_for_windows_path(path)
-      require "rubygems/util"
-
       if Gem::Util.respond_to?(:correct_for_windows_path)
         Gem::Util.correct_for_windows_path(path)
       elsif path[0].chr == "/" && path[1].chr =~ /[a-z]/i && path[2].chr == ":"
diff --git a/lib/bundler/shared_helpers.rb b/lib/bundler/shared_helpers.rb
index 6e83bc5..19fab78 100644
--- a/lib/bundler/shared_helpers.rb
+++ b/lib/bundler/shared_helpers.rb
@@ -194,7 +194,7 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/shared_helpers.rb#L194
       return @md5_available if defined?(@md5_available)
       @md5_available = begin
         require "openssl"
-        OpenSSL::Digest::MD5.digest("")
+        OpenSSL::Digest.digest("MD5", "")
         true
       rescue LoadError
         true
diff --git a/lib/bundler/vendor/thor/lib/thor.rb b/lib/bundler/vendor/thor/lib/thor.rb
index 01c0b2f..f2a0338 100644
--- a/lib/bundler/vendor/thor/lib/thor.rb
+++ b/lib/bundler/vendor/thor/lib/thor.rb
@@ -344,13 +344,6 @@ class Bundler::Thor https://github.com/ruby/ruby/blob/trunk/lib/bundler/vendor/thor/lib/thor.rb#L344
       command && disable_required_check.include?(command.name.to_sym)
     end
 
-    def deprecation_warning(message) #:nodoc:
-      unless ENV['THOR_SILENCE_DEPRECATION']
-        warn "Deprecation warning: #{message}\n" +
-          'You can silence deprecations warning by setting the environment variable THOR_SILENCE_DEPRECATION.'
-      end
-    end
-
   protected
 
     def stop_on_unknown_option #:nodoc:
diff --git a/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb b/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb
index 70504a2..fb76fcd 100644
--- a/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb
+++ b/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb
@@ -33,7 +33,8 @@ class Bundler::Thor https://github.com/ruby/ruby/blob/trunk/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb#L33
       # Boolean:: true if it is identical, false otherwise.
       #
       def identical?
-        exists? && File.identical?(render, destination)
+        source = File.expand_path(render, File.dirname(destination))
+        exists? && File.identical?(source, destination)
       end
 
       def invoke!
diff --git a/lib/bundler/vendor/thor/lib/thor/base.rb b/lib/bundler/vendor/thor/lib/thor/base.rb
index 9ba5243..8487f95 100644
--- a/lib/bundler/vendor/thor/lib/thor/base.rb
+++ b/lib/bundler/vendor/thor/lib/thor/base.rb
@@ -22,6 +22,15 @@ class Bundler::Thor https://github.com/ruby/ruby/blob/trunk/lib/bundler/vendor/thor/lib/thor/base.rb#L22
 
   TEMPLATE_EXTNAME = ".tt"
 
+  class << self
+    def deprecation_warning(message) #:nodoc:
+      unless ENV['THOR_SILENCE_DEPRECATION']
+        warn "Deprecation warning: #{message}\n" +
+          'You can silence deprecations warning by setting the environment variable THOR_SILENCE_DEPRECATION.'
+      end
+    end
+  end
+
   module Base
     attr_accessor :options, :parent_options, :args
 
diff --git a/lib/bundler/vendor/thor/lib/thor/version.rb b/lib/bundler/vendor/thor/lib/thor/version.rb
index 7750d27..1b222da 100644
--- a/lib/bundler/vendor/thor/lib/thor/version.rb
+++ b/lib/bundler/vendor/thor/lib/thor/version.rb
@@ -1,3 +1,3 @@ https://github.com/ruby/ruby/blob/trunk/lib/bundler/vendor/thor/lib/thor/version.rb#L1
 class Bundler::Thor
-  VERSION = "1.0.0"
+  VERSION = "1.0.1"
 end
diff --git a/spec/bundler/bundler/fetcher/compact_index_spec.rb b/spec/bundler/bundler/fetcher/compact_index_spec.rb
index b00eadc..00eb27e 100644
--- a/spec/bundler/bundler/fetcher/compact_index_spec.rb
+++ b/spec/bundler/bundler/fetcher/compact_index_spec.rb
@@ -65,7 +65,7 @@ RSpec.describe Bundler::Fetcher::CompactIndex do https://github.com/ruby/ruby/blob/trunk/spec/bundler/bundler/fetcher/compact_index_spec.rb#L65
 
         context "when FIPS-mode is active" do
           before do
-            allow(OpenSSL::Digest::MD5).to receive(:digest).
+            allow(OpenSSL::Digest).to receive(:digest).with("MD5", "").
               and_raise(OpenSSL::Digest::DigestError)
           end
 
diff --git a/spec/bundler/runtime/setup_spec.rb b/spec/bundler/runtime/setup_spec.rb
index 85f86db..22c07f0 100644
--- a/spec/bundler/runtime/setup_spec.rb
+++ b/spec/bundler/runtime/setup_spec.rb
@@ -602,7 +602,7 @@ RSpec.describe "Bundler.setup" do https://github.com/ruby/ruby/blob/trunk/spec/bundler/runtime/setup_spec.rb#L602
         end
       G
 
-      install_gems "activesupport-2.3.5"
+      system_gems "activesupport-2.3.5"
 
       expect(the_bundle).to include_gems "activesupport 2.3.2", :groups => :default
     end
@@ -618,7 +618,7 @@ RSpec.describe "Bundler.setup" do https://github.com/ruby/ruby/blob/trunk/spec/bundler/runtime/setup_spec.rb#L618
         end
       G
 
-      install_gems "activesupport-2.3.5"
+      system_gems "activesupport-2.3.5"
 
       expect(the_bundle).to include_gems "activesupport 2.3.2"
     end
@@ -765,7 +765,7 @@ end https://github.com/ruby/ruby/blob/trunk/spec/bundler/runtime/setup_spec.rb#L765
     full_gem_name = gem_name + "-1.0"
     ext_dir = File.join(tmp("extensions", full_gem_name))
 
-    install_gems full_gem_name
+    system_gems full_gem_name
 
     install_gemfile <<-G
       source "#{file_uri_for(gem_repo1)}"
diff --git a/spec/bundler/spec_helper.rb b/spec/bundler/spec_helper.rb
index 1985ae4..7ed5bda 100644
--- a/spec/bundler/spec_helper.rb
+++ b/spec/bundler/spec_helper.rb
@@ -99,14 +99,11 @@ RSpec.configure do |config| https://github.com/ruby/ruby/blob/trunk/spec/bundler/spec_helper.rb#L99
       FileUtils.cp_r pristine_system_gem_path, system_gem_path
 
       with_gem_path_as(system_gem_path) do
-        @command_executions = []
-
         Bundler.ui.silence { example.run }
 
-        all_output = @command_executions.map(&:to_s_verbose).join("\n\n")
+        all_output = all_commands_output
         if example.exception && !all_output.empty?
-          warn all_output unless config.formatters.grep(RSpec::Core::Formatters::DocumentationFormatter).empty?
-          message = example.exception.message + "\n\nCommands:\n#{all_output}"
+          message = example.exception.message + all_output
           (class << example.exception; self; end).send(:define_method, :message) do
             message
           end
diff --git a/spec/bundler/support/helpers.rb b/spec/bundler/support/helpers.rb
index 25747b9..b5648b8 100644
--- a/spec/bundler/support/helpers.rb
+++ b/spec/bundler/support/helpers.rb
@@ -27,8 +27,12 @@ module Spec https://github.com/ruby/ruby/blob/trunk/spec/bundler/support/helpers.rb#L27
       TheBundle.new(*args)
     end
 
+    def command_executions
+      @command_executions ||= []
+    end
+
     def last_command
-      @command_executions.last || raise("There is no last command")
+      command_executions.last || raise("There is no last command")
     end
 
     def out
@@ -189,18 +193,36 @@ module Spec https://github.com/ruby/ruby/blob/trunk/spec/bundler/support/helpers.rb#L193
         stderr_read_thread = Thread.new { stderr.read }
         command_execution.stdout = stdout_read_thread.value.strip
         command_execution.stderr = stderr_read_thread.value.strip
-        command_execution.exitstatus = wait_thr && wait_thr.value.exitstatus
-      end
 
-      (@command_executions ||= []) << command_execution
+        status = wait_thr.value
+        command_execution.exitstatus = if status.exited?
+          status.exitstatus
+        elsif status.signaled?
+          128 + status.termsig
+        end
+      end
 
       unless options[:raise_on_error] == false || command_execution.success?
-        raise "Invoking #{cmd} failed!"
+        raise <<~ERROR
+
+          Invoking `#{cmd}` failed with output:
+          ----------------------------------------------------------------------
+          #{command_execution.stdboth}
+          ----------------------------------------------------------------------
+        ERROR
       end
 
+      command_executions << command_execution
+
       command_execution.stdout
     end
 
+    def all_commands_output
+      return [] if command_executions.empty?
+
+      "\n\nCommands:\n#{command_executions.map(&:to_s_verbose).join("\n\n")}"
+    end
+
     def config(config = nil, path = bundled_app(".bundle/config"))
       return YAML.load_file(path) unless config
       FileUtils.mkdir_p(File.dirname(path))
@@ -264,18 +286,22 @@ module Spec https://github.com/ruby/ruby/blob/trunk/spec/bundler/support/helpers.rb#L286
       bundle :lock, opts
     end
 
-    def install_gems(*gems)
+    def system_gems(*gems)
+      gems = gems.flatten
       options = gems.last.is_a?(Hash) ? gems.pop : {}
-      gem_repo = options.fetch(:gem_repo) { gem_repo1 }
-      gems.each do |g|
-        gem_name = g.to_s
-        if gem_name.start_with?("bundler")
-          version = gem_name.match(/\Abundler-(?<version>.*)\z/)[:version] if gem_name != "bundler"
-          with_built_bundler(version) {|gem_path| install_gem(gem_path) }
-        elsif gem_name =~ %r{\A(?:[a-zA-Z]:)?/.*\.gem\z}
-          install_gem(gem_name)
-        else
-          install_gem("#{gem_repo}/gems/#{gem_name}.gem")
+      path = options.fetch(:path, system_gem_path)
+      with_gem_path_ (... truncated)

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

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