diff options
| author | Max Howell | 2009-06-08 15:57:24 +0100 |
|---|---|---|
| committer | Max Howell | 2009-06-08 15:57:24 +0100 |
| commit | 9003225a34ed060e3434df41499f795aac090f6d (patch) | |
| tree | 5ed76cd14ce4ad48faaabb98920738098a5b74d9 /Library/Homebrew | |
| parent | 0997a04bf8c7a43275320428d657bd950ff5c6a3 (diff) | |
| download | brew-9003225a34ed060e3434df41499f795aac090f6d.tar.bz2 | |
Another version test
Diffstat (limited to 'Library/Homebrew')
| -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" |
