makeTarget: function(target) { var self = this, targets = [self.pathBenchmarks], label = '[' + target.green + '] has been assembled'; LOGGER.time(label); if (self.benchmarks && self.benchmarks.length) { targets = self.benchmarks .map(function(b) { return PATH.join(self.pathBenchmarks, b); }); } return U.exec('cd ' + PATH.join(self.pathTmp, target) + ' && npm install && ./node_modules/.bin/bem make ' + targets.join(' ')) .fail(function(err) { LOGGER.error(target.red + ' not make'); return Q.reject(err); }) .then(function() { LOGGER.timeEnd(label); }); },
exportWorkingCopy: function() { var self = this, label = 'Export working copy [' + self.pathSelf.green + ']', cmd = [ 'rsync', '-a', '--exclude=/.git', '--exclude=/.svn', '--exclude=/' + self.pathTmp, '.', self.pathTmp + self.pathSelf ].join(' '); LOGGER.time(label); return U.exec(cmd) .fail(function(err) { LOGGER.error('exportWorkingCopy'.blue); return Q.reject(err); }) .then(function() { LOGGER.timeEnd(label); return self.pathSelf; }); },
.map(function(treeish) { var cmd = "git show " + treeish + " | grep Date | awk -F': ' '{print $2}'"; return U.exec(cmd, null, true) .then(function(output) { return { treeish: treeish, date: output.replace('\n', '') }; }); })
.then(function() { var cmd = [ 'cp', '-R', PATH.join(self.pathTmp, source, self.pathBenchmarks + '*'), PATH.join(self.pathTmp, target, self.pathBenchmarks) ].join(' '); return U.exec(cmd) .fail(onFail); });
cleanTempDir: function() { var cmd = 'rm -rf ./' + this.pathTmp + '*', label = 'TMP folder has been cleaned'; LOGGER.info('Cleaning a TMP folder'); LOGGER.time(label); return U.exec(cmd) .fin(function() { LOGGER.timeEnd(label); }); },
return Q.all(targets.map(function(target) { var cmd = 'rm -rf ' + PATH.join(self.pathTmp, target, self.pathBenchmarks); return U.exec(cmd) .fail(onFail) .then(function() { var cmd = [ 'cp', '-R', PATH.join(self.pathTmp, source, self.pathBenchmarks + '*'), PATH.join(self.pathTmp, target, self.pathBenchmarks) ].join(' '); return U.exec(cmd) .fail(onFail); }); }));