Merge pull request #16210 from carlocab/vendor-symlinks

dev-cmd/vendor-gems: fix creation of broken symlinks
This commit is contained in:
Carlo Cabrera 2023-11-14 20:36:03 +08:00 committed by GitHub
commit d26056bd9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 5 deletions

View File

@ -59,12 +59,16 @@ module Homebrew
mechanize
].each do |gem|
ohai "gem install #{gem}"
safe_system "gem", "install", "mechanize", "--install-dir", "vendor",
safe_system "gem", "install", gem, "--install-dir", "vendor",
"--no-document", "--no-wrappers", "--ignore-dependencies", "--force"
(HOMEBREW_LIBRARY_PATH/"vendor/gems").cd do
if (source = Pathname.glob("#{gem}-*/").first)
FileUtils.ln_sf source, gem
end
source = Pathname.glob("#{gem}-*/").first
next if source.blank?
# We cannot use `#ln_sf` here because that has unintended consequences when
# the symlink we want to create exists and points to an existing directory.
FileUtils.rm_f gem
FileUtils.ln_s source, gem
end
end
end

View File

@ -1 +0,0 @@
mechanize-2.9.1/