Fix GithubGistFormula

This commit is contained in:
Max Howell 2009-06-05 12:57:37 +01:00
parent 354ea6f970
commit e585686b01
2 changed files with 12 additions and 18 deletions

View File

@ -17,7 +17,7 @@
require 'pathname' require 'pathname'
require 'osx/cocoa' # to get number of cores require 'osx/cocoa' # to get number of cores
require "#{File.dirname __FILE__}/env" require 'env'
# optimise all the way to eleven, references: # optimise all the way to eleven, references:
# http://en.gentoo-wiki.com/wiki/Safe_Cflags/Intel # http://en.gentoo-wiki.com/wiki/Safe_Cflags/Intel
@ -161,7 +161,7 @@ public
Dir.chdir appsupport do Dir.chdir appsupport do
tgz=Pathname.new(fetch()).realpath tgz=Pathname.new(fetch()).realpath
md5=`md5 -q "#{tgz}"`.strip md5=`md5 -q "#{tgz}"`.strip
raise "MD5 mismatch: #{md5}" unless md5 and md5 == @md5.downcase raise "MD5 mismatch: #{md5}" unless @md5 and md5 == @md5.downcase
# we make an additional subdirectory so know exactly what we are # we make an additional subdirectory so know exactly what we are
# recursively deleting later # recursively deleting later
@ -297,24 +297,16 @@ class UncompressedScriptFormula <Formula
end end
end end
class GithubGistFormula <Formula class GithubGistFormula <UncompressedScriptFormula
def initialize(url, md5) def initialize
@url=url super
@name=File.basename url @name=File.basename url
@version=File.basename(File.dirname(url))[0,6] @version=File.basename(File.dirname(url))[0,6]
@md5=md5 end
brew do |prefix| def install
bin=prefix+'bin'
bin.mkpath
FileUtils.cp @name, bin FileUtils.cp @name, bin
(bin+@name).chmod 0544 (bin+@name).chmod 0544
nil
end
end
def uncompress path
path.dirname
end end
end end
@ -348,7 +340,7 @@ def system cmd
end end
end end
########################################################################script ####################################################################### script
if $0 == __FILE__ if $0 == __FILE__
d=$cellar.parent+'bin' d=$cellar.parent+'bin'
d.mkpath unless d.exist? d.mkpath unless d.exist?

View File

@ -1,6 +1,8 @@
#!/usr/bin/ruby #!/usr/bin/ruby
$:.unshift File.dirname __FILE__
require 'test/unit' require 'test/unit'
require "#{__FILE__}/../brewkit" require 'brewkit'
class TestFormula <Formula class TestFormula <Formula
def initialize url, md5 def initialize url, md5