aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/version.rb
diff options
context:
space:
mode:
authorJack Nagel2013-04-27 15:21:05 -0500
committerJack Nagel2013-04-27 15:21:05 -0500
commitc7ba2b73e52147cbf93f50b2b9830b94850f5756 (patch)
tree3f8bb2679bc7ab007f9223f2fc80e219c80af32e /Library/Homebrew/version.rb
parente51d0e4d0c296d64c2a51a10af20263b90fff48e (diff)
downloadhomebrew-c7ba2b73e52147cbf93f50b2b9830b94850f5756.tar.bz2
Combine GitHub version regexes
Diffstat (limited to 'Library/Homebrew/version.rb')
-rw-r--r--Library/Homebrew/version.rb14
1 files changed, 3 insertions, 11 deletions
diff --git a/Library/Homebrew/version.rb b/Library/Homebrew/version.rb
index 45b0594e3..efd7e3653 100644
--- a/Library/Homebrew/version.rb
+++ b/Library/Homebrew/version.rb
@@ -118,20 +118,12 @@ class Version
spec.stem
end
- # GitHub tarballs, e.g. v1.2.3
- m = %r[github.com/.+/(?:zip|tar)ball/v?((\d+\.)+\d+)$].match(spec_s)
- return m.captures.first unless m.nil?
-
+ # GitHub tarballs
+ # e.g. https://github.com/foo/bar/tarball/v1.2.3
# e.g. https://github.com/sam-github/libnet/tarball/libnet-1.1.4
- m = %r[github.com/.+/(?:zip|tar)ball/.*-((\d+\.)+\d+)$].match(spec_s)
- return m.captures.first unless m.nil?
-
# e.g. https://github.com/isaacs/npm/tarball/v0.2.5-1
- m = %r[github.com/.+/(?:zip|tar)ball/v?((\d+\.)+\d+-(\d+))$].match(spec_s)
- return m.captures.first unless m.nil?
-
# e.g. https://github.com/petdance/ack/tarball/1.93_02
- m = %r[github.com/.+/(?:zip|tar)ball/v?((\d+\.)+\d+_(\d+))$].match(spec_s)
+ m = %r[github.com/.+/(?:zip|tar)ball/(?:v|\w+-)?((?:\d+[-._])+\d*)$].match(spec_s)
return m.captures.first unless m.nil?
# e.g. https://github.com/erlang/otp/tarball/OTP_R15B01 (erlang style)