Skip to content
Snippets Groups Projects
Commit dd2083d0 authored by Mike McQuaid's avatar Mike McQuaid Committed by GitHub
Browse files

Merge pull request #3262 from kabel/version-detect-php

Add version detection support for php URL
parents 0b105960 4f555656
No related branches found
No related tags found
No related merge requests found
......@@ -649,6 +649,11 @@ describe Version do
.to be_detected_from("ftp://gcc.gnu.org/pub/gcc/snapshots/6-20151227/gcc-6-20151227.tar.bz2")
end
specify "semver in middle of URL" do
expect(Version.create("7.1.10"))
.to be_detected_from("https://php.net/get/php-7.1.10.tar.gz/from/this/mirror")
end
specify "from URL" do
expect(Version.create("1.2.3"))
.to be_detected_from("http://github.com/foo/bar.git", tag: "v1.2.3")
......
......@@ -456,6 +456,10 @@ class Version
# e.g. http://www.ijg.org/files/jpegsrc.v8d.tar.gz
m = /\.v(\d+[a-z]?)/.match(stem)
return m.captures.first unless m.nil?
# e.g. https://secure.php.net/get/php-7.1.10.tar.bz2/from/this/mirror
m = /[-.vV]?((?:\d+\.)+\d+(?:[-_.]?(?i:alpha|beta|pre|rc)\.?\d{,2})?)/.match(spec_s)
return m.captures.first unless m.nil?
end
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment