summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2022-05-20 17:15:15 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2022-05-20 17:32:19 +0900
commitaeea88174d88264469b406003765c7efdcd53edf (patch)
treea4d9de6d1a0027f5b9c2f2050bca2586b87596bb
parentbd8df25cdc8e0e94cbc2eacc492a764e6b90833c (diff)
Merge RubyGems and Bundler HEAD
https://github.com/rubygems/rubygems/commit/125415593ead9ab69a9f0bb5392c9d7ec61b1f51
-rw-r--r--lib/bundler/cli/common.rb2
-rw-r--r--lib/bundler/definition.rb4
-rw-r--r--lib/bundler/dsl.rb2
-rw-r--r--lib/bundler/gem_helpers.rb2
-rw-r--r--lib/bundler/resolver.rb2
-rw-r--r--lib/bundler/rubygems_ext.rb2
-rw-r--r--lib/bundler/shared_helpers.rb10
-rw-r--r--lib/bundler/source/git.rb2
-rw-r--r--lib/bundler/spec_set.rb4
-rw-r--r--lib/rubygems.rb2
-rw-r--r--lib/rubygems/commands/pristine_command.rb2
-rw-r--r--lib/rubygems/commands/setup_command.rb2
-rw-r--r--lib/rubygems/commands/specification_command.rb2
-rw-r--r--lib/rubygems/ext/builder.rb2
-rw-r--r--lib/rubygems/gemcutter_utilities.rb2
-rw-r--r--lib/rubygems/installer.rb4
-rw-r--r--lib/rubygems/local_remote_options.rb2
-rw-r--r--lib/rubygems/query_utils.rb2
-rw-r--r--lib/rubygems/spec_fetcher.rb4
-rw-r--r--lib/rubygems/specification.rb4
-rw-r--r--lib/rubygems/specification_policy.rb2
-rw-r--r--lib/rubygems/util.rb2
-rw-r--r--spec/bundler/runtime/inline_spec.rb2
-rw-r--r--spec/bundler/spec_helper.rb4
-rw-r--r--spec/bundler/support/path.rb8
-rw-r--r--spec/bundler/support/rubygems_ext.rb20
-rw-r--r--spec/bundler/support/sudo.rb4
-rw-r--r--test/rubygems/helper.rb4
-rw-r--r--test/rubygems/package/tar_test_case.rb2
-rw-r--r--test/rubygems/test_gem.rb4
-rw-r--r--test/rubygems/test_gem_commands_contents_command.rb2
-rw-r--r--test/rubygems/test_gem_commands_install_command.rb4
-rw-r--r--test/rubygems/test_gem_config_file.rb6
-rw-r--r--test/rubygems/test_gem_ext_cargo_builder/custom_name/build.rb4
-rw-r--r--test/rubygems/test_gem_gemcutter_utilities.rb2
-rw-r--r--test/rubygems/test_gem_package.rb2
-rw-r--r--test/rubygems/test_gem_remote_fetcher.rb30
-rw-r--r--test/rubygems/test_gem_request_set_lockfile_parser.rb2
-rw-r--r--test/rubygems/test_gem_resolver.rb2
-rw-r--r--test/rubygems/test_gem_resolver_installer_set.rb2
-rw-r--r--test/rubygems/test_gem_specification.rb22
-rw-r--r--test/rubygems/test_require.rb20
-rw-r--r--test/rubygems/test_rubygems.rb8
43 files changed, 121 insertions, 95 deletions
diff --git a/lib/bundler/cli/common.rb b/lib/bundler/cli/common.rb
index 1a469f1d34..b547619c6a 100644
--- a/lib/bundler/cli/common.rb
+++ b/lib/bundler/cli/common.rb
@@ -40,7 +40,7 @@ module Bundler
end
def self.verbalize_groups(groups)
- groups.map!{|g| "'#{g}'" }
+ groups.map! {|g| "'#{g}'" }
group_list = [groups[0...-1].join(", "), groups[-1..-1]].
reject {|s| s.to_s.empty? }.join(" and ")
group_str = groups.size == 1 ? "group" : "groups"
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb
index d862877c2e..4fca763bcc 100644
--- a/lib/bundler/definition.rb
+++ b/lib/bundler/definition.rb
@@ -261,7 +261,7 @@ module Bundler
@locked_specs
elsif !unlocking? && nothing_changed?
Bundler.ui.debug("Found no changes, using resolution from the lockfile")
- SpecSet.new(filter_specs(@locked_specs, @dependencies.select{|dep| @locked_specs[dep].any? }))
+ SpecSet.new(filter_specs(@locked_specs, @dependencies.select {|dep| @locked_specs[dep].any? }))
else
last_resolve = converge_locked_specs
# Run a resolve against the locally available gems
@@ -731,7 +731,7 @@ module Bundler
end
end
- SpecSet.new(filter_specs(converged, deps).reject{|s| @unlock[:gems].include?(s.name) })
+ SpecSet.new(filter_specs(converged, deps).reject {|s| @unlock[:gems].include?(s.name) })
end
def metadata_dependencies
diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb
index f7922b1fba..8983ef3e2b 100644
--- a/lib/bundler/dsl.rb
+++ b/lib/bundler/dsl.rb
@@ -46,7 +46,7 @@ module Bundler
@gemfile = expanded_gemfile_path
@gemfiles << expanded_gemfile_path
contents ||= Bundler.read_file(@gemfile.to_s)
- instance_eval(contents.dup.tap{|x| x.untaint if RUBY_VERSION < "2.7" }, gemfile.to_s, 1)
+ instance_eval(contents.dup.tap {|x| x.untaint if RUBY_VERSION < "2.7" }, gemfile.to_s, 1)
rescue Exception => e # rubocop:disable Lint/RescueException
message = "There was an error " \
"#{e.is_a?(GemfileEvalError) ? "evaluating" : "parsing"} " \
diff --git a/lib/bundler/gem_helpers.rb b/lib/bundler/gem_helpers.rb
index b271b8d229..632698482f 100644
--- a/lib/bundler/gem_helpers.rb
+++ b/lib/bundler/gem_helpers.rb
@@ -48,7 +48,7 @@ module Bundler
sorted_matching = matching.sort_by {|spec| platform_specificity_match(spec.platform, platform) }
exemplary_spec = sorted_matching.first
- sorted_matching.take_while{|spec| same_specificity(platform, spec, exemplary_spec) && same_deps(spec, exemplary_spec) }
+ sorted_matching.take_while {|spec| same_specificity(platform, spec, exemplary_spec) && same_deps(spec, exemplary_spec) }
end
module_function :select_best_platform_match
diff --git a/lib/bundler/resolver.rb b/lib/bundler/resolver.rb
index 433a5e53e1..2285114c57 100644
--- a/lib/bundler/resolver.rb
+++ b/lib/bundler/resolver.rb
@@ -21,7 +21,7 @@ module Bundler
base = SpecSet.new(base) unless base.is_a?(SpecSet)
resolver = new(source_requirements, base, gem_version_promoter, additional_base_requirements, platforms)
result = resolver.start(requirements)
- SpecSet.new(SpecSet.new(result).for(requirements.reject{|dep| dep.name.end_with?("\0") }))
+ SpecSet.new(SpecSet.new(result).for(requirements.reject {|dep| dep.name.end_with?("\0") }))
end
def initialize(source_requirements, base, gem_version_promoter, additional_base_requirements, platforms)
diff --git a/lib/bundler/rubygems_ext.rb b/lib/bundler/rubygems_ext.rb
index b0e35e005e..af669d7d0b 100644
--- a/lib/bundler/rubygems_ext.rb
+++ b/lib/bundler/rubygems_ext.rb
@@ -34,7 +34,7 @@ module Gem
def full_gem_path
if source.respond_to?(:root)
- Pathname.new(loaded_from).dirname.expand_path(source.root).to_s.tap{|x| x.untaint if RUBY_VERSION < "2.7" }
+ Pathname.new(loaded_from).dirname.expand_path(source.root).to_s.tap {|x| x.untaint if RUBY_VERSION < "2.7" }
else
rg_full_gem_path
end
diff --git a/lib/bundler/shared_helpers.rb b/lib/bundler/shared_helpers.rb
index ffdbdee503..8c4e26f074 100644
--- a/lib/bundler/shared_helpers.rb
+++ b/lib/bundler/shared_helpers.rb
@@ -13,13 +13,13 @@ module Bundler
def root
gemfile = find_gemfile
raise GemfileNotFound, "Could not locate Gemfile" unless gemfile
- Pathname.new(gemfile).tap{|x| x.untaint if RUBY_VERSION < "2.7" }.expand_path.parent
+ Pathname.new(gemfile).tap {|x| x.untaint if RUBY_VERSION < "2.7" }.expand_path.parent
end
def default_gemfile
gemfile = find_gemfile
raise GemfileNotFound, "Could not locate Gemfile" unless gemfile
- Pathname.new(gemfile).tap{|x| x.untaint if RUBY_VERSION < "2.7" }.expand_path
+ Pathname.new(gemfile).tap {|x| x.untaint if RUBY_VERSION < "2.7" }.expand_path
end
def default_lockfile
@@ -28,7 +28,7 @@ module Bundler
case gemfile.basename.to_s
when "gems.rb" then Pathname.new(gemfile.sub(/.rb$/, ".locked"))
else Pathname.new("#{gemfile}.lock")
- end.tap{|x| x.untaint if RUBY_VERSION < "2.7" }
+ end.tap {|x| x.untaint if RUBY_VERSION < "2.7" }
end
def default_bundle_dir
@@ -100,7 +100,7 @@ module Bundler
#
# @see {Bundler::PermissionError}
def filesystem_access(path, action = :write, &block)
- yield(path.dup.tap{|x| x.untaint if RUBY_VERSION < "2.7" })
+ yield(path.dup.tap {|x| x.untaint if RUBY_VERSION < "2.7" })
rescue Errno::EACCES
raise PermissionError.new(path, action)
rescue Errno::EAGAIN
@@ -236,7 +236,7 @@ module Bundler
def search_up(*names)
previous = nil
- current = File.expand_path(SharedHelpers.pwd).tap{|x| x.untaint if RUBY_VERSION < "2.7" }
+ current = File.expand_path(SharedHelpers.pwd).tap {|x| x.untaint if RUBY_VERSION < "2.7" }
until !File.directory?(current) || current == previous
if ENV["BUNDLER_SPEC_RUN"]
diff --git a/lib/bundler/source/git.rb b/lib/bundler/source/git.rb
index f174120706..eb82544b86 100644
--- a/lib/bundler/source/git.rb
+++ b/lib/bundler/source/git.rb
@@ -336,7 +336,7 @@ module Bundler
def load_gemspec(file)
stub = Gem::StubSpecification.gemspec_stub(file, install_path.parent, install_path.parent)
- stub.full_gem_path = Pathname.new(file).dirname.expand_path(root).to_s.tap{|x| x.untaint if RUBY_VERSION < "2.7" }
+ stub.full_gem_path = Pathname.new(file).dirname.expand_path(root).to_s.tap {|x| x.untaint if RUBY_VERSION < "2.7" }
StubSpecification.from_stub(stub)
end
diff --git a/lib/bundler/spec_set.rb b/lib/bundler/spec_set.rb
index 44715c3567..0dfaed9807 100644
--- a/lib/bundler/spec_set.rb
+++ b/lib/bundler/spec_set.rb
@@ -18,7 +18,7 @@ module Bundler
loop do
break unless dep = deps.shift
- next if handled.any?{|d| d.name == dep.name && (match_current_platform || d.__platform == dep.__platform) } || dep.name == "bundler"
+ next if handled.any? {|d| d.name == dep.name && (match_current_platform || d.__platform == dep.__platform) } || dep.name == "bundler"
handled << dep
@@ -174,7 +174,7 @@ module Bundler
def spec_for_dependency(dep, match_current_platform)
specs_for_platforms = lookup[dep.name]
if match_current_platform
- GemHelpers.select_best_platform_match(specs_for_platforms.select{|s| Gem::Platform.match_spec?(s) }, Bundler.local_platform)
+ GemHelpers.select_best_platform_match(specs_for_platforms.select {|s| Gem::Platform.match_spec?(s) }, Bundler.local_platform)
else
GemHelpers.select_best_platform_match(specs_for_platforms, dep.__platform)
end
diff --git a/lib/rubygems.rb b/lib/rubygems.rb
index 137c08610b..e46dac0fd7 100644
--- a/lib/rubygems.rb
+++ b/lib/rubygems.rb
@@ -117,7 +117,7 @@ module Gem
# Taint support is deprecated in Ruby 2.7.
# This allows switching ".untaint" to ".tap(&Gem::UNTAINT)",
# to avoid deprecation warnings in Ruby 2.7.
- UNTAINT = RUBY_VERSION < '2.7' ? :untaint.to_sym : proc{}
+ UNTAINT = RUBY_VERSION < '2.7' ? :untaint.to_sym : proc {}
# When https://bugs.ruby-lang.org/issues/17259 is available, there is no need to override Kernel#warn
KERNEL_WARN_IGNORES_INTERNAL_ENTRIES = RUBY_ENGINE == "truffleruby" ||
diff --git a/lib/rubygems/commands/pristine_command.rb b/lib/rubygems/commands/pristine_command.rb
index 3cf496ba5b..030c1bffce 100644
--- a/lib/rubygems/commands/pristine_command.rb
+++ b/lib/rubygems/commands/pristine_command.rb
@@ -113,7 +113,7 @@ extensions will be restored.
end.flatten
end
- specs = specs.select{|spec| RUBY_ENGINE == spec.platform || Gem::Platform.local === spec.platform || spec.platform == Gem::Platform::RUBY }
+ specs = specs.select {|spec| RUBY_ENGINE == spec.platform || Gem::Platform.local === spec.platform || spec.platform == Gem::Platform::RUBY }
if specs.to_a.empty?
raise Gem::Exception,
diff --git a/lib/rubygems/commands/setup_command.rb b/lib/rubygems/commands/setup_command.rb
index 7b6890013c..84e9210cfb 100644
--- a/lib/rubygems/commands/setup_command.rb
+++ b/lib/rubygems/commands/setup_command.rb
@@ -475,7 +475,7 @@ By default, this RubyGems will install gem as:
def files_in(dir)
Dir.chdir dir do
Dir.glob(File.join('**', '*'), File::FNM_DOTMATCH).
- select{|f| !File.directory?(f) }
+ select {|f| !File.directory?(f) }
end
end
diff --git a/lib/rubygems/commands/specification_command.rb b/lib/rubygems/commands/specification_command.rb
index 6f24787962..6fba3a36ec 100644
--- a/lib/rubygems/commands/specification_command.rb
+++ b/lib/rubygems/commands/specification_command.rb
@@ -129,7 +129,7 @@ Specific fields in the specification can be extracted in YAML format:
platform = get_platform_from_requirements(options)
if platform
- specs = specs.select{|s| s.platform.to_s == platform }
+ specs = specs.select {|s| s.platform.to_s == platform }
end
unless options[:all]
diff --git a/lib/rubygems/ext/builder.rb b/lib/rubygems/ext/builder.rb
index d9aa68c067..a5b3363c21 100644
--- a/lib/rubygems/ext/builder.rb
+++ b/lib/rubygems/ext/builder.rb
@@ -63,7 +63,7 @@ class Gem::Ext::Builder
require "open3"
# Set $SOURCE_DATE_EPOCH for the subprocess.
- env = {'SOURCE_DATE_EPOCH' => Gem.source_date_epoch_string}
+ env = { 'SOURCE_DATE_EPOCH' => Gem.source_date_epoch_string }
output, status = begin
Open3.capture2e(env, *command, :chdir => dir)
rescue => error
diff --git a/lib/rubygems/gemcutter_utilities.rb b/lib/rubygems/gemcutter_utilities.rb
index 7cb5fe9448..af0d957bc8 100644
--- a/lib/rubygems/gemcutter_utilities.rb
+++ b/lib/rubygems/gemcutter_utilities.rb
@@ -135,7 +135,7 @@ module Gem::GemcutterUtilities
sign_in_host, scope: scope) do |request|
request.basic_auth email, password
request["OTP"] = otp if otp
- request.body = URI.encode_www_form({:api_key => api_key }.merge(update_scope_params))
+ request.body = URI.encode_www_form({ :api_key => api_key }.merge(update_scope_params))
end
with_response response do |resp|
diff --git a/lib/rubygems/installer.rb b/lib/rubygems/installer.rb
index 5c1674f2e8..0613399890 100644
--- a/lib/rubygems/installer.rb
+++ b/lib/rubygems/installer.rb
@@ -725,11 +725,11 @@ class Gem::Installer
raise Gem::InstallError, "#{spec} has an invalid name"
end
- if spec.raw_require_paths.any?{|path| path =~ /\R/ }
+ if spec.raw_require_paths.any? {|path| path =~ /\R/ }
raise Gem::InstallError, "#{spec} has an invalid require_paths"
end
- if spec.extensions.any?{|ext| ext =~ /\R/ }
+ if spec.extensions.any? {|ext| ext =~ /\R/ }
raise Gem::InstallError, "#{spec} has an invalid extensions"
end
diff --git a/lib/rubygems/local_remote_options.rb b/lib/rubygems/local_remote_options.rb
index 0b8b0ee1a6..9811c8f948 100644
--- a/lib/rubygems/local_remote_options.rb
+++ b/lib/rubygems/local_remote_options.rb
@@ -26,7 +26,7 @@ module Gem::LocalRemoteOptions
valid_uri_schemes = ["http", "https", "file", "s3"]
unless valid_uri_schemes.include?(uri.scheme)
- msg = "Invalid uri scheme for #{value}\nPreface URLs with one of #{valid_uri_schemes.map{|s| "#{s}://" }}"
+ msg = "Invalid uri scheme for #{value}\nPreface URLs with one of #{valid_uri_schemes.map {|s| "#{s}://" }}"
raise ArgumentError, msg
end
diff --git a/lib/rubygems/query_utils.rb b/lib/rubygems/query_utils.rb
index f4cfea3087..e0c71c43cb 100644
--- a/lib/rubygems/query_utils.rb
+++ b/lib/rubygems/query_utils.rb
@@ -61,7 +61,7 @@ module Gem::QueryUtils
gem_names = if args.empty?
[options[:name]]
else
- options[:exact] ? args.map{|arg| /\A#{Regexp.escape(arg)}\Z/ } : args.map{|arg| /#{arg}/i }
+ options[:exact] ? args.map {|arg| /\A#{Regexp.escape(arg)}\Z/ } : args.map {|arg| /#{arg}/i }
end
terminate_interaction(check_installed_gems(gem_names)) if check_installed_gems?
diff --git a/lib/rubygems/spec_fetcher.rb b/lib/rubygems/spec_fetcher.rb
index 15bfbb6f8d..4033e2efa3 100644
--- a/lib/rubygems/spec_fetcher.rb
+++ b/lib/rubygems/spec_fetcher.rb
@@ -91,8 +91,8 @@ class Gem::SpecFetcher
list.each do |source, specs|
if dependency.name.is_a?(String) && specs.respond_to?(:bsearch)
- start_index = (0 ... specs.length).bsearch{|i| specs[i].name >= dependency.name }
- end_index = (0 ... specs.length).bsearch{|i| specs[i].name > dependency.name }
+ start_index = (0 ... specs.length).bsearch {|i| specs[i].name >= dependency.name }
+ end_index = (0 ... specs.length).bsearch {|i| specs[i].name > dependency.name }
specs = specs[start_index ... end_index] if start_index && end_index
end
diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb
index 7e7599f7db..1dfa307fd5 100644
--- a/lib/rubygems/specification.rb
+++ b/lib/rubygems/specification.rb
@@ -157,7 +157,7 @@ class Gem::Specification < Gem::BasicSpecification
}.freeze
# rubocop:disable Style/MutableConstant
- INITIALIZE_CODE_FOR_DEFAULTS = { } # :nodoc:
+ INITIALIZE_CODE_FOR_DEFAULTS = {} # :nodoc:
# rubocop:enable Style/MutableConstant
@@default_value.each do |k,v|
@@ -1110,7 +1110,7 @@ class Gem::Specification < Gem::BasicSpecification
result[spec.name] = spec
end
- result.map(&:last).flatten.sort_by{|tup| tup.name }
+ result.map(&:last).flatten.sort_by {|tup| tup.name }
end
##
diff --git a/lib/rubygems/specification_policy.rb b/lib/rubygems/specification_policy.rb
index 002b3c20c4..8b5d01dda2 100644
--- a/lib/rubygems/specification_policy.rb
+++ b/lib/rubygems/specification_policy.rb
@@ -154,7 +154,7 @@ class Gem::SpecificationPolicy
def validate_duplicate_dependencies # :nodoc:
# NOTE: see REFACTOR note in Gem::Dependency about types - this might be brittle
- seen = Gem::Dependency::TYPES.inject({}) {|types, type| types.merge({ type => {}}) }
+ seen = Gem::Dependency::TYPES.inject({}) {|types, type| types.merge({ type => {} }) }
error_messages = []
@specification.dependencies.each do |dep|
diff --git a/lib/rubygems/util.rb b/lib/rubygems/util.rb
index 4363c5adce..9fd78ab2bc 100644
--- a/lib/rubygems/util.rb
+++ b/lib/rubygems/util.rb
@@ -60,7 +60,7 @@ module Gem::Util
# Invokes system, but silences all output.
def self.silent_system(*command)
- opt = {:out => IO::NULL, :err => [:child, :out]}
+ opt = { :out => IO::NULL, :err => [:child, :out] }
if Hash === command.last
opt.update(command.last)
cmds = command[0...-1]
diff --git a/spec/bundler/runtime/inline_spec.rb b/spec/bundler/runtime/inline_spec.rb
index 9029c9b854..dd22c86f90 100644
--- a/spec/bundler/runtime/inline_spec.rb
+++ b/spec/bundler/runtime/inline_spec.rb
@@ -89,7 +89,7 @@ RSpec.describe "bundler/inline#gemfile" do
expect(out).to include("Installing activesupport")
err_lines = err.split("\n")
- err_lines.reject!{|line| line =~ /\.rb:\d+: warning: / } unless RUBY_VERSION < "2.7"
+ err_lines.reject! {|line| line =~ /\.rb:\d+: warning: / } unless RUBY_VERSION < "2.7"
expect(err_lines).to be_empty
end
diff --git a/spec/bundler/spec_helper.rb b/spec/bundler/spec_helper.rb
index dce2939e83..23db133b67 100644
--- a/spec/bundler/spec_helper.rb
+++ b/spec/bundler/spec_helper.rb
@@ -113,6 +113,10 @@ RSpec.configure do |config|
end
end
+ config.before :each, :sudo => true do
+ Spec::Sudo.write_safe_config
+ end
+
config.after :suite do
FileUtils.rm_r Spec::Path.pristine_system_gem_path
end
diff --git a/spec/bundler/support/path.rb b/spec/bundler/support/path.rb
index 41b36997b2..a39e46c78a 100644
--- a/spec/bundler/support/path.rb
+++ b/spec/bundler/support/path.rb
@@ -258,6 +258,10 @@ module Spec
end
end
+ def git_root
+ ruby_core? ? source_root : source_root.parent
+ end
+
private
def git_ls_files(glob)
@@ -278,10 +282,6 @@ module Spec
ruby_core? ? "man/bundle* man/gemfile*" : "lib/bundler/man/bundle*.1 lib/bundler/man/gemfile*.5"
end
- def git_root
- ruby_core? ? source_root : source_root.parent
- end
-
def ruby_core_tarball?
!git_root.join(".git").directory?
end
diff --git a/spec/bundler/support/rubygems_ext.rb b/spec/bundler/support/rubygems_ext.rb
index fd5f06b14f..eb7e321080 100644
--- a/spec/bundler/support/rubygems_ext.rb
+++ b/spec/bundler/support/rubygems_ext.rb
@@ -18,6 +18,12 @@ module Spec
gem_load_and_activate(gem_name, bin_container)
end
+ def gem_load_and_possibly_install(gem_name, bin_container)
+ require_relative "switch_rubygems"
+
+ gem_load_activate_and_possibly_install(gem_name, bin_container)
+ end
+
def gem_require(gem_name)
gem_activate(gem_name)
require gem_name
@@ -99,9 +105,21 @@ module Spec
abort "We couldn't activate #{gem_name} (#{e.requirement}). Run `gem install #{gem_name}:'#{e.requirement}'`"
end
+ def gem_load_activate_and_possibly_install(gem_name, bin_container)
+ gem_activate_and_possibly_install(gem_name)
+ load Gem.bin_path(gem_name, bin_container)
+ end
+
+ def gem_activate_and_possibly_install(gem_name)
+ gem_activate(gem_name)
+ rescue Gem::LoadError => e
+ Gem.install(gem_name, e.requirement)
+ retry
+ end
+
def gem_activate(gem_name)
require "bundler"
- gem_requirement = Bundler::LockfileParser.new(File.read(dev_lockfile)).dependencies[gem_name]&.requirement
+ gem_requirement = Bundler::LockfileParser.new(File.read(dev_lockfile)).specs.find {|spec| spec.name == gem_name }.version
gem gem_name, gem_requirement
end
diff --git a/spec/bundler/support/sudo.rb b/spec/bundler/support/sudo.rb
index 04e9443945..7b9b392754 100644
--- a/spec/bundler/support/sudo.rb
+++ b/spec/bundler/support/sudo.rb
@@ -6,6 +6,10 @@ module Spec
@which_sudo ||= Bundler.which("sudo")
end
+ def self.write_safe_config
+ File.write(Spec::Path.tmp("gitconfig"), "[safe]\n\tdirectory = #{Spec::Path.git_root}")
+ end
+
def sudo(cmd)
raise "sudo not present" unless Sudo.present?
sys_exec("sudo #{cmd}")
diff --git a/test/rubygems/helper.rb b/test/rubygems/helper.rb
index 4460df8319..c03ce7e6c6 100644
--- a/test/rubygems/helper.rb
+++ b/test/rubygems/helper.rb
@@ -618,7 +618,7 @@ class Gem::TestCase < Test::Unit::TestCase
gem = File.join(@tempdir, File.basename(gem)).tap(&Gem::UNTAINT)
end
- Gem::Installer.at(gem, options.merge({:wrappers => true})).install
+ Gem::Installer.at(gem, options.merge({ :wrappers => true })).install
end
##
@@ -1294,7 +1294,7 @@ Also, a list:
end
def rubygems_path
- $LOAD_PATH.find{|p| p == File.dirname($LOADED_FEATURES.find{|f| f.end_with?("/rubygems.rb") }) }
+ $LOAD_PATH.find {|p| p == File.dirname($LOADED_FEATURES.find {|f| f.end_with?("/rubygems.rb") }) }
end
def with_clean_path_to_ruby
diff --git a/test/rubygems/package/tar_test_case.rb b/test/rubygems/package/tar_test_case.rb
index 99f503a23f..4517f40730 100644
--- a/test/rubygems/package/tar_test_case.rb
+++ b/test/rubygems/package/tar_test_case.rb
@@ -67,7 +67,7 @@ class Gem::Package::TarTestCase < Gem::TestCase
end
def calc_checksum(header)
- sum = header.unpack("C*").inject{|s,a| s + a }
+ sum = header.unpack("C*").inject {|s,a| s + a }
SP(Z(to_oct(sum, 6)))
end
diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb
index 0ff8b4a1db..4d9644d5c9 100644
--- a/test/rubygems/test_gem.rb
+++ b/test/rubygems/test_gem.rb
@@ -1061,7 +1061,7 @@ class TestGem < Gem::TestCase
Gem.refresh
- Gem::Specification.each{|spec| assert spec.activated? if spec == s }
+ Gem::Specification.each {|spec| assert spec.activated? if spec == s }
Gem.loaded_specs.delete(s)
Gem.refresh
@@ -1430,7 +1430,7 @@ class TestGem < Gem::TestCase
a = util_spec "a", "1"
b = util_spec "b", "1", "c" => nil
c = util_spec "c", "2"
- d = util_spec "d", "1", {'e' => '= 1'}, "lib/d#{$$}.rb"
+ d = util_spec "d", "1", { 'e' => '= 1' }, "lib/d#{$$}.rb"
e = util_spec "e", "1"
install_specs a, c, b, e, d
diff --git a/test/rubygems/test_gem_commands_contents_command.rb b/test/rubygems/test_gem_commands_contents_command.rb
index d79174717b..cf93d81e7e 100644
--- a/test/rubygems/test_gem_commands_contents_command.rb
+++ b/test/rubygems/test_gem_commands_contents_command.rb
@@ -239,7 +239,7 @@ lib/foo.rb
[RbConfig::CONFIG['bindir'], 'default_command'],
[RbConfig::CONFIG['rubylibdir'], 'default/gem.rb'],
[RbConfig::CONFIG['archdir'], 'default_gem.so'],
- ].sort.map{|a|File.join a }.join "\n"
+ ].sort.map {|a|File.join a }.join "\n"
assert_equal expected, @ui.output.chomp
assert_equal "", @ui.error
diff --git a/test/rubygems/test_gem_commands_install_command.rb b/test/rubygems/test_gem_commands_install_command.rb
index 47a97dae4b..6127fcc124 100644
--- a/test/rubygems/test_gem_commands_install_command.rb
+++ b/test/rubygems/test_gem_commands_install_command.rb
@@ -521,7 +521,7 @@ ERROR: Possible alternatives: non_existent_with_hint
end
def test_execute_required_ruby_version
- next_ruby = Gem.ruby_version.segments.map.with_index{|n, i| i == 1 ? n + 1 : n }.join(".")
+ next_ruby = Gem.ruby_version.segments.map.with_index {|n, i| i == 1 ? n + 1 : n }.join(".")
local = Gem::Platform.local
spec_fetcher do |fetcher|
@@ -610,7 +610,7 @@ ERROR: Possible alternatives: non_existent_with_hint
end
def test_execute_required_ruby_version_specific_prerelease_not_met
- next_ruby_pre = Gem.ruby_version.segments.map.with_index{|n, i| i == 1 ? n + 1 : n }.join(".") + ".a"
+ next_ruby_pre = Gem.ruby_version.segments.map.with_index {|n, i| i == 1 ? n + 1 : n }.join(".") + ".a"
spec_fetcher do |fetcher|
fetcher.gem 'a', '1.0' do |s|
diff --git a/test/rubygems/test_gem_config_file.rb b/test/rubygems/test_gem_config_file.rb
index 32375e6936..3e09079df8 100644
--- a/test/rubygems/test_gem_config_file.rb
+++ b/test/rubygems/test_gem_config_file.rb
@@ -190,7 +190,7 @@ class TestGemConfigFile < Gem::TestCase
util_config_file
- assert_equal({:rubygems => '701229f217cdf23b1344c7b4b54ca97'},
+ assert_equal({ :rubygems => '701229f217cdf23b1344c7b4b54ca97' },
@cfg.api_keys)
end
@@ -317,8 +317,8 @@ if you believe they were disclosed to a third party.
util_config_file
- assert_equal({:rubygems => '701229f217cdf23b1344c7b4b54ca97',
- :other => 'a5fdbb6ba150cbb83aad2bb2fede64c'}, @cfg.api_keys)
+ assert_equal({ :rubygems => '701229f217cdf23b1344c7b4b54ca97',
+ :other => 'a5fdbb6ba150cbb83aad2bb2fede64c' }, @cfg.api_keys)
end
def test_load_api_keys_bad_permission
diff --git a/test/rubygems/test_gem_ext_cargo_builder/custom_name/build.rb b/test/rubygems/test_gem_ext_cargo_builder/custom_name/build.rb
index 63ac2e5ce6..4d2f8488a4 100644
--- a/test/rubygems/test_gem_ext_cargo_builder/custom_name/build.rb
+++ b/test/rubygems/test_gem_ext_cargo_builder/custom_name/build.rb
@@ -15,7 +15,7 @@ gemspec = File.expand_path('custom_name.gemspec', __dir__)
Dir.mktmpdir("custom_name") do |dir|
built_gem = File.expand_path(File.join(dir, "custom_name.gem"))
- system(*gem, "build", gemspec, "--output", built_gem)
- system(*gem, "install", "--verbose", "--local", built_gem, *ARGV)
+ system *gem, "build", gemspec, "--output", built_gem
+ system *gem, "install", "--verbose", "--local", built_gem, *ARGV
system %q(ruby -rcustom_name -e "puts 'Result: ' + CustomName.say_hello")
end
diff --git a/test/rubygems/test_gem_gemcutter_utilities.rb b/test/rubygems/test_gem_gemcutter_utilities.rb
index 667aba4701..9bfc22a202 100644
--- a/test/rubygems/test_gem_gemcutter_utilities.rb
+++ b/test/rubygems/test_gem_gemcutter_utilities.rb
@@ -254,7 +254,7 @@ class TestGemGemcutterUtilities < Gem::TestCase
end
def test_verify_api_key
- keys = {:other => 'a5fdbb6ba150cbb83aad2bb2fede64cf040453903'}
+ keys = { :other => 'a5fdbb6ba150cbb83aad2bb2fede64cf040453903' }
File.open Gem.configuration.credentials_path, 'w' do |f|
f.write keys.to_yaml
end
diff --git a/test/rubygems/test_gem_package.rb b/test/rubygems/test_gem_package.rb
index 9172b7eef5..34660bdccd 100644
--- a/test/rubygems/test_gem_package.rb
+++ b/test/rubygems/test_gem_package.rb
@@ -218,7 +218,7 @@ class TestGemPackage < Gem::Package::TarTestCase
end
assert_equal %w[lib/code.rb], files
- assert_equal [{'lib/code_sym.rb' => 'code.rb'}, {'lib/code_sym2.rb' => '../lib/code.rb'}], symlinks
+ assert_equal [{ 'lib/code_sym.rb' => 'code.rb' }, { 'lib/code_sym2.rb' => '../lib/code.rb' }], symlinks
end
def test_build
diff --git a/test/rubygems/test_gem_remote_fetcher.rb b/test/rubygems/test_gem_remote_fetcher.rb
index 3ce9be7c90..fa82a117a1 100644
--- a/test/rubygems/test_gem_remote_fetcher.rb
+++ b/test/rubygems/test_gem_remote_fetcher.rb
@@ -705,7 +705,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
def test_fetch_http_with_additional_headers
ENV["http_proxy"] = @proxy_uri
ENV["no_proxy"] = URI::parse(@server_uri).host
- fetcher = Gem::RemoteFetcher.new nil, nil, {"X-Captain" => "murphy"}
+ fetcher = Gem::RemoteFetcher.new nil, nil, { "X-Captain" => "murphy" }
@fetcher = fetcher
assert_equal "murphy", fetcher.fetch_path(@server_uri)
end
@@ -745,7 +745,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
def test_fetch_s3_config_creds
Gem.configuration[:s3_source] = {
- 'my-bucket' => {:id => 'testuser', :secret => 'testpass'},
+ 'my-bucket' => { :id => 'testuser', :secret => 'testpass' },
}
url = 's3://my-bucket/gems/specs.4.8.gz'
Time.stub :now, Time.at(1561353581) do
@@ -757,7 +757,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
def test_fetch_s3_config_creds_with_region
Gem.configuration[:s3_source] = {
- 'my-bucket' => {:id => 'testuser', :secret => 'testpass', :region => 'us-west-2'},
+ 'my-bucket' => { :id => 'testuser', :secret => 'testpass', :region => 'us-west-2' },
}
url = 's3://my-bucket/gems/specs.4.8.gz'
Time.stub :now, Time.at(1561353581) do
@@ -769,7 +769,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
def test_fetch_s3_config_creds_with_token
Gem.configuration[:s3_source] = {
- 'my-bucket' => {:id => 'testuser', :secret => 'testpass', :security_token => 'testtoken'},
+ 'my-bucket' => { :id => 'testuser', :secret => 'testpass', :security_token => 'testtoken' },
}
url = 's3://my-bucket/gems/specs.4.8.gz'
Time.stub :now, Time.at(1561353581) do
@@ -784,7 +784,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
ENV['AWS_SECRET_ACCESS_KEY'] = 'testpass'
ENV['AWS_SESSION_TOKEN'] = nil
Gem.configuration[:s3_source] = {
- 'my-bucket' => {:provider => 'env'},
+ 'my-bucket' => { :provider => 'env' },
}
url = 's3://my-bucket/gems/specs.4.8.gz'
Time.stub :now, Time.at(1561353581) do
@@ -800,7 +800,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
ENV['AWS_SECRET_ACCESS_KEY'] = 'testpass'
ENV['AWS_SESSION_TOKEN'] = nil
Gem.configuration[:s3_source] = {
- 'my-bucket' => {:provider => 'env', :region => 'us-west-2'},
+ 'my-bucket' => { :provider => 'env', :region => 'us-west-2' },
}
url = 's3://my-bucket/gems/specs.4.8.gz'
Time.stub :now, Time.at(1561353581) do
@@ -816,7 +816,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
ENV['AWS_SECRET_ACCESS_KEY'] = 'testpass'
ENV['AWS_SESSION_TOKEN'] = 'testtoken'
Gem.configuration[:s3_source] = {
- 'my-bucket' => {:provider => 'env'},
+ 'my-bucket' => { :provider => 'env' },
}
url = 's3://my-bucket/gems/specs.4.8.gz'
Time.stub :now, Time.at(1561353581) do
@@ -836,7 +836,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
def test_fetch_s3_instance_profile_creds
Gem.configuration[:s3_source] = {
- 'my-bucket' => {:provider => 'instance_profile'},
+ 'my-bucket' => { :provider => 'instance_profile' },
}
url = 's3://my-bucket/gems/specs.4.8.gz'
@@ -850,7 +850,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
def test_fetch_s3_instance_profile_creds_with_region
Gem.configuration[:s3_source] = {
- 'my-bucket' => {:provider => 'instance_profile', :region => 'us-west-2'},
+ 'my-bucket' => { :provider => 'instance_profile', :region => 'us-west-2' },
}
url = 's3://my-bucket/gems/specs.4.8.gz'
@@ -864,7 +864,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
def test_fetch_s3_instance_profile_creds_with_token
Gem.configuration[:s3_source] = {
- 'my-bucket' => {:provider => 'instance_profile'},
+ 'my-bucket' => { :provider => 'instance_profile' },
}
url = 's3://my-bucket/gems/specs.4.8.gz'
@@ -894,7 +894,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
def test_fetch_s3_no_host
Gem.configuration[:s3_source] = {
- 'my-bucket' => {:id => 'testuser', :secret => 'testpass'},
+ 'my-bucket' => { :id => 'testuser', :secret => 'testpass' },
}
url = 's3://other-bucket/gems/specs.4.8.gz'
@@ -904,7 +904,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
end
def test_fetch_s3_no_id
- Gem.configuration[:s3_source] = { 'my-bucket' => {:secret => 'testpass'} }
+ Gem.configuration[:s3_source] = { 'my-bucket' => { :secret => 'testpass' } }
url = 's3://my-bucket/gems/specs.4.8.gz'
refute_fetch_s3 url, 's3_source for my-bucket missing id or secret'
@@ -913,7 +913,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
end
def test_fetch_s3_no_secret
- Gem.configuration[:s3_source] = { 'my-bucket' => {:id => 'testuser'} }
+ Gem.configuration[:s3_source] = { 'my-bucket' => { :id => 'testuser' } }
url = 's3://my-bucket/gems/specs.4.8.gz'
refute_fetch_s3 url, 's3_source for my-bucket missing id or secret'
@@ -973,7 +973,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
def test_ssl_client_cert_auth_connection
ssl_server = start_ssl_server({
:SSLVerifyClient =>
- OpenSSL::SSL::VERIFY_PEER | OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT})
+ OpenSSL::SSL::VERIFY_PEER | OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT })
temp_ca_cert = File.join(__dir__, 'ca_cert.pem')
temp_client_cert = File.join(__dir__, 'client.pem')
@@ -988,7 +988,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
def test_do_not_allow_invalid_client_cert_auth_connection
ssl_server = start_ssl_server({
:SSLVerifyClient =>
- OpenSSL::SSL::VERIFY_PEER | OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT})
+ OpenSSL::SSL::VERIFY_PEER | OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT })
temp_ca_cert = File.join(__dir__, 'ca_cert.pem')
temp_client_cert = File.join(__dir__, 'invalid_client.pem')
diff --git a/test/rubygems/test_gem_request_set_lockfile_parser.rb b/test/rubygems/test_gem_request_set_lockfile_parser.rb
index 4007c3a69c..775085964e 100644
--- a/test/rubygems/test_gem_request_set_lockfile_parser.rb
+++ b/test/rubygems/test_gem_request_set_lockfile_parser.rb
@@ -248,7 +248,7 @@ DEPENDENCIES
assert_equal %w[a-2], lockfile_set.specs.map {|s| s.full_name }
assert_equal %w[https://gems.example/ https://other.example/],
- lockfile_set.specs.flat_map {|s| s.sources.map{|src| src.uri.to_s } }
+ lockfile_set.specs.flat_map {|s| s.sources.map {|src| src.uri.to_s } }
end
def test_parse_GIT
diff --git a/test/rubygems/test_gem_resolver.rb b/test/rubygems/test_gem_resolver.rb
index ea9f9049ce..ab0cdaddb9 100644
--- a/test/rubygems/test_gem_resolver.rb
+++ b/test/rubygems/test_gem_resolver.rb
@@ -191,7 +191,7 @@ class TestGemResolver < Gem::TestCase
# With the following gems already installed:
# a-1, b-1, c-1, e-1
- res.skip_gems = {'a' => [a1_spec], 'b' => [b1_spec], 'c' => [c1_spec], 'e' => [e1_spec]}
+ res.skip_gems = { 'a' => [a1_spec], 'b' => [b1_spec], 'c' => [c1_spec], 'e' => [e1_spec] }
# Make sure the following gems end up getting used/installed/upgraded:
# a-2 (upgraded)
diff --git a/test/rubygems/test_gem_resolver_installer_set.rb b/test/rubygems/test_gem_resolver_installer_set.rb
index 928a16b9d3..7a6d17f2b0 100644
--- a/test/rubygems/test_gem_resolver_installer_set.rb
+++ b/test/rubygems/test_gem_resolver_installer_set.rb
@@ -210,7 +210,7 @@ class TestGemResolverInstallerSet < Gem::TestCase
def (set.remote_set).prefetch(_)
raise "called"
end
- assert_raise(RuntimeError){ set.prefetch(nil) }
+ assert_raise(RuntimeError) { set.prefetch(nil) }
set = Gem::Resolver::InstallerSet.new :local
def (set.remote_set).prefetch(_)
diff --git a/test/rubygems/test_gem_specification.rb b/test/rubygems/test_gem_specification.rb
index 55dd7f0ff2..103d886537 100644
--- a/test/rubygems/test_gem_specification.rb
+++ b/test/rubygems/test_gem_specification.rb
@@ -158,7 +158,7 @@ end
util_spec "pkg#{pkgi}", pkg_version.to_s, deps
end
end
- base = util_spec "pkg_base", "1", {"pkg0" => ">= 0"}
+ base = util_spec "pkg_base", "1", { "pkg0" => ">= 0" }
Gem::Specification.reset
install_specs(*packages.flatten.reverse)
@@ -305,10 +305,10 @@ end
def test_require_should_not_conflict
base = util_spec "0", "1", "A" => ">= 1"
- a1 = util_spec "A", "1", {"c" => ">= 2", "b" => "> 0"}, "lib/a.rb"
- a2 = util_spec "A", "2", {"c" => ">= 2", "b" => "> 0"}, "lib/a.rb"
- b1 = util_spec "b", "1", {"c" => "= 1"}, "lib/d#{$$}.rb"
- b2 = util_spec "b", "2", {"c" => "= 2"}, "lib/d#{$$}.rb"
+ a1 = util_spec "A", "1", { "c" => ">= 2", "b" => "> 0" }, "lib/a.rb"
+ a2 = util_spec "A", "2", { "c" => ">= 2", "b" => "> 0" }, "lib/a.rb"
+ b1 = util_spec "b", "1", { "c" => "= 1" }, "lib/d#{$$}.rb"
+ b2 = util_spec "b", "2", { "c" => "= 2" }, "lib/d#{$$}.rb"
c1 = util_spec "c", "1", {}, "lib/c.rb"
c2 = util_spec "c", "2", {}, "lib/c.rb"
c3 = util_spec "c", "3", {}, "lib/c.rb"
@@ -992,8 +992,8 @@ dependencies: []
dir_standard_specs = File.join Gem.dir, 'specifications'
- save_gemspec('a-1', '1', dir_standard_specs){|s| s.name = 'a' }
- save_gemspec('b-1', '1', dir_standard_specs){|s| s.name = 'b' }
+ save_gemspec('a-1', '1', dir_standard_specs) {|s| s.name = 'a' }
+ save_gemspec('b-1', '1', dir_standard_specs) {|s| s.name = 'b' }
assert_equal ['a-1'], Gem::Specification.stubs_for('a').map {|s| s.full_name }
assert_equal 1, Gem::Specification.class_variable_get(:@@stubs_by_name).length
@@ -1013,7 +1013,7 @@ dependencies: []
def test_self_stubs_for_no_lazy_loading_after_all_specs_setup
Gem::Specification.all = [util_spec('a', '1')]
- save_gemspec('b-1', '1', File.join(Gem.dir, 'specifications')){|s| s.name = 'b' }
+ save_gemspec('b-1', '1', File.join(Gem.dir, 'specifications')) {|s| s.name = 'b' }
assert_equal [], Gem::Specification.stubs_for('b').map {|s| s.full_name }
end
@@ -1060,9 +1060,9 @@ dependencies: []
def test_self_stubs_returns_only_specified_named_specs
dir_standard_specs = File.join Gem.dir, 'specifications'
- save_gemspec('a-1', '1', dir_standard_specs){|s| s.name = 'a' }
- save_gemspec('a-2', '2', dir_standard_specs){|s| s.name = 'a' }
- save_gemspec('a-a', '3', dir_standard_specs){|s| s.name = 'a-a' }
+ save_gemspec('a-1', '1', dir_standard_specs) {|s| s.name = 'a' }
+ save_gemspec('a-2', '2', dir_standard_specs) {|s| s.name = 'a' }
+ save_gemspec('a-a', '3', dir_standard_specs) {|s| s.name = 'a-a' }
assert_equal ['a-1', 'a-2'], Gem::Specification.stubs_for('a').map(&:full_name).sort
end
diff --git a/test/rubygems/test_require.rb b/test/rubygems/test_require.rb
index 8857ceef25..2b63bc600a 100644
--- a/test/rubygems/test_require.rb
+++ b/test/rubygems/test_require.rb
@@ -63,8 +63,8 @@ class TestGemRequire < Gem::TestCase
# Providing -I on the commandline should always beat gems
def test_dash_i_beats_gems
- a1 = util_spec "a", "1", {"b" => "= 1"}, "lib/test_gem_require_a.rb"
- b1 = util_spec "b", "1", {"c" => "> 0"}, "lib/b/c.rb"
+ a1 = util_spec "a", "1", { "b" => "= 1" }, "lib/test_gem_require_a.rb"
+ b1 = util_spec "b", "1", { "c" => "> 0" }, "lib/b/c.rb"
c1 = util_spec "c", "1", nil, "lib/c/c.rb"
c2 = util_spec "c", "2", nil, "lib/c/c.rb"
@@ -102,8 +102,8 @@ class TestGemRequire < Gem::TestCase
# Providing -I on the commandline should always beat gems
def test_dash_i_beats_default_gems
- a1 = new_default_spec "a", "1", {"b" => "= 1"}, "test_gem_require_a.rb"
- b1 = new_default_spec "b", "1", {"c" => "> 0"}, "b/c.rb"
+ a1 = new_default_spec "a", "1", { "b" => "= 1" }, "test_gem_require_a.rb"
+ b1 = new_default_spec "b", "1", { "c" => "> 0" }, "b/c.rb"
c1 = new_default_spec "c", "1", nil, "c/c.rb"
c2 = new_default_spec "c", "2", nil, "c/c.rb"
@@ -152,8 +152,8 @@ class TestGemRequire < Gem::TestCase
install_specs a1, b1
- t1 = create_sync_thread{ assert_require "a#{$$}" }
- t2 = create_sync_thread{ assert_require "b#{$$}" }
+ t1 = create_sync_thread { assert_require "a#{$$}" }
+ t2 = create_sync_thread { assert_require "b#{$$}" }
# wait until both files are waiting on the exit latch
FILE_ENTERED_LATCH.await
@@ -169,7 +169,7 @@ class TestGemRequire < Gem::TestCase
end
def test_require_is_not_lazy_with_exact_req
- a1 = util_spec "a", "1", {"b" => "= 1"}, "lib/test_gem_require_a.rb"
+ a1 = util_spec "a", "1", { "b" => "= 1" }, "lib/test_gem_require_a.rb"
b1 = util_spec "b", "1", nil, "lib/b/c.rb"
b2 = util_spec "b", "2", nil, "lib/b/c.rb"
@@ -184,7 +184,7 @@ class TestGemRequire < Gem::TestCase
end
def test_require_is_lazy_with_inexact_req
- a1 = util_spec "a", "1", {"b" => ">= 1"}, "lib/test_gem_require_a.rb"
+ a1 = util_spec "a", "1", { "b" => ">= 1" }, "lib/test_gem_require_a.rb"
b1 = util_spec "b", "1", nil, "lib/b/c.rb"
b2 = util_spec "b", "2", nil, "lib/b/c.rb"
@@ -199,7 +199,7 @@ class TestGemRequire < Gem::TestCase
end
def test_require_is_not_lazy_with_one_possible
- a1 = util_spec "a", "1", {"b" => ">= 1"}, "lib/test_gem_require_a.rb"
+ a1 = util_spec "a", "1", { "b" => ">= 1" }, "lib/test_gem_require_a.rb"
b1 = util_spec "b", "1", nil, "lib/b/c.rb"
install_specs b1, a1
@@ -243,7 +243,7 @@ class TestGemRequire < Gem::TestCase
require 'benchmark' # the stdlib
- a1 = util_spec "a", "1", {"b" => ">= 1"}, "lib/test_gem_require_a.rb"
+ a1 = util_spec "a", "1", { "b" => ">= 1" }, "lib/test_gem_require_a.rb"
b1 = util_spec "b", "1", nil, "lib/benchmark.rb"
b2 = util_spec "b", "2", nil, "lib/benchmark.rb"
diff --git a/test/rubygems/test_rubygems.rb b/test/rubygems/test_rubygems.rb
index 26c5f1e0fd..739a9985b0 100644
--- a/test/rubygems/test_rubygems.rb
+++ b/test/rubygems/test_rubygems.rb
@@ -2,7 +2,7 @@ require_relative 'helper'
class GemTest < Gem::TestCase
def test_rubygems_normal_behaviour
- _ = Gem::Util.popen(*ruby_with_rubygems_in_load_path, '-e', "'require \"rubygems\"'", {:err => [:child, :out]}).strip
+ _ = Gem::Util.popen(*ruby_with_rubygems_in_load_path, '-e', "'require \"rubygems\"'", { :err => [:child, :out] }).strip
assert $?.success?
end
@@ -13,7 +13,7 @@ class GemTest < Gem::TestCase
intentionally_not_implemented_method
RUBY
- output = Gem::Util.popen(*ruby_with_rubygems_and_fake_operating_system_in_load_path(path), '-e', "'require \"rubygems\"'", {:err => [:child, :out]}).strip
+ output = Gem::Util.popen(*ruby_with_rubygems_and_fake_operating_system_in_load_path(path), '-e', "'require \"rubygems\"'", { :err => [:child, :out] }).strip
assert !$?.success?
assert_includes output, "undefined local variable or method `intentionally_not_implemented_method'"
assert_includes output, "Loading the rubygems/defaults/operating_system.rb file caused an error. " \
@@ -40,7 +40,7 @@ class GemTest < Gem::TestCase
*ruby_with_rubygems_and_fake_operating_system_in_load_path(path),
'-e',
"require \"rubygems\"; puts Gem::Specification.stubs.map(&:full_name)",
- {:err => [:child, :out]}
+ { :err => [:child, :out] }
).strip
begin
assert_empty output
@@ -66,6 +66,6 @@ class GemTest < Gem::TestCase
end
def ruby_with_rubygems_and_fake_operating_system_in_load_path(operating_system_path)
- [Gem.ruby, "-I", operating_system_path, "-I" , $LOAD_PATH.find{|p| p == File.dirname($LOADED_FEATURES.find{|f| f.end_with?("/rubygems.rb") }) }]
+ [Gem.ruby, "-I", operating_system_path, "-I" , $LOAD_PATH.find {|p| p == File.dirname($LOADED_FEATURES.find {|f| f.end_with?("/rubygems.rb") }) }]
end
end