rel.js
3.65 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
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
111
112
113
var config=require('config');
module.exports={
info:{
summary:"tools per rilasci in test",
state:"ok".red
},
execute:function(process,tool){
var env = "operations";
var op = process.argv[3];
var commit = process.argv[4];
if(env!=null && op!=null){
//console.log("finding server "+name.red+" on "+env.red);
var operations;
if(env==="operations") operations = this.list.operations;
for(i in operations){
if(operations[i].name===op){
switch(op){
case "ncctest":
this.releaseNccTest(commit);
break;
case "nccprod":
this.releaseNccProd(commit);
break;
case "test":
this.test();
default:
console.log("default case");
}
}
}
}
if(op==null){
console.log("\n--------------------"+"OPERAZIONI PER I RILACI".red+"----------------------------");
tool.task(this.list.operations);
}
},
/**
* [releaseNccProd crea un pacchetto di NCC utile per un pip di PRODUZIONE]
* @param {[type]} commit [commit di cui fare il pakage]
* @return {[type]} [description]
*/
releaseNccProd:function(commit){
var projectnccprod=config.get('nccprodconfig.projectdir');
var releasedirnccprod=config.get('nccprodconfig.releasedir');
console.log("rilascio on project "+projectnccprod.red+" commit "+commit.red);
console.log("********************************");
console.log("** START - CREAZIONE PACCHETTO NCC PROD per la commit: "+commit.red);
console.log("********************************");
var exec = require('child_process').exec;
var cmd = 'start exit | git-cmd sh '+mainDir+'\\scripts\\ncc_deploy_prod.sh '+projectnccprod+' '+commit+' '+releasedirnccprod;
exec(cmd, function(error, stdout, stderr) {
console.log(stdout);
console.log("****************************");
console.log("** END - CREAZIONE PACCHETTO NCC PROD per la commit: "+commit.red);
console.log("****************************");
});
},
/**
* [releaseNccTest effettua un rilascio per NCC di TEST eseguendo lo script ../scripts/ncc_deploy_test.sh]
* @param {[type]} commit [description]
* @return {[type]} [description]
*/
releaseNccTest:function(commit){
var projectnccTest=config.get('ncctestconfig.projectdir');
console.log("rilascio on project "+projectnccTest.red+" commit "+commit.red);
console.log("*******************************");
console.log("** START - RILASCIO IN TEST commit: "+commit.red+"");
console.log("*******************************");
var exec = require('child_process').exec;
var cmd = 'start exit | git-cmd sh '+mainDir+'\\scripts\\ncc_deploy_test.sh '+projectnccTest+' '+commit+'';
exec(cmd, function(error, stdout, stderr) {
console.log(stdout);
console.log("*****************************");
console.log("** END - RILASCIO IN TEST commit: "+commit.red);
console.log("*****************************");
});
},
/**
* [test description]
* @return {[type]} [description]
*/
test:function(){
var test="pippo";
console.log("rilascio on project "+test.red+" commit "+test.red);
console.log("******************************************************");
console.log(String("**** START - RILASCIO IN TEST commit: ").red+test.red);
console.log("******************************************************");
},
list:{operations:[{
name:"ncctest",
summary:"effettua il rilascio della commit <par1> in TEST (copia anche i file in ftp)",
state:"1"
},
{
name:"nccprod",
summary:"crea il pacchetto di PROD NCC per la commit <par1> e copia il pacchetto nel path condiviso",
state:"1"
},
{
name:"test",
summary:"test",
state:"1"
}
]
}
}