summaryrefslogtreecommitdiff
path: root/deps/npm
diff options
context:
space:
mode:
authorRod Vagg <rod@vagg.org>2015-06-26 22:17:02 +1000
committerRod Vagg <rod@vagg.org>2015-08-04 11:56:15 -0700
commit902c9ca51d1e14a1ebce35177548260079a31b8c (patch)
tree086708a06103760813b3aeba55194520ba36ab04 /deps/npm
parent1057d1186b0fedf87411a1cb56c67dc385ee1f9f (diff)
downloadandroid-node-v8-902c9ca51d1e14a1ebce35177548260079a31b8c.tar.gz
android-node-v8-902c9ca51d1e14a1ebce35177548260079a31b8c.tar.bz2
android-node-v8-902c9ca51d1e14a1ebce35177548260079a31b8c.zip
node-gyp: make aware of nightly, next-nightly & rc
A temporary fix only, node-gyp needs to be made more intelligent upstream about figuring out where to find the download file by inspecting the binary. Floating patch on npm. PR-URL: https://github.com/nodejs/io.js/pull/2066 Reviewed-By: Johan Bergström <bugs@bergstroem.nu> Reviewed-By: Ryan Graham <r.m.graham@gmail.com>
Diffstat (limited to 'deps/npm')
-rw-r--r--deps/npm/node_modules/node-gyp/lib/install.js27
1 files changed, 25 insertions, 2 deletions
diff --git a/deps/npm/node_modules/node-gyp/lib/install.js b/deps/npm/node_modules/node-gyp/lib/install.js
index cdee86ec6c..ff22812a7f 100644
--- a/deps/npm/node_modules/node-gyp/lib/install.js
+++ b/deps/npm/node_modules/node-gyp/lib/install.js
@@ -39,8 +39,8 @@ function install (gyp, argv, callback) {
}
}
- var distUrl = gyp.opts['dist-url'] || gyp.opts.disturl || 'https://iojs.org/dist'
-
+ var defaultUrl = getDefaultIojsUrl(process.version)
+ var distUrl = gyp.opts['dist-url'] || gyp.opts.disturl || defaultUrl
// Determine which node dev files version we are installing
var versionStr = argv[0] || gyp.opts.target || process.version
@@ -455,3 +455,26 @@ 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 distType = versionMatch ? versionMatch[1] || versionMatch[2] : 'release'
+ var defaultUrl = `https://iojs.org/download/${distType}`
+ return defaultUrl
+}
+
+
+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'))
+ console.log('test v2.3.4-nightly12345678aaaaaaaaaa -> https://iojs.org/download/nightly')
+ assert(getDefaultIojsUrl('v2.3.4-nightly12345678aaaaaaaaaa', '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'))
+}