Skip to content

Commit

Permalink
FIX allow @Version to be set in derived Formula
Browse files Browse the repository at this point in the history
  • Loading branch information
mxcl committed Aug 1, 2009
1 parent 1fba7b5 commit dde1b63
Showing 1 changed file with 17 additions and 43 deletions.
60 changes: 17 additions & 43 deletions Library/Homebrew/formula.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,29 +29,13 @@ class AbstractFormula
require 'find'
require 'fileutils'

# fuck knows, ruby is weird
# TODO please fix!
def self.url
@url
end
def url
self.class.url
end
def self.md5
@md5
end
def md5
self.class.md5
end
def self.homepage
@homepage
private
class <<self
attr_reader :url, :version, :md5, :url, :homepage
end
def homepage
self.class.homepage
end
# end ruby is weird section

attr_reader :version, :name
public
attr_reader :url, :version, :md5, :url, :homepage, :name

# reimplement if your package has dependencies
def deps
Expand All @@ -66,36 +50,25 @@ def installed?

def initialize name=nil
@name=name
# fuck knows, ruby is weird
@url=url if @url.nil?
@version=self.class.version unless @version
@url=self.class.url unless @url
@homepage=self.class.homepage unless @homepage
@md5=self.class.md5 unless @md5
raise "@url.nil?" if @url.nil?
@md5=md5 if @md5.nil?
# end ruby is weird section
end

def prefix
raise "@name.nil!" if @name.nil?
raise "@version.nil?" if @version.nil?
HOMEBREW_CELLAR+@name+@version
end
def bin
prefix+'bin'
end
def doc
prefix+'share'+'doc'+name
end
def man
prefix+'share'+'man'
end
def man1
man+'man1'
end
def lib
prefix+'lib'
end
def include
prefix+'include'
end

def bin; prefix+'bin' end
def doc; prefix+'share'+'doc'+name end
def lib; prefix+'lib' end
def man; prefix+'share'+'man' end
def man1; man+'man1' end
def include; prefix+'include' end

def caveats
nil
Expand Down Expand Up @@ -251,6 +224,7 @@ def method_added method
end

# see ack.rb for an example usage
# you need to set @version and @name
class ScriptFileFormula <AbstractFormula
def install
bin.install name
Expand Down

0 comments on commit dde1b63

Please sign in to comment.