-
Notifications
You must be signed in to change notification settings - Fork 9
/
shipitfile.js
45 lines (36 loc) · 1.14 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
/*global Promise:false */
var fs = require('fs'),
project = require( __dirname + '/package.json' );
module.exports = function ( shipit ) {
shipit.initConfig({
demo: {
servers: 'deploy@demo.audiotheme.com',
deployRoot: '/usr/share/nginx/html/demo.audiotheme.com/public/wp-content/plugins/'
},
staging: {
servers: 'deploy@staging.cedaro.com',
deployRoot: '/srv/www/staging.cedaro.com/public/wp-content/plugins/'
}
});
shipit.task( 'deploy', function() {
shipit.archiveFile = project.name + '-' + project.version + '.zip';
shipit.deployPath = shipit.config.deployRoot;
return createDeploymentPath()
.then( copyProject() )
.then( unpackDeployment );
});
function createDeploymentPath() {
return shipit.remote( 'mkdir -p ' + shipit.deployPath );
}
function copyProject() {
return shipit.remoteCopy( 'dist/' + shipit.archiveFile, shipit.deployPath );
}
function unpackDeployment() {
var cmd = [];
cmd.push( 'cd ' + shipit.deployPath );
cmd.push( 'rm -rf ' + project.name );
cmd.push( 'unzip -q ' + shipit.archiveFile );
cmd.push( 'rm ' + shipit.archiveFile );
return shipit.remote( cmd.join( ' && ' ) );
}
};