-
Notifications
You must be signed in to change notification settings - Fork 10
/
Options.js
110 lines (90 loc) · 2.61 KB
/
Options.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
const moment = require('moment');
const extend = require('extend');
const timestamp = moment().utc().format('YYYY-MM-DD-HH-mm-ss-SSS-UTC');
/**
* Options
* @type {Options}
*/
module.exports = class Options{
static defaultOptions() {
return {
debug: false,
// Deployment mode ('archive' or 'synchronize')
mode: 'archive',
archiveName: 'release.tar.gz',
// Archive type : 'zip' or 'tar'
archiveType: 'tar',
gzip: {
gzip: true,
gzipOptions: {
level: 5
}
},
deleteLocalArchiveAfterDeployment: true,
// SSH / SCP connection
port: 22,
host: '',
username: '',
password: '',
privateKeyFile: null,
readyTimeout: 20000,
// Folders / link
currentReleaseLink: 'www',
sharedFolder: 'shared',
releasesFolder: 'releases',
localPath: 'www',
deployPath: '',
synchronizedFolder: 'synchronized',
rsyncOptions: '',
compression: true,
// Release
releasesToKeep: '3',
tag: timestamp,
// Excluded files
exclude: [],
// Folders to share
share: {},
// Directories to create
create: [],
// File to make writable
makeWritable: [],
// Files to make executable
makeExecutable: [],
// Allow remove release on remote
// Warning !!
allowRemove: false,
// Callback
onBeforeDeploy: null,
onBeforeLink: null,
onBeforeRollback: null,
onAfterRollback: null,
onAfterDeploy: null,
}
};
/**
* Return configuration
* merge default prop
*/
constructor(appOptions) {
this.options = extend(
{},
Options.defaultOptions(),
appOptions
);
this.options = this.manageAlias(this.options);
}
get() {
return this.options;
}
/**
* Manage options alias
* @param options
*/
manageAlias(options) {
// Fix : "makeWriteable" is an alias of "makeWritable"
if (options.makeWriteable) {
options.makeWritable = options.makeWriteable;
}
return options;
}
};