From f32d0e6af9b9801b681715e4827912a34a970335 Mon Sep 17 00:00:00 2001 From: Max Howell Date: Sat, 23 May 2009 12:31:32 +0100 Subject: [PATCH] UncompressedScriptFormula --- Cellar/homebrew/brewkit.rb | 12 ++++++++++++ Formula/ack.rb | 19 ++++++++----------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/Cellar/homebrew/brewkit.rb b/Cellar/homebrew/brewkit.rb index 1090ae543d..b009c842cc 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 c950a06363..b27d827ac2 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