-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflightplan.js
More file actions
47 lines (43 loc) · 1.25 KB
/
flightplan.js
File metadata and controls
47 lines (43 loc) · 1.25 KB
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
var plan = require('flightplan');
var webRoot = {
staging: 'path/to/staging/wordpress/theme',
production: 'path/to/staging/wordpress/theme'
};
plan.target('staging', [
{
host: 'host',
username: 'username',
password: 'password',
privateKey: 'path/to/file/key.pem',
agent: process.env.SSH_AUTH_SOCK
}
], {
webRoot: webRoot.staging
});
plan.target('production', [
{
host: 'host',
username: 'username',
password: 'password',
privateKey: 'path/to/file/key.pem',
agent: process.env.SSH_AUTH_SOCK
}
], {
webRoot: webRoot.production
});
plan.local(function (local) {
local.log('Searching for file to upload');
var filesToCopy = local.exec('git ls-files', {silent: true});
local.log('Search Complete.........');
var webRoot = plan.runtime.options.webRoot;
local.log('Uploading files to :: ' + webRoot);
local.transfer(filesToCopy, webRoot);
local.log('Uploading Complete.......');
});
plan.remote(function (remote) {
var webRoot = plan.runtime.options.webRoot;
remote.log('changing permission of all files to 644');
remote.exec('find ' + webRoot + ' -type f -exec chmod 644 {} +');
remote.log('changing permission of all folders to 755');
remote.exec('find ' + webRoot + ' -type d -exec chmod 755 {} +');
});