From 018cffbf2f7aa56c4ea42d254997f88941aff349 Mon Sep 17 00:00:00 2001 From: Rod Vagg Date: Mon, 13 Jul 2015 13:35:02 +1000 Subject: [PATCH] node-gyp: detect RC build with x.y.z-rc.n format MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/io.js/pull/2171 Reviewed-By: Alexis Campailla Reviewed-By: Johan Bergström --- deps/npm/node_modules/node-gyp/lib/install.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/deps/npm/node_modules/node-gyp/lib/install.js b/deps/npm/node_modules/node-gyp/lib/install.js index 737113bbdf21af..79b6cd38266f7d 100644 --- a/deps/npm/node_modules/node-gyp/lib/install.js +++ b/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') }