aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
authorMike McQuaid2013-06-20 13:07:59 +0100
committerMike McQuaid2013-06-20 13:07:59 +0100
commit01e5e428eb2078e1618d2bf35ecf5e4f4a84ca0d (patch)
tree327f20d6b2fb004782ee21a67f11aa9d2c5bba1a /Library/Homebrew
parenta783946b6dc1e2ccbce9260a5d132330811bd317 (diff)
downloadbrew-01e5e428eb2078e1618d2bf35ecf5e4f4a84ca0d.tar.bz2
perforce: add version detection regex.
Diffstat (limited to 'Library/Homebrew')
-rw-r--r--Library/Homebrew/test/test_versions.rb5
-rw-r--r--Library/Homebrew/version.rb4
2 files changed, 9 insertions, 0 deletions
diff --git a/Library/Homebrew/test/test_versions.rb b/Library/Homebrew/test/test_versions.rb
index c5671ce82..e1e4e2dcf 100644
--- a/Library/Homebrew/test/test_versions.rb
+++ b/Library/Homebrew/test/test_versions.rb
@@ -297,4 +297,9 @@ class VersionParsingTests < Test::Unit::TestCase
assert_version_detected '2.4c',
'http://loop-aes.sourceforge.net/aespipe/aespipe-v2.4c.tar.bz2'
end
+
+ def test_perforce_style
+ assert_version_detected '2013.1.610569-x86_64',
+ '/usr/local/perforce-2013.1.610569-x86_64.mountain_lion.bottle.tar.gz'
+ end
end
diff --git a/Library/Homebrew/version.rb b/Library/Homebrew/version.rb
index 07d042eb1..7cc347a03 100644
--- a/Library/Homebrew/version.rb
+++ b/Library/Homebrew/version.rb
@@ -237,6 +237,10 @@ class Version
m = /[-_]([Rr]\d+[AaBb]\d*(?:-\d+)?)/.match(spec_s)
return m.captures.first unless m.nil?
+ # e.g. perforce-2013.1.610569-x86_64
+ m = /-([\d\.]+-x86(_64)?)/.match(stem)
+ return m.captures.first unless m.nil?
+
# e.g. boost_1_39_0
m = /((?:\d+_)+\d+)$/.match(stem)
return m.captures.first.gsub('_', '.') unless m.nil?