diff options
author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2020-07-01 20:22:40 +0200 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2020-07-15 16:05:12 +0900 |
commit | 5783d0dbfc517c7c9e1fc7d6c10134a36e50449e (patch) | |
tree | 43ca9561df58cfd0b690c0084058da287f420bd3 | |
parent | 0c8d90b5269829d9209a409163832998d5d77af4 (diff) | |
download | ruby-5783d0dbfc517c7c9e1fc7d6c10134a36e50449e.tar.gz |
Import remaining changes
The "sync with commits" scripts failed to properly import these for some
reason.
-rw-r--r-- | lib/bundler/rubygems_integration.rb | 4 | ||||
-rw-r--r-- | lib/bundler/shared_helpers.rb | 2 | ||||
-rw-r--r-- | lib/bundler/vendor/thor/lib/thor.rb | 7 | ||||
-rw-r--r-- | lib/bundler/vendor/thor/lib/thor/actions/create_link.rb | 3 | ||||
-rw-r--r-- | lib/bundler/vendor/thor/lib/thor/base.rb | 9 | ||||
-rw-r--r-- | lib/bundler/vendor/thor/lib/thor/version.rb | 2 | ||||
-rw-r--r-- | spec/bundler/bundler/fetcher/compact_index_spec.rb | 2 | ||||
-rw-r--r-- | spec/bundler/runtime/setup_spec.rb | 6 | ||||
-rw-r--r-- | spec/bundler/spec_helper.rb | 7 | ||||
-rw-r--r-- | spec/bundler/support/helpers.rb | 78 |
10 files changed, 67 insertions, 53 deletions
diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb index 5470eb7263..9256fa274c 100644 --- a/lib/bundler/rubygems_integration.rb +++ b/lib/bundler/rubygems_integration.rb @@ -136,14 +136,10 @@ module Bundler 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 6e83bc5ff4..19fab78cc3 100644 --- a/lib/bundler/shared_helpers.rb +++ b/lib/bundler/shared_helpers.rb @@ -194,7 +194,7 @@ module Bundler 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 01c0b2f83c..f2a03388cc 100644 --- a/lib/bundler/vendor/thor/lib/thor.rb +++ b/lib/bundler/vendor/thor/lib/thor.rb @@ -344,13 +344,6 @@ class Bundler::Thor 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 70504a2c1f..fb76fcdbe9 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 # 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 9ba5243378..8487f9590a 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 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 7750d27637..1b222da995 100644 --- a/lib/bundler/vendor/thor/lib/thor/version.rb +++ b/lib/bundler/vendor/thor/lib/thor/version.rb @@ -1,3 +1,3 @@ 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 b00eadceab..00eb27edea 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 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 85f86db2d1..22c07f0be0 100644 --- a/spec/bundler/runtime/setup_spec.rb +++ b/spec/bundler/runtime/setup_spec.rb @@ -602,7 +602,7 @@ RSpec.describe "Bundler.setup" do 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 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 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 1985ae45ce..7ed5bda8e6 100644 --- a/spec/bundler/spec_helper.rb +++ b/spec/bundler/spec_helper.rb @@ -99,14 +99,11 @@ RSpec.configure do |config| 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 25747b9546..b5648b84a8 100644 --- a/spec/bundler/support/helpers.rb +++ b/spec/bundler/support/helpers.rb @@ -27,8 +27,12 @@ module Spec 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 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 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_as(path) do + 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") + end end end end @@ -384,20 +410,12 @@ module Spec system_gems(*gems) end - def system_gems(*gems) - opts = gems.last.is_a?(Hash) ? gems.last : {} - path = opts.fetch(:path, system_gem_path) - gems = gems.flatten - - with_gem_path_as(path) do - install_gems(*gems) - end - end - def realworld_system_gems(*gems) gems = gems.flatten + opts = gems.last.is_a?(Hash) ? gems.pop : {} + path = opts.fetch(:path, system_gem_path) - with_gem_path_as(system_gem_path) do + with_gem_path_as(path) do gems.each do |gem| gem_command "install --no-document #{gem}" end @@ -494,11 +512,11 @@ module Spec process_file(pathname) do |line| case line when /spec\.metadata\["(?:allowed_push_host|homepage_uri|source_code_uri|changelog_uri)"\]/, /spec\.homepage/ - line.gsub(/\=.*$/, "= 'http://example.org'") + line.gsub(/\=.*$/, '= "http://example.org"') when /spec\.summary/ - line.gsub(/\=.*$/, "= %q{A short summary of my new gem.}") + line.gsub(/\=.*$/, '= "A short summary of my new gem."') when /spec\.description/ - line.gsub(/\=.*$/, "= %q{A longer description of my new gem.}") + line.gsub(/\=.*$/, '= "A longer description of my new gem."') else line end |