-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshipitfile.js
57 lines (51 loc) · 1.65 KB
/
shipitfile.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
54
55
56
57
module.exports = function (shipit) {
require('shipit-deploy')(shipit);
shipit.initConfig({
default: {
workspace: '/usr/local/shuttle/workspace',
deployTo: '/usr/local/shuttle/deploy',
repositoryUrl: process.env.REPOPATH,
ignores: ['.git', 'node_modules'],
rsync: ['--del'],
keepReleases: 3,
key: process.env.KEYPATH,
shallowClone: true
},
production: {
branch: 'master',
servers: '[email protected]'
}
});
shipit.on('fetched', function() {
shipit.start('build');
});
shipit.blTask('build', function (cb) {
shipit.local('mkdir dist/', {cwd: shipit.config.workspace})
.then(function(res) {
return shipit.local('npm install', {cwd: shipit.config.workspace});
})
.then(function(res) {
return shipit.local('npm run productiondist', {cwd: shipit.config.workspace});
})
.then(function(res) {
cb();
});
});
shipit.blTask('remotebuild', function (cb) {
var cmd = 'source ~/.profile; cd ' + shipit.releasePath + '; cp shuttle-init.sh /etc/init.d/shuttle;' +
' /usr/local/node-v6.9.1-linux-x64/bin/npm --production' +
shipit.remote(cmd)
.then(function(res) {
return shipit.remote('update-rc.d shuttle defaults && service shuttle restart');
})
.then(function(res) {
cb();
});
});
shipit.on('cleaned', function() {
shipit.start('remotebuild');
});
};