Support github tagged download versions

eg. http://github.com/lloyd/yajl/tarball/1.0.5
This commit is contained in:
Max Howell 2009-08-08 14:24:26 +01:00
parent f724f5ed52
commit dae260561e
2 changed files with 10 additions and 0 deletions

View File

@ -87,6 +87,11 @@ class Pathname
end
def version
# github tarballs are special
# we only support numbered tagged downloads
%r[github.com/.*/tarball/((\d\.)+\d)$].match to_s
return $1 if $1
# eg. boost_1_39_0
/((\d+_)+\d+)$/.match stem
return $1.gsub('_', '.') if $1

View File

@ -151,6 +151,11 @@ class BeerTasting <Test::Unit::TestCase
assert_equal '1.21', r.version
end
def test_version_github
r=MockFormula.new "http://github.com/lloyd/yajl/tarball/1.0.5"
assert_equal '1.0.5', r.version
end
def test_yet_another_version
r=MockFormula.new "http://example.com/mad-0.15.1b.tar.gz"
assert_equal '0.15.1b', r.version