aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/formula.rb
diff options
context:
space:
mode:
authorJack Nagel2013-09-17 21:25:39 -0500
committerJack Nagel2013-09-17 21:29:52 -0500
commitbf2906ed9bb1910d82115012bf5e2b5b497b7d0f (patch)
tree2469b3232c0490632e20608844d58cd2f17f9f72 /Library/Homebrew/formula.rb
parentcc51ab41dbcf80f2bb37584d45eaaa99ac9580b8 (diff)
downloadhomebrew-bf2906ed9bb1910d82115012bf5e2b5b497b7d0f.tar.bz2
Move formula resources to SoftwareSpec
Diffstat (limited to 'Library/Homebrew/formula.rb')
-rw-r--r--Library/Homebrew/formula.rb21
1 files changed, 4 insertions, 17 deletions
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb
index db0e9e02b..075cd087f 100644
--- a/Library/Homebrew/formula.rb
+++ b/Library/Homebrew/formula.rb
@@ -1,4 +1,3 @@
-require 'resource'
require 'dependency_collector'
require 'formula_support'
require 'formula_lock'
@@ -57,9 +56,6 @@ class Formula
end
@pin = FormulaPin.new(self)
-
- @resources = self.class.resources
- @resources.each_value { |r| r.owner = self }
end
def set_spec(name)
@@ -97,13 +93,11 @@ class Formula
def mirrors; active_spec.mirrors; end
def resource(name)
- res = @resources[name]
- raise ResourceMissingError.new(@name, name) if res.nil?
- res
+ active_spec.resource(name)
end
def resources
- @resources.values
+ active_spec.resources.values
end
# if the dir is there, but it's empty we consider it not installed
@@ -705,17 +699,10 @@ class Formula
@stable.mirror(val)
end
- # Hold any resources defined by this formula
- def resources
- @resources ||= Hash.new
- end
-
# Define a named resource using a SoftwareSpec style block
def resource name, &block
- raise DuplicateResourceError.new(name) if resources.has_key?(name)
- resource = Resource.new(name)
- resource.instance_eval(&block)
- resources[name] = resource
+ @stable ||= SoftwareSpec.new
+ @stable.resource(name, &block)
end
def dependencies