mirror of
https://gitlab.silvrtree.co.uk/martind2000/nci.git
synced 2025-01-26 21:06:16 +00:00
merge with master
This commit is contained in:
commit
e219ebfc79
@ -1,9 +0,0 @@
|
|||||||
scm:
|
|
||||||
type: git
|
|
||||||
repository: /Users/vladimir/projects/fit/culture/frontend_node
|
|
||||||
rev: master
|
|
||||||
|
|
||||||
steps:
|
|
||||||
sync: npm run sync
|
|
||||||
test: nrun test -R dot
|
|
||||||
pack: nrun packSafe
|
|
@ -30,6 +30,8 @@ Command.prototype.run = function(params, callback) {
|
|||||||
stdout = self.collectOut ? '' : null,
|
stdout = self.collectOut ? '' : null,
|
||||||
stderr = self.attachStderr ? '' : null;
|
stderr = self.attachStderr ? '' : null;
|
||||||
|
|
||||||
|
callback = _(callback).once();
|
||||||
|
|
||||||
if (!params.cmd) return callback(new Error('`cmd` is not set'));
|
if (!params.cmd) return callback(new Error('`cmd` is not set'));
|
||||||
if (!params.args) return callback(new Error('`args` is not set'));
|
if (!params.args) return callback(new Error('`args` is not set'));
|
||||||
params.options = params.options || {};
|
params.options = params.options || {};
|
||||||
@ -41,6 +43,16 @@ Command.prototype.run = function(params, callback) {
|
|||||||
self.emit('stdin', params.cmd + ' ' + params.args.join(' ') + '\n');
|
self.emit('stdin', params.cmd + ' ' + params.args.join(' ') + '\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var extendError = function (err) {
|
||||||
|
err.message = (
|
||||||
|
'Error while spawn "' +
|
||||||
|
[params.cmd].concat(params.args || []).join(' ') + '": ' +
|
||||||
|
err.message
|
||||||
|
);
|
||||||
|
|
||||||
|
return err;
|
||||||
|
};
|
||||||
|
|
||||||
cmd.stdout.on('data', function(data) {
|
cmd.stdout.on('data', function(data) {
|
||||||
if (self.emitOut) self.emit('stdout', data);
|
if (self.emitOut) self.emit('stdout', data);
|
||||||
if (self.collectOut) stdout += data;
|
if (self.collectOut) stdout += data;
|
||||||
@ -54,11 +66,17 @@ Command.prototype.run = function(params, callback) {
|
|||||||
cmd.on('close', function(code) {
|
cmd.on('close', function(code) {
|
||||||
var err = null;
|
var err = null;
|
||||||
if (code !== 0) {
|
if (code !== 0) {
|
||||||
err = new Error('Spawned command exits with non-zero code: ' + code);
|
err = extendError(
|
||||||
|
new Error('Spawned command exits with non-zero code: ' + code)
|
||||||
|
);
|
||||||
err.stderr = stderr;
|
err.stderr = stderr;
|
||||||
}
|
}
|
||||||
callback(err, stdout);
|
callback(err, stdout);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
cmd.on('error', function(err) {
|
||||||
|
callback(extendError(err));
|
||||||
|
});
|
||||||
|
|
||||||
return cmd;
|
return cmd;
|
||||||
};
|
};
|
||||||
|
@ -172,5 +172,14 @@ Scm.prototype.getChanges = function(rev1, rev2, callback) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Scm.prototype.update = function(rev, callback) {
|
Scm.prototype.update = function(rev, callback) {
|
||||||
this._run({cmd: 'git', args: ['checkout', '-f', rev]}, callback);
|
var self = this;
|
||||||
|
Steppy(
|
||||||
|
function() {
|
||||||
|
self._run({cmd: 'git', args: ['checkout', '-f', rev]}, this.slot());
|
||||||
|
},
|
||||||
|
function() {
|
||||||
|
self._run({cmd: 'git', args: ['submodule', 'update']}, this.slot());
|
||||||
|
},
|
||||||
|
callback
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
"ignore": [
|
"ignore": [
|
||||||
"data",
|
"data",
|
||||||
"node_modules/*/node_modules/",
|
"node_modules/*/node_modules/",
|
||||||
|
"node_modules/nci-classic-ui/app/",
|
||||||
"node_modules/nci-classic-ui/static/"
|
"node_modules/nci-classic-ui/static/"
|
||||||
],
|
],
|
||||||
"watch": "./"
|
"watch": "./"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "nci",
|
"name": "nci",
|
||||||
"version": "0.9.2",
|
"version": "0.9.4",
|
||||||
"description": "Flexible, open source continuous integration server written in node.js",
|
"description": "Flexible, open source continuous integration server written in node.js",
|
||||||
"bin": {
|
"bin": {
|
||||||
"nci": "bin/nci"
|
"nci": "bin/nci"
|
||||||
|
@ -44,7 +44,7 @@ describe('Shell command', function() {
|
|||||||
// messages and codes are slightly different across the OSes
|
// messages and codes are slightly different across the OSes
|
||||||
// e.g. at linux and macos
|
// e.g. at linux and macos
|
||||||
expect(err.message).match(
|
expect(err.message).match(
|
||||||
/^Spawned command exits with non-zero code: \d+/
|
/Spawned command exits with non-zero code: \d+/
|
||||||
);
|
);
|
||||||
expect(err.stderr).match(/echo1:.*not found/);
|
expect(err.stderr).match(/echo1:.*not found/);
|
||||||
expect(std.err).equal('');
|
expect(std.err).equal('');
|
||||||
|
Loading…
Reference in New Issue
Block a user