aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJack Nagel2013-09-17 21:25:39 -0500
committerJack Nagel2013-09-17 21:29:52 -0500
commit360a099faa00a5d44d0f6796ffaf4a017e446a65 (patch)
tree34333c8af6c60b2800cf6b6b2ad83f8deac9bf43 /Library
parent6116450328307530d6d25a3fa5b9c34e2a055f1f (diff)
downloadbrew-360a099faa00a5d44d0f6796ffaf4a017e446a65.tar.bz2
Track initialized specs
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/formula.rb30
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