aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Howell2009-07-23 01:14:22 +0100
committerMax Howell2009-07-23 01:14:22 +0100
commite97c31e35e19207e537c0af1a20e5c7cf5b89d2c (patch)
tree318bf98e2e7441244e84f1db7737cc5b016b8e3b
parent12de180b85a154515466ae425c1998c09e76e8f9 (diff)
downloadhomebrew-e97c31e35e19207e537c0af1a20e5c7cf5b89d2c.tar.bz2
Fix issues with Pathname.install and arrays
-rw-r--r--Library/Formula/dos2unix.rb13
-rw-r--r--Library/Homebrew/brewkit.rb17
2 files changed, 23 insertions, 7 deletions
diff --git a/Library/Formula/dos2unix.rb b/Library/Formula/dos2unix.rb
index 8ed8191f9..9f26b5761 100644
--- a/Library/Formula/dos2unix.rb
+++ b/Library/Formula/dos2unix.rb
@@ -6,10 +6,15 @@ class Dos2unix <Formula
@homepage='http://www.sfr-fresh.com/linux/misc/'
def install
- system "make clean"
- system "make"
+ File.unlink 'dos2unix'
+ # we don't use make as it doesn't optimise :P
+ system "gcc -O3 dos2unix.c -o dos2unix"
# make install is broken due to INSTALL file, but also it sucks so we'll do it
- bin.install ['dos2unix', 'mac2unix']
- man1.install ['dos2unix.1', 'mac2unix.1']
+ # also Ruby 1.8 is broken, it won't allow you to move a symlink that's
+ # target is invalid. FFS very dissapointed with dependability of
+ # fundamental Ruby functions. Maybe we shouldn't use them?
+ # Anyway, that is why the symlink is installed first.
+ bin.install %w[mac2unix dos2unix]
+ man1.install %w[mac2unix.1 dos2unix.1]
end
end
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