Skip to content

Commit

Permalink
Undo stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
deivid-rodriguez committed Feb 6, 2024
1 parent 1034d65 commit a6e4de7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
17 changes: 7 additions & 10 deletions bundler/spec/support/builders.rb
Expand Up @@ -2,12 +2,9 @@

require "bundler/shared_helpers"
require "shellwords"
require_relative "path"

module Spec
module Builders
include Path

def self.constantize(name)
name.delete("-").upcase
end
Expand All @@ -25,7 +22,7 @@ def rake_version
end

def build_repo1
rake_path = Dir["#{base_system_gems}/**/rake*.gem"].first
rake_path = Dir["#{Path.base_system_gems}/**/rake*.gem"].first

build_repo gem_repo1 do
FileUtils.cp rake_path, "#{gem_repo1}/gems/"
Expand Down Expand Up @@ -243,12 +240,12 @@ def build_repo(path, **kwargs, &blk)
end

def check_test_gems!
rake_path = Dir["#{base_system_gems}/**/rake*.gem"].first
rake_path = Dir["#{Path.base_system_gems}/**/rake*.gem"].first

if rake_path.nil?
FileUtils.rm_rf(base_system_gems)
FileUtils.rm_rf(Path.base_system_gems)
Spec::Rubygems.install_test_deps
rake_path = Dir["#{base_system_gems}/**/rake*.gem"].first
rake_path = Dir["#{Path.base_system_gems}/**/rake*.gem"].first
end

if rake_path.nil?
Expand All @@ -264,9 +261,9 @@ def update_repo(path, build_compact_index: true)
@_build_path = "#{path}/gems"
@_build_repo = File.basename(path)
yield
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}")
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}")

command = "generate_index"
command += " --no-compact" if !build_compact_index && gem_command(command + " --help").include?("--[no-]compact")
Expand Down
10 changes: 5 additions & 5 deletions bundler/spec/support/helpers.rb
Expand Up @@ -8,7 +8,7 @@ module Spec
module Helpers
extend self

include Path
include Spec::Path

def reset!
Dir.glob("#{tmp}/{gems/*,*}", File::FNM_DOTMATCH).each do |dir|
Expand Down Expand Up @@ -96,7 +96,7 @@ def bundle(cmd, options = {}, &block)
end
end
if artifice
requires << "#{spec_dir}/support/artifice/#{artifice}.rb"
requires << "#{Path.spec_dir}/support/artifice/#{artifice}.rb"
end

load_path = []
Expand Down Expand Up @@ -150,7 +150,7 @@ def build_ruby_cmd(options = {})

requires = options.delete(:requires) || []

hax_path = "#{spec_dir}/support/hax.rb"
hax_path = "#{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
Expand All @@ -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("#{gem_bin} #{command}", options)
sys_exec("#{Path.gem_bin} #{command}", options)
end

def rake
Expand Down Expand Up @@ -536,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"] = base_system_gem_path.to_s
ENV["GEM_HOME"] = Spec::Path.base_system_gem_path.to_s
require "rack"
ENV["GEM_HOME"] = old_gem_home
end
Expand Down

0 comments on commit a6e4de7

Please sign in to comment.