Combine GitHub version regexes

This commit is contained in:
Jack Nagel 2013-04-27 15:21:05 -05:00
parent 16723afaa8
commit 364c5c3473

View File

@ -118,20 +118,12 @@ class Version
spec.stem spec.stem
end end
# GitHub tarballs, e.g. v1.2.3 # GitHub tarballs
m = %r[github.com/.+/(?:zip|tar)ball/v?((\d+\.)+\d+)$].match(spec_s) # e.g. https://github.com/foo/bar/tarball/v1.2.3
return m.captures.first unless m.nil?
# e.g. https://github.com/sam-github/libnet/tarball/libnet-1.1.4 # 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 # 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 # 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? return m.captures.first unless m.nil?
# e.g. https://github.com/erlang/otp/tarball/OTP_R15B01 (erlang style) # e.g. https://github.com/erlang/otp/tarball/OTP_R15B01 (erlang style)