show current step

This commit is contained in:
oleg 2015-05-20 23:20:51 +03:00
parent 45193664ab
commit 52a18c694a
5 changed files with 13 additions and 7 deletions

View File

@ -77,8 +77,8 @@ Distributor.prototype._runNext = function(callback) {
); );
}); });
executor.on('currentStep', function(stepLabel) { executor.on('currentStep', function(stepName) {
self._updateBuild(build, {currentStep: stepLabel}); self._updateBuild(build, {currentStep: stepName});
}); });
executor.on('data', function(data) { executor.on('data', function(data) {

View File

@ -35,8 +35,7 @@ Executor.prototype.run = function(params, callback) {
self.emit('scmData', scmData); self.emit('scmData', scmData);
var funcs = project.steps.map(function(step, index) { var funcs = project.steps.map(function(step, index) {
return function() { return function() {
var stepLabel = step.name || utils.prune(step.cmd, 15); self.emit('currentStep', step.name);
self.emit('currentStep', stepLabel);
self._runStep(step, this.slot()); self._runStep(step, this.slot());
}; };
}); });

View File

@ -4,7 +4,8 @@ var Steppy = require('twostep').Steppy,
fs = require('fs'), fs = require('fs'),
path = require('path'), path = require('path'),
_ = require('underscore'), _ = require('underscore'),
reader = require('./reader'); reader = require('./reader'),
utils = require('./utils');
function Project(config) { function Project(config) {
this.config = config; this.config = config;
@ -66,7 +67,8 @@ exports.loadConfig = function(dir, callback) {
function(err, config) { function(err, config) {
// apply defaults // apply defaults
_(config.steps).each(function(step) { _(config.steps).each(function(step) {
_(step).defaults({type: 'shell'}); if (!step.type) step.type = 'shell';
if (!step.name) step.name = utils.prune(step.cmd, 40);
}); });
this.pass(config); this.pass(config);

View File

@ -8,5 +8,5 @@ exports.prune = function(str, length) {
result += words.shift() + ' '; result += words.shift() + ' ';
} while (words.length && result.length < length); } while (words.length && result.length < length);
return result.replace(/ $/, result.length <= length ? '' : '...'); return result.replace(/ $/, words.length ? '...' : '');
}; };

View File

@ -29,6 +29,11 @@ mixin statusText(build)
span span
span # span #
span= build.number span= build.number
if build.status === 'in-progress' && build.currentStep
span (
span= build.currentStep
span )
div div
if build.scm if build.scm
span.build_info span.build_info