diff --git a/bin/install-node.js b/bin/install-node.js index ba8a74b4..b16fa372 100644 --- a/bin/install-node.js +++ b/bin/install-node.js @@ -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); }); diff --git a/bin/resin b/bin/resin index 6432418d..2398c8f8 100755 --- a/bin/resin +++ b/bin/resin @@ -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 diff --git a/bin/resin.cmd b/bin/resin.cmd index 7759a069..85f349f7 100755 --- a/bin/resin.cmd +++ b/bin/resin.cmd @@ -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" diff --git a/package.json b/package.json index 2baebca2..9df3f9a0 100644 --- a/package.json +++ b/package.json @@ -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",