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

We need to install the helper module not just on `etc` but also on all subdirectories of it too. Also, handle the case where we install a subdirectory with etc.install. Closes Homebrew/homebrew#26145.
38 lines
712 B
Ruby
38 lines
712 B
Ruby
module InstallRenamed
|
|
def install_p src, new_basename = nil
|
|
super do |src, dst|
|
|
dst += "/#{File.basename(src)}" if File.directory? dst
|
|
|
|
if File.directory? src
|
|
Pathname.new(dst).install Dir["#{src}/*"]
|
|
next
|
|
end
|
|
|
|
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
|
|
|
|
def + path
|
|
super(path).extend(InstallRenamed)
|
|
end
|
|
|
|
def / path
|
|
super(path).extend(InstallRenamed)
|
|
end
|
|
|
|
private
|
|
|
|
def append_default_if_different src, dst
|
|
if File.file? dst and !FileUtils.identical?(src, dst)
|
|
dst += ".default"
|
|
end
|
|
dst
|
|
end
|
|
end
|