-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgitbook-start-https.js
executable file
·83 lines (62 loc) · 2.62 KB
/
gitbook-start-https.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
var fs = require('fs');
var path = require('path');
var child = require("child_process");
function initialize(directorio) {
console.log("\n============ INSTALANDO DEPENDENCIAS GITBOOK-START-HTTPS ============")
console.log("\nEspere mientras el proceso termina ...")
var contenido='\ngulp.task("deploy-https", function () {'+
'\n\tvar iaas_bbdd = require("gitbook-start-https-alex-moi");'+
'\n\tvar url = paquete.repository.url;'+
'\n\tvar iaas_ip = paquete.iaas.IP;'+
'\n\tvar iaas_path = paquete.iaas.PATH;'+
'\n\n\tiaas_bbdd.deploy();'+
'\n});\n\n';
//añadimos la tarea
fs.writeFileSync(path.resolve(process.cwd(),'gulpfile.js'), contenido, {'flag':'a'}, function(err) {
if (err) {
return console.error(err);
}
});
fs.copyFile(path.join(process.cwd(), 'node_modules', 'gitbook-start-https-alex-moi', 'server.js'), path.join(process.cwd(), 'app.js'), function (err) {
if (err) {
return console.error(err);
}
});
fs.copyFile(path.join(process.cwd(), 'node_modules', 'gitbook-start-https-alex-moi', 'mongod'), path.join(process.cwd(), 'mongod'), function (err) {
if (err) {
return console.error(err);
}
});
fs.copyDir(path.join(process.cwd(), 'node_modules', 'gitbook-start-https-alex-moi', 'app'), path.join(process.cwd(), 'app'), function (err) {
if (err) {
return console.error(err);
}
});
fs.copyDir(path.join(process.cwd(), 'node_modules', 'gitbook-start-https-alex-moi', 'config'), path.join(process.cwd(), 'config'), function (err) {
if (err) {
return console.error(err);
}
});
fs.copyDir(path.join(process.cwd(), 'node_modules', 'gitbook-start-https-alex-moi', 'public'), path.join(process.cwd(), 'public'), function (err) {
if (err) {
return console.error(err);
}
});
fs.copyDir(path.join(process.cwd(), 'node_modules', 'gitbook-start-https-alex-moi', 'views'), path.join(process.cwd(), 'views'), function (err) {
if (err) {
return console.error(err);
}
});
};
function deploy() {
child.exec('node app.js', function(error, stdout, stderr){
if(error)
console.log(error)
console.log(stderr);
console.log(stdout);
})
};
module.exports = {
initialize,
deploy
}