aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Howell2009-07-23 01:14:22 +0100
committerMax Howell2009-07-23 01:14:22 +0100
commit34955880d58f6e18b8d4caa58ae011fbbea77be5 (patch)
treea08d47ed3fd5a362dd97202ccd457f396fa0dc6f
parent32281b7a7f6b7b14b8c533f699b8d6d234648e0a (diff)
downloadbrew-34955880d58f6e18b8d4caa58ae011fbbea77be5.tar.bz2
Fix issues with Pathname.install and arrays
-rw-r--r--Library/Homebrew/brewkit.rb17
1 files changed, 14 insertions, 3 deletions
diff --git a/Library/Homebrew/brewkit.rb b/Library/Homebrew/brewkit.rb
index 472999f0e..6b611678b 100644
--- a/Library/Homebrew/brewkit.rb
+++ b/Library/Homebrew/brewkit.rb
@@ -102,9 +102,19 @@ class Pathname
end
def install src
- if File.exist? src
+ if src.is_a? Array
+ src.each {|src| install src }
+ elsif File.exist? src
mkpath
- FileUtils.mv src, to_s
+ if File.symlink? src
+ # we cp symlinks because FileUtils.mv is shit and won't mv a symlink
+ # if its final destination has an invalid target! FFS. Ruby is shit.
+ FileUtils.cp src, to_s
+ else
+ # we mv when possible as it is faster and you should only be using
+ # this function when installing from the temporary build directory
+ FileUtils.mv src, to_s
+ end
end
end
@@ -116,13 +126,14 @@ class Pathname
end
end
+ # for filetypes we support
def extname
/\.(zip|tar\.(gz|bz2)|tgz)$/.match to_s
return ".#{$1}" if $1
return File.extname(to_s)
end
- # for files we support, basename without extension
+ # for filetypes we support, basename without extension
def stem
return File.basename(to_s, extname)
end