Updating dist.js

stable
Alejandro Alonso 2015-01-30 11:46:06 +01:00
parent 7b557f7f93
commit 107e8f2ae6
1 changed files with 12 additions and 5 deletions

17
dist.js
View File

@ -7,19 +7,26 @@ var ncp = Promise.promisify(require('ncp').ncp);
var local = 'tmp'; var local = 'tmp';
var repo = 'https://github.com/taigaio/taiga-front'; var repo = 'https://github.com/taigaio/taiga-front';
var action = (function cloneOrPull(){ if (process.argv.length !== 3){
console.log("¡Error!, call me with somethink like: \nnode dist.js branch_name");
process.exit();
}
var branch = process.argv[2];
var synchRepoAction = (function cloneOrPull(){
var cloned = fs.existsSync(local); var cloned = fs.existsSync(local);
if (cloned) { if (cloned) {
action = 'cd ' + local + ' && git pull'; action = 'git checkout ' + branch + '&& cd ' + local + ' && git checkout ' + branch + ' && git pull';
} else { } else {
action = 'git clone ' + repo + ' ' + local; action = 'git checkout ' + branch + 'git clone -b ' + branch + ' ' + repo + ' ' + local;
} }
return action; return action;
}()) }())
exec(action) exec(synchRepoAction)
.then(function() { .then(function() {
//remove old tmp dist //remove old tmp dist
return delAsync(local + '/dist'); return delAsync(local + '/dist');
@ -48,6 +55,6 @@ exec(action)
}) })
.then(function() { .then(function() {
//push //push
return exec('git push origin master'); return exec('git push origin ' + branch);
}) })
.done(); .done();