diff options
| author | Max Howell | 2009-09-11 12:51:36 +0100 |
|---|---|---|
| committer | Max Howell | 2009-09-11 17:42:53 +0100 |
| commit | d92ca447b94788d52cece7e49da2e12efa4d9848 (patch) | |
| tree | a424c3849b0cc3d955a06e2a6651b1edac5ad59c /Library | |
| parent | 47fcaf8233bd3e2508630e6d645a2e85d6fcca0f (diff) | |
| download | homebrew-d92ca447b94788d52cece7e49da2e12efa4d9848.tar.bz2 | |
Fix lame version, eg. 398-2
Included test this time!
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/pathname+yeast.rb | 9 | ||||
| -rwxr-xr-x | Library/Homebrew/unittest.rb | 5 |
2 files changed, 13 insertions, 1 deletions
diff --git a/Library/Homebrew/pathname+yeast.rb b/Library/Homebrew/pathname+yeast.rb index 091b0379f..6bdd42334 100644 --- a/Library/Homebrew/pathname+yeast.rb +++ b/Library/Homebrew/pathname+yeast.rb @@ -96,6 +96,9 @@ class Pathname out<<`du -hd0 #{to_s} | cut -d"\t" -f1`.strip end + # attempts to retrieve the version component of this path, so generally + # you'll call it on tarballs or extracted tarball directories, if you add + # to this please provide amend the unittest def version if directory? # directories don't have extnames @@ -108,7 +111,7 @@ class Pathname # we only support numbered tagged downloads %r[github.com/.*/tarball/((\d\.)+\d)$].match to_s return $1 if $1 - + # eg. boost_1_39_0 /((\d+_)+\d+)$/.match stem return $1.gsub('_', '.') if $1 @@ -117,6 +120,10 @@ class Pathname # eg. ruby-1.9.1-p243 /-((\d+\.)*\d\.\d+-p?\d+)$/.match stem return $1 if $1 + + # eg. lame-398-1 + /-((\d)+-\d)/.match stem + return $1 if $1 # eg. foobar-4.5.1 /-((\d+\.)*\d+)$/.match stem diff --git a/Library/Homebrew/unittest.rb b/Library/Homebrew/unittest.rb index ae8b0c1bc..62cc356be 100755 --- a/Library/Homebrew/unittest.rb +++ b/Library/Homebrew/unittest.rb @@ -374,6 +374,11 @@ class BeerTasting <Test::Unit::TestCase assert_equal '0.1.9', d.version end + def test_lame_version_style + f=MockFormula.new 'http://kent.dl.sourceforge.net/sourceforge/lame/lame-398-2.tar.gz' + assert_equal '398-2', f.version + end + def test_ruby_version_style f=MockFormula.new 'ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.1-p243.tar.gz' assert_equal '1.9.1-p243', f.version |
