Add Jenkins version matching (and test).

This commit is contained in:
Mike McQuaid 2012-10-16 10:31:03 +01:00
parent 55fabe36e0
commit 425440de3b
2 changed files with 8 additions and 0 deletions

View File

@ -235,6 +235,10 @@ class VersionParsingTests < Test::Unit::TestCase
assert_version_detected '3.4', 'http://www.antlr.org/download/antlr-3.4-complete.jar' assert_version_detected '3.4', 'http://www.antlr.org/download/antlr-3.4-complete.jar'
end end
def test_jenkins_version_style
assert_version_detected '1.486', 'http://mirrors.jenkins-ci.org/war/1.486/jenkins.war'
end
# def test_version_ghc_style # def test_version_ghc_style
# assert_version_detected '7.0.4', 'http://www.haskell.org/ghc/dist/7.0.4/ghc-7.0.4-x86_64-apple-darwin.tar.bz2' # assert_version_detected '7.0.4', 'http://www.haskell.org/ghc/dist/7.0.4/ghc-7.0.4-x86_64-apple-darwin.tar.bz2'
# assert_version_detected '7.0.4', 'http://www.haskell.org/ghc/dist/7.0.4/ghc-7.0.4-i386-apple-darwin.tar.bz2' # assert_version_detected '7.0.4', 'http://www.haskell.org/ghc/dist/7.0.4/ghc-7.0.4-i386-apple-darwin.tar.bz2'

View File

@ -175,6 +175,10 @@ class Version
# e.g. astyle_1.23_macosx.tar.gz # e.g. astyle_1.23_macosx.tar.gz
m = /_([^_]+)/.match(stem) m = /_([^_]+)/.match(stem)
return m.captures.first unless m.nil? return m.captures.first unless m.nil?
# e.g. http://mirrors.jenkins-ci.org/war/1.486/jenkins.war
m = /\/(\d\.\d+)\//.match(spec.to_s)
return m.captures.first unless m.nil?
end end
# DSL for defining comparators # DSL for defining comparators