build: add support for nodejs 0.10
For Ubuntu 14.04 Node.js compatibility: http://packages.ubuntu.com/trusty/nodejs
This commit is contained in:
parent
9e0e9a2c89
commit
d958e83f1d
|
@ -11,6 +11,7 @@ addons:
|
|||
- gcc-4.8
|
||||
- libzmq3-dev
|
||||
node_js:
|
||||
- "v0.10.25"
|
||||
- "v0.12.7"
|
||||
- "v4"
|
||||
script:
|
||||
|
|
|
@ -5,6 +5,7 @@ var fs = require('fs');
|
|||
var path = require('path');
|
||||
var spawn = require('child_process').spawn;
|
||||
var bitcore = require('bitcore-lib');
|
||||
var utils = require('../utils');
|
||||
var $ = bitcore.util.preconditions;
|
||||
var _ = bitcore.deps._;
|
||||
|
||||
|
@ -14,7 +15,7 @@ var _ = bitcore.deps._;
|
|||
* @param {Function} done
|
||||
*/
|
||||
function addConfig(configFilePath, service, done) {
|
||||
$.checkState(path.isAbsolute(configFilePath), 'An absolute path is expected');
|
||||
$.checkState(utils.isAbsolutePath(configFilePath), 'An absolute path is expected');
|
||||
fs.readFile(configFilePath, function(err, data) {
|
||||
if (err) {
|
||||
return done(err);
|
||||
|
@ -39,7 +40,7 @@ function addConfig(configFilePath, service, done) {
|
|||
* @param {Function} done
|
||||
*/
|
||||
function addService(configDir, service, done) {
|
||||
$.checkState(path.isAbsolute(configDir), 'An absolute path is expected');
|
||||
$.checkState(utils.isAbsolutePath(configDir), 'An absolute path is expected');
|
||||
var npm = spawn('npm', ['install', service, '--save'], {cwd: configDir});
|
||||
|
||||
npm.stdout.on('data', function(data) {
|
||||
|
@ -69,7 +70,7 @@ function add(options, done) {
|
|||
$.checkArgument(_.isObject(options));
|
||||
$.checkArgument(_.isFunction(done));
|
||||
$.checkArgument(
|
||||
_.isString(options.path) && path.isAbsolute(options.path),
|
||||
_.isString(options.path) && utils.isAbsolutePath(options.path),
|
||||
'An absolute path is expected'
|
||||
);
|
||||
$.checkArgument(Array.isArray(options.services));
|
||||
|
|
|
@ -5,6 +5,7 @@ var $ = bitcore.util.preconditions;
|
|||
var _ = bitcore.deps._;
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
var utils = require('../utils');
|
||||
|
||||
/**
|
||||
* Will return the path and bitcore-node configuration
|
||||
|
@ -12,7 +13,7 @@ var fs = require('fs');
|
|||
*/
|
||||
function findConfig(cwd) {
|
||||
$.checkArgument(_.isString(cwd), 'Argument should be a string');
|
||||
$.checkArgument(path.isAbsolute(cwd), 'Argument should be an absolute path');
|
||||
$.checkArgument(utils.isAbsolutePath(cwd), 'Argument should be an absolute path');
|
||||
var directory = String(cwd);
|
||||
while (!fs.existsSync(path.resolve(directory, 'bitcore-node.json'))) {
|
||||
directory = path.resolve(directory, '../');
|
||||
|
|
|
@ -8,6 +8,7 @@ var spawn = require('child_process').spawn;
|
|||
var bitcore = require('bitcore-lib');
|
||||
var $ = bitcore.util.preconditions;
|
||||
var _ = bitcore.deps._;
|
||||
var utils = require('../utils');
|
||||
|
||||
/**
|
||||
* Will remove a service from bitcore-node.json
|
||||
|
@ -16,7 +17,7 @@ var _ = bitcore.deps._;
|
|||
* @param {Function} done
|
||||
*/
|
||||
function removeConfig(configFilePath, service, done) {
|
||||
$.checkArgument(path.isAbsolute(configFilePath), 'An absolute path is expected');
|
||||
$.checkArgument(utils.isAbsolutePath(configFilePath), 'An absolute path is expected');
|
||||
fs.readFile(configFilePath, function(err, data) {
|
||||
if (err) {
|
||||
return done(err);
|
||||
|
@ -47,7 +48,7 @@ function removeConfig(configFilePath, service, done) {
|
|||
* @param {Function} done
|
||||
*/
|
||||
function uninstallService(configDir, service, done) {
|
||||
$.checkArgument(path.isAbsolute(configDir), 'An absolute path is expected');
|
||||
$.checkArgument(utils.isAbsolutePath(configDir), 'An absolute path is expected');
|
||||
$.checkArgument(_.isString(service), 'A string is expected for the service argument');
|
||||
|
||||
var child = spawn('npm', ['uninstall', service, '--save'], {cwd: configDir});
|
||||
|
@ -76,7 +77,7 @@ function uninstallService(configDir, service, done) {
|
|||
* @param {Function} done
|
||||
*/
|
||||
function removeService(configDir, service, done) {
|
||||
$.checkArgument(path.isAbsolute(configDir), 'An absolute path is expected');
|
||||
$.checkArgument(utils.isAbsolutePath(configDir), 'An absolute path is expected');
|
||||
$.checkArgument(_.isString(service), 'A string is expected for the service argument');
|
||||
|
||||
// check if the service is installed
|
||||
|
@ -109,7 +110,7 @@ function remove(options, done) {
|
|||
$.checkArgument(_.isObject(options));
|
||||
$.checkArgument(_.isFunction(done));
|
||||
$.checkArgument(
|
||||
_.isString(options.path) && path.isAbsolute(options.path),
|
||||
_.isString(options.path) && utils.isAbsolutePath(options.path),
|
||||
'An absolute path is expected'
|
||||
);
|
||||
$.checkArgument(Array.isArray(options.services));
|
||||
|
|
|
@ -21,4 +21,9 @@ utils.startAtZero = function startAtZero(obj, key) {
|
|||
}
|
||||
};
|
||||
|
||||
utils.isAbsolutePath = require('path').isAbsolute;
|
||||
if (!utils.isAbsolutePath) {
|
||||
utils.isAbsolutePath = require('path-is-absolute');
|
||||
}
|
||||
|
||||
module.exports = utils;
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
"lru-cache": "^4.0.1",
|
||||
"mkdirp": "0.5.0",
|
||||
"npm": "^2.14.1",
|
||||
"path-is-absolute": "^1.0.0",
|
||||
"semver": "^5.0.1",
|
||||
"socket.io": "^1.4.5",
|
||||
"socket.io-client": "^1.4.5",
|
||||
|
|
Loading…
Reference in New Issue