Merge pull request #1102 from zmwangx/alpha-rc-detection

version: improve alpha and rc detection (elasticsearch)
This commit is contained in:
Zhiming Wang 2016-09-24 05:53:17 -04:00 committed by GitHub
commit 687f0fcf72
2 changed files with 6 additions and 2 deletions

View File

@ -203,6 +203,10 @@ class VersionParsingTests < Homebrew::TestCase
assert_version_detected "0.7.1", "https://codeload.github.com/gsamokovarov/jump/tar.gz/v0.7.1" assert_version_detected "0.7.1", "https://codeload.github.com/gsamokovarov/jump/tar.gz/v0.7.1"
end end
def test_elasticsearch_alpha_style
assert_version_detected "5.0.0-alpha5", "https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/tar/elasticsearch/5.0.0-alpha5/elasticsearch-5.0.0-alpha5.tar.gz"
end
def test_gloox_beta_style def test_gloox_beta_style
assert_version_detected "1.0-beta7", "http://camaya.net/download/gloox-1.0-beta7.tar.bz2" assert_version_detected "1.0-beta7", "http://camaya.net/download/gloox-1.0-beta7.tar.bz2"
end end

View File

@ -340,8 +340,8 @@ class Version
m = /-((?:\d+\.)*\d+(?:[abc]|rc|RC)\d*)$/.match(stem) m = /-((?:\d+\.)*\d+(?:[abc]|rc|RC)\d*)$/.match(stem)
return m.captures.first unless m.nil? return m.captures.first unless m.nil?
# e.g. foobar-4.5.0-beta1, or foobar-4.50-beta # e.g. foobar-4.5.0-alpha5, foobar-4.5.0-beta1, or foobar-4.50-beta
m = /-((?:\d+\.)*\d+-beta\d*)$/.match(stem) m = /-((?:\d+\.)*\d+-(?:alpha|beta|rc)\d*)$/.match(stem)
return m.captures.first unless m.nil? return m.captures.first unless m.nil?
# e.g. http://ftpmirror.gnu.org/libidn/libidn-1.29-win64.zip # e.g. http://ftpmirror.gnu.org/libidn/libidn-1.29-win64.zip