Browse Source

node-gyp: detect RC build with x.y.z-rc.n format

PR-URL: https://github.com/nodejs/io.js/pull/2171
Reviewed-By: Alexis Campailla <alexis@janeasystems.com>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
v4.0.0-rc
Rod Vagg 10 years ago
parent
commit
9f727f5e03
  1. 16
      deps/npm/node_modules/node-gyp/lib/install.js

16
deps/npm/node_modules/node-gyp/lib/install.js

@ -460,7 +460,7 @@ function install (gyp, argv, callback) {
// pick out 'nightly', 'next-nightly' or 'rc' from the version string if it's there
// adjust URL accordingly
function getDefaultIojsUrl(version) {
var versionMatch = version.match(/^v\d+\.\d+\.\d+-(?:(?:(nightly|next-nightly)\d{8}[0-9a-f]{10})|(?:(rc)\d+))$/)
var versionMatch = version.match(/^v\d+\.\d+\.\d+-(?:(?:(nightly|next-nightly)\.?\d{8}[0-9a-f]{10})|(?:(rc)\.\d+))$/)
var distType = versionMatch ? versionMatch[1] || versionMatch[2] : 'release'
var defaultUrl = `https://iojs.org/download/${distType}`
return defaultUrl
@ -470,11 +470,15 @@ function getDefaultIojsUrl(version) {
if (require.main === module) {
var assert = require('assert')
console.log('test v2.3.4 -> https://iojs.org/download/release')
assert(getDefaultIojsUrl('v2.3.4', 'https://iojs.org/download/release'))
assert.equal(getDefaultIojsUrl('v2.3.4'), 'https://iojs.org/download/release')
console.log('test v2.3.4-nightly12345678aaaaaaaaaa -> https://iojs.org/download/nightly')
assert(getDefaultIojsUrl('v2.3.4-nightly12345678aaaaaaaaaa', 'https://iojs.org/download/nightly'))
assert.equal(getDefaultIojsUrl('v2.3.4-nightly12345678aaaaaaaaaa'), 'https://iojs.org/download/nightly')
console.log('test v2.3.4-nightly.12345678aaaaaaaaaa -> https://iojs.org/download/nightly')
assert.equal(getDefaultIojsUrl('v2.3.4-nightly.12345678aaaaaaaaaa'), 'https://iojs.org/download/nightly')
console.log('test v2.3.4-next-nightly12345678aaaaaaaaaa -> https://iojs.org/download/release/next-nightly')
assert(getDefaultIojsUrl('v2.3.4-next-nightly12345678aaaaaaaaaa', 'https://iojs.org/download/next-nightly'))
console.log('test v2.3.4-rc100 -> https://iojs.org/download/rc')
assert(getDefaultIojsUrl('v2.3.4-rc100', 'https://iojs.org/download/rc'))
assert.equal(getDefaultIojsUrl('v2.3.4-next-nightly12345678aaaaaaaaaa'), 'https://iojs.org/download/next-nightly')
console.log('test v2.3.4-next-nightly.12345678aaaaaaaaaa -> https://iojs.org/download/release/next-nightly')
assert.equal(getDefaultIojsUrl('v2.3.4-next-nightly.12345678aaaaaaaaaa'), 'https://iojs.org/download/next-nightly')
console.log('test v2.3.4-rc.100 -> https://iojs.org/download/rc')
assert.equal(getDefaultIojsUrl('v2.3.4-rc.100'), 'https://iojs.org/download/rc')
}

Loading…
Cancel
Save