aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Howell2009-05-23 12:31:32 +0100
committerMax Howell2009-05-23 18:19:03 +0100
commitf32d0e6af9b9801b681715e4827912a34a970335 (patch)
tree6c6f0d6a472e6a60a6ff4f33c3b0a9afe78b4bc7
parentdef522a5cfbd5dbba21f71f64c4641ed488232dc (diff)
downloadbrew-f32d0e6af9b9801b681715e4827912a34a970335.tar.bz2
UncompressedScriptFormula
-rw-r--r--Cellar/homebrew/brewkit.rb12
-rw-r--r--Formula/ack.rb19
2 files changed, 20 insertions, 11 deletions
diff --git a/Cellar/homebrew/brewkit.rb b/Cellar/homebrew/brewkit.rb
index 1090ae543..b009c842c 100644
--- a/Cellar/homebrew/brewkit.rb
+++ b/Cellar/homebrew/brewkit.rb
@@ -159,6 +159,18 @@ private
end
end
+# you have to reimplement initialize to set the version, for example usage
+# see the ack script
+class UncompressedScriptFormula < Formula
+ def initialize(url)
+ @url=url
+ @name=File.basename url
+ end
+ def uncompress path
+ path.dirname
+ end
+end
+
def inreplace(path, before, after)
before=before.to_s.gsub('"', '\"').gsub('/', '\/')
after=after.to_s.gsub('"', '\"').gsub('/', '\/')
diff --git a/Formula/ack.rb b/Formula/ack.rb
index c950a0636..b27d827ac 100644
--- a/Formula/ack.rb
+++ b/Formula/ack.rb
@@ -4,22 +4,19 @@ require 'fileutils'
homepage='http://betterthangrep.com/'
-class UncompressedFormula < Formula
+class AckFormula < UncompressedScriptFormula
def initialize
- @name='ack'
+ super('http://ack.googlecode.com/svn/tags/1.88/ack')
@version='1.88'
- @url='http://ack.googlecode.com/svn/tags/1.88/ack'
@md5='8009a13ab0fc66047bea0ea2ad89419c'
end
-
- def uncompress path
- path.dirname
- end
end
-UncompressedFormula.new.brew do |prefix|
+ack=AckFormula.new
+ack.brew do |prefix|
bin=prefix+'bin'
- FileUtils.mkpath bin
- FileUtils.cp 'ack', bin
- `chmod u+x #{bin}/ack`
+ bin.mkpath
+ FileUtils.cp ack.name, bin
+ (bin+ack.name).chmod 0544
+ nil
end \ No newline at end of file