1 | const ask = require("./ask");
|
2 | const pushToGit = require("./push.js");
|
3 | const cloneOnSSh = require("./ssh.clone.js");
|
4 |
|
5 | const deploy = {
|
6 | beforeDeploy:function () {
|
7 | return new Promise((resolve,reject)=>{
|
8 | msgs.ok("Starting the deployment process");
|
9 | ask(false,false)
|
10 | .then((answers)=>resolve(answers))
|
11 | .catch((err)=>reject(err));
|
12 | });
|
13 | },
|
14 | deploy:function (data) {
|
15 | return new Promise((resolve,reject)=>{
|
16 | pushToGit(data)
|
17 | .then(()=>cloneOnSSh(data))
|
18 | .then(()=>resolve(data))
|
19 | .catch((err)=>reject(err));
|
20 | });
|
21 | },
|
22 | afterDeploy:function (data) {
|
23 | return new Promise((resolve,reject)=>{
|
24 | ask(true,data)
|
25 | .then(()=>resolve(data))
|
26 | .catch((err)=>reject(err));
|
27 | });
|
28 | },
|
29 | run:function () {
|
30 | deploy.beforeDeploy()
|
31 | .then((data)=>deploy.deploy(data))
|
32 | .then((data)=>deploy.afterDeploy(data))
|
33 | .then((data)=>{
|
34 | msgs.ok("All Done!");
|
35 | })
|
36 | .catch((err)=>{
|
37 | msgs.err(err);
|
38 | });
|
39 | },
|
40 | };
|
41 |
|
42 | module.exports = deploy; |
\ | No newline at end of file |