diff options
| -rw-r--r-- | Cellar/homebrew/brewkit.rb | 6 | ||||
| -rwxr-xr-x | Cellar/homebrew/unittest.rb | 5 |
2 files changed, 9 insertions, 2 deletions
diff --git a/Cellar/homebrew/brewkit.rb b/Cellar/homebrew/brewkit.rb index 8965e3bf5..e05073b2e 100644 --- a/Cellar/homebrew/brewkit.rb +++ b/Cellar/homebrew/brewkit.rb @@ -44,8 +44,10 @@ class Formula filename=File.basename url i=filename.index /[-_]\d/ unless i.nil? - /^((\d+[.-])*\d+)/.match filename[i+1,1000] #1000 because rubysucks - @version = $1 + /^((\d+[._])*(\d+-)?\d+)/.match filename[i+1,1000] #1000 because rubysucks + @version=$1 + # if there are no dots replace underscores, boost do this, the bastards! + @version.gsub!('_', '.') unless @version.include? '.' else # no divisor or a '.' divisor, eg. dmd.1.11.zip /^[a-zA-Z._-]*((\d+\.)*\d+)/.match filename diff --git a/Cellar/homebrew/unittest.rb b/Cellar/homebrew/unittest.rb index 1587959bd..8e1e01cb3 100755 --- a/Cellar/homebrew/unittest.rb +++ b/Cellar/homebrew/unittest.rb @@ -16,6 +16,11 @@ class BeerTasting < Test::Unit::TestCase assert_equal '1.1', r.version end + def test_version_underscores_all_the_way + r=Formula.new "http://example.com/boost_1_39_0.tar.bz2", 'nomd5' + assert_equal '1.39.0', r.version + end + def test_version_internal_dash r=Formula.new "http://example.com/foo-arse-1.1-2.tar.gz", 'nomd5' assert_equal '1.1-2', r.version |
