From d62fd8743634da86a6fc228f39c0a81b2ef67c34 Mon Sep 17 00:00:00 2001 From: Max Howell Date: Fri, 11 Sep 2009 12:51:36 +0100 Subject: [PATCH] Fix lame version, eg. 398-2 Included test this time! --- Library/Homebrew/pathname+yeast.rb | 9 ++++++++- Library/Homebrew/unittest.rb | 5 +++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/pathname+yeast.rb b/Library/Homebrew/pathname+yeast.rb index 091b0379ff..6bdd423347 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 ae8b0c1bc3..62cc356be2 100755 --- a/Library/Homebrew/unittest.rb +++ b/Library/Homebrew/unittest.rb @@ -374,6 +374,11 @@ class BeerTasting