summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2021-08-02 12:07:39 +0900
committernagachika <nagachika@ruby-lang.org>2021-08-19 15:46:40 +0900
commit41a28637807bef9b15c404c93a778aaa6266ace7 (patch)
tree5a85615a3ff7fa753540f095f446babc1b5fe162
parent679185d6c87e0f2e4f6a5da5ce50d02c80ab31b1 (diff)
Merge RubyGems 3.2.25 and Bundler 2.2.25
-rw-r--r--lib/bundler.rb4
-rw-r--r--lib/bundler/cli.rb6
-rw-r--r--lib/bundler/cli/cache.rb2
-rw-r--r--lib/bundler/cli/doctor.rb2
-rw-r--r--lib/bundler/cli/install.rb21
-rw-r--r--lib/bundler/cli/list.rb8
-rw-r--r--lib/bundler/cli/open.rb3
-rw-r--r--lib/bundler/cli/update.rb2
-rw-r--r--lib/bundler/definition.rb52
-rw-r--r--lib/bundler/dsl.rb15
-rw-r--r--lib/bundler/installer/gem_installer.rb19
-rw-r--r--lib/bundler/lockfile_parser.rb1
-rw-r--r--lib/bundler/rubygems_gem_installer.rb6
-rw-r--r--lib/bundler/runtime.rb21
-rw-r--r--lib/bundler/settings.rb2
-rw-r--r--lib/bundler/setup.rb4
-rw-r--r--lib/bundler/shared_helpers.rb7
-rw-r--r--lib/bundler/source/git/git_proxy.rb3
-rw-r--r--lib/bundler/source/rubygems.rb4
-rw-r--r--lib/bundler/source_list.rb19
-rw-r--r--lib/bundler/spec_set.rb46
-rw-r--r--lib/bundler/templates/Executable.bundler12
-rw-r--r--lib/bundler/version.rb2
-rw-r--r--lib/bundler/worker.rb19
-rw-r--r--lib/rubygems.rb12
-rw-r--r--lib/rubygems/config_file.rb8
-rw-r--r--lib/rubygems/ext/builder.rb1
-rw-r--r--lib/rubygems/ext/ext_conf_builder.rb3
-rw-r--r--lib/rubygems/ext/rake_builder.rb3
-rw-r--r--lib/rubygems/remote_fetcher.rb1
-rw-r--r--lib/rubygems/requirement.rb23
-rw-r--r--lib/rubygems/s3_uri_signer.rb1
-rw-r--r--lib/rubygems/safe_yaml.rb2
-rw-r--r--lib/rubygems/specification.rb6
-rw-r--r--lib/rubygems/syck_hack.rb77
-rw-r--r--spec/bundler/bundler/cli_spec.rb6
-rw-r--r--spec/bundler/bundler/dsl_spec.rb17
-rw-r--r--spec/bundler/bundler/env_spec.rb4
-rw-r--r--spec/bundler/bundler/plugin/index_spec.rb2
-rw-r--r--spec/bundler/bundler/source/rubygems_spec.rb14
-rw-r--r--spec/bundler/bundler/source_list_spec.rb15
-rw-r--r--spec/bundler/bundler/worker_spec.rb47
-rw-r--r--spec/bundler/cache/gems_spec.rb8
-rw-r--r--spec/bundler/cache/git_spec.rb9
-rw-r--r--spec/bundler/cache/path_spec.rb12
-rw-r--r--spec/bundler/commands/binstubs_spec.rb17
-rw-r--r--spec/bundler/commands/check_spec.rb3
-rw-r--r--spec/bundler/commands/clean_spec.rb15
-rw-r--r--spec/bundler/commands/config_spec.rb16
-rw-r--r--spec/bundler/commands/exec_spec.rb64
-rw-r--r--spec/bundler/commands/info_spec.rb4
-rw-r--r--spec/bundler/commands/install_spec.rb56
-rw-r--r--spec/bundler/commands/open_spec.rb1
-rw-r--r--spec/bundler/commands/update_spec.rb20
-rw-r--r--spec/bundler/install/allow_offline_install_spec.rb2
-rw-r--r--spec/bundler/install/deploy_spec.rb5
-rw-r--r--spec/bundler/install/failure_spec.rb97
-rw-r--r--spec/bundler/install/gemfile/eval_gemfile_spec.rb7
-rw-r--r--spec/bundler/install/gemfile/gemspec_spec.rb2
-rw-r--r--spec/bundler/install/gemfile/git_spec.rb42
-rw-r--r--spec/bundler/install/gemfile/path_spec.rb30
-rw-r--r--spec/bundler/install/gemfile/platform_spec.rb1
-rw-r--r--spec/bundler/install/gemfile/sources_spec.rb4
-rw-r--r--spec/bundler/install/gemfile/specific_platform_spec.rb1
-rw-r--r--spec/bundler/install/gemfile_spec.rb8
-rw-r--r--spec/bundler/install/gems/compact_index_spec.rb1
-rw-r--r--spec/bundler/install/gems/native_extensions_spec.rb4
-rw-r--r--spec/bundler/install/gems/standalone_spec.rb40
-rw-r--r--spec/bundler/install/gemspecs_spec.rb7
-rw-r--r--spec/bundler/install/git_spec.rb4
-rw-r--r--spec/bundler/install/redownload_spec.rb1
-rw-r--r--spec/bundler/install/yanked_spec.rb31
-rw-r--r--spec/bundler/lock/git_spec.rb1
-rw-r--r--spec/bundler/lock/lockfile_spec.rb23
-rw-r--r--spec/bundler/other/major_deprecation_spec.rb28
-rw-r--r--spec/bundler/other/platform_spec.rb16
-rw-r--r--spec/bundler/plugins/install_spec.rb2
-rw-r--r--spec/bundler/runtime/executable_spec.rb1
-rw-r--r--spec/bundler/runtime/inline_spec.rb7
-rw-r--r--spec/bundler/runtime/require_spec.rb15
-rw-r--r--spec/bundler/runtime/setup_spec.rb19
-rw-r--r--spec/bundler/runtime/with_unbundled_env_spec.rb2
-rw-r--r--spec/bundler/update/git_spec.rb10
-rw-r--r--spec/bundler/update/path_spec.rb1
-rw-r--r--test/rubygems/data/null-type.gemspec.rzbin554 -> 504 bytes
-rw-r--r--test/rubygems/helper.rb (renamed from lib/rubygems/test_case.rb)31
-rw-r--r--test/rubygems/installer_test_case.rb (renamed from lib/rubygems/installer_test_case.rb)2
-rw-r--r--test/rubygems/package/tar_test_case.rb (renamed from lib/rubygems/package/tar_test_case.rb)2
-rw-r--r--test/rubygems/test_bundled_ca.rb2
-rw-r--r--test/rubygems/test_config.rb2
-rw-r--r--test/rubygems/test_deprecate.rb2
-rw-r--r--test/rubygems/test_gem.rb2
-rw-r--r--test/rubygems/test_gem_available_set.rb2
-rw-r--r--test/rubygems/test_gem_bundler_version_finder.rb2
-rw-r--r--test/rubygems/test_gem_command.rb2
-rw-r--r--test/rubygems/test_gem_command_manager.rb2
-rw-r--r--test/rubygems/test_gem_commands_build_command.rb2
-rw-r--r--test/rubygems/test_gem_commands_cert_command.rb2
-rw-r--r--test/rubygems/test_gem_commands_check_command.rb2
-rw-r--r--test/rubygems/test_gem_commands_cleanup_command.rb2
-rw-r--r--test/rubygems/test_gem_commands_contents_command.rb2
-rw-r--r--test/rubygems/test_gem_commands_dependency_command.rb2
-rw-r--r--test/rubygems/test_gem_commands_environment_command.rb2
-rw-r--r--test/rubygems/test_gem_commands_fetch_command.rb2
-rw-r--r--test/rubygems/test_gem_commands_generate_index_command.rb2
-rw-r--r--test/rubygems/test_gem_commands_help_command.rb2
-rw-r--r--test/rubygems/test_gem_commands_info_command.rb2
-rw-r--r--test/rubygems/test_gem_commands_install_command.rb2
-rw-r--r--test/rubygems/test_gem_commands_list_command.rb2
-rw-r--r--test/rubygems/test_gem_commands_lock_command.rb2
-rw-r--r--test/rubygems/test_gem_commands_mirror.rb2
-rw-r--r--test/rubygems/test_gem_commands_open_command.rb2
-rw-r--r--test/rubygems/test_gem_commands_outdated_command.rb2
-rw-r--r--test/rubygems/test_gem_commands_owner_command.rb2
-rw-r--r--test/rubygems/test_gem_commands_pristine_command.rb2
-rw-r--r--test/rubygems/test_gem_commands_push_command.rb2
-rw-r--r--test/rubygems/test_gem_commands_query_command.rb2
-rw-r--r--test/rubygems/test_gem_commands_search_command.rb2
-rw-r--r--test/rubygems/test_gem_commands_server_command.rb2
-rw-r--r--test/rubygems/test_gem_commands_setup_command.rb6
-rw-r--r--test/rubygems/test_gem_commands_signin_command.rb2
-rw-r--r--test/rubygems/test_gem_commands_signout_command.rb2
-rw-r--r--test/rubygems/test_gem_commands_sources_command.rb2
-rw-r--r--test/rubygems/test_gem_commands_specification_command.rb2
-rw-r--r--test/rubygems/test_gem_commands_stale_command.rb2
-rw-r--r--test/rubygems/test_gem_commands_uninstall_command.rb2
-rw-r--r--test/rubygems/test_gem_commands_unpack_command.rb2
-rw-r--r--test/rubygems/test_gem_commands_update_command.rb2
-rw-r--r--test/rubygems/test_gem_commands_which_command.rb2
-rw-r--r--test/rubygems/test_gem_commands_yank_command.rb2
-rw-r--r--test/rubygems/test_gem_config_file.rb2
-rw-r--r--test/rubygems/test_gem_dependency.rb2
-rw-r--r--test/rubygems/test_gem_dependency_installer.rb2
-rw-r--r--test/rubygems/test_gem_dependency_list.rb2
-rw-r--r--test/rubygems/test_gem_dependency_resolution_error.rb2
-rw-r--r--test/rubygems/test_gem_doctor.rb2
-rw-r--r--test/rubygems/test_gem_ext_builder.rb5
-rw-r--r--test/rubygems/test_gem_ext_cmake_builder.rb2
-rw-r--r--test/rubygems/test_gem_ext_configure_builder.rb2
-rw-r--r--test/rubygems/test_gem_ext_ext_conf_builder.rb2
-rw-r--r--test/rubygems/test_gem_ext_rake_builder.rb2
-rw-r--r--test/rubygems/test_gem_gem_runner.rb2
-rw-r--r--test/rubygems/test_gem_gemcutter_utilities.rb2
-rw-r--r--test/rubygems/test_gem_impossible_dependencies_error.rb2
-rw-r--r--test/rubygems/test_gem_indexer.rb2
-rw-r--r--test/rubygems/test_gem_install_update_options.rb2
-rw-r--r--test/rubygems/test_gem_installer.rb4
-rw-r--r--test/rubygems/test_gem_local_remote_options.rb2
-rw-r--r--test/rubygems/test_gem_name_tuple.rb2
-rw-r--r--test/rubygems/test_gem_package.rb2
-rw-r--r--test/rubygems/test_gem_package_old.rb2
-rw-r--r--test/rubygems/test_gem_package_tar_header.rb2
-rw-r--r--test/rubygems/test_gem_package_tar_reader.rb2
-rw-r--r--test/rubygems/test_gem_package_tar_reader_entry.rb2
-rw-r--r--test/rubygems/test_gem_package_tar_writer.rb2
-rw-r--r--test/rubygems/test_gem_package_task.rb2
-rw-r--r--test/rubygems/test_gem_path_support.rb2
-rw-r--r--test/rubygems/test_gem_platform.rb2
-rw-r--r--test/rubygems/test_gem_rdoc.rb2
-rw-r--r--test/rubygems/test_gem_remote_fetcher.rb2
-rw-r--r--test/rubygems/test_gem_request.rb2
-rw-r--r--test/rubygems/test_gem_request_connection_pools.rb2
-rw-r--r--test/rubygems/test_gem_request_set.rb2
-rw-r--r--test/rubygems/test_gem_request_set_gem_dependency_api.rb2
-rw-r--r--test/rubygems/test_gem_request_set_lockfile.rb2
-rw-r--r--test/rubygems/test_gem_request_set_lockfile_parser.rb2
-rw-r--r--test/rubygems/test_gem_request_set_lockfile_tokenizer.rb2
-rw-r--r--test/rubygems/test_gem_requirement.rb36
-rw-r--r--test/rubygems/test_gem_resolver.rb2
-rw-r--r--test/rubygems/test_gem_resolver_activation_request.rb2
-rw-r--r--test/rubygems/test_gem_resolver_api_set.rb2
-rw-r--r--test/rubygems/test_gem_resolver_api_specification.rb2
-rw-r--r--test/rubygems/test_gem_resolver_best_set.rb2
-rw-r--r--test/rubygems/test_gem_resolver_composed_set.rb2
-rw-r--r--test/rubygems/test_gem_resolver_conflict.rb2
-rw-r--r--test/rubygems/test_gem_resolver_dependency_request.rb2
-rw-r--r--test/rubygems/test_gem_resolver_git_set.rb2
-rw-r--r--test/rubygems/test_gem_resolver_git_specification.rb3
-rw-r--r--test/rubygems/test_gem_resolver_index_set.rb2
-rw-r--r--test/rubygems/test_gem_resolver_index_specification.rb2
-rw-r--r--test/rubygems/test_gem_resolver_installed_specification.rb2
-rw-r--r--test/rubygems/test_gem_resolver_installer_set.rb2
-rw-r--r--test/rubygems/test_gem_resolver_local_specification.rb2
-rw-r--r--test/rubygems/test_gem_resolver_lock_set.rb2
-rw-r--r--test/rubygems/test_gem_resolver_lock_specification.rb2
-rw-r--r--test/rubygems/test_gem_resolver_requirement_list.rb2
-rw-r--r--test/rubygems/test_gem_resolver_specification.rb2
-rw-r--r--test/rubygems/test_gem_resolver_vendor_set.rb2
-rw-r--r--test/rubygems/test_gem_resolver_vendor_specification.rb2
-rw-r--r--test/rubygems/test_gem_security.rb2
-rw-r--r--test/rubygems/test_gem_security_policy.rb2
-rw-r--r--test/rubygems/test_gem_security_signer.rb2
-rw-r--r--test/rubygems/test_gem_security_trust_dir.rb2
-rw-r--r--test/rubygems/test_gem_server.rb2
-rw-r--r--test/rubygems/test_gem_silent_ui.rb2
-rw-r--r--test/rubygems/test_gem_source.rb2
-rw-r--r--test/rubygems/test_gem_source_fetch_problem.rb2
-rw-r--r--test/rubygems/test_gem_source_git.rb2
-rw-r--r--test/rubygems/test_gem_source_installed.rb2
-rw-r--r--test/rubygems/test_gem_source_list.rb2
-rw-r--r--test/rubygems/test_gem_source_local.rb2
-rw-r--r--test/rubygems/test_gem_source_lock.rb2
-rw-r--r--test/rubygems/test_gem_source_specific_file.rb2
-rw-r--r--test/rubygems/test_gem_source_subpath_problem.rb2
-rw-r--r--test/rubygems/test_gem_source_vendor.rb2
-rw-r--r--test/rubygems/test_gem_spec_fetcher.rb2
-rw-r--r--test/rubygems/test_gem_specification.rb166
-rw-r--r--test/rubygems/test_gem_stream_ui.rb2
-rw-r--r--test/rubygems/test_gem_stub_specification.rb2
-rw-r--r--test/rubygems/test_gem_text.rb2
-rw-r--r--test/rubygems/test_gem_uninstaller.rb2
-rw-r--r--test/rubygems/test_gem_unsatisfiable_dependency_error.rb2
-rw-r--r--test/rubygems/test_gem_uri_formatter.rb2
-rw-r--r--test/rubygems/test_gem_util.rb2
-rw-r--r--test/rubygems/test_gem_validator.rb2
-rw-r--r--test/rubygems/test_gem_version.rb2
-rw-r--r--test/rubygems/test_gem_version_option.rb2
-rw-r--r--test/rubygems/test_kernel.rb2
-rw-r--r--test/rubygems/test_project_sanity.rb2
-rw-r--r--test/rubygems/test_remote_fetch_error.rb2
-rw-r--r--test/rubygems/test_require.rb2
-rw-r--r--test/rubygems/utilities.rb (renamed from lib/rubygems/test_utilities.rb)2
-rw-r--r--tool/bundler/rubocop_gems.rb.lock2
-rw-r--r--tool/bundler/test_gems.rb.lock2
224 files changed, 929 insertions, 745 deletions
diff --git a/lib/bundler.rb b/lib/bundler.rb
index e3127adb6b..439c8cbb86 100644
--- a/lib/bundler.rb
+++ b/lib/bundler.rb
@@ -653,10 +653,6 @@ EOF
rescue ScriptError, StandardError => e
msg = "There was an error while loading `#{path.basename}`: #{e.message}"
- if e.is_a?(LoadError)
- msg += "\nDoes it try to require a relative path? That's been removed in Ruby 1.9"
- end
-
raise GemspecError, Dsl::DSLError.new(msg, path, e.backtrace, contents)
end
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb
index 177f362070..f054a2bfed 100644
--- a/lib/bundler/cli.rb
+++ b/lib/bundler/cli.rb
@@ -456,6 +456,12 @@ module Bundler
"do in future versions. Instead please use `bundle config set cache_all true`, " \
"and stop using this flag" if ARGV.include?("--all")
+ SharedHelpers.major_deprecation 2,
+ "The `--path` flag is deprecated because its semantics are unclear. " \
+ "Use `bundle config cache_path` to configure the path of your cache of gems, " \
+ "and `bundle config path` to configure the path where your gems are installed, " \
+ "and stop using this flag" if ARGV.include?("--path")
+
require_relative "cli/cache"
Cache.new(options).run
end
diff --git a/lib/bundler/cli/cache.rb b/lib/bundler/cli/cache.rb
index 9cd6133879..c8698ed7e3 100644
--- a/lib/bundler/cli/cache.rb
+++ b/lib/bundler/cli/cache.rb
@@ -9,7 +9,7 @@ module Bundler
end
def run
- Bundler.ui.level = "error" if options[:quiet]
+ Bundler.ui.level = "warn" if options[:quiet]
Bundler.settings.set_command_option_if_given :path, options[:path]
Bundler.settings.set_command_option_if_given :cache_path, options["cache-path"]
diff --git a/lib/bundler/cli/doctor.rb b/lib/bundler/cli/doctor.rb
index 959b1b5e04..c28997bc7d 100644
--- a/lib/bundler/cli/doctor.rb
+++ b/lib/bundler/cli/doctor.rb
@@ -61,7 +61,7 @@ module Bundler
end
def run
- Bundler.ui.level = "error" if options[:quiet]
+ Bundler.ui.level = "warn" if options[:quiet]
Bundler.settings.validate!
check!
diff --git a/lib/bundler/cli/install.rb b/lib/bundler/cli/install.rb
index 5e39e2a36d..4c1915fea6 100644
--- a/lib/bundler/cli/install.rb
+++ b/lib/bundler/cli/install.rb
@@ -8,7 +8,7 @@ module Bundler
end
def run
- Bundler.ui.level = "error" if options[:quiet]
+ Bundler.ui.level = "warn" if options[:quiet]
warn_if_root
@@ -60,7 +60,7 @@ module Bundler
installer = Installer.install(Bundler.root, definition, options)
Bundler.settings.temporary(:cache_all_platforms => options[:local] ? false : Bundler.settings[:cache_all_platforms]) do
- Bundler.load.cache if Bundler.app_cache.exist? && !options["no-cache"] && !Bundler.frozen_bundle?
+ Bundler.load.cache(nil, options[:local]) if Bundler.app_cache.exist? && !options["no-cache"] && !Bundler.frozen_bundle?
end
Bundler.ui.confirm "Bundle complete! #{dependencies_count_for(definition)}, #{gems_installed_for(definition)}."
@@ -83,22 +83,9 @@ module Bundler
end
Bundler::CLI::Common.output_fund_metadata_summary
- rescue GemNotFound, VersionConflict => e
- if options[:local] && Bundler.app_cache.exist?
- Bundler.ui.warn "Some gems seem to be missing from your #{Bundler.settings.app_cache_path} directory."
- end
-
- unless Bundler.definition.has_rubygems_remotes?
- Bundler.ui.warn <<-WARN, :wrap => true
- Your Gemfile has no gem server sources. If you need gems that are \
- not already on your machine, add a line like this to your Gemfile:
- source 'https://rubygems.org'
- WARN
- end
- raise e
- rescue Gem::InvalidSpecificationException => e
+ rescue Gem::InvalidSpecificationException
Bundler.ui.warn "You have one or more invalid gemspecs that need to be fixed."
- raise e
+ raise
end
private
diff --git a/lib/bundler/cli/list.rb b/lib/bundler/cli/list.rb
index 66abd32650..f56bf5b86a 100644
--- a/lib/bundler/cli/list.rb
+++ b/lib/bundler/cli/list.rb
@@ -16,7 +16,13 @@ module Bundler
specs = if @only_group.any? || @without_group.any?
filtered_specs_by_groups
else
- Bundler.load.specs
+ begin
+ Bundler.load.specs
+ rescue GemNotFound => e
+ Bundler.ui.error e.message
+ Bundler.ui.warn "Install missing gems with `bundle install`."
+ exit 1
+ end
end.reject {|s| s.name == "bundler" }.sort_by(&:name)
return Bundler.ui.info "No gems in the Gemfile" if specs.empty?
diff --git a/lib/bundler/cli/open.rb b/lib/bundler/cli/open.rb
index df32e2f38b..ea504344f3 100644
--- a/lib/bundler/cli/open.rb
+++ b/lib/bundler/cli/open.rb
@@ -1,7 +1,5 @@
# frozen_string_literal: true
-require "shellwords"
-
module Bundler
class CLI::Open
attr_reader :options, :name
@@ -19,6 +17,7 @@ module Bundler
else
path = spec.full_gem_path
Dir.chdir(path) do
+ require "shellwords"
command = Shellwords.split(editor) + [path]
Bundler.with_original_env do
system(*command)
diff --git a/lib/bundler/cli/update.rb b/lib/bundler/cli/update.rb
index cf6a5b26d3..1adcaef67c 100644
--- a/lib/bundler/cli/update.rb
+++ b/lib/bundler/cli/update.rb
@@ -9,7 +9,7 @@ module Bundler
end
def run
- Bundler.ui.level = "error" if options[:quiet]
+ Bundler.ui.level = "warn" if options[:quiet]
Plugin.gemfile_install(Bundler.default_gemfile) if Bundler.feature_flag.plugins?
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb
index 94b8bc4057..f987d85f5b 100644
--- a/lib/bundler/definition.rb
+++ b/lib/bundler/definition.rb
@@ -133,7 +133,7 @@ module Bundler
@unlock[:gems] ||= @dependencies.map(&:name)
else
eager_unlock = expand_dependencies(@unlock[:gems] || [], true)
- @unlock[:gems] = @locked_specs.for(eager_unlock, false, false, false).map(&:name)
+ @unlock[:gems] = @locked_specs.for(eager_unlock, false, false).map(&:name)
end
@dependency_changes = converge_dependencies
@@ -185,15 +185,7 @@ module Bundler
#
# @return [Bundler::SpecSet]
def specs
- @specs ||= add_bundler_to(resolve.materialize(requested_dependencies))
- rescue GemNotFound => e # Handle yanked gem
- gem_name, gem_version = extract_gem_info(e)
- locked_gem = @locked_specs[gem_name].last
- raise if locked_gem.nil? || locked_gem.version.to_s != gem_version || !@remote
- raise GemNotFound, "Your bundle is locked to #{locked_gem} from #{locked_gem.source}, but that version can " \
- "no longer be found in that source. That means the author of #{locked_gem} has removed it. " \
- "You'll need to update your bundle to a version other than #{locked_gem} that hasn't been " \
- "removed in order to install."
+ @specs ||= materialize(requested_dependencies)
end
def new_specs
@@ -205,9 +197,7 @@ module Bundler
end
def missing_specs
- missing = []
- resolve.materialize(requested_dependencies, missing)
- missing
+ resolve.materialize(requested_dependencies).missing_specs
end
def missing_specs?
@@ -241,7 +231,7 @@ module Bundler
def specs_for(groups)
groups = requested_groups if groups.empty?
deps = dependencies_for(groups)
- add_bundler_to(resolve.materialize(expand_dependencies(deps)))
+ materialize(expand_dependencies(deps))
end
def dependencies_for(groups)
@@ -274,10 +264,6 @@ module Bundler
end
end
- def has_rubygems_remotes?
- sources.rubygems_sources.any? {|s| s.remotes.any? }
- end
-
def spec_git_paths
sources.git_sources.map {|s| File.realpath(s.path) if File.exist?(s.path) }.compact
end
@@ -493,7 +479,23 @@ module Bundler
private
- def add_bundler_to(specs)
+ def materialize(dependencies)
+ specs = resolve.materialize(dependencies)
+ missing_specs = specs.missing_specs
+
+ if missing_specs.any?
+ missing_specs.each do |s|
+ locked_gem = @locked_specs[s.name].last
+ next if locked_gem.nil? || locked_gem.version != s.version || !@remote
+ raise GemNotFound, "Your bundle is locked to #{locked_gem} from #{locked_gem.source}, but that version can " \
+ "no longer be found in that source. That means the author of #{locked_gem} has removed it. " \
+ "You'll need to update your bundle to a version other than #{locked_gem} that hasn't been " \
+ "removed in order to install."
+ end
+
+ raise GemNotFound, "Could not find #{missing_specs.map(&:full_name).join(", ")} in any of the sources"
+ end
+
unless specs["bundler"].any?
bundler = sources.metadata_source.specs.search(Gem::Dependency.new("bundler", VERSION)).last
specs["bundler"] = bundler
@@ -712,7 +714,7 @@ module Bundler
@locked_specs.each do |s|
# Replace the locked dependency's source with the equivalent source from the Gemfile
dep = @dependencies.find {|d| s.satisfies?(d) }
- s.source = (dep && dep.source) || sources.get(s.source)
+ s.source = (dep && dep.source) || sources.get(s.source) unless multisource_allowed?
# Don't add a spec to the list if its source is expired. For example,
# if you change a Git gem to RubyGems.
@@ -730,7 +732,7 @@ module Bundler
# if we won't need the source (according to the lockfile),
# don't error if the path/git source isn't available
next if @locked_specs.
- for(requested_dependencies, false, true, false).
+ for(requested_dependencies, false, true).
none? {|locked_spec| locked_spec.source == s.source }
raise
@@ -750,7 +752,7 @@ module Bundler
resolve = SpecSet.new(converged)
@locked_specs_incomplete_for_platform = !resolve.for(expand_dependencies(requested_dependencies & deps), true, true)
- resolve = SpecSet.new(resolve.for(expand_dependencies(deps, true), false, false, false).reject{|s| @unlock[:gems].include?(s.name) })
+ resolve = SpecSet.new(resolve.for(expand_dependencies(deps, true), false, false).reject{|s| @unlock[:gems].include?(s.name) })
diff = nil
# Now, we unlock any sources that do not have anymore gems pinned to it
@@ -854,12 +856,6 @@ module Bundler
current == proposed
end
- def extract_gem_info(error)
- # This method will extract the error message like "Could not find foo-1.2.3 in any of the sources"
- # to an array. The first element will be the gem name (e.g. foo), the second will be the version number.
- error.message.scan(/Could not find (\w+)-(\d+(?:\.\d+)+)/).flatten
- end
-
def compute_requires
dependencies.reduce({}) do |requires, dep|
next requires unless dep.should_include?
diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb
index ac955894a7..3517a109ed 100644
--- a/lib/bundler/dsl.rb
+++ b/lib/bundler/dsl.rb
@@ -447,8 +447,21 @@ repo_name ||= user_name
end
def check_rubygems_source_safety
- return unless @sources.aggregate_global_source?
+ if @sources.implicit_global_source?
+ implicit_global_source_warning
+ elsif @sources.aggregate_global_source?
+ multiple_global_source_warning
+ end
+ end
+
+ def implicit_global_source_warning
+ Bundler::SharedHelpers.major_deprecation 2, "This Gemfile does not include an explicit global source. " \
+ "Not using an explicit global source may result in a different lockfile being generated depending on " \
+ "the gems you have installed locally before bundler is run." \
+ "Instead, define a global source in your Gemfile like this: source \"https://rubygems.org\"."
+ end
+ def multiple_global_source_warning
if Bundler.feature_flag.bundler_3_mode?
msg = "This Gemfile contains multiple primary sources. " \
"Each source after the first must include a block to indicate which gems " \
diff --git a/lib/bundler/installer/gem_installer.rb b/lib/bundler/installer/gem_installer.rb
index 507fd1802c..1df86ccfbc 100644
--- a/lib/bundler/installer/gem_installer.rb
+++ b/lib/bundler/installer/gem_installer.rb
@@ -1,7 +1,5 @@
# frozen_string_literal: true
-require "shellwords"
-
module Bundler
class GemInstaller
attr_reader :spec, :standalone, :worker, :force, :installer
@@ -31,34 +29,23 @@ module Bundler
def specific_failure_message(e)
message = "#{e.class}: #{e.message}\n"
- message += " " + e.backtrace.join("\n ") + "\n\n" if Bundler.ui.debug?
+ message += " " + e.backtrace.join("\n ") + "\n\n"
message = message.lines.first + Bundler.ui.add_color(message.lines.drop(1).join, :clear)
message + Bundler.ui.add_color(failure_message, :red)
end
def failure_message
- return install_error_message if spec.source.options["git"]
- "#{install_error_message}\n#{gem_install_message}"
+ install_error_message
end
def install_error_message
"An error occurred while installing #{spec.name} (#{spec.version}), and Bundler cannot continue."
end
- def gem_install_message
- source = spec.source
- return unless source.respond_to?(:remotes)
-
- if source.remotes.size == 1
- "Make sure that `gem install #{spec.name} -v '#{spec.version}' --source '#{source.remotes.first}'` succeeds before bundling."
- else
- "Make sure that `gem install #{spec.name} -v '#{spec.version}'` succeeds before bundling."
- end
- end
-
def spec_settings
# Fetch the build settings, if there are any
if settings = Bundler.settings["build.#{spec.name}"]
+ require "shellwords"
Shellwords.shellsplit(settings)
end
end
diff --git a/lib/bundler/lockfile_parser.rb b/lib/bundler/lockfile_parser.rb
index afc21fd006..8d0e44d0ae 100644
--- a/lib/bundler/lockfile_parser.rb
+++ b/lib/bundler/lockfile_parser.rb
@@ -195,6 +195,7 @@ module Bundler
platform = platform ? Gem::Platform.new(platform) : Gem::Platform::RUBY
@current_spec = LazySpecification.new(name, version, platform)
@current_spec.source = @current_source
+ @current_source.add_dependency_names(name)
@specs[@current_spec.identifier] = @current_spec
elsif spaces.size == 6
diff --git a/lib/bundler/rubygems_gem_installer.rb b/lib/bundler/rubygems_gem_installer.rb
index f5f3c53309..8890582318 100644
--- a/lib/bundler/rubygems_gem_installer.rb
+++ b/lib/bundler/rubygems_gem_installer.rb
@@ -61,7 +61,10 @@ module Bundler
def build_extensions
extension_cache_path = options[:bundler_extension_cache_path]
- return super unless extension_cache_path && extension_dir = spec.extension_dir
+ unless extension_cache_path && extension_dir = spec.extension_dir
+ require "shellwords" # compensate missing require in rubygems before version 3.2.25
+ return super
+ end
extension_dir = Pathname.new(extension_dir)
build_complete = SharedHelpers.filesystem_access(extension_cache_path.join("gem.build_complete"), :read, &:file?)
@@ -71,6 +74,7 @@ module Bundler
FileUtils.cp_r extension_cache_path, spec.extension_dir
end
else
+ require "shellwords" # compensate missing require in rubygems before version 3.2.25
super
if extension_dir.directory? # not made for gems without extensions
SharedHelpers.filesystem_access(extension_cache_path.parent, &:mkpath)
diff --git a/lib/bundler/runtime.rb b/lib/bundler/runtime.rb
index 287fa1cfe9..fbb8833cfb 100644
--- a/lib/bundler/runtime.rb
+++ b/lib/bundler/runtime.rb
@@ -22,10 +22,6 @@ module Bundler
# Activate the specs
load_paths = specs.map do |spec|
- unless spec.loaded_from
- raise GemNotFound, "#{spec.full_name} is missing. Run `bundle install` to get it."
- end
-
check_for_activated_spec!(spec)
Bundler.rubygems.mark_loaded(spec)
@@ -104,7 +100,7 @@ module Bundler
alias_method :gems, :specs
- def cache(custom_path = nil)
+ def cache(custom_path = nil, local = false)
cache_path = Bundler.app_cache(custom_path)
SharedHelpers.filesystem_access(cache_path) do |p|
FileUtils.mkdir_p(p)
@@ -112,7 +108,20 @@ module Bundler
Bundler.ui.info "Updating files in #{Bundler.settings.app_cache_path}"
- specs_to_cache = Bundler.settings[:cache_all_platforms] ? @definition.resolve.materialized_for_all_platforms : specs
+ specs_to_cache = if Bundler.settings[:cache_all_platforms]
+ @definition.resolve.materialized_for_all_platforms
+ else
+ begin
+ specs
+ rescue GemNotFound
+ if local
+ Bundler.ui.warn "Some gems seem to be missing from your #{Bundler.settings.app_cache_path} directory."
+ end
+
+ raise
+ end
+ end
+
specs_to_cache.each do |spec|
next if spec.name == "bundler"
next if spec.source.is_a?(Source::Gemspec)
diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb
index de42cc16af..03126f616c 100644
--- a/lib/bundler/settings.rb
+++ b/lib/bundler/settings.rb
@@ -428,6 +428,8 @@ module Bundler
def global_config_file
if ENV["BUNDLE_CONFIG"] && !ENV["BUNDLE_CONFIG"].empty?
Pathname.new(ENV["BUNDLE_CONFIG"])
+ elsif ENV["BUNDLE_USER_CONFIG"] && !ENV["BUNDLE_USER_CONFIG"].empty?
+ Pathname.new(ENV["BUNDLE_USER_CONFIG"])
elsif Bundler.rubygems.user_home && !Bundler.rubygems.user_home.empty?
Pathname.new(Bundler.rubygems.user_home).join(".bundle/config")
end
diff --git a/lib/bundler/setup.rb b/lib/bundler/setup.rb
index 27911dc1ad..32e9b2d7c0 100644
--- a/lib/bundler/setup.rb
+++ b/lib/bundler/setup.rb
@@ -9,10 +9,10 @@ if Bundler::SharedHelpers.in_bundle?
begin
Bundler.ui.silence { Bundler.setup }
rescue Bundler::BundlerError => e
- Bundler.ui.warn "\e[31m#{e.message}\e[0m"
+ Bundler.ui.error e.message
Bundler.ui.warn e.backtrace.join("\n") if ENV["DEBUG"]
if e.is_a?(Bundler::GemNotFound)
- Bundler.ui.warn "\e[33mRun `bundle install` to install missing gems.\e[0m"
+ Bundler.ui.warn "Run `bundle install` to install missing gems."
end
exit e.status_code
end
diff --git a/lib/bundler/shared_helpers.rb b/lib/bundler/shared_helpers.rb
index 09b79acbf9..187dfe87a1 100644
--- a/lib/bundler/shared_helpers.rb
+++ b/lib/bundler/shared_helpers.rb
@@ -152,13 +152,6 @@ module Bundler
Bundler.ui.warn message
end
- def trap(signal, override = false, &block)
- prior = Signal.trap(signal) do
- block.call
- prior.call unless override
- end
- end
-
def ensure_same_dependencies(spec, old_deps, new_deps)
new_deps = new_deps.reject {|d| d.type == :development }
old_deps = old_deps.reject {|d| d.type == :development }
diff --git a/lib/bundler/source/git/git_proxy.rb b/lib/bundler/source/git/git_proxy.rb
index ae21770306..7555561edd 100644
--- a/lib/bundler/source/git/git_proxy.rb
+++ b/lib/bundler/source/git/git_proxy.rb
@@ -1,7 +1,5 @@
# frozen_string_literal: true
-require "shellwords"
-
module Bundler
class Source
class Git
@@ -224,6 +222,7 @@ module Bundler
end
def check_allowed(command)
+ require "shellwords"
command_with_no_credentials = URICredentialsFilter.credential_filtered_string("git #{command.shelljoin}", uri)
raise GitNotAllowedError.new(command_with_no_credentials) unless allow?
command_with_no_credentials
diff --git a/lib/bundler/source/rubygems.rb b/lib/bundler/source/rubygems.rb
index 43b193cf1c..858a69a48b 100644
--- a/lib/bundler/source/rubygems.rb
+++ b/lib/bundler/source/rubygems.rb
@@ -71,6 +71,10 @@ module Bundler
@remotes.size > 1
end
+ def no_remotes?
+ @remotes.size == 0
+ end
+
def can_lock?(spec)
return super unless multiple_remotes?
include?(spec.source)
diff --git a/lib/bundler/source_list.rb b/lib/bundler/source_list.rb
index 113d49ba72..d6310b78c0 100644
--- a/lib/bundler/source_list.rb
+++ b/lib/bundler/source_list.rb
@@ -37,6 +37,10 @@ module Bundler
global_rubygems_source.multiple_remotes?
end
+ def implicit_global_source?
+ global_rubygems_source.no_remotes?
+ end
+
def add_path_source(options = {})
if options["gemspec"]
add_source_to_list Source::Gemspec.new(options), path_sources
@@ -117,7 +121,8 @@ module Bundler
def replace_sources!(replacement_sources)
return false if replacement_sources.empty?
- @path_sources, @git_sources, @plugin_sources = map_sources(replacement_sources)
+ @rubygems_sources, @path_sources, @git_sources, @plugin_sources = map_sources(replacement_sources)
+ @global_rubygems_source = global_replacement_source(replacement_sources)
different_sources?(lock_sources, replacement_sources)
end
@@ -152,13 +157,21 @@ module Bundler
end
def map_sources(replacement_sources)
- [path_sources, git_sources, plugin_sources].map do |sources|
+ [@rubygems_sources, @path_sources, @git_sources, @plugin_sources].map do |sources|
sources.map do |source|
replacement_sources.find {|s| s == source } || source
end
end
end
+ def global_replacement_source(replacement_sources)
+ replacement_source = replacement_sources.find {|s| s == global_rubygems_source }
+ return global_rubygems_source unless replacement_source
+
+ replacement_source.local!
+ replacement_source
+ end
+
def different_sources?(lock_sources, replacement_sources)
!equal_sources?(lock_sources, replacement_sources) && !equivalent_sources?(lock_sources, replacement_sources)
end
@@ -202,7 +215,7 @@ module Bundler
end
def equal_source?(source, other_source)
- return source.include?(other_source) if source.is_a?(Source::Rubygems) && other_source.is_a?(Source::Rubygems) && !merged_gem_lockfile_sections?
+ return source.include?(other_source) if source.is_a?(Source::Rubygems) && other_source.is_a?(Source::Rubygems)
source == other_source
end
diff --git a/lib/bundler/spec_set.rb b/lib/bundler/spec_set.rb
index 1a8906c47e..7be4fcca87 100644
--- a/lib/bundler/spec_set.rb
+++ b/lib/bundler/spec_set.rb
@@ -11,7 +11,7 @@ module Bundler
@specs = specs
end
- def for(dependencies, check = false, match_current_platform = false, raise_on_missing = true)
+ def for(dependencies, check = false, match_current_platform = false)
handled = []
deps = dependencies.dup
specs = []
@@ -33,11 +33,6 @@ module Bundler
end
elsif check
return false
- elsif raise_on_missing
- others = lookup[dep.name] if match_current_platform
- message = "Unable to find a spec satisfying #{dep} in the set. Perhaps the lockfile is corrupted?"
- message += " Found #{others.join(", ")} that did not match the current platform." if others && !others.empty?
- raise GemNotFound, message
end
end
@@ -71,52 +66,35 @@ module Bundler
lookup.dup
end
- def materialize(deps, missing_specs = nil)
- materialized = self.for(deps, false, true, !missing_specs)
-
- materialized.group_by(&:source).each do |source, specs|
- next unless specs.any?{|s| s.is_a?(LazySpecification) }
-
- source.local!
- names = -> { specs.map(&:name).uniq }
- source.double_check_for(names)
- end
+ def materialize(deps)
+ materialized = self.for(deps, false, true)
materialized.map! do |s|
next s unless s.is_a?(LazySpecification)
- spec = s.__materialize__
- unless spec
- unless missing_specs
- raise GemNotFound, "Could not find #{s.full_name} in any of the sources"
- end
- missing_specs << s
- end
- spec
+ s.source.local!
+ s.__materialize__ || s
end
- SpecSet.new(missing_specs ? materialized.compact : materialized)
+ SpecSet.new(materialized)
end
# Materialize for all the specs in the spec set, regardless of what platform they're for
# This is in contrast to how for does platform filtering (and specifically different from how `materialize` calls `for` only for the current platform)
# @return [Array<Gem::Specification>]
def materialized_for_all_platforms
- @specs.group_by(&:source).each do |source, specs|
- next unless specs.any?{|s| s.is_a?(LazySpecification) }
-
- source.local!
- source.remote!
- names = -> { specs.map(&:name).uniq }
- source.double_check_for(names)
- end
-
@specs.map do |s|
next s unless s.is_a?(LazySpecification)
+ s.source.local!
+ s.source.remote!
spec = s.__materialize__
raise GemNotFound, "Could not find #{s.full_name} in any of the sources" unless spec
spec
end
end
+ def missing_specs
+ @specs.select {|s| s.is_a?(LazySpecification) }
+ end
+
def merge(set)
arr = sorted.dup
set.each do |set_spec|
diff --git a/lib/bundler/templates/Executable.bundler b/lib/bundler/templates/Executable.bundler
index 69f26bb9c0..8009412ea2 100644
--- a/lib/bundler/templates/Executable.bundler
+++ b/lib/bundler/templates/Executable.bundler
@@ -60,16 +60,16 @@ m = Module.new do
Regexp.last_match(1)
end
- def bundler_version
- @bundler_version ||=
+ def bundler_requirement
+ @bundler_requirement ||=
env_var_version || cli_arg_version ||
- lockfile_version
+ bundler_requirement_for(lockfile_version)
end
- def bundler_requirement
- return "#{Gem::Requirement.default}.a" unless bundler_version
+ def bundler_requirement_for(version)
+ return "#{Gem::Requirement.default}.a" unless version
- bundler_gem_version = Gem::Version.new(bundler_version)
+ bundler_gem_version = Gem::Version.new(version)
requirement = bundler_gem_version.approximate_recommendation
diff --git a/lib/bundler/version.rb b/lib/bundler/version.rb
index c4f92994ff..4447aa401e 100644
--- a/lib/bundler/version.rb
+++ b/lib/bundler/version.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: false
module Bundler
- VERSION = "2.2.24".freeze
+ VERSION = "2.2.25".freeze
def self.bundler_major_version
@bundler_major_version ||= VERSION.split(".").first.to_i
diff --git a/lib/bundler/worker.rb b/lib/bundler/worker.rb
index 10139ed25b..ffa095b228 100644
--- a/lib/bundler/worker.rb
+++ b/lib/bundler/worker.rb
@@ -26,7 +26,7 @@ module Bundler
@func = func
@size = size
@threads = nil
- SharedHelpers.trap("INT") { abort_threads }
+ @previous_interrupt_handler = nil
end
# Enqueue a request to be executed in the worker pool
@@ -68,13 +68,16 @@ module Bundler
# so as worker threads after retrieving it, shut themselves down
def stop_threads
return unless @threads
+
@threads.each { @request_queue.enq POISON }
@threads.each(&:join)
+
+ remove_interrupt_handler
+
@threads = nil
end
def abort_threads
- return unless @threads
Bundler.ui.debug("\n#{caller.join("\n")}")
@threads.each(&:exit)
exit 1
@@ -94,11 +97,23 @@ module Bundler
end
end.compact
+ add_interrupt_handler unless @threads.empty?
+
return if creation_errors.empty?
message = "Failed to create threads for the #{name} worker: #{creation_errors.map(&:to_s).uniq.join(", ")}"
raise ThreadCreationError, message if @threads.empty?
Bundler.ui.info message
end
+
+ def add_interrupt_handler
+ @previous_interrupt_handler = trap("INT") { abort_threads }
+ end
+
+ def remove_interrupt_handler
+ return unless @previous_interrupt_handler
+
+ trap "INT", @previous_interrupt_handler
+ end
end
end
diff --git a/lib/rubygems.rb b/lib/rubygems.rb
index 2216e59d17..900f98542e 100644
--- a/lib/rubygems.rb
+++ b/lib/rubygems.rb
@@ -8,7 +8,7 @@
require 'rbconfig'
module Gem
- VERSION = "3.2.24".freeze
+ VERSION = "3.2.25".freeze
end
# Must be first since it unloads the prelude from 1.9.2
@@ -628,12 +628,6 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
rescue ::LoadError
# If we can't load psych, that's fine, go on.
else
- # If 'yaml' has already been required, then we have to
- # be sure to switch it over to the newly loaded psych.
- if defined?(YAML::ENGINE) && YAML::ENGINE.yamler != "psych"
- YAML::ENGINE.yamler = "psych"
- end
-
require 'rubygems/psych_additions'
require 'rubygems/psych_tree'
end
@@ -641,10 +635,6 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
require 'yaml'
require 'rubygems/safe_yaml'
- # Now that we're sure some kind of yaml library is loaded, pull
- # in our hack to deal with Syck's DefaultKey ugliness.
- require 'rubygems/syck_hack'
-
@yaml_loaded = true
end
diff --git a/lib/rubygems/config_file.rb b/lib/rubygems/config_file.rb
index 3746d7aab0..02bb2be122 100644
--- a/lib/rubygems/config_file.rb
+++ b/lib/rubygems/config_file.rb
@@ -320,7 +320,8 @@ if you believe they were disclosed to a third party.
config = load_file(credentials_path).merge(host => api_key)
dirname = File.dirname credentials_path
- FileUtils.mkdir_p(dirname) unless File.exist? dirname
+ require 'fileutils'
+ FileUtils.mkdir_p(dirname)
Gem.load_yaml
@@ -457,9 +458,8 @@ if you believe they were disclosed to a third party.
# Writes out this config file, replacing its source.
def write
- unless File.exist?(File.dirname(config_file_name))
- FileUtils.mkdir_p File.dirname(config_file_name)
- end
+ require 'fileutils'
+ FileUtils.mkdir_p File.dirname(config_file_name)
File.open config_file_name, 'w' do |io|
io.write to_yaml
diff --git a/lib/rubygems/ext/builder.rb b/lib/rubygems/ext/builder.rb
index e4af450565..2b46bb1356 100644
--- a/lib/rubygems/ext/builder.rb
+++ b/lib/rubygems/ext/builder.rb
@@ -57,6 +57,7 @@ class Gem::Ext::Builder
p(command)
end
results << "current directory: #{dir}"
+ require "shellwords"
results << command.shelljoin
require "open3"
diff --git a/lib/rubygems/ext/ext_conf_builder.rb b/lib/rubygems/ext/ext_conf_builder.rb
index 1f73796351..3ca3463615 100644
--- a/lib/rubygems/ext/ext_conf_builder.rb
+++ b/lib/rubygems/ext/ext_conf_builder.rb
@@ -5,8 +5,6 @@
# See LICENSE.txt for permissions.
#++
-require 'shellwords'
-
class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder
def self.build(extension, dest_path, results, args=[], lib_dir=nil, extension_dir=Dir.pwd)
require 'fileutils'
@@ -40,6 +38,7 @@ class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder
begin
# workaround for https://github.com/oracle/truffleruby/issues/2115
siteconf_path = RUBY_ENGINE == "truffleruby" ? siteconf.path.dup : siteconf.path
+ require "shellwords"
cmd = Gem.ruby.shellsplit << "-I" << File.expand_path("../../..", __FILE__) <<
"-r" << get_relative_path(siteconf_path, extension_dir) << File.basename(extension)
cmd.push(*args)
diff --git a/lib/rubygems/ext/rake_builder.rb b/lib/rubygems/ext/rake_builder.rb
index 64a6c0eb80..fed98e741c 100644
--- a/lib/rubygems/ext/rake_builder.rb
+++ b/lib/rubygems/ext/rake_builder.rb
@@ -5,8 +5,6 @@
# See LICENSE.txt for permissions.
#++
-require "shellwords"
-
class Gem::Ext::RakeBuilder < Gem::Ext::Builder
def self.build(extension, dest_path, results, args=[], lib_dir=nil, extension_dir=Dir.pwd)
if File.basename(extension) =~ /mkrf_conf/i
@@ -16,6 +14,7 @@ class Gem::Ext::RakeBuilder < Gem::Ext::Builder
rake = ENV['rake']
if rake
+ require "shellwords"
rake = rake.shellsplit
else
begin
diff --git a/lib/rubygems/remote_fetcher.rb b/lib/rubygems/remote_fetcher.rb
index da7b46e06e..7c2db12dc1 100644
--- a/lib/rubygems/remote_fetcher.rb
+++ b/lib/rubygems/remote_fetcher.rb
@@ -6,7 +6,6 @@ require 'rubygems/s3_uri_signer'
require 'rubygems/uri_formatter'
require 'rubygems/uri_parsing'
require 'rubygems/user_interaction'
-require 'resolv'
##
# RemoteFetcher handles the details of fetching gems and gem information from
diff --git a/lib/rubygems/requirement.rb b/lib/rubygems/requirement.rb
index 6721de4055..16de45ad91 100644
--- a/lib/rubygems/requirement.rb
+++ b/lib/rubygems/requirement.rb
@@ -194,24 +194,19 @@ class Gem::Requirement
end
def marshal_dump # :nodoc:
- fix_syck_default_key_in_requirements
-
[@requirements]
end
def marshal_load(array) # :nodoc:
@requirements = array[0]
- fix_syck_default_key_in_requirements
+ raise TypeError, "wrong @requirements" unless Array === @requirements
end
def yaml_initialize(tag, vals) # :nodoc:
vals.each do |ivar, val|
instance_variable_set "@#{ivar}", val
end
-
- Gem.load_yaml
- fix_syck_default_key_in_requirements
end
def init_with(coder) # :nodoc:
@@ -246,8 +241,7 @@ class Gem::Requirement
def satisfied_by?(version)
raise ArgumentError, "Need a Gem::Version: #{version.inspect}" unless
Gem::Version === version
- # #28965: syck has a bug with unquoted '=' YAML.loading as YAML::DefaultKey
- requirements.all? {|op, rv| (OPS[op] || OPS["="]).call version, rv }
+ requirements.all? {|op, rv| OPS[op].call version, rv }
end
alias :=== :satisfied_by?
@@ -289,19 +283,6 @@ class Gem::Requirement
def _tilde_requirements
@_tilde_requirements ||= _sorted_requirements.select {|r| r.first == "~>" }
end
-
- private
-
- def fix_syck_default_key_in_requirements # :nodoc:
- Gem.load_yaml
-
- # Fixup the Syck DefaultKey bug
- @requirements.each do |r|
- if r[0].kind_of? Gem::SyckDefaultKey
- r[0] = "="
- end
- end
- end
end
class Gem::Version
diff --git a/lib/rubygems/s3_uri_signer.rb b/lib/rubygems/s3_uri_signer.rb
index f1f9229ca5..bba9afc9ff 100644
--- a/lib/rubygems/s3_uri_signer.rb
+++ b/lib/rubygems/s3_uri_signer.rb
@@ -1,4 +1,3 @@
-require 'base64'
require 'digest'
require 'rubygems/openssl'
diff --git a/lib/rubygems/safe_yaml.rb b/lib/rubygems/safe_yaml.rb
index 29312ad5a1..e905052e1c 100644
--- a/lib/rubygems/safe_yaml.rb
+++ b/lib/rubygems/safe_yaml.rb
@@ -17,8 +17,6 @@ module Gem
Gem::Specification
Gem::Version
Gem::Version::Requirement
- YAML::Syck::DefaultKey
- Syck::DefaultKey
].freeze
PERMITTED_SYMBOLS = %w[
diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb
index 23a37e966b..ae16dce885 100644
--- a/lib/rubygems/specification.rb
+++ b/lib/rubygems/specification.rb
@@ -1690,12 +1690,6 @@ class Gem::Specification < Gem::BasicSpecification
when String then
if DateTimeFormat =~ date
Time.utc($1.to_i, $2.to_i, $3.to_i)
-
- # Workaround for where the date format output from psych isn't
- # parsed as a Time object by syck and thus comes through as a
- # string.
- elsif /\A(\d{4})-(\d{2})-(\d{2}) \d{2}:\d{2}:\d{2}\.\d+?Z\z/ =~ date
- Time.utc($1.to_i, $2.to_i, $3.to_i)
else
raise(Gem::InvalidSpecificationException,
"invalid date format in specification: #{date.inspect}")
diff --git a/lib/rubygems/syck_hack.rb b/lib/rubygems/syck_hack.rb
deleted file mode 100644
index 051483eac8..0000000000
--- a/lib/rubygems/syck_hack.rb
+++ /dev/null
@@ -1,77 +0,0 @@
-# frozen_string_literal: true
-# :stopdoc:
-
-# Hack to handle syck's DefaultKey bug
-#
-# This file is always loaded AFTER either syck or psych are already
-# loaded. It then looks at what constants are available and creates
-# a consistent view on all rubys.
-#
-# All this is so that there is always a YAML::Syck::DefaultKey
-# class no matter if the full yaml library has loaded or not.
-#
-
-module YAML # :nodoc:
- # In newer 1.9.2, there is a Syck toplevel constant instead of it
- # being underneath YAML. If so, reference it back under YAML as
- # well.
- if defined? ::Syck
- # for tests that change YAML::ENGINE
- # 1.8 does not support the second argument to const_defined?
- remove_const :Syck rescue nil
-
- Syck = ::Syck
-
- # JRuby's "Syck" is called "Yecht"
- elsif defined? YAML::Yecht
- Syck = YAML::Yecht
-
- # Otherwise, if there is no YAML::Syck, then we've got just psych
- # loaded, so lets define a stub for DefaultKey.
- elsif !defined? YAML::Syck
- module Syck
- class DefaultKey # :nodoc:
- end
- end
- end
-
- # Now that we've got something that is always here, define #to_s
- # so when code tries to use this, it at least just shows up like it
- # should.
- module Syck
- class DefaultKey
- remove_method :to_s rescue nil
-
- def to_s
- '='
- end
- end
- end
-
- SyntaxError = Error unless defined? SyntaxError
-end
-
-# Sometime in the 1.9 dev cycle, the Syck constant was moved from under YAML
-# to be a toplevel constant. So gemspecs created under these versions of Syck
-# will have references to Syck::DefaultKey.
-#
-# So we need to be sure that we reference Syck at the toplevel too so that
-# we can always load these kind of gemspecs.
-#
-if !defined?(Syck)
- Syck = YAML::Syck
-end
-
-# Now that we've got Syck setup in all the right places, store
-# a reference to the DefaultKey class inside Gem. We do this so that
-# if later on YAML, etc are redefined, we've still got a consistent
-# place to find the DefaultKey class for comparison.
-
-module Gem
- # for tests that change YAML::ENGINE
- remove_const :SyckDefaultKey if const_defined? :SyckDefaultKey
-
- SyckDefaultKey = YAML::Syck::DefaultKey
-end
-
-# :startdoc:
diff --git a/spec/bundler/bundler/cli_spec.rb b/spec/bundler/bundler/cli_spec.rb
index cc8949d27d..c9dd101f55 100644
--- a/spec/bundler/bundler/cli_spec.rb
+++ b/spec/bundler/bundler/cli_spec.rb
@@ -129,18 +129,18 @@ RSpec.describe "bundle executable" do
context "with --verbose" do
it "prints the running command" do
- gemfile ""
+ gemfile "source \"#{file_uri_for(gem_repo1)}\""
bundle "info bundler", :verbose => true
expect(out).to start_with("Running `bundle info bundler --verbose` with bundler #{Bundler::VERSION}")
end
it "doesn't print defaults" do
- install_gemfile "", :verbose => true
+ install_gemfile "source \"#{file_uri_for(gem_repo1)}\"", :verbose => true
expect(out).to start_with("Running `bundle install --verbose` with bundler #{Bundler::VERSION}")
end
it "doesn't print defaults" do
- install_gemfile "", :verbose => true
+ install_gemfile "source \"#{file_uri_for(gem_repo1)}\"", :verbose => true
expect(out).to start_with("Running `bundle install --verbose` with bundler #{Bundler::VERSION}")
end
end
diff --git a/spec/bundler/bundler/dsl_spec.rb b/spec/bundler/bundler/dsl_spec.rb
index a47dd6e399..e6cd43ab59 100644
--- a/spec/bundler/bundler/dsl_spec.rb
+++ b/spec/bundler/bundler/dsl_spec.rb
@@ -241,4 +241,21 @@ RSpec.describe Bundler::Dsl do
end
end
end
+
+ describe "#check_primary_source_safety" do
+ context "when a global source is not defined implicitly" do
+ it "will raise a major deprecation warning" do
+ not_a_global_source = double("not-a-global-source", :no_remotes? => true)
+ allow(Bundler::Source::Rubygems).to receive(:new).and_return(not_a_global_source)
+
+ warning = "This Gemfile does not include an explicit global source. " \
+ "Not using an explicit global source may result in a different lockfile being generated depending on " \
+ "the gems you have installed locally before bundler is run." \
+ "Instead, define a global source in your Gemfile like this: source \"https://rubygems.org\"."
+ expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(2, warning)
+
+ subject.check_primary_source_safety
+ end
+ end
+ end
end
diff --git a/spec/bundler/bundler/env_spec.rb b/spec/bundler/bundler/env_spec.rb
index ccdfd27276..513c42ac09 100644
--- a/spec/bundler/bundler/env_spec.rb
+++ b/spec/bundler/bundler/env_spec.rb
@@ -73,7 +73,7 @@ RSpec.describe Bundler::Env do
context "when there is a Gemfile and a lockfile and print_gemfile is true" do
before do
- gemfile "gem 'rack', '1.0.0'"
+ gemfile "source \"#{file_uri_for(gem_repo1)}\"; gem 'rack', '1.0.0'"
lockfile <<-L
GEM
@@ -137,7 +137,7 @@ RSpec.describe Bundler::Env do
end
before do
- gemfile("gemspec")
+ gemfile("source \"#{file_uri_for(gem_repo1)}\"; gemspec")
File.open(bundled_app.join("foo.gemspec"), "wb") do |f|
f.write(gemspec)
diff --git a/spec/bundler/bundler/plugin/index_spec.rb b/spec/bundler/bundler/plugin/index_spec.rb
index bf32c3e2ba..d34b0de342 100644
--- a/spec/bundler/bundler/plugin/index_spec.rb
+++ b/spec/bundler/bundler/plugin/index_spec.rb
@@ -5,7 +5,7 @@ RSpec.describe Bundler::Plugin::Index do
before do
allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile)
- gemfile ""
+ gemfile "source \"#{file_uri_for(gem_repo1)}\""
path = lib_path(plugin_name)
index.register_plugin("new-plugin", path.to_s, [path.join("lib").to_s], commands, sources, hooks)
end
diff --git a/spec/bundler/bundler/source/rubygems_spec.rb b/spec/bundler/bundler/source/rubygems_spec.rb
index 7c457a7265..884fa81046 100644
--- a/spec/bundler/bundler/source/rubygems_spec.rb
+++ b/spec/bundler/bundler/source/rubygems_spec.rb
@@ -30,4 +30,18 @@ RSpec.describe Bundler::Source::Rubygems do
end
end
end
+
+ describe "#no_remotes?" do
+ context "when no remote provided" do
+ it "returns a truthy value" do
+ expect(described_class.new("remotes" => []).no_remotes?).to be_truthy
+ end
+ end
+
+ context "when a remote provided" do
+ it "returns a falsey value" do
+ expect(described_class.new("remotes" => ["https://rubygems.org"]).no_remotes?).to be_falsey
+ end
+ end
+ end
end
diff --git a/spec/bundler/bundler/source_list_spec.rb b/spec/bundler/bundler/source_list_spec.rb
index c2d1978b29..f860e9ff58 100644
--- a/spec/bundler/bundler/source_list_spec.rb
+++ b/spec/bundler/bundler/source_list_spec.rb
@@ -441,4 +441,19 @@ RSpec.describe Bundler::SourceList do
source_list.remote!
end
end
+
+ describe "implicit_global_source?" do
+ context "when a global rubygem source provided" do
+ it "returns a falsy value" do
+ source_list.add_global_rubygems_remote("https://rubygems.org")
+
+ expect(source_list.implicit_global_source?).to be_falsey
+ end
+ end
+ context "when no global rubygem source provided" do
+ it "returns a truthy value" do
+ expect(source_list.implicit_global_source?).to be_truthy
+ end
+ end
+ end
end
diff --git a/spec/bundler/bundler/worker_spec.rb b/spec/bundler/bundler/worker_spec.rb
index 2e5642709d..e4ebbd2932 100644
--- a/spec/bundler/bundler/worker_spec.rb
+++ b/spec/bundler/bundler/worker_spec.rb
@@ -19,4 +19,51 @@ RSpec.describe Bundler::Worker do
end
end
end
+
+ describe "handling interrupts" do
+ let(:status) do
+ pid = Process.fork do
+ $stderr.reopen File.new("/dev/null", "w")
+ Signal.trap "INT", previous_interrupt_handler
+ subject.enq "a"
+ subject.stop unless interrupt_before_stopping
+ Process.kill "INT", Process.pid
+ end
+
+ Process.wait2(pid).last
+ end
+
+ before do
+ skip "requires Process.fork" unless Process.respond_to?(:fork)
+ end
+
+ context "when interrupted before stopping" do
+ let(:interrupt_before_stopping) { true }
+ let(:previous_interrupt_handler) { ->(*) { exit 0 } }
+
+ it "aborts" do
+ expect(status.exitstatus).to eq(1)
+ end
+ end
+
+ context "when interrupted after stopping" do
+ let(:interrupt_before_stopping) { false }
+
+ context "when the previous interrupt handler was the default" do
+ let(:previous_interrupt_handler) { "DEFAULT" }
+
+ it "uses the default interrupt handler" do
+ expect(status).to be_signaled
+ end
+ end
+
+ context "when the previous interrupt handler was customized" do
+ let(:previous_interrupt_handler) { ->(*) { exit 42 } }
+
+ it "restores the custom interrupt handler after stopping" do
+ expect(status.exitstatus).to eq(42)
+ end
+ end
+ end
+ end
end
diff --git a/spec/bundler/cache/gems_spec.rb b/spec/bundler/cache/gems_spec.rb
index 161ec64218..72e372fb41 100644
--- a/spec/bundler/cache/gems_spec.rb
+++ b/spec/bundler/cache/gems_spec.rb
@@ -4,6 +4,7 @@ RSpec.describe "bundle cache" do
shared_examples_for "when there are only gemsources" do
before :each do
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem 'rack'
G
@@ -39,6 +40,7 @@ RSpec.describe "bundle cache" do
end
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "rack"
G
@@ -49,6 +51,7 @@ RSpec.describe "bundle cache" do
system_gems "rack-1.0.0", :path => default_bundle_path
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "rack"
G
@@ -64,6 +67,7 @@ RSpec.describe "bundle cache" do
cache_gems "rack-1.0.0"
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "rack"
G
@@ -100,7 +104,7 @@ RSpec.describe "bundle cache" do
it "uses builtin gems when installing to system gems" do
bundle "config set path.system true"
- install_gemfile %(gem 'builtin_gem', '1.0.2')
+ install_gemfile %(source "#{file_uri_for(gem_repo1)}"; gem 'builtin_gem', '1.0.2')
expect(the_bundle).to include_gems("builtin_gem 1.0.2")
end
@@ -134,6 +138,7 @@ RSpec.describe "bundle cache" do
bundle "config set path.system true"
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem 'builtin_gem', '1.0.2'
G
@@ -302,6 +307,7 @@ RSpec.describe "bundle cache" do
:path => bundled_app("vendor/cache")
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo-bundler"
G
diff --git a/spec/bundler/cache/git_spec.rb b/spec/bundler/cache/git_spec.rb
index 25f12a9e87..b88993e9b1 100644
--- a/spec/bundler/cache/git_spec.rb
+++ b/spec/bundler/cache/git_spec.rb
@@ -18,6 +18,7 @@ RSpec.describe "bundle cache with git" do
ref = git.ref_for("master", 11)
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :git => '#{lib_path("foo-1.0")}'
G
@@ -36,6 +37,7 @@ RSpec.describe "bundle cache with git" do
ref = git.ref_for("master", 11)
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :git => '#{lib_path("foo-1.0")}'
G
@@ -55,6 +57,7 @@ RSpec.describe "bundle cache with git" do
build_git "foo"
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :git => '#{lib_path("foo-1.0")}'
G
@@ -72,6 +75,7 @@ RSpec.describe "bundle cache with git" do
old_ref = git.ref_for("master", 11)
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :git => '#{lib_path("foo-1.0")}'
G
@@ -102,6 +106,7 @@ RSpec.describe "bundle cache with git" do
old_ref = git.ref_for("master", 11)
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :git => '#{lib_path("foo-1.0")}'
G
@@ -130,6 +135,7 @@ RSpec.describe "bundle cache with git" do
ref = git.ref_for("master", 11)
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :git => '#{lib_path("foo-invalid")}', :branch => :master
G
@@ -160,6 +166,7 @@ RSpec.describe "bundle cache with git" do
sys_exec "git commit -m \"submodulator\"", :dir => lib_path("has_submodule-1.0")
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
git "#{lib_path("has_submodule-1.0")}", :submodules => true do
gem "has_submodule"
end
@@ -183,6 +190,7 @@ RSpec.describe "bundle cache with git" do
update_git("foo") {|s| s.write "foo.gemspec", spec_lines.join("\n") }
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :git => '#{lib_path("foo-1.0")}'
G
bundle "config set cache_all true"
@@ -197,6 +205,7 @@ RSpec.describe "bundle cache with git" do
build_git "foo"
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :git => '#{lib_path("foo-1.0")}'
G
bundle "config set cache_all true"
diff --git a/spec/bundler/cache/path_spec.rb b/spec/bundler/cache/path_spec.rb
index c81dda7405..2ad136a008 100644
--- a/spec/bundler/cache/path_spec.rb
+++ b/spec/bundler/cache/path_spec.rb
@@ -5,6 +5,7 @@ RSpec.describe "bundle cache with path" do
build_lib "foo", :path => bundled_app("lib/foo")
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :path => '#{bundled_app("lib/foo")}'
G
@@ -18,6 +19,7 @@ RSpec.describe "bundle cache with path" do
build_lib "foo"
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :path => '#{lib_path("foo-1.0")}'
G
@@ -36,6 +38,7 @@ RSpec.describe "bundle cache with path" do
build_lib libname, :path => libpath
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "#{libname}", :path => '#{libpath}'
G
@@ -51,6 +54,7 @@ RSpec.describe "bundle cache with path" do
build_lib "foo"
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :path => '#{lib_path("foo-1.0")}'
G
@@ -73,6 +77,7 @@ RSpec.describe "bundle cache with path" do
build_lib "foo"
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :path => '#{lib_path("foo-1.0")}'
G
@@ -84,6 +89,7 @@ RSpec.describe "bundle cache with path" do
build_lib "bar"
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "bar", :path => '#{lib_path("bar-1.0")}'
G
@@ -95,6 +101,7 @@ RSpec.describe "bundle cache with path" do
build_lib "foo"
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :path => '#{lib_path("foo-1.0")}'
G
@@ -107,6 +114,7 @@ RSpec.describe "bundle cache with path" do
build_lib "foo"
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :path => '#{lib_path("foo-1.0")}'
G
@@ -119,6 +127,7 @@ RSpec.describe "bundle cache with path" do
build_lib "foo"
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :path => '#{lib_path("foo-1.0")}'
G
@@ -127,6 +136,7 @@ RSpec.describe "bundle cache with path" do
build_lib "bar"
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :path => '#{lib_path("foo-1.0")}'
gem "bar", :path => '#{lib_path("bar-1.0")}'
G
@@ -139,6 +149,7 @@ RSpec.describe "bundle cache with path" do
build_lib "foo"
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :path => '#{lib_path("foo-1.0")}'
G
@@ -147,6 +158,7 @@ RSpec.describe "bundle cache with path" do
build_lib "baz"
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :path => '#{lib_path("foo-1.0")}'
gem "baz", :path => '#{lib_path("baz-1.0")}'
G
diff --git a/spec/bundler/commands/binstubs_spec.rb b/spec/bundler/commands/binstubs_spec.rb
index 3b177b32ea..fb5da98bf3 100644
--- a/spec/bundler/commands/binstubs_spec.rb
+++ b/spec/bundler/commands/binstubs_spec.rb
@@ -140,8 +140,15 @@ RSpec.describe "bundle binstubs <gem>" do
it "runs the correct version of bundler" do
sys_exec "bin/bundle install", :env => { "BUNDLER_VERSION" => "999.999.999" }, :raise_on_error => false
expect(exitstatus).to eq(42)
- expect(err).to include("Activating bundler (~> 999.999) failed:").
- and include("To install the version of bundler this project requires, run `gem install bundler -v '~> 999.999'`")
+ expect(err).to include("Activating bundler (999.999.999) failed:").
+ and include("To install the version of bundler this project requires, run `gem install bundler -v '999.999.999'`")
+ end
+
+ it "runs the correct version of bundler even if a higher version is installed" do
+ system_gems "bundler-999.999.998", "bundler-999.999.999"
+
+ sys_exec "bin/bundle install", :env => { "BUNDLER_VERSION" => "999.999.998", "DEBUG" => "1" }, :raise_on_error => false
+ expect(out).to include %(Using bundler 999.999.998\n)
end
end
@@ -215,8 +222,8 @@ RSpec.describe "bundle binstubs <gem>" do
it "calls through to the explicit bundler version" do
sys_exec "bin/bundle update --bundler=999.999.999", :raise_on_error => false
expect(exitstatus).to eq(42)
- expect(err).to include("Activating bundler (~> 999.999) failed:").
- and include("To install the version of bundler this project requires, run `gem install bundler -v '~> 999.999'`")
+ expect(err).to include("Activating bundler (999.999.999) failed:").
+ and include("To install the version of bundler this project requires, run `gem install bundler -v '999.999.999'`")
end
end
@@ -254,6 +261,7 @@ RSpec.describe "bundle binstubs <gem>" do
s.executables = %w[foo]
end
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :git => "#{lib_path("foo")}"
G
@@ -269,6 +277,7 @@ RSpec.describe "bundle binstubs <gem>" do
s.executables = %w[foo]
end
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :path => "#{lib_path("foo")}"
G
diff --git a/spec/bundler/commands/check_spec.rb b/spec/bundler/commands/check_spec.rb
index 88950cef85..c48220f8df 100644
--- a/spec/bundler/commands/check_spec.rb
+++ b/spec/bundler/commands/check_spec.rb
@@ -319,6 +319,7 @@ RSpec.describe "bundle check" do
describe "when using only scoped rubygems sources" do
before do
gemfile <<~G
+ source "#{file_uri_for(gem_repo2)}"
source "#{file_uri_for(gem_repo1)}" do
gem "rack"
end
@@ -343,6 +344,7 @@ RSpec.describe "bundle check" do
end
gemfile <<~G
+ source "#{file_uri_for(gem_repo1)}"
source "#{file_uri_for(gem_repo4)}" do
gem "depends_on_rack"
end
@@ -355,6 +357,7 @@ RSpec.describe "bundle check" do
expect(out).to include("The Gemfile's dependencies are satisfied")
expect(lockfile).to eq <<~L
GEM
+ remote: #{file_uri_for(gem_repo1)}/
specs:
GEM
diff --git a/spec/bundler/commands/clean_spec.rb b/spec/bundler/commands/clean_spec.rb
index 7c43aaabc4..429fb17d82 100644
--- a/spec/bundler/commands/clean_spec.rb
+++ b/spec/bundler/commands/clean_spec.rb
@@ -261,6 +261,7 @@ RSpec.describe "bundle clean" do
revision = revision_for(lib_path("rails"))
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "activesupport", :git => "#{lib_path("rails")}", :ref => '#{revision}'
G
@@ -625,21 +626,19 @@ RSpec.describe "bundle clean" do
end
it "when using --force, it doesn't remove default gem binaries" do
- skip "does not work on ruby 3.0 because it changes the path to look for default gems, tsort is a default gem there, and we can't install it either like we do with fiddle because it doesn't yet exist" unless RUBY_VERSION < "3.0.0"
+ skip "does not work on old rubies because the realworld gems that need to be installed don't support them" if RUBY_VERSION < "2.7.0"
skip "does not work on rubygems versions where `--install_dir` doesn't respect --default" unless Gem::Installer.for_spec(loaded_gemspec, :install_dir => "/foo").default_spec_file == "/foo/specifications/default/bundler-#{Bundler::VERSION}.gemspec" # Since rubygems 3.2.0.rc.2
default_irb_version = ruby "gem 'irb', '< 999999'; require 'irb'; puts IRB::VERSION", :raise_on_error => false
skip "irb isn't a default gem" if default_irb_version.empty?
- build_repo2 do
- # simulate executable for default gem
- build_gem "irb", default_irb_version, :to_system => true, :default => true do |s|
- s.executables = "irb"
- end
+ # simulate executable for default gem
+ build_gem "irb", default_irb_version, :to_system => true, :default => true do |s|
+ s.executables = "irb"
end
- realworld_system_gems "fiddle --version 1.0.0"
+ realworld_system_gems "fiddle --version 1.0.6", "tsort --version 0.1.0", "pathname --version 0.1.0", "set --version 1.0.1"
install_gemfile <<-G
source "#{file_uri_for(gem_repo2)}"
@@ -869,6 +868,7 @@ RSpec.describe "bundle clean" do
expect(very_simple_binary_extensions_dir).to exist
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "very_simple_git_binary", :git => "#{lib_path("very_simple_git_binary-1.0")}", :ref => "#{revision}"
G
@@ -878,6 +878,7 @@ RSpec.describe "bundle clean" do
expect(very_simple_binary_extensions_dir).to exist
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
G
bundle "install"
diff --git a/spec/bundler/commands/config_spec.rb b/spec/bundler/commands/config_spec.rb
index 2f4488a552..4e13a7903e 100644
--- a/spec/bundler/commands/config_spec.rb
+++ b/spec/bundler/commands/config_spec.rb
@@ -76,6 +76,20 @@ RSpec.describe ".bundle/config" do
end
end
+ describe "config location" do
+ let(:bundle_user_config) { File.join(Dir.home, ".config/bundler") }
+
+ before do
+ Dir.mkdir File.dirname(bundle_user_config)
+ end
+
+ it "can be configured through BUNDLE_USER_CONFIG" do
+ bundle "config set path vendor", :env => { "BUNDLE_USER_CONFIG" => bundle_user_config }
+ bundle "config get path", :env => { "BUNDLE_USER_CONFIG" => bundle_user_config }
+ expect(out).to include("Set for the current user (#{bundle_user_config}): \"vendor\"")
+ end
+ end
+
describe "global" do
before(:each) do
install_gemfile <<-G
@@ -321,7 +335,7 @@ E
end
describe "quoting" do
- before(:each) { gemfile "# no gems" }
+ before(:each) { gemfile "source \"#{file_uri_for(gem_repo1)}\"" }
let(:long_string) do
"--with-xml2-include=/usr/pkg/include/libxml2 --with-xml2-lib=/usr/pkg/lib " \
"--with-xslt-dir=/usr/pkg"
diff --git a/spec/bundler/commands/exec_spec.rb b/spec/bundler/commands/exec_spec.rb
index 39430d52a4..68c4726608 100644
--- a/spec/bundler/commands/exec_spec.rb
+++ b/spec/bundler/commands/exec_spec.rb
@@ -8,6 +8,7 @@ RSpec.describe "bundle exec" do
it "works with --gemfile flag" do
create_file "CustomGemfile", <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "rack", "1.0.0"
G
@@ -17,6 +18,7 @@ RSpec.describe "bundle exec" do
it "activates the correct gem" do
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "rack", "0.9.1"
G
@@ -26,6 +28,7 @@ RSpec.describe "bundle exec" do
it "works and prints no warnings when HOME is not writable" do
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "rack", "0.9.1"
G
@@ -36,6 +39,7 @@ RSpec.describe "bundle exec" do
it "works when the bins are in ~/.bundle" do
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "rack"
G
@@ -45,6 +49,7 @@ RSpec.describe "bundle exec" do
it "works when running from a random directory" do
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "rack"
G
@@ -54,37 +59,39 @@ RSpec.describe "bundle exec" do
end
it "works when exec'ing something else" do
- install_gemfile 'gem "rack"'
+ install_gemfile "source \"#{file_uri_for(gem_repo1)}\"; gem \"rack\""
bundle "exec echo exec"
expect(out).to eq("exec")
end
it "works when exec'ing to ruby" do
- install_gemfile 'gem "rack"'
+ install_gemfile "source \"#{file_uri_for(gem_repo1)}\"; gem \"rack\""
bundle "exec ruby -e 'puts %{hi}'"
expect(out).to eq("hi")
end
it "works when exec'ing to rubygems" do
- install_gemfile 'gem "rack"'
+ install_gemfile "source \"#{file_uri_for(gem_repo1)}\"; gem \"rack\""
bundle "exec #{gem_cmd} --version"
expect(out).to eq(Gem::VERSION)
end
it "works when exec'ing to rubygems through sh -c" do
- install_gemfile 'gem "rack"'
+ install_gemfile "source \"#{file_uri_for(gem_repo1)}\"; gem \"rack\""
bundle "exec sh -c '#{gem_cmd} --version'"
expect(out).to eq(Gem::VERSION)
end
it "works when exec'ing back to bundler with a lockfile that doesn't include the current platform" do
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "rack", "0.9.1"
G
# simulate lockfile generated with old version not including specific platform
lockfile <<-L
GEM
+ remote: #{file_uri_for(gem_repo1)}/
specs:
rack (0.9.1)
@@ -110,20 +117,20 @@ RSpec.describe "bundle exec" do
Process.setproctitle("1-2-3-4-5-6-7")
puts `ps -ocommand= -p#{$$}`
RUBY
- create_file "Gemfile"
+ create_file "Gemfile", "source \"#{file_uri_for(gem_repo1)}\""
create_file "a.rb", script_that_changes_its_own_title_and_checks_if_picked_up_by_ps_unix_utility
bundle "exec ruby a.rb"
expect(out).to eq("1-2-3-4-5-6-7")
end
it "accepts --verbose" do
- install_gemfile 'gem "rack"'
+ install_gemfile "source \"#{file_uri_for(gem_repo1)}\"; gem \"rack\""
bundle "exec --verbose echo foobar"
expect(out).to eq("foobar")
end
it "passes --verbose to command if it is given after the command" do
- install_gemfile 'gem "rack"'
+ install_gemfile "source \"#{file_uri_for(gem_repo1)}\"; gem \"rack\""
bundle "exec echo --verbose"
expect(out).to eq("--verbose")
end
@@ -147,7 +154,7 @@ RSpec.describe "bundle exec" do
end
G
- install_gemfile ""
+ install_gemfile "source \"#{file_uri_for(gem_repo1)}\""
sys_exec "#{Gem.ruby} #{command.path}"
expect(out).to be_empty
@@ -155,7 +162,7 @@ RSpec.describe "bundle exec" do
end
it "accepts --keep-file-descriptors" do
- install_gemfile ""
+ install_gemfile "source \"#{file_uri_for(gem_repo1)}\""
bundle "exec --keep-file-descriptors echo foobar"
expect(err).to be_empty
@@ -164,7 +171,7 @@ RSpec.describe "bundle exec" do
it "can run a command named --verbose" do
skip "https://github.com/rubygems/rubygems/issues/3351" if Gem.win_platform?
- install_gemfile 'gem "rack"'
+ install_gemfile "source \"#{file_uri_for(gem_repo1)}\"; gem \"rack\""
File.open(bundled_app("--verbose"), "w") do |f|
f.puts "#!/bin/sh"
f.puts "echo foobar"
@@ -210,7 +217,7 @@ RSpec.describe "bundle exec" do
before do
skip "irb isn't a default gem" if default_irb_version.empty?
- install_gemfile ""
+ install_gemfile "source \"#{file_uri_for(gem_repo1)}\""
end
it "uses version provided by ruby" do
@@ -325,6 +332,7 @@ RSpec.describe "bundle exec" do
skip "https://github.com/rubygems/rubygems/issues/3351" if Gem.win_platform?
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "rack"
G
@@ -343,6 +351,7 @@ RSpec.describe "bundle exec" do
skip "https://github.com/rubygems/rubygems/issues/3351" if Gem.win_platform?
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "rack"
G
@@ -359,6 +368,7 @@ RSpec.describe "bundle exec" do
it "errors nicely when the argument doesn't exist" do
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "rack"
G
@@ -370,6 +380,7 @@ RSpec.describe "bundle exec" do
it "errors nicely when the argument is not executable" do
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "rack"
G
@@ -381,6 +392,7 @@ RSpec.describe "bundle exec" do
it "errors nicely when no arguments are passed" do
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "rack"
G
@@ -412,6 +424,7 @@ RSpec.describe "bundle exec" do
skip "https://github.com/rubygems/rubygems/issues/3351" if Gem.win_platform?
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "rack"
G
@@ -496,6 +509,7 @@ RSpec.describe "bundle exec" do
describe "run from a random directory" do
before(:each) do
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "rack"
G
end
@@ -519,6 +533,7 @@ RSpec.describe "bundle exec" do
end
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "fizz", :path => "#{File.expand_path(home("fizz"))}"
G
end
@@ -543,6 +558,7 @@ RSpec.describe "bundle exec" do
end
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "fizz_git", :git => "#{lib_path("fizz_git-1.0")}"
G
end
@@ -566,6 +582,7 @@ RSpec.describe "bundle exec" do
end
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "fizz_no_gemspec", "1.0", :git => "#{lib_path("fizz_no_gemspec-1.0")}"
G
end
@@ -612,6 +629,7 @@ RSpec.describe "bundle exec" do
end
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :path => "#{lib_path("foo-1.0")}"
G
@@ -627,6 +645,8 @@ RSpec.describe "bundle exec" do
skip "https://github.com/rubygems/rubygems/issues/3351" if Gem.win_platform?
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
+
module Monkey
def bin_path(a,b,c)
raise Gem::GemNotFoundException.new('Fail')
@@ -660,6 +680,7 @@ RSpec.describe "bundle exec" do
bundled_app(path).chmod(0o755)
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "rack"
G
end
@@ -806,6 +827,7 @@ RSpec.describe "bundle exec" do
context "when Bundler.setup fails", :bundler => "< 3" do
before do
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem 'rack', '2'
G
ENV["BUNDLER_FORCE_TTY"] = "true"
@@ -814,9 +836,9 @@ RSpec.describe "bundle exec" do
let(:exit_code) { Bundler::GemNotFound.new.status_code }
let(:expected) { "" }
let(:expected_err) { <<-EOS.strip }
-\e[31mCould not find gem 'rack (= 2)' in locally installed gems.
-The source contains the following versions of 'rack': 0.9.1, 1.0.0\e[0m
-\e[33mRun `bundle install` to install missing gems.\e[0m
+Could not find gem 'rack (= 2)' in rubygems repository #{file_uri_for(gem_repo1)}/ or installed locally.
+The source contains the following versions of 'rack': 0.9.1, 1.0.0
+Run `bundle install` to install missing gems.
EOS
it "runs" do
@@ -832,6 +854,7 @@ The source contains the following versions of 'rack': 0.9.1, 1.0.0\e[0m
context "when Bundler.setup fails", :bundler => "3" do
before do
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem 'rack', '2'
G
ENV["BUNDLER_FORCE_TTY"] = "true"
@@ -840,9 +863,9 @@ The source contains the following versions of 'rack': 0.9.1, 1.0.0\e[0m
let(:exit_code) { Bundler::GemNotFound.new.status_code }
let(:expected) { "" }
let(:expected_err) { <<-EOS.strip }
-\e[31mCould not find gem 'rack (= 2)' in locally installed gems.
-The source contains the following versions of 'rack': 1.0.0\e[0m
-\e[33mRun `bundle install` to install missing gems.\e[0m
+Could not find gem 'rack (= 2)' in rubygems repository #{file_uri_for(gem_repo1)}/ or installed locally.
+The source contains the following versions of 'rack': 1.0.0
+Run `bundle install` to install missing gems.
EOS
it "runs" do
@@ -1020,7 +1043,7 @@ __FILE__: #{path.to_s.inspect}
before do
skip "https://github.com/rubygems/rubygems/issues/3351" if Gem.win_platform?
- install_gemfile ""
+ install_gemfile "source \"#{file_uri_for(gem_repo1)}\""
end
it "does not undo the monkeypatches" do
@@ -1079,7 +1102,7 @@ __FILE__: #{path.to_s.inspect}
RUBY
# A Gemfile needs to be in the root to trick bundler's root resolution
- create_file(bundled_app("Gemfile"))
+ create_file(bundled_app("Gemfile"), "source \"#{file_uri_for(gem_repo1)}\"")
bundle "install"
end
@@ -1110,7 +1133,7 @@ __FILE__: #{path.to_s.inspect}
skip "https://github.com/rubygems/rubygems/issues/3351" if Gem.win_platform?
skip "openssl isn't a default gem" if expected.empty?
- install_gemfile "" # must happen before installing the broken system gem
+ install_gemfile "source \"#{file_uri_for(gem_repo1)}\"" # must happen before installing the broken system gem
build_repo4 do
build_gem "openssl", openssl_version do |s|
@@ -1151,6 +1174,7 @@ __FILE__: #{path.to_s.inspect}
build_git "simple_git_binary", &:add_c_extension
bundle "config set --local path .bundle"
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "simple_git_binary", :git => '#{lib_path("simple_git_binary-1.0")}'
G
end
diff --git a/spec/bundler/commands/info_spec.rb b/spec/bundler/commands/info_spec.rb
index daed4587d5..906349cacf 100644
--- a/spec/bundler/commands/info_spec.rb
+++ b/spec/bundler/commands/info_spec.rb
@@ -111,6 +111,7 @@ RSpec.describe "bundle info" do
it "prints out git info" do
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :git => "#{lib_path("foo-1.0")}"
G
expect(the_bundle).to include_gems "foo 1.0"
@@ -126,6 +127,7 @@ RSpec.describe "bundle info" do
@revision = revision_for(lib_path("foo-1.0"))[0...6]
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :git => "#{lib_path("foo-1.0")}", :branch => "omg"
G
expect(the_bundle).to include_gems "foo 1.0.omg"
@@ -137,6 +139,7 @@ RSpec.describe "bundle info" do
it "doesn't print the branch when tied to a ref" do
sha = revision_for(lib_path("foo-1.0"))
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :git => "#{lib_path("foo-1.0")}", :ref => "#{sha}"
G
@@ -147,6 +150,7 @@ RSpec.describe "bundle info" do
it "handles when a version is a '-' prerelease" do
@git = build_git("foo", "1.0.0-beta.1", :path => lib_path("foo"))
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", "1.0.0-beta.1", :git => "#{lib_path("foo")}"
G
expect(the_bundle).to include_gems "foo 1.0.0.pre.beta.1"
diff --git a/spec/bundler/commands/install_spec.rb b/spec/bundler/commands/install_spec.rb
index 00a277a826..412000341f 100644
--- a/spec/bundler/commands/install_spec.rb
+++ b/spec/bundler/commands/install_spec.rb
@@ -334,11 +334,15 @@ RSpec.describe "bundle install with gem sources" do
gem "rack"
G
- expect(err).to include("Your Gemfile has no gem server sources")
+ expect(err).to include("This Gemfile does not include an explicit global source. " \
+ "Not using an explicit global source may result in a different lockfile being generated depending on " \
+ "the gems you have installed locally before bundler is run." \
+ "Instead, define a global source in your Gemfile like this: source \"https://rubygems.org\".")
end
it "creates a Gemfile.lock on a blank Gemfile" do
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
G
expect(File.exist?(bundled_app_lock)).to eq(true)
@@ -448,7 +452,7 @@ RSpec.describe "bundle install with gem sources" do
expect(last_command.stdboth).not_to match(/Error Report/i)
expect(err).to include("An error occurred while installing ajp-rails (0.0.0), and Bundler cannot continue.").
- and include("Make sure that `gem install ajp-rails -v '0.0.0' --source '#{file_uri_for(gem_repo2)}/'` succeeds before bundling.")
+ and include("Bundler::APIResponseInvalidDependenciesError")
end
it "doesn't blow up when the local .bundle/config is empty" do
@@ -482,6 +486,7 @@ RSpec.describe "bundle install with gem sources" do
install_gemfile <<-G, :raise_on_error => false
::RUBY_VERSION = '2.0.1'
ruby '~> 2.2'
+ source "#{file_uri_for(gem_repo1)}"
G
expect(err).to include("Your Ruby version is 2.0.1, but your Gemfile specified ~> 2.2")
end
@@ -493,12 +498,14 @@ RSpec.describe "bundle install with gem sources" do
::RUBY_VERSION = '2.1.3'
::RUBY_PATCHLEVEL = 100
ruby '~> 2.1.0'
+ source "#{file_uri_for(gem_repo1)}"
G
end
it "writes current Ruby version to Gemfile.lock" do
lockfile_should_be <<-L
GEM
+ remote: #{file_uri_for(gem_repo1)}/
specs:
PLATFORMS
@@ -519,10 +526,12 @@ RSpec.describe "bundle install with gem sources" do
::RUBY_VERSION = '2.2.3'
::RUBY_PATCHLEVEL = 100
ruby '~> 2.2.0'
+ source "#{file_uri_for(gem_repo1)}"
G
lockfile_should_be <<-L
GEM
+ remote: #{file_uri_for(gem_repo1)}/
specs:
PLATFORMS
@@ -540,6 +549,7 @@ RSpec.describe "bundle install with gem sources" do
it "does not crash when unlocking" do
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
ruby '>= 2.1.0'
G
@@ -558,6 +568,7 @@ RSpec.describe "bundle install with gem sources" do
build_lib "foo"
gemfile = <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem 'foo', :path => "#{lib_path("foo-1.0")}"
G
File.open("#{root_dir}/Gemfile", "w") do |file|
@@ -574,6 +585,7 @@ RSpec.describe "bundle install with gem sources" do
build_lib "foo", :path => root_dir
gemfile = <<-G
+ source "#{file_uri_for(gem_repo1)}"
gemspec
G
File.open("#{root_dir}/Gemfile", "w") do |file|
@@ -585,16 +597,48 @@ RSpec.describe "bundle install with gem sources" do
end
describe "when requesting a quiet install via --quiet" do
- it "should be quiet" do
+ it "should be quiet if there are no warnings" do
bundle "config set force_ruby_platform true"
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem 'rack'
G
- bundle :install, :quiet => true, :raise_on_error => false
- expect(err).to include("Could not find gem 'rack'")
- expect(err).to_not include("Your Gemfile has no gem server sources")
+ bundle :install, :quiet => true
+ expect(out).to be_empty
+ expect(err).to be_empty
+ end
+
+ it "should still display warnings and errors" do
+ bundle "config set force_ruby_platform true"
+
+ create_file("install_with_warning.rb", <<~RUBY)
+ require "#{lib_dir}/bundler"
+ require "#{lib_dir}/bundler/cli"
+ require "#{lib_dir}/bundler/cli/install"
+
+ module RunWithWarning
+ def run
+ super
+ rescue
+ Bundler.ui.warn "BOOOOO"
+ raise
+ end
+ end
+
+ Bundler::CLI::Install.prepend(RunWithWarning)
+ RUBY
+
+ gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
+ gem 'non-existing-gem'
+ G
+
+ bundle :install, :quiet => true, :raise_on_error => false, :env => { "RUBYOPT" => "-r#{bundled_app("install_with_warning.rb")}" }
+ expect(out).to be_empty
+ expect(err).to include("Could not find gem 'non-existing-gem'")
+ expect(err).to include("BOOOOO")
end
end
diff --git a/spec/bundler/commands/open_spec.rb b/spec/bundler/commands/open_spec.rb
index d18e620783..53dc35c2c7 100644
--- a/spec/bundler/commands/open_spec.rb
+++ b/spec/bundler/commands/open_spec.rb
@@ -105,6 +105,7 @@ RSpec.describe "bundle open" do
skip "No default gems available on this test run" if default_gems.empty?
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "json"
G
end
diff --git a/spec/bundler/commands/update_spec.rb b/spec/bundler/commands/update_spec.rb
index f9548238e9..14fe3e245b 100644
--- a/spec/bundler/commands/update_spec.rb
+++ b/spec/bundler/commands/update_spec.rb
@@ -66,7 +66,7 @@ RSpec.describe "bundle update" do
end
it "doesn't delete the Gemfile.lock file if something goes wrong" do
- install_gemfile ""
+ install_gemfile "source \"#{file_uri_for(gem_repo1)}\""
gemfile <<-G
source "#{file_uri_for(gem_repo2)}"
@@ -96,19 +96,19 @@ RSpec.describe "bundle update" do
before { bundle "config set update_requires_all_flag true" }
it "errors when passed nothing" do
- install_gemfile ""
+ install_gemfile "source \"#{file_uri_for(gem_repo1)}\""
bundle :update, :raise_on_error => false
expect(err).to eq("To update everything, pass the `--all` flag.")
end
it "errors when passed --all and another option" do
- install_gemfile ""
+ install_gemfile "source \"#{file_uri_for(gem_repo1)}\""
bundle "update --all foo", :raise_on_error => false
expect(err).to eq("Cannot specify --all along with specific options.")
end
it "updates everything when passed --all" do
- install_gemfile ""
+ install_gemfile "source \"#{file_uri_for(gem_repo1)}\""
bundle "update --all"
expect(out).to include("Bundle updated!")
end
@@ -753,6 +753,7 @@ RSpec.describe "bundle update in more complicated situations" do
build_git "foo"
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :git => '#{lib_path("foo-1.0")}'
G
@@ -769,6 +770,7 @@ RSpec.describe "bundle update in more complicated situations" do
build_git "rack"
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo2)}"
gem "rack", :git => '#{lib_path("rack-1.0")}'
G
@@ -922,6 +924,7 @@ RSpec.describe "bundle update --ruby" do
::RUBY_VERSION = '2.1.3'
::RUBY_PATCHLEVEL = 100
ruby '~> 2.1.0'
+ source "#{file_uri_for(gem_repo1)}"
G
end
@@ -930,6 +933,7 @@ RSpec.describe "bundle update --ruby" do
gemfile <<-G
::RUBY_VERSION = '2.1.4'
::RUBY_PATCHLEVEL = 222
+ source "#{file_uri_for(gem_repo1)}"
G
end
it "removes the Ruby from the Gemfile.lock" do
@@ -937,6 +941,7 @@ RSpec.describe "bundle update --ruby" do
lockfile_should_be <<-L
GEM
+ remote: #{file_uri_for(gem_repo1)}/
specs:
PLATFORMS
@@ -956,6 +961,7 @@ RSpec.describe "bundle update --ruby" do
::RUBY_VERSION = '2.1.4'
::RUBY_PATCHLEVEL = 222
ruby '~> 2.1.0'
+ source "#{file_uri_for(gem_repo1)}"
G
end
it "updates the Gemfile.lock with the latest version" do
@@ -963,6 +969,7 @@ RSpec.describe "bundle update --ruby" do
lockfile_should_be <<-L
GEM
+ remote: #{file_uri_for(gem_repo1)}/
specs:
PLATFORMS
@@ -985,6 +992,7 @@ RSpec.describe "bundle update --ruby" do
::RUBY_VERSION = '2.2.2'
::RUBY_PATCHLEVEL = 505
ruby '~> 2.1.0'
+ source "#{file_uri_for(gem_repo1)}"
G
end
it "shows a helpful error message" do
@@ -1000,6 +1008,7 @@ RSpec.describe "bundle update --ruby" do
::RUBY_VERSION = '1.8.3'
::RUBY_PATCHLEVEL = 55
ruby '~> 1.8.0'
+ source "#{file_uri_for(gem_repo1)}"
G
end
it "updates the Gemfile.lock with the latest version" do
@@ -1007,6 +1016,7 @@ RSpec.describe "bundle update --ruby" do
lockfile_should_be <<-L
GEM
+ remote: #{file_uri_for(gem_repo1)}/
specs:
PLATFORMS
@@ -1248,7 +1258,7 @@ RSpec.describe "bundle update conservative" do
context "error handling" do
before do
- gemfile ""
+ gemfile "source \"#{file_uri_for(gem_repo1)}\""
end
it "raises if too many flags are provided" do
diff --git a/spec/bundler/install/allow_offline_install_spec.rb b/spec/bundler/install/allow_offline_install_spec.rb
index d0aa4e4d9e..524363fde5 100644
--- a/spec/bundler/install/allow_offline_install_spec.rb
+++ b/spec/bundler/install/allow_offline_install_spec.rb
@@ -75,6 +75,7 @@ RSpec.describe "bundle install with :allow_offline_install" do
git = build_git "a", "1.0.0", :path => lib_path("a")
update_git("a", :path => git.path, :branch => "new_branch")
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "a", :git => #{git.path.to_s.dump}
G
@@ -84,6 +85,7 @@ RSpec.describe "bundle install with :allow_offline_install" do
break_git_remote_ops! do
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "a", :git => #{git.path.to_s.dump}, :branch => "new_branch"
G
end
diff --git a/spec/bundler/install/deploy_spec.rb b/spec/bundler/install/deploy_spec.rb
index 8f6298b301..8f2650a932 100644
--- a/spec/bundler/install/deploy_spec.rb
+++ b/spec/bundler/install/deploy_spec.rb
@@ -53,6 +53,7 @@ RSpec.describe "install in deployment or frozen mode" do
it "works if you exclude a group with a git gem" do
build_git "foo"
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
group :test do
gem "foo", :git => "#{lib_path("foo-1.0")}"
end
@@ -76,6 +77,7 @@ RSpec.describe "install in deployment or frozen mode" do
build_lib "foo", :path => lib_path("nested/foo")
build_lib "bar", :path => lib_path("nested/bar")
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", "1.0", :path => "#{lib_path("nested")}"
gem "bar", :path => "#{lib_path("nested")}"
G
@@ -88,6 +90,7 @@ RSpec.describe "install in deployment or frozen mode" do
it "works when path gems are specified twice" do
build_lib "foo", :path => lib_path("nested/foo")
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :path => "#{lib_path("nested/foo")}"
gem "foo", :path => "#{lib_path("nested/foo")}"
G
@@ -110,6 +113,7 @@ RSpec.describe "install in deployment or frozen mode" do
it "works with sources given by a block" do
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
source "#{file_uri_for(gem_repo1)}" do
gem "rack"
end
@@ -431,6 +435,7 @@ You have deleted from the Gemfile:
it "works fine after bundle package and bundle install --local" do
build_lib "foo", :path => lib_path("foo")
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :path => "#{lib_path("foo")}"
G
diff --git a/spec/bundler/install/failure_spec.rb b/spec/bundler/install/failure_spec.rb
index d265fafa63..4a9c33754f 100644
--- a/spec/bundler/install/failure_spec.rb
+++ b/spec/bundler/install/failure_spec.rb
@@ -2,7 +2,7 @@
RSpec.describe "bundle install" do
context "installing a gem fails" do
- it "prints out why that gem was being installed" do
+ it "prints out why that gem was being installed and the underlying error" do
build_repo2 do
build_gem "activesupport", "2.3.2" do |s|
s.extensions << "Rakefile"
@@ -18,102 +18,9 @@ RSpec.describe "bundle install" do
source "#{file_uri_for(gem_repo2)}"
gem "rails"
G
+ expect(err).to start_with("Gem::Ext::BuildError: ERROR: Failed to build gem native extension.")
expect(err).to end_with(<<-M.strip)
An error occurred while installing activesupport (2.3.2), and Bundler cannot continue.
-Make sure that `gem install activesupport -v '2.3.2' --source '#{file_uri_for(gem_repo2)}/'` succeeds before bundling.
-
-In Gemfile:
- rails was resolved to 2.3.2, which depends on
- actionmailer was resolved to 2.3.2, which depends on
- activesupport
- M
- end
-
- context "when installing a git gem" do
- it "does not tell the user to run 'gem install'" do
- build_git "activesupport", "2.3.2", :path => lib_path("activesupport") do |s|
- s.extensions << "Rakefile"
- s.write "Rakefile", <<-RUBY
- task :default do
- abort "make installing activesupport-2.3.2 fail"
- end
- RUBY
- end
-
- install_gemfile <<-G, :raise_on_error => false
- source "#{file_uri_for(gem_repo1)}"
- gem "rails"
- gem "activesupport", :git => "#{lib_path("activesupport")}"
- G
-
- expect(err).to end_with(<<-M.strip)
-An error occurred while installing activesupport (2.3.2), and Bundler cannot continue.
-
-In Gemfile:
- rails was resolved to 2.3.2, which depends on
- actionmailer was resolved to 2.3.2, which depends on
- activesupport
- M
- end
- end
-
- context "when installing a gem using a git block" do
- it "does not tell the user to run 'gem install'" do
- build_git "activesupport", "2.3.2", :path => lib_path("activesupport") do |s|
- s.extensions << "Rakefile"
- s.write "Rakefile", <<-RUBY
- task :default do
- abort "make installing activesupport-2.3.2 fail"
- end
- RUBY
- end
-
- install_gemfile <<-G, :raise_on_error => false
- source "#{file_uri_for(gem_repo1)}"
- gem "rails"
-
- git "#{lib_path("activesupport")}" do
- gem "activesupport"
- end
- G
-
- expect(err).to end_with(<<-M.strip)
-An error occurred while installing activesupport (2.3.2), and Bundler cannot continue.
-
-
-In Gemfile:
- rails was resolved to 2.3.2, which depends on
- actionmailer was resolved to 2.3.2, which depends on
- activesupport
- M
- end
- end
-
- it "prints out the hint for the remote source when available" do
- build_repo2 do
- build_gem "activesupport", "2.3.2" do |s|
- s.extensions << "Rakefile"
- s.write "Rakefile", <<-RUBY
- task :default do
- abort "make installing activesupport-2.3.2 fail"
- end
- RUBY
- end
- end
-
- build_repo4 do
- build_gem "a"
- end
-
- install_gemfile <<-G, :raise_on_error => false
- source "#{file_uri_for(gem_repo4)}"
- source "#{file_uri_for(gem_repo2)}" do
- gem "rails"
- end
- G
- expect(err).to end_with(<<-M.strip)
-An error occurred while installing activesupport (2.3.2), and Bundler cannot continue.
-Make sure that `gem install activesupport -v '2.3.2' --source '#{file_uri_for(gem_repo2)}/'` succeeds before bundling.
In Gemfile:
rails was resolved to 2.3.2, which depends on
diff --git a/spec/bundler/install/gemfile/eval_gemfile_spec.rb b/spec/bundler/install/gemfile/eval_gemfile_spec.rb
index 8303e6284e..02283291b4 100644
--- a/spec/bundler/install/gemfile/eval_gemfile_spec.rb
+++ b/spec/bundler/install/gemfile/eval_gemfile_spec.rb
@@ -11,12 +11,14 @@ RSpec.describe "bundle install with gemfile that uses eval_gemfile" do
context "eval-ed Gemfile points to an internal gemspec" do
before do
create_file "Gemfile-other", <<-G
+ source "#{file_uri_for(gem_repo1)}"
gemspec :path => 'gems/gunks'
G
end
it "installs the gemspec specified gem" do
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
eval_gemfile 'Gemfile-other'
G
expect(out).to include("Resolving dependencies")
@@ -35,6 +37,8 @@ RSpec.describe "bundle install with gemfile that uses eval_gemfile" do
end
create_file bundled_app("gems/Gemfile"), <<-G
+ source "#{file_uri_for(gem_repo2)}"
+
gemspec :path => "\#{__dir__}/gunks"
source "#{file_uri_for(gem_repo2)}" do
@@ -62,10 +66,12 @@ RSpec.describe "bundle install with gemfile that uses eval_gemfile" do
before do
build_lib("a", :path => bundled_app("gems/a"))
create_file bundled_app("nested/Gemfile-nested"), <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "a", :path => "../gems/a"
G
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
eval_gemfile "nested/Gemfile-nested"
G
end
@@ -89,6 +95,7 @@ RSpec.describe "bundle install with gemfile that uses eval_gemfile" do
it "installs the gemspec specified gem" do
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
eval_gemfile 'other/Gemfile-other'
gemspec :path => 'gems/gunks'
G
diff --git a/spec/bundler/install/gemfile/gemspec_spec.rb b/spec/bundler/install/gemfile/gemspec_spec.rb
index 32dd7d24b8..6d9cd2daff 100644
--- a/spec/bundler/install/gemfile/gemspec_spec.rb
+++ b/spec/bundler/install/gemfile/gemspec_spec.rb
@@ -210,6 +210,7 @@ RSpec.describe "bundle install from an existing gemspec" do
end
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gemspec
G
@@ -263,6 +264,7 @@ RSpec.describe "bundle install from an existing gemspec" do
build_lib "omg", "2.0", :path => lib_path("omg")
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gemspec :path => "#{lib_path("omg")}"
G
diff --git a/spec/bundler/install/gemfile/git_spec.rb b/spec/bundler/install/gemfile/git_spec.rb
index ba8f253b0e..5ea9eee878 100644
--- a/spec/bundler/install/gemfile/git_spec.rb
+++ b/spec/bundler/install/gemfile/git_spec.rb
@@ -62,6 +62,7 @@ RSpec.describe "bundle install with git sources" do
update_git "foo"
install_gemfile bundled_app2("Gemfile"), <<-G, :dir => bundled_app2
+ source "#{file_uri_for(gem_repo1)}"
git "#{lib_path("foo-1.0")}" do
gem 'foo'
end
@@ -84,6 +85,7 @@ RSpec.describe "bundle install with git sources" do
build_git "foo"
install_gemfile <<-G, :raise_on_error => false
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", "1.1", :git => "#{lib_path("foo-1.0")}"
G
@@ -98,6 +100,7 @@ RSpec.describe "bundle install with git sources" do
end
install_gemfile <<-G, :raise_on_error => false
+ source "#{file_uri_for(gem_repo1)}"
platforms :jruby do
gem "only_java", "1.2", :git => "#{lib_path("only_java-1.0-java")}"
end
@@ -119,6 +122,7 @@ RSpec.describe "bundle install with git sources" do
end
install_gemfile <<-G, :raise_on_error => false
+ source "#{file_uri_for(gem_repo1)}"
platforms :jruby do
gem "only_java", "1.2", :git => "#{lib_path("only_java-1.1-java")}"
end
@@ -187,6 +191,7 @@ RSpec.describe "bundle install with git sources" do
it "works" do
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
git "#{lib_path("foo-1.0")}", :ref => "#{@revision}" do
gem "foo"
end
@@ -202,6 +207,7 @@ RSpec.describe "bundle install with git sources" do
it "works when the revision is a symbol" do
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
git "#{lib_path("foo-1.0")}", :ref => #{@revision.to_sym.inspect} do
gem "foo"
end
@@ -230,6 +236,7 @@ RSpec.describe "bundle install with git sources" do
end
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
git "#{lib_path("foo-1.0")}", :ref => "refs/bundler/1" do
gem "foo"
end
@@ -246,6 +253,7 @@ RSpec.describe "bundle install with git sources" do
it "works when the revision is a non-head ref and it was previously downloaded" do
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
git "#{lib_path("foo-1.0")}" do
gem "foo"
end
@@ -264,6 +272,7 @@ RSpec.describe "bundle install with git sources" do
end
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
git "#{lib_path("foo-1.0")}", :ref => "refs/bundler/1" do
gem "foo"
end
@@ -284,6 +293,7 @@ RSpec.describe "bundle install with git sources" do
bundle "config set global_gem_cache true"
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
git "#{lib_path("foo-1.0")}" do
gem "foo"
end
@@ -306,6 +316,7 @@ RSpec.describe "bundle install with git sources" do
update_git("foo", :path => repo, :branch => branch)
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
git "#{repo}", :branch => #{branch.dump} do
gem "foo"
end
@@ -322,6 +333,7 @@ RSpec.describe "bundle install with git sources" do
update_git("foo", :path => repo, :branch => branch)
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
git "#{repo}", :branch => #{branch.dump} do
gem "foo"
end
@@ -339,6 +351,7 @@ RSpec.describe "bundle install with git sources" do
update_git("foo", :path => repo, :branch => branch)
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
git "#{repo}", :branch => #{branch.dump} do
gem "foo"
end
@@ -357,6 +370,7 @@ RSpec.describe "bundle install with git sources" do
update_git("foo", :path => repo, :tag => tag)
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
git "#{repo}", :tag => #{tag.dump} do
gem "foo"
end
@@ -373,6 +387,7 @@ RSpec.describe "bundle install with git sources" do
update_git("foo", :path => repo, :tag => tag)
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
git "#{repo}", :tag => #{tag.dump} do
gem "foo"
end
@@ -390,6 +405,7 @@ RSpec.describe "bundle install with git sources" do
update_git("foo", :path => repo, :tag => tag)
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
git "#{repo}", :tag => #{tag.dump} do
gem "foo"
end
@@ -705,6 +721,7 @@ RSpec.describe "bundle install with git sources" do
build_lib "hi2u", :path => lib_path("hi2u")
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
path "#{lib_path("hi2u")}" do
gem "omg"
gem "hi2u"
@@ -721,6 +738,7 @@ RSpec.describe "bundle install with git sources" do
update_git "foo"
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :git => "#{lib_path("foo-1.0")}", :ref => "#{@revision}"
G
@@ -785,6 +803,7 @@ RSpec.describe "bundle install with git sources" do
build_git "foo", "1.0"
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", "1.0", :git => "#{lib_path("foo-1.0")}"
G
@@ -806,6 +825,7 @@ RSpec.describe "bundle install with git sources" do
it "catches git errors and spits out useful output" do
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", "1.0", :git => "omgomg"
G
@@ -820,6 +840,7 @@ RSpec.describe "bundle install with git sources" do
build_git "foo", :path => lib_path("foo space-1.0")
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :git => "#{lib_path("foo space-1.0")}"
G
@@ -830,6 +851,7 @@ RSpec.describe "bundle install with git sources" do
build_git "forced", "1.0"
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
git "#{lib_path("forced-1.0")}" do
gem 'forced'
end
@@ -858,6 +880,7 @@ RSpec.describe "bundle install with git sources" do
sys_exec "git commit -m \"submodulator\"", :dir => lib_path("has_submodule-1.0")
install_gemfile <<-G, :raise_on_error => false
+ source "#{file_uri_for(gem_repo1)}"
git "#{lib_path("has_submodule-1.0")}" do
gem "has_submodule"
end
@@ -876,6 +899,7 @@ RSpec.describe "bundle install with git sources" do
sys_exec "git commit -m \"submodulator\"", :dir => lib_path("has_submodule-1.0")
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
git "#{lib_path("has_submodule-1.0")}", :submodules => true do
gem "has_submodule"
end
@@ -892,6 +916,7 @@ RSpec.describe "bundle install with git sources" do
sys_exec "git commit -m \"submodulator\"", :dir => lib_path("has_submodule-1.0")
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
git "#{lib_path("has_submodule-1.0")}" do
gem "has_submodule"
end
@@ -906,6 +931,7 @@ RSpec.describe "bundle install with git sources" do
git = build_git "foo"
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
git "#{lib_path("foo-1.0")}" do
gem "foo"
end
@@ -915,6 +941,7 @@ RSpec.describe "bundle install with git sources" do
update_git "foo"
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
git "#{lib_path("foo-1.0")}", :ref => "#{git.ref_for("HEAD^")}" do
gem "foo"
end
@@ -932,6 +959,7 @@ RSpec.describe "bundle install with git sources" do
build_git "foo"
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :git => "#{lib_path("foo-1.0")}"
G
@@ -945,6 +973,7 @@ RSpec.describe "bundle install with git sources" do
build_git "foo"
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :git => "#{lib_path("foo-1.0")}"
G
@@ -959,6 +988,7 @@ RSpec.describe "bundle install with git sources" do
FileUtils.touch(default_bundle_path("bundler"))
install_gemfile <<-G, :raise_on_error => false
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :git => "#{lib_path("foo-1.0")}"
G
@@ -976,6 +1006,7 @@ RSpec.describe "bundle install with git sources" do
build_git "bar", :path => lib_path("nested")
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :git => "#{lib_path("nested")}"
gem "bar", :git => "#{lib_path("nested")}"
G
@@ -1033,6 +1064,7 @@ RSpec.describe "bundle install with git sources" do
build_git "valim"
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "valim", :git => "#{file_uri_for(lib_path("valim-1.0"))}"
G
@@ -1058,11 +1090,13 @@ RSpec.describe "bundle install with git sources" do
revision = revision_for(lib_path("foo-1.0"))
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :git => "#{file_uri_for(lib_path("foo-1.0"))}", :ref => "#{revision}"
G
expect(out).to_not match(/Revision.*does not exist/)
install_gemfile <<-G, :raise_on_error => false
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :git => "#{file_uri_for(lib_path("foo-1.0"))}", :ref => "deadbeef"
G
expect(err).to include("Revision deadbeef does not exist in the repository")
@@ -1089,6 +1123,7 @@ RSpec.describe "bundle install with git sources" do
it "runs pre-install hooks" do
build_git "foo"
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :git => "#{lib_path("foo-1.0")}"
G
@@ -1108,6 +1143,7 @@ RSpec.describe "bundle install with git sources" do
it "runs post-install hooks" do
build_git "foo"
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :git => "#{lib_path("foo-1.0")}"
G
@@ -1127,6 +1163,7 @@ RSpec.describe "bundle install with git sources" do
it "complains if the install hook fails" do
build_git "foo"
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :git => "#{lib_path("foo-1.0")}"
G
@@ -1403,6 +1440,7 @@ In Gemfile:
build_git "foo"
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
git "#{lib_path("foo-1.0")}" do
gem 'foo'
end
@@ -1419,6 +1457,7 @@ In Gemfile:
build_git "foo"
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
git "#{lib_path("foo-1.0")}" do
gem 'foo'
end
@@ -1448,6 +1487,7 @@ In Gemfile:
build_git "foo", "1.0", :path => lib_path("foo")
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :git => "#{lib_path("foo")}", :branch => "master"
G
@@ -1463,6 +1503,7 @@ In Gemfile:
it "does not display the password" do
install_gemfile <<-G, :raise_on_error => false
+ source "#{file_uri_for(gem_repo1)}"
git "https://#{credentials}@github.com/company/private-repo" do
gem "foo"
end
@@ -1478,6 +1519,7 @@ In Gemfile:
it "displays the oauth scheme but not the oauth token" do
install_gemfile <<-G, :raise_on_error => false
+ source "#{file_uri_for(gem_repo1)}"
git "https://#{credentials}:x-oauth-basic@github.com/company/private-repo" do
gem "foo"
end
diff --git a/spec/bundler/install/gemfile/path_spec.rb b/spec/bundler/install/gemfile/path_spec.rb
index 1c77b3a37e..566fdcf65a 100644
--- a/spec/bundler/install/gemfile/path_spec.rb
+++ b/spec/bundler/install/gemfile/path_spec.rb
@@ -16,6 +16,7 @@ RSpec.describe "bundle install with explicit source paths" do
build_lib "foo"
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
path "#{lib_path("foo-1.0")}" do
gem 'foo'
end
@@ -28,6 +29,7 @@ RSpec.describe "bundle install with explicit source paths" do
build_lib "foo"
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem 'foo', :path => "#{lib_path("foo-1.0")}"
G
@@ -40,6 +42,7 @@ RSpec.describe "bundle install with explicit source paths" do
relative_path = lib_path("foo-1.0").relative_path_from(bundled_app)
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem 'foo', :path => "#{relative_path}"
G
@@ -52,6 +55,7 @@ RSpec.describe "bundle install with explicit source paths" do
relative_path = lib_path("foo-1.0").relative_path_from(Pathname.new("~").expand_path)
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem 'foo', :path => "~/#{relative_path}"
G
@@ -66,6 +70,7 @@ RSpec.describe "bundle install with explicit source paths" do
relative_path = lib_path("foo-1.0").relative_path_from(Pathname.new("/home/#{username}").expand_path)
install_gemfile <<-G, :raise_on_error => false
+ source "#{file_uri_for(gem_repo1)}"
gem 'foo', :path => "~#{username}/#{relative_path}"
G
expect(err).to match("There was an error while trying to use the path `~#{username}/#{relative_path}`.")
@@ -76,6 +81,7 @@ RSpec.describe "bundle install with explicit source paths" do
build_lib "foo", :path => bundled_app("foo-1.0")
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem 'foo', :path => "./foo-1.0"
G
@@ -87,6 +93,7 @@ RSpec.describe "bundle install with explicit source paths" do
build_lib "aaa", :path => lib_path("demo/aaa")
gemfile = <<-G
+ source "#{file_uri_for(gem_repo1)}"
gemspec
gem "aaa", :path => "./aaa"
G
@@ -105,6 +112,7 @@ RSpec.describe "bundle install with explicit source paths" do
aaa (1.0)
GEM
+ remote: #{file_uri_for(gem_repo1)}/
specs:
PLATFORMS
@@ -128,6 +136,7 @@ RSpec.describe "bundle install with explicit source paths" do
build_lib "foo", :path => bundled_app("foo-1.0")
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem 'foo', :path => File.expand_path("../foo-1.0", __FILE__)
G
@@ -167,6 +176,7 @@ RSpec.describe "bundle install with explicit source paths" do
build_lib "foo", "1.0.0", :path => lib_path("omg/foo")
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "omg", :path => "#{lib_path("omg")}"
G
@@ -177,6 +187,7 @@ RSpec.describe "bundle install with explicit source paths" do
build_lib "omg", "2.0", :path => lib_path("omg")
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "omg", :path => "#{lib_path("omg")}"
G
@@ -200,6 +211,7 @@ RSpec.describe "bundle install with explicit source paths" do
end
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "premailer", :path => "#{lib_path("premailer")}"
G
@@ -221,6 +233,7 @@ RSpec.describe "bundle install with explicit source paths" do
end
install_gemfile <<-G, :raise_on_error => false
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :path => "#{lib_path("foo-1.0")}"
G
@@ -304,6 +317,7 @@ RSpec.describe "bundle install with explicit source paths" do
end
install_gemfile <<-G, :raise_on_error => false
+ source "#{file_uri_for(gem_repo1)}"
gemspec :path => "#{lib_path("foo")}"
G
@@ -317,6 +331,7 @@ RSpec.describe "bundle install with explicit source paths" do
end
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gemspec :path => "#{lib_path("foo")}", :name => "foo"
G
@@ -329,6 +344,7 @@ RSpec.describe "bundle install with explicit source paths" do
end
install_gemfile <<-G, :verbose => true
+ source "#{file_uri_for(gem_repo1)}"
path "#{lib_path("foo-1.0")}" do
gem 'foo'
end
@@ -346,6 +362,7 @@ RSpec.describe "bundle install with explicit source paths" do
lib_path("foo-1.0").join("bin/performance").mkpath
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem 'foo', '1.0', :path => "#{lib_path("foo-1.0")}"
G
expect(err).to be_empty
@@ -355,6 +372,7 @@ RSpec.describe "bundle install with explicit source paths" do
build_lib "foo"
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem 'foo', :path => "#{lib_path("foo-1.0")}"
G
@@ -367,6 +385,7 @@ RSpec.describe "bundle install with explicit source paths" do
build_lib "hi2u"
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
path "#{lib_path}" do
gem "omg"
gem "hi2u"
@@ -385,6 +404,7 @@ RSpec.describe "bundle install with explicit source paths" do
end
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :path => "#{lib_path("foo")}"
gem "omg", :path => "#{lib_path("omg")}"
G
@@ -396,6 +416,7 @@ RSpec.describe "bundle install with explicit source paths" do
build_lib "foo", :gemspec => false
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", "1.0", :path => "#{lib_path("foo-1.0")}"
G
@@ -411,12 +432,13 @@ RSpec.describe "bundle install with explicit source paths" do
specs:
GEM
- remote: http://rubygems.org
+ remote: http://rubygems.org/
L
FileUtils.mkdir_p(bundled_app("vendor/bar"))
install_gemfile <<-G
+ source "http://rubygems.org"
gem "bar", "1.0.0", path: "vendor/bar", require: "bar/nyard"
G
end
@@ -461,6 +483,7 @@ RSpec.describe "bundle install with explicit source paths" do
end
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :path => "#{lib_path("foo-1.0")}"
G
@@ -476,6 +499,7 @@ RSpec.describe "bundle install with explicit source paths" do
build_lib "bar", "1.0", :path => lib_path("foo/bar")
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :path => "#{lib_path("foo")}"
G
end
@@ -720,6 +744,7 @@ RSpec.describe "bundle install with explicit source paths" do
it "runs pre-install hooks" do
build_git "foo"
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :git => "#{lib_path("foo-1.0")}"
G
@@ -739,6 +764,7 @@ RSpec.describe "bundle install with explicit source paths" do
it "runs post-install hooks" do
build_git "foo"
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :git => "#{lib_path("foo-1.0")}"
G
@@ -758,6 +784,7 @@ RSpec.describe "bundle install with explicit source paths" do
it "complains if the install hook fails" do
build_git "foo"
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :git => "#{lib_path("foo-1.0")}"
G
@@ -788,6 +815,7 @@ RSpec.describe "bundle install with explicit source paths" do
end
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :path => "#{lib_path("foo-1.0")}"
gem "bar", :path => "#{lib_path("bar-1.0")}"
G
diff --git a/spec/bundler/install/gemfile/platform_spec.rb b/spec/bundler/install/gemfile/platform_spec.rb
index c49594183e..7cd06b7e08 100644
--- a/spec/bundler/install/gemfile/platform_spec.rb
+++ b/spec/bundler/install/gemfile/platform_spec.rb
@@ -400,6 +400,7 @@ RSpec.describe "bundle install with platform conditionals" do
build_git "foo"
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
platform :#{not_local_tag} do
gem "foo", :git => "#{lib_path("foo-1.0")}"
end
diff --git a/spec/bundler/install/gemfile/sources_spec.rb b/spec/bundler/install/gemfile/sources_spec.rb
index 0739285a5d..8c225afb11 100644
--- a/spec/bundler/install/gemfile/sources_spec.rb
+++ b/spec/bundler/install/gemfile/sources_spec.rb
@@ -1074,6 +1074,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
build_lib "foo"
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "rack", :source => "https://gem.repo1"
gem "foo", :path => "#{lib_path("foo-1.0")}"
G
@@ -1309,6 +1310,8 @@ RSpec.describe "bundle install with gems on multiple sources" do
end
install_gemfile <<-G, :artifice => "compact_index", :raise_on_error => false
+ source "#{file_uri_for(gem_repo1)}"
+
source "https://gem.repo4" do
gem "depends_on_rack"
end
@@ -1338,6 +1341,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
end
install_gemfile <<-G, :artifice => "compact_index", :raise_on_error => false
+ source "#{file_uri_for(gem_repo1)}"
source "https://gem.repo4" do
gem "depends_on_rack"
end
diff --git a/spec/bundler/install/gemfile/specific_platform_spec.rb b/spec/bundler/install/gemfile/specific_platform_spec.rb
index a6d8318fe4..4c24f09368 100644
--- a/spec/bundler/install/gemfile/specific_platform_spec.rb
+++ b/spec/bundler/install/gemfile/specific_platform_spec.rb
@@ -173,6 +173,7 @@ RSpec.describe "bundle install with specific platforms" do
git = build_git "pg_array_parser", "1.0"
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "pg_array_parser", :git => "#{lib_path("pg_array_parser-1.0")}"
G
diff --git a/spec/bundler/install/gemfile_spec.rb b/spec/bundler/install/gemfile_spec.rb
index ffbb2e3a61..0f8f1ecfa8 100644
--- a/spec/bundler/install/gemfile_spec.rb
+++ b/spec/bundler/install/gemfile_spec.rb
@@ -4,6 +4,8 @@ RSpec.describe "bundle install" do
context "with duplicated gems" do
it "will display a warning" do
install_gemfile <<-G, :raise_on_error => false
+ source "#{file_uri_for(gem_repo1)}"
+
gem 'rails', '~> 4.0.0'
gem 'rails', '~> 4.0.0'
G
@@ -54,6 +56,8 @@ RSpec.describe "bundle install" do
context "with deprecated features" do
it "reports that lib is an invalid option" do
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
+
gem "rack", :lib => "rack"
G
@@ -86,6 +90,8 @@ RSpec.describe "bundle install" do
context "with a Gemfile containing non-US-ASCII characters" do
it "reads the Gemfile with the UTF-8 encoding by default" do
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
+
str = "Il était une fois ..."
puts "The source encoding is: " + str.encoding.name
G
@@ -99,6 +105,8 @@ RSpec.describe "bundle install" do
# NOTE: This works thanks to #eval interpreting the magic encoding comment
install_gemfile <<-G
# encoding: iso-8859-1
+ source "#{file_uri_for(gem_repo1)}"
+
str = "Il #{"\xE9".dup.force_encoding("binary")}tait une fois ..."
puts "The source encoding is: " + str.encoding.name
G
diff --git a/spec/bundler/install/gems/compact_index_spec.rb b/spec/bundler/install/gems/compact_index_spec.rb
index 6257cf4f71..0cee69f702 100644
--- a/spec/bundler/install/gems/compact_index_spec.rb
+++ b/spec/bundler/install/gems/compact_index_spec.rb
@@ -930,6 +930,7 @@ Either installing with `--full-index` or running `bundle update rails` should fi
it "does not duplicate specs in the lockfile when updating and a dependency is not installed" do
install_gemfile <<-G, :artifice => "compact_index"
+ source "#{file_uri_for(gem_repo1)}"
source "#{source_uri}" do
gem "rails"
gem "activemerchant"
diff --git a/spec/bundler/install/gems/native_extensions_spec.rb b/spec/bundler/install/gems/native_extensions_spec.rb
index 8a4de3cf92..d5cafcfc2c 100644
--- a/spec/bundler/install/gems/native_extensions_spec.rb
+++ b/spec/bundler/install/gems/native_extensions_spec.rb
@@ -78,6 +78,7 @@ RSpec.describe "installing a gem with native extensions", :ruby_repo do
bundle "config set build.c_extension --with-c_extension=hello"
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "c_extension", :git => #{lib_path("c_extension-1.0").to_s.dump}
G
@@ -126,11 +127,13 @@ RSpec.describe "installing a gem with native extensions", :ruby_repo do
# 1st time, require only one gem -- only one of the extensions gets built.
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "c_extension_one", :git => #{lib_path("gems").to_s.dump}
G
# 2nd time, require both gems -- we need both extensions to be built now.
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "c_extension_one", :git => #{lib_path("gems").to_s.dump}
gem "c_extension_two", :git => #{lib_path("gems").to_s.dump}
G
@@ -171,6 +174,7 @@ RSpec.describe "installing a gem with native extensions", :ruby_repo do
bundle "config set build.c_extension --with-c_extension=hello --with-c_extension_bundle-dir=hola"
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "c_extension", :git => #{lib_path("c_extension-1.0").to_s.dump}
G
diff --git a/spec/bundler/install/gems/standalone_spec.rb b/spec/bundler/install/gems/standalone_spec.rb
index 08d5276a54..6578997cd6 100644
--- a/spec/bundler/install/gems/standalone_spec.rb
+++ b/spec/bundler/install/gems/standalone_spec.rb
@@ -108,6 +108,45 @@ RSpec.shared_examples "bundle install --standalone" do
include_examples "common functionality"
end
+ describe "with default gems and a lockfile", :ruby_repo do
+ before do
+ skip "does not work on rubygems versions where `--install_dir` doesn't respect --default" unless Gem::Installer.for_spec(loaded_gemspec, :install_dir => "/foo").default_spec_file == "/foo/specifications/default/bundler-#{Bundler::VERSION}.gemspec" # Since rubygems 3.2.0.rc.2
+ skip "does not work on old rubies because the realworld gems that need to be installed don't support them" if RUBY_VERSION < "2.7.0"
+
+ realworld_system_gems "fiddle --version 1.0.6", "tsort --version 0.1.0"
+
+ necessary_system_gems = ["optparse --version 0.1.1", "psych --version 3.3.2", "yaml --version 0.1.1", "logger --version 1.4.3", "etc --version 1.2.0"]
+ necessary_system_gems += ["shellwords --version 0.1.0", "base64 --version 0.1.0", "resolv --version 0.2.1"] if Gem.rubygems_version < Gem::Version.new("3.3.3.a")
+ realworld_system_gems(*necessary_system_gems, :path => scoped_gem_path(bundled_app("bundle")))
+
+ build_gem "foo", "1.0.0", :to_system => true, :default => true do |s|
+ s.add_dependency "bar"
+ end
+
+ build_gem "bar", "1.0.0", :to_system => true, :default => true
+
+ build_repo4 do
+ build_gem "foo", "1.0.0" do |s|
+ s.add_dependency "bar"
+ end
+
+ build_gem "bar", "1.0.0"
+ end
+
+ gemfile <<-G
+ source "https://gem.repo4"
+ gem "foo"
+ G
+
+ bundle "lock", :dir => cwd, :artifice => "compact_index"
+ end
+
+ it "works" do
+ bundle "config set --local path #{bundled_app("bundle")}"
+ bundle :install, :standalone => true, :dir => cwd, :artifice => "compact_index", :env => { "BUNDLER_GEM_DEFAULT_DIR" => system_gem_path.to_s }
+ end
+ end
+
describe "with gems with native extension", :ruby_repo do
before do
bundle "config set --local path #{bundled_app("bundle")}"
@@ -146,6 +185,7 @@ RSpec.shared_examples "bundle install --standalone" do
end
bundle "config set --local path #{bundled_app("bundle")}"
install_gemfile <<-G, :standalone => true, :dir => cwd, :raise_on_error => false
+ source "#{file_uri_for(gem_repo1)}"
gem "bar", :git => "#{lib_path("bar-1.0")}"
G
end
diff --git a/spec/bundler/install/gemspecs_spec.rb b/spec/bundler/install/gemspecs_spec.rb
index dc1934804d..0c4518fe2b 100644
--- a/spec/bundler/install/gemspecs_spec.rb
+++ b/spec/bundler/install/gemspecs_spec.rb
@@ -21,6 +21,7 @@ RSpec.describe "bundle install" do
build_lib "yaml_spec", :gemspec => :yaml
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem 'yaml_spec', :path => "#{lib_path("yaml_spec-1.0")}"
G
expect(err).to be_empty
@@ -57,6 +58,7 @@ RSpec.describe "bundle install" do
G
install_gemfile <<-G, :env => { "LANG" => "C" }
+ source "#{file_uri_for(gem_repo1)}"
gemspec
G
@@ -82,6 +84,7 @@ RSpec.describe "bundle install" do
G
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gemspec
G
@@ -96,6 +99,7 @@ RSpec.describe "bundle install" do
install_gemfile <<-G
ruby '#{RUBY_VERSION}', :engine_version => '#{RUBY_VERSION}', :engine => 'ruby'
+ source "#{file_uri_for(gem_repo1)}"
gemspec
G
expect(the_bundle).to include_gems "foo 1.0"
@@ -109,6 +113,7 @@ RSpec.describe "bundle install" do
install_gemfile <<-G, :raise_on_error => false
ruby '#{RUBY_VERSION}', :engine_version => '#{RUBY_VERSION}', :engine => 'ruby', :patchlevel => '#{RUBY_PATCHLEVEL}'
+ source "#{file_uri_for(gem_repo1)}"
gemspec
G
expect(the_bundle).to include_gems "foo 1.0"
@@ -123,6 +128,7 @@ RSpec.describe "bundle install" do
install_gemfile <<-G, :raise_on_error => false
ruby '#{RUBY_VERSION}', :engine_version => '#{RUBY_VERSION}', :engine => 'ruby', :patchlevel => '#{patchlevel}'
+ source "#{file_uri_for(gem_repo1)}"
gemspec
G
@@ -140,6 +146,7 @@ RSpec.describe "bundle install" do
install_gemfile <<-G, :raise_on_error => false
ruby '#{version}', :engine_version => '#{version}', :engine => 'ruby'
+ source "#{file_uri_for(gem_repo1)}"
gemspec
G
diff --git a/spec/bundler/install/git_spec.rb b/spec/bundler/install/git_spec.rb
index 4a3827eafd..d43aacee7e 100644
--- a/spec/bundler/install/git_spec.rb
+++ b/spec/bundler/install/git_spec.rb
@@ -6,6 +6,7 @@ RSpec.describe "bundle install" do
build_git "foo", "1.0", :path => lib_path("foo")
install_gemfile <<-G, :verbose => true
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :git => "#{file_uri_for(lib_path("foo"))}"
G
@@ -17,6 +18,7 @@ RSpec.describe "bundle install" do
build_git "foo", "1.0", :path => lib_path("foo"), :default_branch => "main"
install_gemfile <<-G, :verbose => true
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :git => "#{file_uri_for(lib_path("foo"))}"
G
@@ -34,6 +36,7 @@ RSpec.describe "bundle install" do
update_git "foo", "3.0", :path => lib_path("foo"), :gemspec => true
install_gemfile <<-G, :verbose => true
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :git => "#{file_uri_for(lib_path("foo"))}", :ref => "master~2"
G
@@ -51,6 +54,7 @@ RSpec.describe "bundle install" do
revision = build_git("foo").ref_for("HEAD")
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :git => "#{file_uri_for(lib_path("foo-1.0"))}", :group => :development
G
diff --git a/spec/bundler/install/redownload_spec.rb b/spec/bundler/install/redownload_spec.rb
index 0eae615c59..a936b2b536 100644
--- a/spec/bundler/install/redownload_spec.rb
+++ b/spec/bundler/install/redownload_spec.rb
@@ -33,6 +33,7 @@ RSpec.describe "bundle install" do
before do
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :git => "#{lib_path("foo-1.0")}"
G
end
diff --git a/spec/bundler/install/yanked_spec.rb b/spec/bundler/install/yanked_spec.rb
index 6d3065a836..c5f3d788ba 100644
--- a/spec/bundler/install/yanked_spec.rb
+++ b/spec/bundler/install/yanked_spec.rb
@@ -70,4 +70,35 @@ RSpec.context "when using gem before installing" do
expect(err).to_not include("If you haven't changed sources, that means the author of rack (0.9.1) has removed it.")
expect(err).to_not include("You'll need to update your bundle to a different version of rack (0.9.1) that hasn't been removed in order to install.")
end
+
+ it "does not suggest the author has yanked the gem when using more than one gem, but shows all gems that couldn't be found in the source" do
+ gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
+ gem "rack", "0.9.1"
+ gem "rack_middleware", "1.0"
+ G
+
+ lockfile <<-L
+ GEM
+ remote: #{file_uri_for(gem_repo1)}
+ specs:
+ rack (0.9.1)
+ rack_middleware (1.0)
+
+ PLATFORMS
+ ruby
+
+ DEPENDENCIES
+ rack (= 0.9.1)
+ rack_middleware (1.0)
+ L
+
+ bundle :list, :raise_on_error => false
+
+ expect(err).to include("Could not find rack-0.9.1, rack_middleware-1.0 in any of the sources")
+ expect(err).to include("Install missing gems with `bundle install`.")
+ expect(err).to_not include("Your bundle is locked to rack (0.9.1), but that version could not be found in any of the sources listed in your Gemfile.")
+ expect(err).to_not include("If you haven't changed sources, that means the author of rack (0.9.1) has removed it.")
+ expect(err).to_not include("You'll need to update your bundle to a different version of rack (0.9.1) that hasn't been removed in order to install.")
+ end
end
diff --git a/spec/bundler/lock/git_spec.rb b/spec/bundler/lock/git_spec.rb
index 14b80483ee..56db5d8305 100644
--- a/spec/bundler/lock/git_spec.rb
+++ b/spec/bundler/lock/git_spec.rb
@@ -5,6 +5,7 @@ RSpec.describe "bundle lock with git gems" do
build_git "foo"
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem 'foo', :git => "#{lib_path("foo-1.0")}"
G
end
diff --git a/spec/bundler/lock/lockfile_spec.rb b/spec/bundler/lock/lockfile_spec.rb
index 0ab31eabc6..0e2a3a3cd8 100644
--- a/spec/bundler/lock/lockfile_spec.rb
+++ b/spec/bundler/lock/lockfile_spec.rb
@@ -322,6 +322,8 @@ RSpec.describe "the lockfile format" do
bundle "config set http://localgemserver.test/ user:pass"
install_gemfile(<<-G, :artifice => "endpoint_strict_basic_authentication", :quiet => true)
+ source "#{file_uri_for(gem_repo1)}"
+
source "http://localgemserver.test/" do
end
@@ -333,6 +335,7 @@ RSpec.describe "the lockfile format" do
lockfile_should_be <<-G
GEM
+ remote: #{file_uri_for(gem_repo1)}/
specs:
GEM
@@ -388,6 +391,7 @@ RSpec.describe "the lockfile format" do
git = build_git "foo"
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :git => "#{lib_path("foo-1.0")}"
G
@@ -399,6 +403,7 @@ RSpec.describe "the lockfile format" do
foo (1.0)
GEM
+ remote: #{file_uri_for(gem_repo1)}/
specs:
PLATFORMS
@@ -455,6 +460,7 @@ RSpec.describe "the lockfile format" do
git = build_git "foo"
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
git "#{lib_path("foo-1.0")}" do
gem "foo"
end
@@ -468,6 +474,7 @@ RSpec.describe "the lockfile format" do
foo (1.0)
GEM
+ remote: #{file_uri_for(gem_repo1)}/
specs:
PLATFORMS
@@ -486,6 +493,7 @@ RSpec.describe "the lockfile format" do
update_git "foo", :branch => "omg"
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :git => "#{lib_path("foo-1.0")}", :branch => "omg"
G
@@ -498,6 +506,7 @@ RSpec.describe "the lockfile format" do
foo (1.0)
GEM
+ remote: #{file_uri_for(gem_repo1)}/
specs:
PLATFORMS
@@ -516,6 +525,7 @@ RSpec.describe "the lockfile format" do
update_git "foo", :tag => "omg"
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :git => "#{lib_path("foo-1.0")}", :tag => "omg"
G
@@ -528,6 +538,7 @@ RSpec.describe "the lockfile format" do
foo (1.0)
GEM
+ remote: #{file_uri_for(gem_repo1)}/
specs:
PLATFORMS
@@ -545,6 +556,7 @@ RSpec.describe "the lockfile format" do
build_lib "foo"
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :path => "#{lib_path("foo-1.0")}"
G
@@ -555,6 +567,7 @@ RSpec.describe "the lockfile format" do
foo (1.0)
GEM
+ remote: #{file_uri_for(gem_repo1)}/
specs:
PLATFORMS
@@ -572,6 +585,7 @@ RSpec.describe "the lockfile format" do
build_lib "foo"
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :path => "#{lib_path("foo-1.0")}"
G
@@ -586,6 +600,7 @@ RSpec.describe "the lockfile format" do
foo (1.0)
GEM
+ remote: #{file_uri_for(gem_repo1)}/
specs:
PLATFORMS
@@ -821,6 +836,7 @@ RSpec.describe "the lockfile format" do
build_lib "foo", :path => bundled_app("foo")
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
path "foo" do
gem "foo"
end
@@ -833,6 +849,7 @@ RSpec.describe "the lockfile format" do
foo (1.0)
GEM
+ remote: #{file_uri_for(gem_repo1)}/
specs:
PLATFORMS
@@ -850,6 +867,7 @@ RSpec.describe "the lockfile format" do
build_lib "foo", :path => bundled_app(File.join("..", "foo"))
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
path "../foo" do
gem "foo"
end
@@ -862,6 +880,7 @@ RSpec.describe "the lockfile format" do
foo (1.0)
GEM
+ remote: #{file_uri_for(gem_repo1)}/
specs:
PLATFORMS
@@ -879,6 +898,7 @@ RSpec.describe "the lockfile format" do
build_lib "foo", :path => bundled_app("foo")
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
path File.expand_path("../foo", __FILE__) do
gem "foo"
end
@@ -891,6 +911,7 @@ RSpec.describe "the lockfile format" do
foo (1.0)
GEM
+ remote: #{file_uri_for(gem_repo1)}/
specs:
PLATFORMS
@@ -908,6 +929,7 @@ RSpec.describe "the lockfile format" do
build_lib("foo", :path => tmp.join("foo"))
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gemspec :path => "../foo"
G
@@ -918,6 +940,7 @@ RSpec.describe "the lockfile format" do
foo (1.0)
GEM
+ remote: #{file_uri_for(gem_repo1)}/
specs:
PLATFORMS
diff --git a/spec/bundler/other/major_deprecation_spec.rb b/spec/bundler/other/major_deprecation_spec.rb
index 494d6a27b5..459d777a8b 100644
--- a/spec/bundler/other/major_deprecation_spec.rb
+++ b/spec/bundler/other/major_deprecation_spec.rb
@@ -165,6 +165,28 @@ RSpec.describe "major deprecations" do
pending "fails with a helpful error", :bundler => "3"
end
+ context "bundle cache --path" do
+ before do
+ install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
+ gem "rack"
+ G
+
+ bundle "cache --path foo", :raise_on_error => false
+ end
+
+ it "should print a deprecation warning", :bundler => "< 3" do
+ expect(deprecations).to include(
+ "The `--path` flag is deprecated because its semantics are unclear. " \
+ "Use `bundle config cache_path` to configure the path of your cache of gems, " \
+ "and `bundle config path` to configure the path where your gems are installed, " \
+ "and stop using this flag"
+ )
+ end
+
+ pending "fails with a helpful error", :bundler => "3"
+ end
+
describe "bundle config" do
describe "old list interface" do
before do
@@ -311,7 +333,7 @@ RSpec.describe "major deprecations" do
end
it "should print a proper warning, and use gems.rb" do
- create_file "gems.rb"
+ create_file "gems.rb", "source \"#{file_uri_for(gem_repo1)}\""
install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
gem "rack"
@@ -462,7 +484,7 @@ RSpec.describe "major deprecations" do
context "when Bundler.setup is run in a ruby script" do
before do
- create_file "gems.rb"
+ create_file "gems.rb", "source \"#{file_uri_for(gem_repo1)}\""
install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
gem "rack", :group => :test
@@ -607,7 +629,7 @@ The :gist git source is deprecated, and will be removed in the future. Add this
before do
graphviz_version = RUBY_VERSION >= "2.4" ? "1.2.5" : "1.2.4"
realworld_system_gems "ruby-graphviz --version #{graphviz_version}"
- create_file "gems.rb"
+ create_file "gems.rb", "source \"#{file_uri_for(gem_repo1)}\""
bundle "viz"
end
diff --git a/spec/bundler/other/platform_spec.rb b/spec/bundler/other/platform_spec.rb
index eb3539b412..5693d6bce6 100644
--- a/spec/bundler/other/platform_spec.rb
+++ b/spec/bundler/other/platform_spec.rb
@@ -213,11 +213,13 @@ G
it "handles when there is a locked requirement" do
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
ruby "< 1.8.7"
G
lockfile <<-L
GEM
+ remote: #{file_uri_for(gem_repo1)}/
specs:
PLATFORMS
@@ -238,6 +240,7 @@ G
it "handles when there is a requirement in the gemfile" do
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
ruby ">= 1.8.7"
G
@@ -247,6 +250,7 @@ G
it "handles when there are multiple requirements in the gemfile" do
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
ruby ">= 1.8.7", "< 2.0.0"
G
@@ -685,6 +689,7 @@ G
it "copies the .gem file to vendor/cache when ruby version matches" do
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem 'rack'
#{ruby_version_correct}
@@ -708,6 +713,7 @@ G
it "fails if the ruby version doesn't match" do
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem 'rack'
#{ruby_version_incorrect}
@@ -719,6 +725,7 @@ G
it "fails if the engine doesn't match" do
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem 'rack'
#{engine_incorrect}
@@ -730,6 +737,7 @@ G
it "fails if the engine version doesn't match", :jruby do
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem 'rack'
#{engine_version_incorrect}
@@ -762,6 +770,7 @@ G
it "copies the .gem file to vendor/cache when ruby version matches" do
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem 'rack'
#{ruby_version_correct}
@@ -785,6 +794,7 @@ G
it "fails if the ruby version doesn't match" do
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem 'rack'
#{ruby_version_incorrect}
@@ -796,6 +806,7 @@ G
it "fails if the engine doesn't match" do
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem 'rack'
#{engine_incorrect}
@@ -807,6 +818,7 @@ G
it "fails if the engine version doesn't match", :jruby do
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem 'rack'
#{engine_version_incorrect}
@@ -837,6 +849,7 @@ G
it "activates the correct gem when ruby version matches" do
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "rack", "0.9.1"
#{ruby_version_correct}
@@ -849,6 +862,7 @@ G
it "activates the correct gem when ruby version matches any engine", :jruby do
system_gems "rack-1.0.0", "rack-0.9.1", :path => default_bundle_path
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "rack", "0.9.1"
#{ruby_version_correct_engineless}
@@ -860,6 +874,7 @@ G
it "fails when the ruby version doesn't match" do
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "rack", "0.9.1"
#{ruby_version_incorrect}
@@ -871,6 +886,7 @@ G
it "fails when the engine doesn't match" do
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "rack", "0.9.1"
#{engine_incorrect}
diff --git a/spec/bundler/plugins/install_spec.rb b/spec/bundler/plugins/install_spec.rb
index ef39e75a58..c719e8533e 100644
--- a/spec/bundler/plugins/install_spec.rb
+++ b/spec/bundler/plugins/install_spec.rb
@@ -214,6 +214,7 @@ RSpec.describe "bundler plugin install" do
end
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
plugin 'ga-plugin', :git => "#{lib_path("ga-plugin-1.0")}"
G
@@ -227,6 +228,7 @@ RSpec.describe "bundler plugin install" do
end
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
plugin 'ga-plugin', :path => "#{lib_path("ga-plugin-1.0")}"
G
diff --git a/spec/bundler/runtime/executable_spec.rb b/spec/bundler/runtime/executable_spec.rb
index e39338e425..a11f547648 100644
--- a/spec/bundler/runtime/executable_spec.rb
+++ b/spec/bundler/runtime/executable_spec.rb
@@ -63,6 +63,7 @@ RSpec.describe "Running bin/* commands" do
end
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "rack", :path => "#{lib_path("rack")}"
G
diff --git a/spec/bundler/runtime/inline_spec.rb b/spec/bundler/runtime/inline_spec.rb
index 4c2dff466b..647e6a8bd2 100644
--- a/spec/bundler/runtime/inline_spec.rb
+++ b/spec/bundler/runtime/inline_spec.rb
@@ -48,6 +48,7 @@ RSpec.describe "bundler/inline#gemfile" do
it "requires the gems" do
script <<-RUBY
gemfile do
+ source "#{file_uri_for(gem_repo1)}"
path "#{lib_path}" do
gem "two"
end
@@ -58,6 +59,7 @@ RSpec.describe "bundler/inline#gemfile" do
script <<-RUBY, :raise_on_error => false
gemfile do
+ source "#{file_uri_for(gem_repo1)}"
path "#{lib_path}" do
gem "eleven"
end
@@ -139,6 +141,7 @@ RSpec.describe "bundler/inline#gemfile" do
require '#{entrypoint}'
options = { :ui => Bundler::UI::Shell.new }
gemfile(false, options) do
+ source "#{file_uri_for(gem_repo1)}"
path "#{lib_path}" do
gem "two"
end
@@ -168,6 +171,7 @@ RSpec.describe "bundler/inline#gemfile" do
baz_ref = build_git("baz", "2.0.0").ref_for("HEAD")
script <<-RUBY
gemfile do
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :git => #{lib_path("foo-1.0.0").to_s.dump}
gem "baz", :git => #{lib_path("baz-2.0.0").to_s.dump}, :ref => #{baz_ref.dump}
end
@@ -184,12 +188,14 @@ RSpec.describe "bundler/inline#gemfile" do
script <<-RUBY
gemfile do
path "#{lib_path}" do
+ source "#{file_uri_for(gem_repo1)}"
gem "two"
end
end
gemfile do
path "#{lib_path}" do
+ source "#{file_uri_for(gem_repo1)}"
gem "four"
end
end
@@ -367,6 +373,7 @@ RSpec.describe "bundler/inline#gemfile" do
script <<-RUBY, :dir => tmp("path_without_gemfile")
gemfile do
+ source "#{file_uri_for(gem_repo2)}"
path "#{lib_path}" do
gem "foo", require: false
end
diff --git a/spec/bundler/runtime/require_spec.rb b/spec/bundler/runtime/require_spec.rb
index a3fa4fbe47..d91b5f8666 100644
--- a/spec/bundler/runtime/require_spec.rb
+++ b/spec/bundler/runtime/require_spec.rb
@@ -46,6 +46,7 @@ RSpec.describe "Bundler.require" do
end
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
path "#{lib_path}" do
gem "one", :group => :bar, :require => %w[baz qux]
gem "two"
@@ -112,6 +113,7 @@ RSpec.describe "Bundler.require" do
it "raises an exception if a require is specified but the file does not exist" do
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
path "#{lib_path}" do
gem "two", :require => 'fail'
end
@@ -130,6 +132,7 @@ RSpec.describe "Bundler.require" do
end
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
path "#{lib_path}" do
gem "faulty"
end
@@ -146,6 +149,7 @@ RSpec.describe "Bundler.require" do
end
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
path "#{lib_path}" do
gem "loadfuuu"
end
@@ -172,6 +176,7 @@ RSpec.describe "Bundler.require" do
it "requires gem names that are namespaced" do
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
path '#{lib_path}' do
gem 'jquery-rails'
end
@@ -186,6 +191,8 @@ RSpec.describe "Bundler.require" do
s.write "lib/brcrypt.rb", "BCrypt = '1.0.0'"
end
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
+
path "#{lib_path}" do
gem "bcrypt-ruby"
end
@@ -202,6 +209,7 @@ RSpec.describe "Bundler.require" do
it "does not mangle explicitly given requires" do
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
path "#{lib_path}" do
gem 'jquery-rails', :require => 'jquery-rails'
end
@@ -219,6 +227,7 @@ RSpec.describe "Bundler.require" do
end
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
path "#{lib_path}" do
gem "load-fuuu"
end
@@ -242,6 +251,7 @@ RSpec.describe "Bundler.require" do
end
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
path "#{lib_path}" do
gem "load-fuuu"
end
@@ -300,6 +310,7 @@ RSpec.describe "Bundler.require" do
it "works when the gems are in the Gemfile in the correct order" do
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
path "#{lib_path}" do
gem "two"
gem "one"
@@ -318,6 +329,7 @@ RSpec.describe "Bundler.require" do
end
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "multi_gem", :require => "one", :group => :one
gem "multi_gem", :require => "two", :group => :two
G
@@ -341,6 +353,7 @@ RSpec.describe "Bundler.require" do
it "fails when the gems are in the Gemfile in the wrong order" do
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
path "#{lib_path}" do
gem "one"
gem "two"
@@ -358,6 +371,7 @@ RSpec.describe "Bundler.require" do
end
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "busted_require"
G
@@ -396,6 +410,7 @@ RSpec.describe "Bundler.require" do
build_git "foo"
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :git => "#{lib_path("foo-1.0")}"
G
diff --git a/spec/bundler/runtime/setup_spec.rb b/spec/bundler/runtime/setup_spec.rb
index 380db99136..42bbacea0e 100644
--- a/spec/bundler/runtime/setup_spec.rb
+++ b/spec/bundler/runtime/setup_spec.rb
@@ -430,6 +430,7 @@ RSpec.describe "Bundler.setup" do
build_git "rack", "1.0.0"
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "rack", :git => "#{lib_path("rack-1.0.0")}"
G
end
@@ -857,7 +858,7 @@ end
end
it "should not remove itself from the LOAD_PATH and require a different copy of 'bundler/setup'" do
- install_gemfile ""
+ install_gemfile "source \"#{file_uri_for(gem_repo1)}\""
ruby <<-R, :env => { "GEM_PATH" => symlinked_gem_home }
TracePoint.trace(:class) do |tp|
@@ -906,6 +907,7 @@ end
FileUtils.rm(File.join(path, "foo.gemspec"))
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem 'foo', '1.2.3', :path => 'vendor/foo'
G
@@ -926,6 +928,7 @@ end
FileUtils.rm(File.join(absolute_path, "foo.gemspec"))
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem 'foo', '1.2.3', :path => '#{relative_path}'
G
@@ -944,6 +947,7 @@ end
build_git "no_gemspec", :gemspec => false
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "no_gemspec", "1.0", :git => "#{lib_path("no_gemspec-1.0")}"
G
end
@@ -1046,6 +1050,7 @@ end
end
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "bar", :git => "#{lib_path("bar-1.0")}"
G
end
@@ -1066,7 +1071,6 @@ end
expect(err.lines.map(&:chomp)).to include(
a_string_starting_with("[!] There was an error while loading `bar.gemspec`:"),
- a_string_starting_with("Does it try to require a relative path? That's been removed in Ruby 1.9."),
" # from #{default_bundle_path "bundler", "gems", "bar-1.0-#{ref[0, 12]}", "bar.gemspec"}:1",
" > require 'foobarbaz'"
)
@@ -1093,6 +1097,7 @@ end
describe "when Bundler is bundled" do
it "doesn't blow up" do
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "bundler", :path => "#{root}"
G
@@ -1224,7 +1229,7 @@ end
describe "with gemified standard libraries" do
it "does not load Psych" do
- gemfile ""
+ gemfile "source \"#{file_uri_for(gem_repo1)}\""
ruby <<-RUBY
require '#{entrypoint}/setup'
puts defined?(Psych::VERSION) ? Psych::VERSION : "undefined"
@@ -1237,7 +1242,7 @@ end
end
it "does not load openssl" do
- install_gemfile ""
+ install_gemfile "source \"#{file_uri_for(gem_repo1)}\""
ruby <<-RUBY
require "bundler/setup"
puts defined?(OpenSSL) || "undefined"
@@ -1296,13 +1301,13 @@ end
RUBY
it "activates no gems with -rbundler/setup" do
- install_gemfile ""
+ install_gemfile "source \"#{file_uri_for(gem_repo1)}\""
ruby code, :env => { "RUBYOPT" => activation_warning_hack_rubyopt + " -rbundler/setup" }
expect(out).to eq("{}")
end
it "activates no gems with bundle exec" do
- install_gemfile ""
+ install_gemfile "source \"#{file_uri_for(gem_repo1)}\""
create_file("script.rb", code)
bundle "exec ruby ./script.rb", :env => { "RUBYOPT" => activation_warning_hack_rubyopt }
expect(out).to eq("{}")
@@ -1311,7 +1316,7 @@ end
it "activates no gems with bundle exec that is loaded" do
skip "not executable" if Gem.win_platform?
- install_gemfile ""
+ install_gemfile "source \"#{file_uri_for(gem_repo1)}\""
create_file("script.rb", "#!/usr/bin/env ruby\n\n#{code}")
FileUtils.chmod(0o777, bundled_app("script.rb"))
bundle "exec ./script.rb", :artifice => nil, :env => { "RUBYOPT" => activation_warning_hack_rubyopt }
diff --git a/spec/bundler/runtime/with_unbundled_env_spec.rb b/spec/bundler/runtime/with_unbundled_env_spec.rb
index 03de830ea0..731a9921a2 100644
--- a/spec/bundler/runtime/with_unbundled_env_spec.rb
+++ b/spec/bundler/runtime/with_unbundled_env_spec.rb
@@ -8,7 +8,7 @@ RSpec.describe "Bundler.with_env helpers" do
def build_bundler_context(options = {})
bundle "config set path vendor/bundle"
- gemfile ""
+ gemfile "source \"#{file_uri_for(gem_repo1)}\""
bundle "install", options
end
diff --git a/spec/bundler/update/git_spec.rb b/spec/bundler/update/git_spec.rb
index bf078fa576..26ad1b45d3 100644
--- a/spec/bundler/update/git_spec.rb
+++ b/spec/bundler/update/git_spec.rb
@@ -7,6 +7,7 @@ RSpec.describe "bundle update" do
update_git "foo", :branch => "omg"
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
git "#{lib_path("foo-1.0")}", :branch => "omg" do
gem 'foo'
end
@@ -28,6 +29,7 @@ RSpec.describe "bundle update" do
end
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "rails", :git => "#{file_uri_for(lib_path("rails"))}"
G
@@ -40,6 +42,7 @@ RSpec.describe "bundle update" do
update_git "foo", :branch => "omg", :path => lib_path("foo")
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
git "#{lib_path("foo")}", :branch => "omg" do
gem 'foo'
end
@@ -61,6 +64,7 @@ RSpec.describe "bundle update" do
end
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :git => "#{file_uri_for(lib_path("foo"))}"
gem "bar"
G
@@ -79,12 +83,14 @@ RSpec.describe "bundle update" do
build_git "foo", :path => lib_path("foo_two")
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", "1.0", :git => "#{file_uri_for(lib_path("foo_one"))}"
G
FileUtils.rm_rf lib_path("foo_one")
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", "1.0", :git => "#{file_uri_for(lib_path("foo_two"))}"
G
@@ -100,6 +106,7 @@ RSpec.describe "bundle update" do
update_git "foo", :push => "master"
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem 'foo', :git => "#{@remote.path}"
G
@@ -108,6 +115,7 @@ RSpec.describe "bundle update" do
update_git "foo", :push => "fubar"
gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem 'foo', :git => "#{@remote.path}", :tag => "fubar"
G
@@ -183,6 +191,7 @@ RSpec.describe "bundle update" do
build_git "foo", "1.0"
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "foo", :git => "#{file_uri_for(lib_path("foo-1.0"))}"
G
@@ -214,6 +223,7 @@ RSpec.describe "bundle update" do
build_git "rails", "2.3.2", :path => lib_path("rails")
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "rails", :git => "#{file_uri_for(lib_path("rails"))}"
G
diff --git a/spec/bundler/update/path_spec.rb b/spec/bundler/update/path_spec.rb
index 38c125e04b..756770313b 100644
--- a/spec/bundler/update/path_spec.rb
+++ b/spec/bundler/update/path_spec.rb
@@ -6,6 +6,7 @@ RSpec.describe "path sources" do
build_lib "activesupport", "2.3.5", :path => lib_path("rails/activesupport")
install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
gem "activesupport", :path => "#{lib_path("rails/activesupport")}"
G
diff --git a/test/rubygems/data/null-type.gemspec.rz b/test/rubygems/data/null-type.gemspec.rz
index bad99289d1..2134fcde29 100644
--- a/test/rubygems/data/null-type.gemspec.rz
+++ b/test/rubygems/data/null-type.gemspec.rz
Binary files differ
diff --git a/lib/rubygems/test_case.rb b/test/rubygems/helper.rb
index 24e8ac853e..c3befb535f 100644
--- a/lib/rubygems/test_case.rb
+++ b/test/rubygems/helper.rb
@@ -52,32 +52,28 @@ require 'rubygems/mock_gem_ui'
module Gem
##
- # Allows setting the gem path searcher. This method is available when
- # requiring 'rubygems/test_case'
+ # Allows setting the gem path searcher.
def self.searcher=(searcher)
@searcher = searcher
end
##
- # Allows toggling Windows behavior. This method is available when requiring
- # 'rubygems/test_case'
+ # Allows toggling Windows behavior.
def self.win_platform=(val)
@@win_platform = val
end
##
- # Allows setting path to Ruby. This method is available when requiring
- # 'rubygems/test_case'
+ # Allows setting path to Ruby.
def self.ruby=(ruby)
@ruby = ruby
end
##
- # When rubygems/test_case is required the default user interaction is a
- # MockGemUi.
+ # Sets the default user interaction to a MockGemUi.
module DefaultUserInteraction
@ui = Gem::MockGemUi.new
@@ -88,8 +84,7 @@ require "rubygems/command"
class Gem::Command
##
- # Allows resetting the hash of specific args per command. This method is
- # available when requiring 'rubygems/test_case'
+ # Allows resetting the hash of specific args per command.
def self.specific_extra_args_hash=(value)
@specific_extra_args_hash = value
@@ -111,8 +106,6 @@ class Gem::TestCase < Test::Unit::TestCase
attr_accessor :uri # :nodoc:
- TEST_PATH = ENV.fetch('RUBYGEMS_TEST_PATH', File.expand_path('../../../test/rubygems', __FILE__))
-
def assert_activate(expected, *specs)
specs.each do |spec|
case spec
@@ -1304,7 +1297,7 @@ Also, a list:
end
def ruby_with_rubygems_in_load_path
- [Gem.ruby, "-I", File.expand_path("..", __dir__)]
+ [Gem.ruby, "-I", File.expand_path("../../lib", __dir__)]
end
def with_clean_path_to_ruby
@@ -1335,8 +1328,8 @@ Also, a list:
end
end
- @@good_rake = "#{rubybin} #{escape_path(TEST_PATH, 'good_rake.rb')}"
- @@bad_rake = "#{rubybin} #{escape_path(TEST_PATH, 'bad_rake.rb')}"
+ @@good_rake = "#{rubybin} #{escape_path(__dir__, 'good_rake.rb')}"
+ @@bad_rake = "#{rubybin} #{escape_path(__dir__, 'bad_rake.rb')}"
##
# Construct a new Gem::Dependency.
@@ -1523,12 +1516,12 @@ Also, a list:
def self.cert_path(cert_name)
if 32 == (Time.at(2**32) rescue 32)
- cert_file = "#{TEST_PATH}/#{cert_name}_cert_32.pem"
+ cert_file = "#{__dir__}/#{cert_name}_cert_32.pem"
return cert_file if File.exist? cert_file
end
- "#{TEST_PATH}/#{cert_name}_cert.pem"
+ "#{__dir__}/#{cert_name}_cert.pem"
end
##
@@ -1546,7 +1539,7 @@ Also, a list:
# Returns the path to the key named +key_name+ from <tt>test/rubygems</tt>
def self.key_path(key_name)
- "#{TEST_PATH}/#{key_name}_key.pem"
+ "#{__dir__}/#{key_name}_key.pem"
end
# :stopdoc:
@@ -1607,4 +1600,4 @@ class Object
end
end
-require 'rubygems/test_utilities'
+require_relative 'utilities'
diff --git a/lib/rubygems/installer_test_case.rb b/test/rubygems/installer_test_case.rb
index 416dac7be6..824ac53a82 100644
--- a/lib/rubygems/installer_test_case.rb
+++ b/test/rubygems/installer_test_case.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/installer'
class Gem::Installer
diff --git a/lib/rubygems/package/tar_test_case.rb b/test/rubygems/package/tar_test_case.rb
index 1161d0a5a8..99f503a23f 100644
--- a/lib/rubygems/package/tar_test_case.rb
+++ b/test/rubygems/package/tar_test_case.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative '../helper'
require 'rubygems/package'
##
diff --git a/test/rubygems/test_bundled_ca.rb b/test/rubygems/test_bundled_ca.rb
index ff5b8dba19..fff5904aba 100644
--- a/test/rubygems/test_bundled_ca.rb
+++ b/test/rubygems/test_bundled_ca.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'net/http'
require 'rubygems/openssl'
diff --git a/test/rubygems/test_config.rb b/test/rubygems/test_config.rb
index 015e2b1d8a..4d64f16fca 100644
--- a/test/rubygems/test_config.rb
+++ b/test/rubygems/test_config.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems'
require 'shellwords'
diff --git a/test/rubygems/test_deprecate.rb b/test/rubygems/test_deprecate.rb
index 4a14266ce3..a619eccb37 100644
--- a/test/rubygems/test_deprecate.rb
+++ b/test/rubygems/test_deprecate.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/deprecate'
class TestDeprecate < Gem::TestCase
diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb
index d548e95fd7..79ea89e2fa 100644
--- a/test/rubygems/test_gem.rb
+++ b/test/rubygems/test_gem.rb
@@ -1,5 +1,5 @@
# coding: US-ASCII
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems'
require 'rubygems/command'
require 'rubygems/installer'
diff --git a/test/rubygems/test_gem_available_set.rb b/test/rubygems/test_gem_available_set.rb
index dd2816acc6..c4164d77f2 100644
--- a/test/rubygems/test_gem_available_set.rb
+++ b/test/rubygems/test_gem_available_set.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/available_set'
require 'rubygems/security'
diff --git a/test/rubygems/test_gem_bundler_version_finder.rb b/test/rubygems/test_gem_bundler_version_finder.rb
index 4126898048..e971e6ae29 100644
--- a/test/rubygems/test_gem_bundler_version_finder.rb
+++ b/test/rubygems/test_gem_bundler_version_finder.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
class TestGemBundlerVersionFinder < Gem::TestCase
def setup
diff --git a/test/rubygems/test_gem_command.rb b/test/rubygems/test_gem_command.rb
index 4d0c4eb5e8..43ce6ea39f 100644
--- a/test/rubygems/test_gem_command.rb
+++ b/test/rubygems/test_gem_command.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/command'
class Gem::Command
diff --git a/test/rubygems/test_gem_command_manager.rb b/test/rubygems/test_gem_command_manager.rb
index d9c74191cd..6225576367 100644
--- a/test/rubygems/test_gem_command_manager.rb
+++ b/test/rubygems/test_gem_command_manager.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/command_manager'
class TestGemCommandManager < Gem::TestCase
diff --git a/test/rubygems/test_gem_commands_build_command.rb b/test/rubygems/test_gem_commands_build_command.rb
index 3adf69cdf4..1304beb580 100644
--- a/test/rubygems/test_gem_commands_build_command.rb
+++ b/test/rubygems/test_gem_commands_build_command.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/commands/build_command'
require 'rubygems/package'
diff --git a/test/rubygems/test_gem_commands_cert_command.rb b/test/rubygems/test_gem_commands_cert_command.rb
index e8b6e506f5..f722678a19 100644
--- a/test/rubygems/test_gem_commands_cert_command.rb
+++ b/test/rubygems/test_gem_commands_cert_command.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/commands/cert_command'
unless Gem::HAVE_OPENSSL
diff --git a/test/rubygems/test_gem_commands_check_command.rb b/test/rubygems/test_gem_commands_check_command.rb
index 07eea188e3..f280b060c4 100644
--- a/test/rubygems/test_gem_commands_check_command.rb
+++ b/test/rubygems/test_gem_commands_check_command.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/commands/check_command'
class TestGemCommandsCheckCommand < Gem::TestCase
diff --git a/test/rubygems/test_gem_commands_cleanup_command.rb b/test/rubygems/test_gem_commands_cleanup_command.rb
index 6e21e8c68b..fc98998012 100644
--- a/test/rubygems/test_gem_commands_cleanup_command.rb
+++ b/test/rubygems/test_gem_commands_cleanup_command.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/commands/cleanup_command'
require 'rubygems/installer'
diff --git a/test/rubygems/test_gem_commands_contents_command.rb b/test/rubygems/test_gem_commands_contents_command.rb
index 2b04a9c654..d79174717b 100644
--- a/test/rubygems/test_gem_commands_contents_command.rb
+++ b/test/rubygems/test_gem_commands_contents_command.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/commands/contents_command'
class TestGemCommandsContentsCommand < Gem::TestCase
diff --git a/test/rubygems/test_gem_commands_dependency_command.rb b/test/rubygems/test_gem_commands_dependency_command.rb
index d49aa2f513..13c7c065b5 100644
--- a/test/rubygems/test_gem_commands_dependency_command.rb
+++ b/test/rubygems/test_gem_commands_dependency_command.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/commands/dependency_command'
class TestGemCommandsDependencyCommand < Gem::TestCase
diff --git a/test/rubygems/test_gem_commands_environment_command.rb b/test/rubygems/test_gem_commands_environment_command.rb
index c31ca24869..2bf80d8d85 100644
--- a/test/rubygems/test_gem_commands_environment_command.rb
+++ b/test/rubygems/test_gem_commands_environment_command.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/commands/environment_command'
class TestGemCommandsEnvironmentCommand < Gem::TestCase
diff --git a/test/rubygems/test_gem_commands_fetch_command.rb b/test/rubygems/test_gem_commands_fetch_command.rb
index 9a81e8898e..35ee00f763 100644
--- a/test/rubygems/test_gem_commands_fetch_command.rb
+++ b/test/rubygems/test_gem_commands_fetch_command.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/package'
require 'rubygems/security'
require 'rubygems/commands/fetch_command'
diff --git a/test/rubygems/test_gem_commands_generate_index_command.rb b/test/rubygems/test_gem_commands_generate_index_command.rb
index fc1317a49d..5b7b37a446 100644
--- a/test/rubygems/test_gem_commands_generate_index_command.rb
+++ b/test/rubygems/test_gem_commands_generate_index_command.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/indexer'
require 'rubygems/commands/generate_index_command'
diff --git a/test/rubygems/test_gem_commands_help_command.rb b/test/rubygems/test_gem_commands_help_command.rb
index 128db5db1f..a70dd770e1 100644
--- a/test/rubygems/test_gem_commands_help_command.rb
+++ b/test/rubygems/test_gem_commands_help_command.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
require "rubygems"
-require "rubygems/test_case"
+require_relative "helper"
require "rubygems/commands/help_command"
require "rubygems/package"
require "rubygems/command_manager"
diff --git a/test/rubygems/test_gem_commands_info_command.rb b/test/rubygems/test_gem_commands_info_command.rb
index 6d67b567c7..462075f98c 100644
--- a/test/rubygems/test_gem_commands_info_command.rb
+++ b/test/rubygems/test_gem_commands_info_command.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/commands/info_command'
class TestGemCommandsInfoCommand < Gem::TestCase
diff --git a/test/rubygems/test_gem_commands_install_command.rb b/test/rubygems/test_gem_commands_install_command.rb
index c51bbf810d..48ac040d0e 100644
--- a/test/rubygems/test_gem_commands_install_command.rb
+++ b/test/rubygems/test_gem_commands_install_command.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/commands/install_command'
require 'rubygems/request_set'
require 'rubygems/rdoc'
diff --git a/test/rubygems/test_gem_commands_list_command.rb b/test/rubygems/test_gem_commands_list_command.rb
index 772a99eabd..d8cffce7a3 100644
--- a/test/rubygems/test_gem_commands_list_command.rb
+++ b/test/rubygems/test_gem_commands_list_command.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/commands/list_command'
class TestGemCommandsListCommand < Gem::TestCase
diff --git a/test/rubygems/test_gem_commands_lock_command.rb b/test/rubygems/test_gem_commands_lock_command.rb
index 81252e6409..f8afca1e29 100644
--- a/test/rubygems/test_gem_commands_lock_command.rb
+++ b/test/rubygems/test_gem_commands_lock_command.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/commands/lock_command'
class TestGemCommandsLockCommand < Gem::TestCase
diff --git a/test/rubygems/test_gem_commands_mirror.rb b/test/rubygems/test_gem_commands_mirror.rb
index 6b2b7d11bb..470f1c30fa 100644
--- a/test/rubygems/test_gem_commands_mirror.rb
+++ b/test/rubygems/test_gem_commands_mirror.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/commands/mirror_command'
class TestGemCommandsMirrorCommand < Gem::TestCase
diff --git a/test/rubygems/test_gem_commands_open_command.rb b/test/rubygems/test_gem_commands_open_command.rb
index 2c32b810cc..8447f7ea35 100644
--- a/test/rubygems/test_gem_commands_open_command.rb
+++ b/test/rubygems/test_gem_commands_open_command.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/commands/open_command'
class TestGemCommandsOpenCommand < Gem::TestCase
diff --git a/test/rubygems/test_gem_commands_outdated_command.rb b/test/rubygems/test_gem_commands_outdated_command.rb
index c4af421f5d..dc5c40a782 100644
--- a/test/rubygems/test_gem_commands_outdated_command.rb
+++ b/test/rubygems/test_gem_commands_outdated_command.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/commands/outdated_command'
class TestGemCommandsOutdatedCommand < Gem::TestCase
diff --git a/test/rubygems/test_gem_commands_owner_command.rb b/test/rubygems/test_gem_commands_owner_command.rb
index 730048e0ff..5b06b628c2 100644
--- a/test/rubygems/test_gem_commands_owner_command.rb
+++ b/test/rubygems/test_gem_commands_owner_command.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/commands/owner_command'
class TestGemCommandsOwnerCommand < Gem::TestCase
diff --git a/test/rubygems/test_gem_commands_pristine_command.rb b/test/rubygems/test_gem_commands_pristine_command.rb
index 118b2334fc..f4000f4657 100644
--- a/test/rubygems/test_gem_commands_pristine_command.rb
+++ b/test/rubygems/test_gem_commands_pristine_command.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/commands/pristine_command'
class TestGemCommandsPristineCommand < Gem::TestCase
diff --git a/test/rubygems/test_gem_commands_push_command.rb b/test/rubygems/test_gem_commands_push_command.rb
index 202e44e620..fa3968ffce 100644
--- a/test/rubygems/test_gem_commands_push_command.rb
+++ b/test/rubygems/test_gem_commands_push_command.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/commands/push_command'
class TestGemCommandsPushCommand < Gem::TestCase
diff --git a/test/rubygems/test_gem_commands_query_command.rb b/test/rubygems/test_gem_commands_query_command.rb
index cb95f185ab..0cc88b1685 100644
--- a/test/rubygems/test_gem_commands_query_command.rb
+++ b/test/rubygems/test_gem_commands_query_command.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/commands/query_command'
module TestGemCommandsQueryCommandSetup
diff --git a/test/rubygems/test_gem_commands_search_command.rb b/test/rubygems/test_gem_commands_search_command.rb
index 17693e6837..6397dbd4d4 100644
--- a/test/rubygems/test_gem_commands_search_command.rb
+++ b/test/rubygems/test_gem_commands_search_command.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/commands/search_command'
class TestGemCommandsSearchCommand < Gem::TestCase
diff --git a/test/rubygems/test_gem_commands_server_command.rb b/test/rubygems/test_gem_commands_server_command.rb
index 36c1feaec2..09cec63c15 100644
--- a/test/rubygems/test_gem_commands_server_command.rb
+++ b/test/rubygems/test_gem_commands_server_command.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/commands/server_command'
class TestGemCommandsServerCommand < Gem::TestCase
diff --git a/test/rubygems/test_gem_commands_setup_command.rb b/test/rubygems/test_gem_commands_setup_command.rb
index 93646550c1..3aa6bfa2fe 100644
--- a/test/rubygems/test_gem_commands_setup_command.rb
+++ b/test/rubygems/test_gem_commands_setup_command.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/commands/setup_command'
class TestGemCommandsSetupCommand < Gem::TestCase
@@ -21,7 +21,7 @@ class TestGemCommandsSetupCommand < Gem::TestCase
filelist = %w[
bin/gem
lib/rubygems.rb
- lib/rubygems/test_case.rb
+ lib/rubygems/requirement.rb
lib/rubygems/ssl_certs/rubygems.org/foo.pem
bundler/exe/bundle
bundler/exe/bundler
@@ -159,7 +159,7 @@ class TestGemCommandsSetupCommand < Gem::TestCase
end
def test_files_in
- assert_equal %w[rubygems.rb rubygems/ssl_certs/rubygems.org/foo.pem rubygems/test_case.rb],
+ assert_equal %w[rubygems.rb rubygems/requirement.rb rubygems/ssl_certs/rubygems.org/foo.pem],
@cmd.files_in('lib').sort
end
diff --git a/test/rubygems/test_gem_commands_signin_command.rb b/test/rubygems/test_gem_commands_signin_command.rb
index d895d90b0c..eaf32886b3 100644
--- a/test/rubygems/test_gem_commands_signin_command.rb
+++ b/test/rubygems/test_gem_commands_signin_command.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/commands/signin_command'
require 'rubygems/installer'
diff --git a/test/rubygems/test_gem_commands_signout_command.rb b/test/rubygems/test_gem_commands_signout_command.rb
index 20389d0537..aa6300b6ab 100644
--- a/test/rubygems/test_gem_commands_signout_command.rb
+++ b/test/rubygems/test_gem_commands_signout_command.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/commands/signout_command'
require 'rubygems/installer'
diff --git a/test/rubygems/test_gem_commands_sources_command.rb b/test/rubygems/test_gem_commands_sources_command.rb
index 70d1b3611c..7bca0f3803 100644
--- a/test/rubygems/test_gem_commands_sources_command.rb
+++ b/test/rubygems/test_gem_commands_sources_command.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/commands/sources_command'
class TestGemCommandsSourcesCommand < Gem::TestCase
diff --git a/test/rubygems/test_gem_commands_specification_command.rb b/test/rubygems/test_gem_commands_specification_command.rb
index a04746f82c..c8cb7df32e 100644
--- a/test/rubygems/test_gem_commands_specification_command.rb
+++ b/test/rubygems/test_gem_commands_specification_command.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/commands/specification_command'
class TestGemCommandsSpecificationCommand < Gem::TestCase
diff --git a/test/rubygems/test_gem_commands_stale_command.rb b/test/rubygems/test_gem_commands_stale_command.rb
index 0aa7f243e2..83bd3e5def 100644
--- a/test/rubygems/test_gem_commands_stale_command.rb
+++ b/test/rubygems/test_gem_commands_stale_command.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/commands/stale_command'
class TestGemCommandsStaleCommand < Gem::TestCase
diff --git a/test/rubygems/test_gem_commands_uninstall_command.rb b/test/rubygems/test_gem_commands_uninstall_command.rb
index a1b81d73de..55f1049266 100644
--- a/test/rubygems/test_gem_commands_uninstall_command.rb
+++ b/test/rubygems/test_gem_commands_uninstall_command.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/installer_test_case'
+require_relative 'installer_test_case'
require 'rubygems/commands/uninstall_command'
class TestGemCommandsUninstallCommand < Gem::InstallerTestCase
diff --git a/test/rubygems/test_gem_commands_unpack_command.rb b/test/rubygems/test_gem_commands_unpack_command.rb
index f2f60f02bf..55369f1eeb 100644
--- a/test/rubygems/test_gem_commands_unpack_command.rb
+++ b/test/rubygems/test_gem_commands_unpack_command.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/commands/unpack_command'
class TestGemCommandsUnpackCommand < Gem::TestCase
diff --git a/test/rubygems/test_gem_commands_update_command.rb b/test/rubygems/test_gem_commands_update_command.rb
index 3224391018..a7ddddf2c1 100644
--- a/test/rubygems/test_gem_commands_update_command.rb
+++ b/test/rubygems/test_gem_commands_update_command.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/commands/update_command'
class TestGemCommandsUpdateCommand < Gem::TestCase
diff --git a/test/rubygems/test_gem_commands_which_command.rb b/test/rubygems/test_gem_commands_which_command.rb
index ce56f8eefc..a398dc5708 100644
--- a/test/rubygems/test_gem_commands_which_command.rb
+++ b/test/rubygems/test_gem_commands_which_command.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/commands/which_command'
class TestGemCommandsWhichCommand < Gem::TestCase
diff --git a/test/rubygems/test_gem_commands_yank_command.rb b/test/rubygems/test_gem_commands_yank_command.rb
index 76e935b06a..3b0956e1c4 100644
--- a/test/rubygems/test_gem_commands_yank_command.rb
+++ b/test/rubygems/test_gem_commands_yank_command.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/commands/yank_command'
class TestGemCommandsYankCommand < Gem::TestCase
diff --git a/test/rubygems/test_gem_config_file.rb b/test/rubygems/test_gem_config_file.rb
index 77d7a08bb8..32375e6936 100644
--- a/test/rubygems/test_gem_config_file.rb
+++ b/test/rubygems/test_gem_config_file.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/config_file'
class TestGemConfigFile < Gem::TestCase
diff --git a/test/rubygems/test_gem_dependency.rb b/test/rubygems/test_gem_dependency.rb
index d4ef220064..1ca0fc378c 100644
--- a/test/rubygems/test_gem_dependency.rb
+++ b/test/rubygems/test_gem_dependency.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/dependency'
class TestGemDependency < Gem::TestCase
diff --git a/test/rubygems/test_gem_dependency_installer.rb b/test/rubygems/test_gem_dependency_installer.rb
index 90d5d16403..9cbdcefea4 100644
--- a/test/rubygems/test_gem_dependency_installer.rb
+++ b/test/rubygems/test_gem_dependency_installer.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/dependency_installer'
require 'rubygems/security'
diff --git a/test/rubygems/test_gem_dependency_list.rb b/test/rubygems/test_gem_dependency_list.rb
index 097e680596..15c50de199 100644
--- a/test/rubygems/test_gem_dependency_list.rb
+++ b/test/rubygems/test_gem_dependency_list.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/dependency_list'
class TestGemDependencyList < Gem::TestCase
diff --git a/test/rubygems/test_gem_dependency_resolution_error.rb b/test/rubygems/test_gem_dependency_resolution_error.rb
index 5321f7031c..0e4a2fe31a 100644
--- a/test/rubygems/test_gem_dependency_resolution_error.rb
+++ b/test/rubygems/test_gem_dependency_resolution_error.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
class TestGemDependencyResolutionError < Gem::TestCase
def setup
diff --git a/test/rubygems/test_gem_doctor.rb b/test/rubygems/test_gem_doctor.rb
index 4514d17f9f..583c735dd3 100644
--- a/test/rubygems/test_gem_doctor.rb
+++ b/test/rubygems/test_gem_doctor.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/doctor'
class TestGemDoctor < Gem::TestCase
diff --git a/test/rubygems/test_gem_ext_builder.rb b/test/rubygems/test_gem_ext_builder.rb
index 36d5328aef..165194510e 100644
--- a/test/rubygems/test_gem_ext_builder.rb
+++ b/test/rubygems/test_gem_ext_builder.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/ext'
require 'rubygems/installer'
@@ -106,6 +106,7 @@ install:
end
def test_build_extensions
+ pend if /mswin/ =~ RUBY_PLATFORM && ENV.key?('GITHUB_ACTIONS') # not working from the beginning
@spec.extensions << 'ext/extconf.rb'
ext_dir = File.join @spec.gem_dir, 'ext'
@@ -141,6 +142,7 @@ install:
end
def test_build_extensions_with_gemhome_with_space
+ pend if /mswin/ =~ RUBY_PLATFORM && ENV.key?('GITHUB_ACTIONS') # not working from the beginning
new_gemhome = File.join @tempdir, 'gem home'
File.rename(@gemhome, new_gemhome)
@gemhome = new_gemhome
@@ -161,6 +163,7 @@ install:
false
end
end
+ pend if /mswin/ =~ RUBY_PLATFORM && ENV.key?('GITHUB_ACTIONS') # not working from the beginning
@spec.extensions << 'ext/extconf.rb'
diff --git a/test/rubygems/test_gem_ext_cmake_builder.rb b/test/rubygems/test_gem_ext_cmake_builder.rb
index 47d06efbca..5ab82c545f 100644
--- a/test/rubygems/test_gem_ext_cmake_builder.rb
+++ b/test/rubygems/test_gem_ext_cmake_builder.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/ext'
class TestGemExtCmakeBuilder < Gem::TestCase
diff --git a/test/rubygems/test_gem_ext_configure_builder.rb b/test/rubygems/test_gem_ext_configure_builder.rb
index 87260bcfa2..76ccfe2dc4 100644
--- a/test/rubygems/test_gem_ext_configure_builder.rb
+++ b/test/rubygems/test_gem_ext_configure_builder.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/ext'
class TestGemExtConfigureBuilder < Gem::TestCase
diff --git a/test/rubygems/test_gem_ext_ext_conf_builder.rb b/test/rubygems/test_gem_ext_ext_conf_builder.rb
index 02b46ad8b7..70833f35cf 100644
--- a/test/rubygems/test_gem_ext_ext_conf_builder.rb
+++ b/test/rubygems/test_gem_ext_ext_conf_builder.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/ext'
class TestGemExtExtConfBuilder < Gem::TestCase
diff --git a/test/rubygems/test_gem_ext_rake_builder.rb b/test/rubygems/test_gem_ext_rake_builder.rb
index 505f42ba06..3d8922eed5 100644
--- a/test/rubygems/test_gem_ext_rake_builder.rb
+++ b/test/rubygems/test_gem_ext_rake_builder.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/ext'
class TestGemExtRakeBuilder < Gem::TestCase
diff --git a/test/rubygems/test_gem_gem_runner.rb b/test/rubygems/test_gem_gem_runner.rb
index 8df11ecebc..6f5361cf2f 100644
--- a/test/rubygems/test_gem_gem_runner.rb
+++ b/test/rubygems/test_gem_gem_runner.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
class TestGemGemRunner < Gem::TestCase
def setup
diff --git a/test/rubygems/test_gem_gemcutter_utilities.rb b/test/rubygems/test_gem_gemcutter_utilities.rb
index fa9f951f8e..0bcd1504e9 100644
--- a/test/rubygems/test_gem_gemcutter_utilities.rb
+++ b/test/rubygems/test_gem_gemcutter_utilities.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems'
require 'rubygems/command'
require 'rubygems/gemcutter_utilities'
diff --git a/test/rubygems/test_gem_impossible_dependencies_error.rb b/test/rubygems/test_gem_impossible_dependencies_error.rb
index e4fe6ef77c..971be151df 100644
--- a/test/rubygems/test_gem_impossible_dependencies_error.rb
+++ b/test/rubygems/test_gem_impossible_dependencies_error.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
class TestGemImpossibleDependenciesError < Gem::TestCase
def test_message_conflict
diff --git a/test/rubygems/test_gem_indexer.rb b/test/rubygems/test_gem_indexer.rb
index adc83dd8fb..6653f29adf 100644
--- a/test/rubygems/test_gem_indexer.rb
+++ b/test/rubygems/test_gem_indexer.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/indexer'
class TestGemIndexer < Gem::TestCase
diff --git a/test/rubygems/test_gem_install_update_options.rb b/test/rubygems/test_gem_install_update_options.rb
index 1afac10f73..33cb5c08bf 100644
--- a/test/rubygems/test_gem_install_update_options.rb
+++ b/test/rubygems/test_gem_install_update_options.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/installer_test_case'
+require_relative 'installer_test_case'
require 'rubygems/install_update_options'
require 'rubygems/command'
require 'rubygems/dependency_installer'
diff --git a/test/rubygems/test_gem_installer.rb b/test/rubygems/test_gem_installer.rb
index 0a73425f93..a2b390d639 100644
--- a/test/rubygems/test_gem_installer.rb
+++ b/test/rubygems/test_gem_installer.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/installer_test_case'
+require_relative 'installer_test_case'
class TestGemInstaller < Gem::InstallerTestCase
def setup
@@ -740,7 +740,6 @@ gem 'other', version
installer = Gem::Installer.at(
gem_with_dangling_symlink,
- :install_dir => @gem_home,
:user_install => false,
:force => true
)
@@ -1482,6 +1481,7 @@ gem 'other', version
def test_install_extension_and_script
pend "Makefile creation crashes on jruby" if Gem.java_platform?
+ pend if /mswin/ =~ RUBY_PLATFORM && ENV.key?('GITHUB_ACTIONS') # not working from the beginning
@spec = setup_base_spec
@spec.extensions << "extconf.rb"
diff --git a/test/rubygems/test_gem_local_remote_options.rb b/test/rubygems/test_gem_local_remote_options.rb
index 2373bbde1f..948d1e3981 100644
--- a/test/rubygems/test_gem_local_remote_options.rb
+++ b/test/rubygems/test_gem_local_remote_options.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/local_remote_options'
require 'rubygems/command'
diff --git a/test/rubygems/test_gem_name_tuple.rb b/test/rubygems/test_gem_name_tuple.rb
index 92cfe6c1d2..d87db9bc45 100644
--- a/test/rubygems/test_gem_name_tuple.rb
+++ b/test/rubygems/test_gem_name_tuple.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/name_tuple'
class TestGemNameTuple < Gem::TestCase
diff --git a/test/rubygems/test_gem_package.rb b/test/rubygems/test_gem_package.rb
index 4cb8b9f981..3fa2c1911c 100644
--- a/test/rubygems/test_gem_package.rb
+++ b/test/rubygems/test_gem_package.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require 'rubygems/package/tar_test_case'
+require_relative 'package/tar_test_case'
require 'digest'
class TestGemPackage < Gem::Package::TarTestCase
diff --git a/test/rubygems/test_gem_package_old.rb b/test/rubygems/test_gem_package_old.rb
index 3477e001dc..945340a96a 100644
--- a/test/rubygems/test_gem_package_old.rb
+++ b/test/rubygems/test_gem_package_old.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
unless Gem.java_platform? # jruby can't require the simple_gem file
require 'rubygems/simple_gem'
diff --git a/test/rubygems/test_gem_package_tar_header.rb b/test/rubygems/test_gem_package_tar_header.rb
index 9f321e0a77..0e72a72d6a 100644
--- a/test/rubygems/test_gem_package_tar_header.rb
+++ b/test/rubygems/test_gem_package_tar_header.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/package/tar_test_case'
+require_relative 'package/tar_test_case'
require 'rubygems/package'
class TestGemPackageTarHeader < Gem::Package::TarTestCase
diff --git a/test/rubygems/test_gem_package_tar_reader.rb b/test/rubygems/test_gem_package_tar_reader.rb
index 05b3ac56a6..277b552f1b 100644
--- a/test/rubygems/test_gem_package_tar_reader.rb
+++ b/test/rubygems/test_gem_package_tar_reader.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/package/tar_test_case'
+require_relative 'package/tar_test_case'
require 'rubygems/package'
class TestGemPackageTarReader < Gem::Package::TarTestCase
diff --git a/test/rubygems/test_gem_package_tar_reader_entry.rb b/test/rubygems/test_gem_package_tar_reader_entry.rb
index bf20388f59..1be5870146 100644
--- a/test/rubygems/test_gem_package_tar_reader_entry.rb
+++ b/test/rubygems/test_gem_package_tar_reader_entry.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/package/tar_test_case'
+require_relative 'package/tar_test_case'
require 'rubygems/package'
class TestGemPackageTarReaderEntry < Gem::Package::TarTestCase
diff --git a/test/rubygems/test_gem_package_tar_writer.rb b/test/rubygems/test_gem_package_tar_writer.rb
index 6260f80ef9..31a91fa21a 100644
--- a/test/rubygems/test_gem_package_tar_writer.rb
+++ b/test/rubygems/test_gem_package_tar_writer.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/package/tar_test_case'
+require_relative 'package/tar_test_case'
require 'rubygems/package/tar_writer'
class TestGemPackageTarWriter < Gem::Package::TarTestCase
diff --git a/test/rubygems/test_gem_package_task.rb b/test/rubygems/test_gem_package_task.rb
index 6f217061d2..0cedfe56eb 100644
--- a/test/rubygems/test_gem_package_task.rb
+++ b/test/rubygems/test_gem_package_task.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems'
begin
diff --git a/test/rubygems/test_gem_path_support.rb b/test/rubygems/test_gem_path_support.rb
index 719aee52f6..88a3cc29b9 100644
--- a/test/rubygems/test_gem_path_support.rb
+++ b/test/rubygems/test_gem_path_support.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems'
require 'fileutils'
diff --git a/test/rubygems/test_gem_platform.rb b/test/rubygems/test_gem_platform.rb
index 84754402ad..aae0250801 100644
--- a/test/rubygems/test_gem_platform.rb
+++ b/test/rubygems/test_gem_platform.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/platform'
require 'rbconfig'
diff --git a/test/rubygems/test_gem_rdoc.rb b/test/rubygems/test_gem_rdoc.rb
index a8089bdb94..7b8ad07b27 100644
--- a/test/rubygems/test_gem_rdoc.rb
+++ b/test/rubygems/test_gem_rdoc.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
require 'rubygems'
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/rdoc'
class TestGemRDoc < Gem::TestCase
diff --git a/test/rubygems/test_gem_remote_fetcher.rb b/test/rubygems/test_gem_remote_fetcher.rb
index 69f62b6ca4..1bae9247fe 100644
--- a/test/rubygems/test_gem_remote_fetcher.rb
+++ b/test/rubygems/test_gem_remote_fetcher.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'webrick'
require 'webrick/https' if Gem::HAVE_OPENSSL
diff --git a/test/rubygems/test_gem_request.rb b/test/rubygems/test_gem_request.rb
index 094d0aecf3..780150d639 100644
--- a/test/rubygems/test_gem_request.rb
+++ b/test/rubygems/test_gem_request.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/request'
require 'ostruct'
require 'base64'
diff --git a/test/rubygems/test_gem_request_connection_pools.rb b/test/rubygems/test_gem_request_connection_pools.rb
index a6ab002396..c5e7cf2ed4 100644
--- a/test/rubygems/test_gem_request_connection_pools.rb
+++ b/test/rubygems/test_gem_request_connection_pools.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/request'
require 'timeout'
diff --git a/test/rubygems/test_gem_request_set.rb b/test/rubygems/test_gem_request_set.rb
index 404e9b61aa..e2fe98b9bf 100644
--- a/test/rubygems/test_gem_request_set.rb
+++ b/test/rubygems/test_gem_request_set.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/request_set'
class TestGemRequestSet < Gem::TestCase
diff --git a/test/rubygems/test_gem_request_set_gem_dependency_api.rb b/test/rubygems/test_gem_request_set_gem_dependency_api.rb
index 5891882119..cc4f99df91 100644
--- a/test/rubygems/test_gem_request_set_gem_dependency_api.rb
+++ b/test/rubygems/test_gem_request_set_gem_dependency_api.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/request_set'
class TestGemRequestSetGemDependencyAPI < Gem::TestCase
diff --git a/test/rubygems/test_gem_request_set_lockfile.rb b/test/rubygems/test_gem_request_set_lockfile.rb
index 2ad743c5a1..690b632d9b 100644
--- a/test/rubygems/test_gem_request_set_lockfile.rb
+++ b/test/rubygems/test_gem_request_set_lockfile.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/request_set'
require 'rubygems/request_set/lockfile'
diff --git a/test/rubygems/test_gem_request_set_lockfile_parser.rb b/test/rubygems/test_gem_request_set_lockfile_parser.rb
index 2954df70d8..4007c3a69c 100644
--- a/test/rubygems/test_gem_request_set_lockfile_parser.rb
+++ b/test/rubygems/test_gem_request_set_lockfile_parser.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/request_set'
require 'rubygems/request_set/lockfile'
require 'rubygems/request_set/lockfile/tokenizer'
diff --git a/test/rubygems/test_gem_request_set_lockfile_tokenizer.rb b/test/rubygems/test_gem_request_set_lockfile_tokenizer.rb
index a81ecac7b7..f779c33012 100644
--- a/test/rubygems/test_gem_request_set_lockfile_tokenizer.rb
+++ b/test/rubygems/test_gem_request_set_lockfile_tokenizer.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/request_set'
require 'rubygems/request_set/lockfile'
require 'rubygems/request_set/lockfile/tokenizer'
diff --git a/test/rubygems/test_gem_requirement.rb b/test/rubygems/test_gem_requirement.rb
index f7cdbab92e..b20b3cc0dc 100644
--- a/test/rubygems/test_gem_requirement.rb
+++ b/test/rubygems/test_gem_requirement.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require "rubygems/requirement"
class TestGemRequirement < Gem::TestCase
@@ -423,6 +423,40 @@ class TestGemRequirement < Gem::TestCase
assert_requirement_hash_equal "1", "1.0.0"
end
+ class Exploit < RuntimeError
+ end
+
+ def self.exploit(arg)
+ raise Exploit, "arg = #{arg}"
+ end
+
+ def test_marshal_load_attack
+ wa = Net::WriteAdapter.allocate
+ wa.instance_variable_set(:@socket, self.class)
+ wa.instance_variable_set(:@method_id, :exploit)
+ request_set = Gem::RequestSet.allocate
+ request_set.instance_variable_set(:@git_set, "id")
+ request_set.instance_variable_set(:@sets, wa)
+ wa = Net::WriteAdapter.allocate
+ wa.instance_variable_set(:@socket, request_set)
+ wa.instance_variable_set(:@method_id, :resolve)
+ ent = Gem::Package::TarReader::Entry.allocate
+ ent.instance_variable_set(:@read, 0)
+ ent.instance_variable_set(:@header, "aaa")
+ io = Net::BufferedIO.allocate
+ io.instance_variable_set(:@io, ent)
+ io.instance_variable_set(:@debug_output, wa)
+ reader = Gem::Package::TarReader.allocate
+ reader.instance_variable_set(:@io, io)
+ requirement = Gem::Requirement.allocate
+ requirement.instance_variable_set(:@requirements, reader)
+ m = [Gem::SpecFetcher, Gem::Installer, requirement]
+ e = assert_raise(TypeError) do
+ Marshal.load(Marshal.dump(m))
+ end
+ assert_equal(e.message, "wrong @requirements")
+ end
+
# Assert that two requirements are equal. Handles Gem::Requirements,
# strings, arrays, numbers, and versions.
diff --git a/test/rubygems/test_gem_resolver.rb b/test/rubygems/test_gem_resolver.rb
index fbf9438122..eb798ad557 100644
--- a/test/rubygems/test_gem_resolver.rb
+++ b/test/rubygems/test_gem_resolver.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
class TestGemResolver < Gem::TestCase
def setup
diff --git a/test/rubygems/test_gem_resolver_activation_request.rb b/test/rubygems/test_gem_resolver_activation_request.rb
index f973c5956d..c7b726a230 100644
--- a/test/rubygems/test_gem_resolver_activation_request.rb
+++ b/test/rubygems/test_gem_resolver_activation_request.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
class TestGemResolverActivationRequest < Gem::TestCase
def setup
diff --git a/test/rubygems/test_gem_resolver_api_set.rb b/test/rubygems/test_gem_resolver_api_set.rb
index aa17ec6f3a..c3db25d7aa 100644
--- a/test/rubygems/test_gem_resolver_api_set.rb
+++ b/test/rubygems/test_gem_resolver_api_set.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
class TestGemResolverAPISet < Gem::TestCase
def setup
diff --git a/test/rubygems/test_gem_resolver_api_specification.rb b/test/rubygems/test_gem_resolver_api_specification.rb
index e9ba4ae481..3f9b81868f 100644
--- a/test/rubygems/test_gem_resolver_api_specification.rb
+++ b/test/rubygems/test_gem_resolver_api_specification.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
class TestGemResolverAPISpecification < Gem::TestCase
def test_initialize
diff --git a/test/rubygems/test_gem_resolver_best_set.rb b/test/rubygems/test_gem_resolver_best_set.rb
index df6b438763..0e279d16a8 100644
--- a/test/rubygems/test_gem_resolver_best_set.rb
+++ b/test/rubygems/test_gem_resolver_best_set.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
class TestGemResolverBestSet < Gem::TestCase
def setup
diff --git a/test/rubygems/test_gem_resolver_composed_set.rb b/test/rubygems/test_gem_resolver_composed_set.rb
index 7c8ae004a3..405753a373 100644
--- a/test/rubygems/test_gem_resolver_composed_set.rb
+++ b/test/rubygems/test_gem_resolver_composed_set.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
class TestGemResolverComposedSet < Gem::TestCase
def test_errors
diff --git a/test/rubygems/test_gem_resolver_conflict.rb b/test/rubygems/test_gem_resolver_conflict.rb
index ff5fe9bae3..1d46e69c3f 100644
--- a/test/rubygems/test_gem_resolver_conflict.rb
+++ b/test/rubygems/test_gem_resolver_conflict.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
class TestGemResolverConflict < Gem::TestCase
def test_explanation
diff --git a/test/rubygems/test_gem_resolver_dependency_request.rb b/test/rubygems/test_gem_resolver_dependency_request.rb
index a8ddc8362b..cea0a7952d 100644
--- a/test/rubygems/test_gem_resolver_dependency_request.rb
+++ b/test/rubygems/test_gem_resolver_dependency_request.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
class TestGemResolverDependencyRequest < Gem::TestCase
def setup
diff --git a/test/rubygems/test_gem_resolver_git_set.rb b/test/rubygems/test_gem_resolver_git_set.rb
index 7b0efa0680..145cd6c7df 100644
--- a/test/rubygems/test_gem_resolver_git_set.rb
+++ b/test/rubygems/test_gem_resolver_git_set.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
class TestGemResolverGitSet < Gem::TestCase
def setup
diff --git a/test/rubygems/test_gem_resolver_git_specification.rb b/test/rubygems/test_gem_resolver_git_specification.rb
index 25e93bb7d5..857452c159 100644
--- a/test/rubygems/test_gem_resolver_git_specification.rb
+++ b/test/rubygems/test_gem_resolver_git_specification.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/installer'
class TestGemResolverGitSpecification < Gem::TestCase
@@ -63,6 +63,7 @@ class TestGemResolverGitSpecification < Gem::TestCase
def test_install_extension
pend if Gem.java_platform?
+ pend if /mswin/ =~ RUBY_PLATFORM && ENV.key?('GITHUB_ACTIONS') # not working from the beginning
name, _, repository, = git_gem 'a', 1 do |s|
s.extensions << 'ext/extconf.rb'
end
diff --git a/test/rubygems/test_gem_resolver_index_set.rb b/test/rubygems/test_gem_resolver_index_set.rb
index 2de766f60a..ddae0c2b82 100644
--- a/test/rubygems/test_gem_resolver_index_set.rb
+++ b/test/rubygems/test_gem_resolver_index_set.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
class TestGemResolverIndexSet < Gem::TestCase
def setup
diff --git a/test/rubygems/test_gem_resolver_index_specification.rb b/test/rubygems/test_gem_resolver_index_specification.rb
index 382f95c004..ef9c17034e 100644
--- a/test/rubygems/test_gem_resolver_index_specification.rb
+++ b/test/rubygems/test_gem_resolver_index_specification.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/available_set'
class TestGemResolverIndexSpecification < Gem::TestCase
diff --git a/test/rubygems/test_gem_resolver_installed_specification.rb b/test/rubygems/test_gem_resolver_installed_specification.rb
index b102f98d00..0e5ea02fb9 100644
--- a/test/rubygems/test_gem_resolver_installed_specification.rb
+++ b/test/rubygems/test_gem_resolver_installed_specification.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
class TestGemResolverInstalledSpecification < Gem::TestCase
def setup
diff --git a/test/rubygems/test_gem_resolver_installer_set.rb b/test/rubygems/test_gem_resolver_installer_set.rb
index d45a527d2f..66857943c9 100644
--- a/test/rubygems/test_gem_resolver_installer_set.rb
+++ b/test/rubygems/test_gem_resolver_installer_set.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
class TestGemResolverInstallerSet < Gem::TestCase
def test_add_always_install
diff --git a/test/rubygems/test_gem_resolver_local_specification.rb b/test/rubygems/test_gem_resolver_local_specification.rb
index 67b8f34cc1..c11f736128 100644
--- a/test/rubygems/test_gem_resolver_local_specification.rb
+++ b/test/rubygems/test_gem_resolver_local_specification.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/available_set'
class TestGemResolverLocalSpecification < Gem::TestCase
diff --git a/test/rubygems/test_gem_resolver_lock_set.rb b/test/rubygems/test_gem_resolver_lock_set.rb
index cb03e0b5f8..dc7767a3f8 100644
--- a/test/rubygems/test_gem_resolver_lock_set.rb
+++ b/test/rubygems/test_gem_resolver_lock_set.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
class TestGemResolverLockSet < Gem::TestCase
def setup
diff --git a/test/rubygems/test_gem_resolver_lock_specification.rb b/test/rubygems/test_gem_resolver_lock_specification.rb
index 07654a9164..46c8e5edd6 100644
--- a/test/rubygems/test_gem_resolver_lock_specification.rb
+++ b/test/rubygems/test_gem_resolver_lock_specification.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/installer'
require 'rubygems/resolver'
diff --git a/test/rubygems/test_gem_resolver_requirement_list.rb b/test/rubygems/test_gem_resolver_requirement_list.rb
index af8a77ef4b..806c387669 100644
--- a/test/rubygems/test_gem_resolver_requirement_list.rb
+++ b/test/rubygems/test_gem_resolver_requirement_list.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
class TestGemResolverRequirementList < Gem::TestCase
def setup
diff --git a/test/rubygems/test_gem_resolver_specification.rb b/test/rubygems/test_gem_resolver_specification.rb
index 8b50bf91bd..9f28c1c0cf 100644
--- a/test/rubygems/test_gem_resolver_specification.rb
+++ b/test/rubygems/test_gem_resolver_specification.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
class TestGemResolverSpecification < Gem::TestCase
class TestSpec < Gem::Resolver::Specification
diff --git a/test/rubygems/test_gem_resolver_vendor_set.rb b/test/rubygems/test_gem_resolver_vendor_set.rb
index 19cc7383c6..e16d43ac1a 100644
--- a/test/rubygems/test_gem_resolver_vendor_set.rb
+++ b/test/rubygems/test_gem_resolver_vendor_set.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
class TestGemResolverVendorSet < Gem::TestCase
def setup
diff --git a/test/rubygems/test_gem_resolver_vendor_specification.rb b/test/rubygems/test_gem_resolver_vendor_specification.rb
index dbf0c58e0b..93382ccd81 100644
--- a/test/rubygems/test_gem_resolver_vendor_specification.rb
+++ b/test/rubygems/test_gem_resolver_vendor_specification.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
class TestGemResolverVendorSpecification < Gem::TestCase
def setup
diff --git a/test/rubygems/test_gem_security.rb b/test/rubygems/test_gem_security.rb
index 0badb96763..2eabbea3bf 100644
--- a/test/rubygems/test_gem_security.rb
+++ b/test/rubygems/test_gem_security.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/security'
unless Gem::HAVE_OPENSSL
diff --git a/test/rubygems/test_gem_security_policy.rb b/test/rubygems/test_gem_security_policy.rb
index a85791c918..515b8ea00b 100644
--- a/test/rubygems/test_gem_security_policy.rb
+++ b/test/rubygems/test_gem_security_policy.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
unless Gem::HAVE_OPENSSL
warn 'Skipping Gem::Security::Policy tests. openssl not found.'
diff --git a/test/rubygems/test_gem_security_signer.rb b/test/rubygems/test_gem_security_signer.rb
index 9a369a2518..7bd6510b50 100644
--- a/test/rubygems/test_gem_security_signer.rb
+++ b/test/rubygems/test_gem_security_signer.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
unless Gem::HAVE_OPENSSL
warn 'Skipping Gem::Security::Signer tests. openssl not found.'
diff --git a/test/rubygems/test_gem_security_trust_dir.rb b/test/rubygems/test_gem_security_trust_dir.rb
index 6dc0997eaf..fc88c84865 100644
--- a/test/rubygems/test_gem_security_trust_dir.rb
+++ b/test/rubygems/test_gem_security_trust_dir.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
unless Gem::HAVE_OPENSSL
warn 'Skipping Gem::Security::TrustDir tests. openssl not found.'
diff --git a/test/rubygems/test_gem_server.rb b/test/rubygems/test_gem_server.rb
index aeb7fa2ab9..f6aa99fb02 100644
--- a/test/rubygems/test_gem_server.rb
+++ b/test/rubygems/test_gem_server.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/server'
require 'stringio'
diff --git a/test/rubygems/test_gem_silent_ui.rb b/test/rubygems/test_gem_silent_ui.rb
index 0d46ab592a..355255fb48 100644
--- a/test/rubygems/test_gem_silent_ui.rb
+++ b/test/rubygems/test_gem_silent_ui.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/user_interaction'
require 'timeout'
diff --git a/test/rubygems/test_gem_source.rb b/test/rubygems/test_gem_source.rb
index f7b288ae11..24312626f4 100644
--- a/test/rubygems/test_gem_source.rb
+++ b/test/rubygems/test_gem_source.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/source'
require 'rubygems/indexer'
diff --git a/test/rubygems/test_gem_source_fetch_problem.rb b/test/rubygems/test_gem_source_fetch_problem.rb
index 87b190a12c..0b1472c0c6 100644
--- a/test/rubygems/test_gem_source_fetch_problem.rb
+++ b/test/rubygems/test_gem_source_fetch_problem.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
class TestGemSourceFetchProblem < Gem::TestCase
def test_exception
diff --git a/test/rubygems/test_gem_source_git.rb b/test/rubygems/test_gem_source_git.rb
index 749859b024..73ed8dd2ef 100644
--- a/test/rubygems/test_gem_source_git.rb
+++ b/test/rubygems/test_gem_source_git.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/source'
class TestGemSourceGit < Gem::TestCase
diff --git a/test/rubygems/test_gem_source_installed.rb b/test/rubygems/test_gem_source_installed.rb
index 93aa4eb039..ef9b63e611 100644
--- a/test/rubygems/test_gem_source_installed.rb
+++ b/test/rubygems/test_gem_source_installed.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/source'
class TestGemSourceInstalled < Gem::TestCase
diff --git a/test/rubygems/test_gem_source_list.rb b/test/rubygems/test_gem_source_list.rb
index 7c60af3ff8..6ac5dbb2a6 100644
--- a/test/rubygems/test_gem_source_list.rb
+++ b/test/rubygems/test_gem_source_list.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
require 'rubygems'
require 'rubygems/source_list'
-require 'rubygems/test_case'
+require_relative 'helper'
class TestGemSourceList < Gem::TestCase
def setup
diff --git a/test/rubygems/test_gem_source_local.rb b/test/rubygems/test_gem_source_local.rb
index 7417f8d111..2d4ddbc3a4 100644
--- a/test/rubygems/test_gem_source_local.rb
+++ b/test/rubygems/test_gem_source_local.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/source'
require 'fileutils'
diff --git a/test/rubygems/test_gem_source_lock.rb b/test/rubygems/test_gem_source_lock.rb
index 8c55926d94..5f916cdf7f 100644
--- a/test/rubygems/test_gem_source_lock.rb
+++ b/test/rubygems/test_gem_source_lock.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
class TestGemSourceLock < Gem::TestCase
def test_fetch_spec
diff --git a/test/rubygems/test_gem_source_specific_file.rb b/test/rubygems/test_gem_source_specific_file.rb
index f6d6aa51d5..72ed993a88 100644
--- a/test/rubygems/test_gem_source_specific_file.rb
+++ b/test/rubygems/test_gem_source_specific_file.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/source'
class TestGemSourceSpecificFile < Gem::TestCase
diff --git a/test/rubygems/test_gem_source_subpath_problem.rb b/test/rubygems/test_gem_source_subpath_problem.rb
index b2289ea625..c37df39f0c 100644
--- a/test/rubygems/test_gem_source_subpath_problem.rb
+++ b/test/rubygems/test_gem_source_subpath_problem.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/source'
class TestGemSourceSubpathProblem < Gem::TestCase
diff --git a/test/rubygems/test_gem_source_vendor.rb b/test/rubygems/test_gem_source_vendor.rb
index 18a3f47f45..a5ffb0f223 100644
--- a/test/rubygems/test_gem_source_vendor.rb
+++ b/test/rubygems/test_gem_source_vendor.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/source'
class TestGemSourceVendor < Gem::TestCase
diff --git a/test/rubygems/test_gem_spec_fetcher.rb b/test/rubygems/test_gem_spec_fetcher.rb
index 8b94708259..afae46e120 100644
--- a/test/rubygems/test_gem_spec_fetcher.rb
+++ b/test/rubygems/test_gem_spec_fetcher.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/spec_fetcher'
class TestGemSpecFetcher < Gem::TestCase
diff --git a/test/rubygems/test_gem_specification.rb b/test/rubygems/test_gem_specification.rb
index 226ec40bf0..88afa3faa0 100644
--- a/test/rubygems/test_gem_specification.rb
+++ b/test/rubygems/test_gem_specification.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
require 'benchmark'
-require 'rubygems/test_case'
+require_relative 'helper'
require 'date'
require 'pathname'
require 'stringio'
@@ -107,8 +107,6 @@ end
end
@current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
-
- load 'rubygems/syck_hack.rb'
end
def test_self_find_active_stub_by_path
@@ -747,125 +745,6 @@ end
spec.specification_version
end
- def test_self_from_yaml_syck_date_bug
- # This is equivalent to (and totally valid) psych 1.0 output and
- # causes parse errors on syck.
- yaml = @a1.to_yaml
- yaml.sub!(/^date:.*/, "date: 2011-04-26 00:00:00.000000000Z")
-
- spec = with_syck do
- Gem::Specification.from_yaml yaml
- end
-
- assert_kind_of Time, @a1.date
- assert_kind_of Time, spec.date
- end
-
- def test_self_from_yaml_syck_default_key_bug
- # This is equivalent to (and totally valid) psych 1.0 output and
- # causes parse errors on syck.
- yaml = <<-YAML
---- !ruby/object:Gem::Specification
-name: posix-spawn
-version: !ruby/object:Gem::Version
- version: 0.3.6
- prerelease:
-dependencies:
-- !ruby/object:Gem::Dependency
- name: rake-compiler
- requirement: &70243867725240 !ruby/object:Gem::Requirement
- none: false
- requirements:
- - - =
- - !ruby/object:Gem::Version
- version: 0.7.6
- type: :development
- prerelease: false
- version_requirements: *70243867725240
-platform: ruby
-files: []
-test_files: []
-bindir:
- YAML
-
- spec = with_syck do
- Gem::Specification.from_yaml yaml
- end
-
- op = spec.dependencies.first.requirement.requirements.first.first
- refute_kind_of YAML::Syck::DefaultKey, op
-
- refute_match %r{DefaultKey}, spec.to_ruby
- end
-
- def test_self_from_yaml_cleans_up_defaultkey
- yaml = <<-YAML
---- !ruby/object:Gem::Specification
-name: posix-spawn
-version: !ruby/object:Gem::Version
- version: 0.3.6
- prerelease:
-dependencies:
-- !ruby/object:Gem::Dependency
- name: rake-compiler
- requirement: &70243867725240 !ruby/object:Gem::Requirement
- none: false
- requirements:
- - - !ruby/object:YAML::Syck::DefaultKey {}
-
- - !ruby/object:Gem::Version
- version: 0.7.6
- type: :development
- prerelease: false
- version_requirements: *70243867725240
-platform: ruby
-files: []
-test_files: []
-bindir:
- YAML
-
- spec = Gem::Specification.from_yaml yaml
-
- op = spec.dependencies.first.requirement.requirements.first.first
- refute_kind_of YAML::Syck::DefaultKey, op
-
- refute_match %r{DefaultKey}, spec.to_ruby
- end
-
- def test_self_from_yaml_cleans_up_defaultkey_from_newer_192
- yaml = <<-YAML
---- !ruby/object:Gem::Specification
-name: posix-spawn
-version: !ruby/object:Gem::Version
- version: 0.3.6
- prerelease:
-dependencies:
-- !ruby/object:Gem::Dependency
- name: rake-compiler
- requirement: &70243867725240 !ruby/object:Gem::Requirement
- none: false
- requirements:
- - - !ruby/object:Syck::DefaultKey {}
-
- - !ruby/object:Gem::Version
- version: 0.7.6
- type: :development
- prerelease: false
- version_requirements: *70243867725240
-platform: ruby
-files: []
-test_files: []
-bindir:
- YAML
-
- spec = Gem::Specification.from_yaml yaml
-
- op = spec.dependencies.first.requirement.requirements.first.first
- refute_kind_of YAML::Syck::DefaultKey, op
-
- refute_match %r{DefaultKey}, spec.to_ruby
- end
-
def test_self_from_yaml_cleans_up_Date_objects
yaml = <<-YAML
--- !ruby/object:Gem::Specification
@@ -3860,49 +3739,6 @@ end
end
end
- def with_syck
- begin
- verbose, $VERBOSE = $VERBOSE, nil
- require "yaml"
- old_engine = YAML::ENGINE.yamler
- YAML::ENGINE.yamler = 'syck'
- load 'rubygems/syck_hack.rb'
- rescue NameError
- # probably on 1.8, ignore
- ensure
- $VERBOSE = verbose
- end
-
- yield
- ensure
- begin
- YAML::ENGINE.yamler = old_engine
- load 'rubygems/syck_hack.rb'
- rescue NameError
- # ignore
- end
- end
-
- def with_psych
- begin
- require "yaml"
- old_engine = YAML::ENGINE.yamler
- YAML::ENGINE.yamler = 'psych'
- load 'rubygems/syck_hack.rb'
- rescue NameError
- # probably on 1.8, ignore
- end
-
- yield
- ensure
- begin
- YAML::ENGINE.yamler = old_engine
- load 'rubygems/syck_hack.rb'
- rescue NameError
- # ignore
- end
- end
-
def silence_warnings
old_verbose, $VERBOSE = $VERBOSE, false
yield
diff --git a/test/rubygems/test_gem_stream_ui.rb b/test/rubygems/test_gem_stream_ui.rb
index 9148ad1385..dc245c342a 100644
--- a/test/rubygems/test_gem_stream_ui.rb
+++ b/test/rubygems/test_gem_stream_ui.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/user_interaction'
require 'timeout'
diff --git a/test/rubygems/test_gem_stub_specification.rb b/test/rubygems/test_gem_stub_specification.rb
index 4f2e40dde0..e008391ef7 100644
--- a/test/rubygems/test_gem_stub_specification.rb
+++ b/test/rubygems/test_gem_stub_specification.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require "rubygems/test_case"
+require_relative "helper"
require "rubygems/stub_specification"
class TestStubSpecification < Gem::TestCase
diff --git a/test/rubygems/test_gem_text.rb b/test/rubygems/test_gem_text.rb
index d8e4b75f3a..069cfdc4e6 100644
--- a/test/rubygems/test_gem_text.rb
+++ b/test/rubygems/test_gem_text.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require "rubygems/text"
class TestGemText < Gem::TestCase
diff --git a/test/rubygems/test_gem_uninstaller.rb b/test/rubygems/test_gem_uninstaller.rb
index 0386099a8f..9e18972864 100644
--- a/test/rubygems/test_gem_uninstaller.rb
+++ b/test/rubygems/test_gem_uninstaller.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/installer_test_case'
+require_relative 'installer_test_case'
require 'rubygems/uninstaller'
class TestGemUninstaller < Gem::InstallerTestCase
diff --git a/test/rubygems/test_gem_unsatisfiable_dependency_error.rb b/test/rubygems/test_gem_unsatisfiable_dependency_error.rb
index 7950efb2a9..f9d30123f0 100644
--- a/test/rubygems/test_gem_unsatisfiable_dependency_error.rb
+++ b/test/rubygems/test_gem_unsatisfiable_dependency_error.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
class TestGemUnsatisfiableDependencyError < Gem::TestCase
def setup
diff --git a/test/rubygems/test_gem_uri_formatter.rb b/test/rubygems/test_gem_uri_formatter.rb
index debc7739cb..a41c9238ad 100644
--- a/test/rubygems/test_gem_uri_formatter.rb
+++ b/test/rubygems/test_gem_uri_formatter.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/uri_formatter'
class TestGemUriFormatter < Gem::TestCase
diff --git a/test/rubygems/test_gem_util.rb b/test/rubygems/test_gem_util.rb
index 69b7043328..e0db5c283d 100644
--- a/test/rubygems/test_gem_util.rb
+++ b/test/rubygems/test_gem_util.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/util'
class TestGemUtil < Gem::TestCase
diff --git a/test/rubygems/test_gem_validator.rb b/test/rubygems/test_gem_validator.rb
index 5158543fa9..8090776b4a 100644
--- a/test/rubygems/test_gem_validator.rb
+++ b/test/rubygems/test_gem_validator.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require "rubygems/test_case"
+require_relative "helper"
require "rubygems/validator"
class TestGemValidator < Gem::TestCase
diff --git a/test/rubygems/test_gem_version.rb b/test/rubygems/test_gem_version.rb
index 91325c2214..422e1ee86c 100644
--- a/test/rubygems/test_gem_version.rb
+++ b/test/rubygems/test_gem_version.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require "rubygems/version"
class TestGemVersion < Gem::TestCase
diff --git a/test/rubygems/test_gem_version_option.rb b/test/rubygems/test_gem_version_option.rb
index 49a8513dbe..74d7979e3a 100644
--- a/test/rubygems/test_gem_version_option.rb
+++ b/test/rubygems/test_gem_version_option.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems/command'
require 'rubygems/version_option'
diff --git a/test/rubygems/test_kernel.rb b/test/rubygems/test_kernel.rb
index b7c809f87d..dee36d05ee 100644
--- a/test/rubygems/test_kernel.rb
+++ b/test/rubygems/test_kernel.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
class TestKernel < Gem::TestCase
def setup
diff --git a/test/rubygems/test_project_sanity.rb b/test/rubygems/test_project_sanity.rb
index 97fc64fb6a..e9e3bfd1ba 100644
--- a/test/rubygems/test_project_sanity.rb
+++ b/test/rubygems/test_project_sanity.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require "rubygems/test_case"
+require_relative "helper"
require "open3"
class TestProjectSanity < Gem::TestCase
diff --git a/test/rubygems/test_remote_fetch_error.rb b/test/rubygems/test_remote_fetch_error.rb
index a1c25bcdda..b9e58389d3 100644
--- a/test/rubygems/test_remote_fetch_error.rb
+++ b/test/rubygems/test_remote_fetch_error.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
class TestRemoteFetchError < Gem::TestCase
def test_password_redacted
diff --git a/test/rubygems/test_require.rb b/test/rubygems/test_require.rb
index 4591530156..07e412cc76 100644
--- a/test/rubygems/test_require.rb
+++ b/test/rubygems/test_require.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+require_relative 'helper'
require 'rubygems'
class TestGemRequire < Gem::TestCase
diff --git a/lib/rubygems/test_utilities.rb b/test/rubygems/utilities.rb
index 08faef6578..20416fe70b 100644
--- a/lib/rubygems/test_utilities.rb
+++ b/test/rubygems/utilities.rb
@@ -348,8 +348,6 @@ end
# A StringIO duck-typed class that uses Tempfile instead of String as the
# backing store.
#
-# This is available when rubygems/test_utilities is required.
-#--
# This class was added to flush out problems in Rubinius' IO implementation.
class TempIO < Tempfile
diff --git a/tool/bundler/rubocop_gems.rb.lock b/tool/bundler/rubocop_gems.rb.lock
index 8e26a50658..45a33136bb 100644
--- a/tool/bundler/rubocop_gems.rb.lock
+++ b/tool/bundler/rubocop_gems.rb.lock
@@ -57,4 +57,4 @@ DEPENDENCIES
test-unit
BUNDLED WITH
- 2.2.24
+ 2.2.25
diff --git a/tool/bundler/test_gems.rb.lock b/tool/bundler/test_gems.rb.lock
index 964b7df730..ae002ef2e4 100644
--- a/tool/bundler/test_gems.rb.lock
+++ b/tool/bundler/test_gems.rb.lock
@@ -40,4 +40,4 @@ DEPENDENCIES
webrick (= 1.7.0)
BUNDLED WITH
- 2.2.24
+ 2.2.25