|
|
@ -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') |
|
|
|
} |
|
|
|