diff options
| author | Jack Nagel | 2013-09-17 21:25:39 -0500 |
|---|---|---|
| committer | Jack Nagel | 2013-09-17 21:29:52 -0500 |
| commit | 09a5e201f610e45d89a392fc7db36fa6f7d97441 (patch) | |
| tree | 8d540176c45e74542c6a5a8382446fd38bc8d3cf /Library | |
| parent | bf2906ed9bb1910d82115012bf5e2b5b497b7d0f (diff) | |
| download | homebrew-09a5e201f610e45d89a392fc7db36fa6f7d97441.tar.bz2 | |
Track initialized specs
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/formula.rb | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 075cd087f..add84efbe 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -644,45 +644,55 @@ class Formula Checksum::TYPES.each do |cksum| class_eval <<-EOS, __FILE__, __LINE__ + 1 def #{cksum}(val) - @stable ||= SoftwareSpec.new + @stable ||= create_spec(SoftwareSpec) @stable.#{cksum}(val) end EOS end + def specs + @specs ||= [] + end + + def create_spec(klass) + spec = klass.new + specs << spec + spec + end + def build @build ||= BuildOptions.new(ARGV.options_only) end def url val, specs={} - @stable ||= SoftwareSpec.new + @stable ||= create_spec(SoftwareSpec) @stable.url(val, specs) end def stable &block return @stable unless block_given? - @stable ||= SoftwareSpec.new + @stable ||= create_spec(SoftwareSpec) @stable.instance_eval(&block) end def bottle *, &block return @bottle unless block_given? - @bottle ||= Bottle.new + @bottle ||= create_spec(Bottle) @bottle.instance_eval(&block) end def devel &block return @devel unless block_given? - @devel ||= SoftwareSpec.new + @devel ||= create_spec(SoftwareSpec) @devel.instance_eval(&block) end def head val=nil, specs={}, &block if block_given? - @head ||= HeadSoftwareSpec.new + @head ||= create_spec(HeadSoftwareSpec) @head.instance_eval(&block) elsif val - @head ||= HeadSoftwareSpec.new + @head ||= create_spec(HeadSoftwareSpec) @head.url(val, specs) else @head @@ -690,18 +700,18 @@ class Formula end def version val=nil - @stable ||= SoftwareSpec.new + @stable ||= create_spec(SoftwareSpec) @stable.version(val) end def mirror val - @stable ||= SoftwareSpec.new + @stable ||= create_spec(SoftwareSpec) @stable.mirror(val) end # Define a named resource using a SoftwareSpec style block def resource name, &block - @stable ||= SoftwareSpec.new + @stable ||= create_spec(SoftwareSpec) @stable.resource(name, &block) end |
