Only reference bundle node version in package.json

This commit is contained in:
Juan Cruz Viotti 2015-02-13 15:35:28 -04:00
parent 16544e41a9
commit 188d6213e3
4 changed files with 15 additions and 10 deletions

View File

@ -1,5 +1,8 @@
var binary = require('node-binary');
var nodeVersion = 'v0.12.0';
var fs = require('fs');
var path = require('path');
var nodeVersion = require('../package.json').bundled_engine;
var destination = './bin/node';
console.log('Downloading node-' + nodeVersion + '-' + process.platform + '-' + process.arch);
@ -7,11 +10,14 @@ binary.download({
os: process.platform,
arch: process.arch,
version: nodeVersion
}, './bin/node', function(error, binaryPath) {
}, destination, function(error, binaryPath) {
if(error) {
console.error(error.message);
process.exit(1);
}
console.log('NodeJS was downloaded to ' + binaryPath);
var output = path.join(destination, 'node-' + process.platform + '-' + process.arch);
fs.renameSync(binaryPath, output);
console.log('NodeJS downloaded to ' + output);
});

View File

@ -4,8 +4,6 @@ function unsupported_platform() {
echo "Your platform (`uname -a`) is not supported." && exit 1
}
NODE_VERSION="v0.12.0"
# Detect CPU arch.
ARCHITECTURE=`uname -m`
case "$ARCHITECTURE" in
@ -17,19 +15,19 @@ esac
# Darwin
if [ "`uname`" == "Darwin" ]; then
NODE_BIN="node-$NODE_VERSION-darwin-$ARCHITECTURE"
NODE_BIN="node-darwin-$ARCHITECTURE"
# Linux
elif [ "`expr substr $(uname -s) 1 5`" == "Linux" ]; then
NODE_BIN="node-$NODE_VERSION-linux-$ARCHITECTURE"
NODE_BIN="node-linux-$ARCHITECTURE"
# Win32
elif [ "`expr substr $(uname -s) 1 10`" == "MINGW32_NT" ]; then
NODE_BIN="node-$NODE_VERSION-win32-$ARCHITECTURE.exe"
NODE_BIN="node-win32-$ARCHITECTURE.exe"
# SunOS
elif [ "`uname`" == "SunOS" ]; then
NODE_BIN="node-$NODE_VERSION-sunos-$ARCHITECTURE.bin"
NODE_BIN="node-sunos-$ARCHITECTURE.bin"
else
unsupported_platform

View File

@ -3,7 +3,7 @@
:: http://stackoverflow.com/questions/12322308/batch-file-to-check-64bit-or-32bit-os
reg Query "HKLM\Hardware\Description\System\CentralProcessor\0" | find /i "x86" > NUL && set ARCH=x86 || set ARCH=x64
set NODE_PATH="%~dp0\node\node-v0.12.0-win32-%ARCH%.exe"
set NODE_PATH="%~dp0\node\node-win32-%ARCH%.exe"
@IF NOT EXIST %NODE_PATH% (
set NODE_PATH="node.exe"

View File

@ -8,6 +8,7 @@
"url": "git@bitbucket.org:rulemotion/resin-cli.git"
},
"preferGlobal": true,
"bundled_engine": "v0.12.0",
"man": [
"./man/resin.1",
"./man/resin-completion.1",