From d68efde6a19b71c826e85c05ea4ab8f6aa479356 Mon Sep 17 00:00:00 2001 From: Aymeric Le Dorze Date: Fri, 3 Feb 2023 17:59:09 +0100 Subject: [PATCH] Fix relativizing directory on remotes that do not represent a path --- lib/appraisal/appraisal.rb | 2 +- spec/acceptance/cli/install_spec.rb | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/lib/appraisal/appraisal.rb b/lib/appraisal/appraisal.rb index 761eed9b..f63d075b 100644 --- a/lib/appraisal/appraisal.rb +++ b/lib/appraisal/appraisal.rb @@ -107,7 +107,7 @@ def relativize lockfile_content = File.read(lockfile_path) File.open(lockfile_path, 'w') do |file| - file.write lockfile_content.gsub(/#{current_directory}/, relative_path.to_s) + file.write lockfile_content.gsub(/ #{current_directory}/, " #{relative_path.to_s}") end end diff --git a/spec/acceptance/cli/install_spec.rb b/spec/acceptance/cli/install_spec.rb index bde014bf..9122d15d 100644 --- a/spec/acceptance/cli/install_spec.rb +++ b/spec/acceptance/cli/install_spec.rb @@ -40,6 +40,26 @@ not_to include(current_directory) end + it 'does not relativize directory of uris in gemfile.lock' do + build_gemspec + add_gemspec_to_gemfile + + build_git_gem('uri_dummy') + uri_dummy_path = "#{current_directory}/uri_dummy" + FileUtils.symlink(File.absolute_path('tmp/gems/uri_dummy'), uri_dummy_path) + + build_appraisal_file <<-Appraisal + appraise '1.0.0' do + gem 'uri_dummy', git: 'file://#{uri_dummy_path}' + end + Appraisal + + run 'appraisal install' + + expect(content_of("gemfiles/1.0.0.gemfile.lock")). + to include("file://#{uri_dummy_path}") + end + context 'with job size', :parallel => true do before do build_appraisal_file <<-Appraisal