From c10a32ee7ec4e29be98c015652dd40ff6a6ef111 Mon Sep 17 00:00:00 2001 From: David Rodriguez Date: Tue, 6 Feb 2024 10:04:08 +0100 Subject: [PATCH] More --- bundler/spec/support/builders.rb | 17 ++++++++++------- bundler/spec/support/helpers.rb | 14 ++++++++------ 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/bundler/spec/support/builders.rb b/bundler/spec/support/builders.rb index ce78f5aa215f..abb04d7e62a5 100644 --- a/bundler/spec/support/builders.rb +++ b/bundler/spec/support/builders.rb @@ -2,9 +2,12 @@ require "bundler/shared_helpers" require "shellwords" +require_relative "path" module Spec module Builders + include Path + def self.constantize(name) name.delete("-").upcase end @@ -22,7 +25,7 @@ def rake_version end def build_repo1 - rake_path = Dir["#{Path.base_system_gems}/**/rake*.gem"].first + rake_path = Dir["#{base_system_gems}/**/rake*.gem"].first build_repo gem_repo1 do FileUtils.cp rake_path, "#{gem_repo1}/gems/" @@ -240,12 +243,12 @@ def build_repo(path, **kwargs, &blk) end def check_test_gems! - rake_path = Dir["#{Path.base_system_gems}/**/rake*.gem"].first + rake_path = Dir["#{base_system_gems}/**/rake*.gem"].first if rake_path.nil? - FileUtils.rm_rf(Path.base_system_gems) + FileUtils.rm_rf(base_system_gems) Spec::Rubygems.install_test_deps - rake_path = Dir["#{Path.base_system_gems}/**/rake*.gem"].first + rake_path = Dir["#{base_system_gems}/**/rake*.gem"].first end if rake_path.nil? @@ -261,9 +264,9 @@ def update_repo(path, build_compact_index: true) @_build_path = "#{path}/gems" @_build_repo = File.basename(path) yield - with_gem_path_as Path.base_system_gem_path do - Dir[Spec::Path.base_system_gem_path.join("gems/rubygems-generate_index*/lib")].first || - raise("Could not find rubygems-generate_index lib directory in #{Spec::Path.base_system_gem_path}") + with_gem_path_as base_system_gem_path do + Dir[base_system_gem_path.join("gems/rubygems-generate_index*/lib")].first || + raise("Could not find rubygems-generate_index lib directory in #{base_system_gem_path}") command = "generate_index" command += " --no-compact" if !build_compact_index && gem_command(command + " --help").include?("--[no-]compact") diff --git a/bundler/spec/support/helpers.rb b/bundler/spec/support/helpers.rb index 0a98fe8c64f7..b5ef9faea2fe 100644 --- a/bundler/spec/support/helpers.rb +++ b/bundler/spec/support/helpers.rb @@ -8,7 +8,7 @@ module Spec module Helpers extend self - include Spec::Path + include Path def reset! Dir.glob("#{tmp}/{gems/*,*}", File::FNM_DOTMATCH).each do |dir| @@ -96,7 +96,7 @@ def bundle(cmd, options = {}, &block) end end if artifice - requires << "#{Path.spec_dir}/support/artifice/#{artifice}.rb" + requires << "#{spec_dir}/support/artifice/#{artifice}.rb" end load_path = [] @@ -150,7 +150,7 @@ def build_ruby_cmd(options = {}) requires = options.delete(:requires) || [] - hax_path = "#{Path.spec_dir}/support/hax.rb" + hax_path = "#{spec_dir}/support/hax.rb" # For specs that need to ignore the default Bundler gem, load hax before # anything else since other stuff may actually load bundler and not skip @@ -170,7 +170,7 @@ def gem_command(command, options = {}) env = options[:env] || {} env["RUBYOPT"] = opt_add(opt_add("-r#{spec_dir}/support/hax.rb", env["RUBYOPT"]), ENV["RUBYOPT"]) options[:env] = env - sys_exec("#{Path.gem_bin} #{command}", options) + sys_exec("#{gem_bin} #{command}", options) end def rake @@ -320,7 +320,9 @@ def system_gems(*gems) end def install_dev_bundler - system_gems :bundler, path: Path.pristine_system_gem_path + extend Path + + system_gems :bundler, path: pristine_system_gem_path end def install_gem(path, install_dir, default = false) @@ -534,7 +536,7 @@ def with_env_vars(env_hash, &block) def require_rack # need to hack, so we can require rack old_gem_home = ENV["GEM_HOME"] - ENV["GEM_HOME"] = Path.base_system_gem_path.to_s + ENV["GEM_HOME"] = base_system_gem_path.to_s require "rack" ENV["GEM_HOME"] = old_gem_home end