diff options
| -rw-r--r-- | Library/Homebrew/brewkit.rb | 8 | ||||
| -rwxr-xr-x | Library/Homebrew/unittest.rb | 5 |
2 files changed, 10 insertions, 3 deletions
diff --git a/Library/Homebrew/brewkit.rb b/Library/Homebrew/brewkit.rb index 1bd250e77..d0a59b888 100644 --- a/Library/Homebrew/brewkit.rb +++ b/Library/Homebrew/brewkit.rb @@ -77,9 +77,11 @@ def extract_version basename /((\d+\.)*\d+)$/.match basename return $1 if $1 - # eg. (erlang) otp_src_R13B - /^.*[-_.](.*)$/.match basename - return $1 if $1 + # eg. otp_src_R13B (this is erlang's style) + # eg. astyle_1.23_macosx.tar.gz + basename.scan /_([^_]+)/ do |match| + return match.first if /\d/.match $1 + end end diff --git a/Library/Homebrew/unittest.rb b/Library/Homebrew/unittest.rb index 229bc57b4..5ac1f994a 100755 --- a/Library/Homebrew/unittest.rb +++ b/Library/Homebrew/unittest.rb @@ -34,6 +34,11 @@ class BeerTasting <Test::Unit::TestCase assert_equal 'R13B', r.version end + def test_astyle_verson_style + r=TestFormula.new "http://kent.dl.sourceforge.net/sourceforge/astyle/astyle_1.23_macosx.tar.gz" + assert_equal '1.23', 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 |
