aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike McQuaid2014-08-25 10:28:40 +0100
committerMike McQuaid2014-08-26 08:30:47 +0100
commit6cf528545e74c4b9c5f9a93b0e5a8d711a95f612 (patch)
tree78cb618bc843f5eb608cff52a2344f013c776344
parentb24367564f527d16c768f0ca065c89ea93b13b27 (diff)
downloadhomebrew-6cf528545e74c4b9c5f9a93b0e5a8d711a95f612.tar.bz2
etc.install: handle recursive directory installs.
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 #26145.
-rw-r--r--Library/Homebrew/extend/pathname.rb1
-rw-r--r--Library/Homebrew/install_renamed.rb14
2 files changed, 15 insertions, 0 deletions
diff --git a/Library/Homebrew/extend/pathname.rb b/Library/Homebrew/extend/pathname.rb
index 8ecff6bf4..ca1d167c1 100644
--- a/Library/Homebrew/extend/pathname.rb
+++ b/Library/Homebrew/extend/pathname.rb
@@ -48,6 +48,7 @@ class Pathname
dst = dst.to_s
dst = yield(src, dst) if block_given?
+ return unless dst
mkpath
diff --git a/Library/Homebrew/install_renamed.rb b/Library/Homebrew/install_renamed.rb
index 42d0fee8f..02a6e9b10 100644
--- a/Library/Homebrew/install_renamed.rb
+++ b/Library/Homebrew/install_renamed.rb
@@ -2,6 +2,12 @@ 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
@@ -12,6 +18,14 @@ module InstallRenamed
end
end
+ def + path
+ super(path).extend(InstallRenamed)
+ end
+
+ def / path
+ super(path).extend(InstallRenamed)
+ end
+
private
def append_default_if_different src, dst