Delegate downloader to active_spec instead of storing it in an ivar

This commit is contained in:
Jack Nagel 2014-02-20 13:45:13 -05:00
parent 3aa06a701d
commit ccb216c9c7

View File

@ -16,7 +16,7 @@ class Formula
include Utils::Inreplace
extend BuildEnvironmentDSL
attr_reader :name, :path, :homepage, :downloader, :build
attr_reader :name, :path, :homepage, :build
attr_reader :stable, :bottle, :devel, :head, :active_spec
# The current working directory during builds and tests.
@ -53,7 +53,6 @@ class Formula
@active_spec = determine_active_spec
validate_attributes :url, :name, :version
@downloader = active_spec.downloader
@build = determine_build_options
@pin = FormulaPin.new(self)
@ -120,6 +119,10 @@ class Formula
active_spec.requirements
end
def downloader
active_spec.downloader
end
# if the dir is there, but it's empty we consider it not installed
def installed?
(dir = installed_prefix).directory? && dir.children.length > 0