aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMax Howell2009-06-15 00:54:58 +0100
committerMax Howell2009-06-15 00:54:58 +0100
commitb3b78eceeb53bb84402507d65308ca5bf30afb24 (patch)
tree6c9a14ce5c16e33594a5c4488557b54408ac61a1 /Library
parent92154225dc6b821caadc129625f2d887c5fef352 (diff)
downloadbrew-b3b78eceeb53bb84402507d65308ca5bf30afb24.tar.bz2
Test for astyle versioning
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/brewkit.rb8
-rwxr-xr-xLibrary/Homebrew/unittest.rb5
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