-
Notifications
You must be signed in to change notification settings - Fork 5
/
worker.js
53 lines (47 loc) · 1.33 KB
/
worker.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
var async = require('async')
, _ = require('lodash')
, nuGet = require('./lib/nuget')
, msbuild = require('./lib/msbuild')
, version = require('./lib/version');
module.exports = {
init: function (config, job, context, cb) {
config = config || {};
cb(null, {
environment: function (context, done) {
var tasks = [];
tasks.push(function(next) {
msbuild.ensurePathToExecutable(context, config, next);
});
if (config.restorePackages) {
tasks.push(function(next) {
nuGet.ensureNuGet(context, next);
});
}
run(tasks, done);
},
prepare: function (context, done) {
var tasks = [];
if (config.restorePackages) {
tasks.push(function(next) {
nuGet.restorePackages(context, config, next);
});
}
if (config.patchAssemblyVersions) {
tasks.push(function(next) {
version.patchFiles(context, config, next);
});
}
tasks.push(function(next) {
msbuild.build(context, config, next);
});
run(tasks, done);
}
});
}
}
var run = function(tasks, done) {
async.series(tasks, function(err, results) {
console.log(err);
done(err, _.any(results, true));
});
}