mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00

I've given up on this; too many edge cases. If someone else wants to pick it up then send me a message and I'll walk you through the approach.
24 lines
490 B
Ruby
24 lines
490 B
Ruby
module InstallRenamed
|
|
def install_p src, new_basename = nil
|
|
super do |src, dst|
|
|
dst += "/#{File.basename(src)}" if File.directory? dst
|
|
append_default_if_different(src, dst)
|
|
end
|
|
end
|
|
|
|
def cp_path_sub pattern, replacement
|
|
super do |src, dst|
|
|
append_default_if_different(src, dst)
|
|
end
|
|
end
|
|
|
|
private
|
|
|
|
def append_default_if_different src, dst
|
|
if File.file? dst and !FileUtils.identical?(src, dst)
|
|
dst += ".default"
|
|
end
|
|
dst
|
|
end
|
|
end
|