Skip to content

Commit

Permalink
dev-cmd/vendor-gems: fix creation of broken symlinks
Browse files Browse the repository at this point in the history
When the target symlink already points to an existing directory, the
`#ln_sf` call creates the symlink inside the intended target directory
(which is not what we intend to do here).

Let's fix that.

Closes Homebrew#16205
  • Loading branch information
carlocab committed Nov 14, 2023
1 parent d3d51d3 commit 4cc1f85
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
10 changes: 6 additions & 4 deletions Library/Homebrew/dev-cmd/vendor-gems.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,14 @@ def vendor_gems
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?

FileUtils.rm_f gem
FileUtils.ln_s source, gem
end
end
end
Expand Down

This file was deleted.

0 comments on commit 4cc1f85

Please sign in to comment.