Do a stricter version check

A version should always be set when going through the constructor
so tighten this check. Also do some style clean ups here.
This commit is contained in:
Adam Vandenberg 2012-03-09 10:18:12 -08:00
parent 275d22db9e
commit 04088ba96d

View File

@ -24,7 +24,6 @@ class Formula
set_instance_variable 'bottle_sha1' set_instance_variable 'bottle_sha1'
set_instance_variable 'head' set_instance_variable 'head'
set_instance_variable 'specs' set_instance_variable 'specs'
set_instance_variable 'standard' set_instance_variable 'standard'
set_instance_variable 'unstable' set_instance_variable 'unstable'
@ -47,9 +46,11 @@ class Formula
# If we got an explicit path, use that, else determine from the name # If we got an explicit path, use that, else determine from the name
@path = path.nil? ? self.class.path(name) : Pathname.new(path) @path = path.nil? ? self.class.path(name) : Pathname.new(path)
# Use a provided version, if any
set_instance_variable 'version' set_instance_variable 'version'
# Otherwise detect the version from the URL
@version ||= @spec_to_use.detect_version @version ||= @spec_to_use.detect_version
validate_variable :version if @version validate_variable :version
CHECKSUM_TYPES.each { |type| set_instance_variable type } CHECKSUM_TYPES.each { |type| set_instance_variable type }