aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Nagel2014-05-27 21:41:43 -0500
committerJack Nagel2014-05-27 21:41:43 -0500
commit355e06d433babe116156c126ae10ef44554e2b2b (patch)
tree32130daa0809884b58f715de188f8309b44f8888
parentab78520977fd8d425c87ac591e1463e0e0620c10 (diff)
downloadhomebrew-355e06d433babe116156c126ae10ef44554e2b2b.tar.bz2
Remove support for version "schemes", just pass version objects directly
I'm not sure why I thought reinventing object instantiation was a good idea.
-rw-r--r--Library/Formula/scantailor.rb4
-rw-r--r--Library/Homebrew/resource.rb6
-rw-r--r--Library/Homebrew/test/test_resource.rb6
-rw-r--r--Library/Homebrew/version.rb8
4 files changed, 8 insertions, 16 deletions
diff --git a/Library/Formula/scantailor.rb b/Library/Formula/scantailor.rb
index f3a9af76a..6122e0902 100644
--- a/Library/Formula/scantailor.rb
+++ b/Library/Formula/scantailor.rb
@@ -22,12 +22,12 @@ class Scantailor < Formula
homepage 'http://scantailor.org/'
url 'https://downloads.sourceforge.net/project/scantailor/scantailor/0.9.11.1/scantailor-0.9.11.1.tar.gz'
- version '0.9.11.1' => Version
+ version Scantailor::Version.new("0.9.11.1")
sha1 '80970bbcd65fbf8bc62c0ff0cb7bcb78c86961c3'
devel do
url 'https://downloads.sourceforge.net/project/scantailor/scantailor-devel/enhanced/scantailor-enhanced-20140214.tar.bz2'
- version 'enhanced-20140214' => Version
+ version Scantailor::Version.new("enhanced-20140214")
sha1 'e90b861f02a571184b8ab9d5ef59dd57dcf1c212'
end
diff --git a/Library/Homebrew/resource.rb b/Library/Homebrew/resource.rb
index 6a72a6e99..3409845a0 100644
--- a/Library/Homebrew/resource.rb
+++ b/Library/Homebrew/resource.rb
@@ -118,9 +118,9 @@ class Resource
def detect_version(val)
case val
- when nil then Version.detect(url, specs)
- when String then Version.new(val)
- when Hash then Version.new_with_scheme(*val.shift)
+ when nil then Version.detect(url, specs)
+ when String then Version.new(val)
+ when Version then val
else
raise TypeError, "version '#{val.inspect}' should be a string"
end
diff --git a/Library/Homebrew/test/test_resource.rb b/Library/Homebrew/test/test_resource.rb
index 3cfe592e1..2baf4750e 100644
--- a/Library/Homebrew/test/test_resource.rb
+++ b/Library/Homebrew/test/test_resource.rb
@@ -61,10 +61,10 @@ class ResourceTests < Test::Unit::TestCase
end
def test_version_with_scheme
- scheme = Class.new(Version)
- @resource.version('1.0' => scheme)
+ klass = Class.new(Version)
+ @resource.version klass.new("1.0")
assert_version_equal '1.0', @resource.version
- assert_instance_of scheme, @resource.version
+ assert_instance_of klass, @resource.version
end
def test_version_from_tag
diff --git a/Library/Homebrew/version.rb b/Library/Homebrew/version.rb
index 2e0bc85a5..cd1c14989 100644
--- a/Library/Homebrew/version.rb
+++ b/Library/Homebrew/version.rb
@@ -155,14 +155,6 @@ class Version
StringToken::PATTERN
)
- def self.new_with_scheme(value, scheme)
- if Class === scheme && scheme.ancestors.include?(Version)
- scheme.new(value)
- else
- raise TypeError, "Unknown version scheme #{scheme.inspect}"
- end
- end
-
def self.detect(url, specs={})
if specs.has_key?(:tag)
new(specs[:tag][/((?:\d+\.)*\d+)/, 1], true)