UNPKG

991 BJavaScriptView Raw
1const ask = require("./ask");
2const pushToGit = require("./push.js");
3const cloneOnSSh = require("./ssh.clone.js");
4
5const 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
42module.exports = deploy;
\No newline at end of file