diff options
| author | Max Howell | 2009-06-08 15:57:24 +0100 |
|---|---|---|
| committer | Max Howell | 2009-06-08 15:57:24 +0100 |
| commit | 36b5fcf6c020b46b8ef8223a77e76b32008d80e6 (patch) | |
| tree | 6eaa1a3190280c3e914f1990985975ad37ddd9ea /Library | |
| parent | ba264d8cd0b743b7ff81fe1d942802915ac38711 (diff) | |
| download | homebrew-36b5fcf6c020b46b8ef8223a77e76b32008d80e6.tar.bz2 | |
Another version test
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/brewkit.rb | 22 | ||||
| -rwxr-xr-x | Library/Homebrew/unittest.rb | 5 |
2 files changed, 21 insertions, 6 deletions
diff --git a/Library/Homebrew/brewkit.rb b/Library/Homebrew/brewkit.rb index 45efd2628..8a0aa8387 100644 --- a/Library/Homebrew/brewkit.rb +++ b/Library/Homebrew/brewkit.rb @@ -57,16 +57,26 @@ end # pass in the basename of the filename _without_ any file extension def extract_version basename - # eg. foobar4.5.1 + # eg. boost_1_39_0 + /((\d+_)+\d+)$/.match basename + return $1.gsub('_', '.') if $1 + + # eg. foobar-4.5.1-1 + /-((\d+\.)*\d+-\d+)$/.match basename + return $1 if $1 + # eg. foobar-4.5.1 - # eg. foobar-4.5.1b - /^[^0-9]*((\d+\.)*(\d+-)?\d+[abc]?)$/.match basename + /-((\d+\.)*\d+)$/.match basename return $1 if $1 - # eg. boost_1_39_0 - /^[^0-9]*((\d+_)*\d+)$/.match basename - return $1.gsub('_', '.') if $1 + # eg. foobar-4.5.1b + /-((\d+\.)*\d+[abc])$/.match basename + return $1 if $1 + # eg. foobar4.5.1 + /((\d+\.)*\d+)$/.match basename + return $1 if $1 + # eg. (erlang) otp_src_R13B /^.*[-_.](.*)$/.match basename return $1 if $1 diff --git a/Library/Homebrew/unittest.rb b/Library/Homebrew/unittest.rb index 4ae7bc4f0..229bc57b4 100755 --- a/Library/Homebrew/unittest.rb +++ b/Library/Homebrew/unittest.rb @@ -33,6 +33,11 @@ class BeerTasting <Test::Unit::TestCase r=TestFormula.new "http://erlang.org/download/otp_src_R13B.tar.gz" assert_equal 'R13B', r.version end + + def test_dos2unix + r=TestFormula.new "http://www.sfr-fresh.com/linux/misc/dos2unix-3.1.tar.gz" + assert_equal '3.1', r.version + end def test_version_internal_dash r=TestFormula.new "http://example.com/foo-arse-1.1-2.tar.gz" |
