Add an 'update' verb which pushes the repo to the remote server and runs a poststart local_hook. Fix a bug in the git lib that tried to push the wrong directory.

This commit is contained in:
Shane Tomlinson 2012-10-29 14:29:36 +00:00
Родитель 5e6550c6ca
Коммит 621f62b148
2 изменённых файлов: 33 добавлений и 2 удалений

Просмотреть файл

@ -364,6 +364,37 @@ verbs['list'] = function(args) {
}); });
}; };
verbs['update'] = function(args) {
if (!args || args.length != 1) {
throw 'missing required argument: name of instance';
}
var name = args[0];
validateName(name);
vm.find(name, function(err, deets) {
checkErr(err);
if (deets && deets.ipAddress) {
console.log("pushing to git repo", deets.ipAddress);
git.push(deets.ipAddress, function(line) {
console.log(line);
}, function(status) {
if (!status) {
hooks.runLocalHook('poststart', deets);
}
else {
checkErr("Could not push git instance");
}
});
}
else {
console.log(name, "is not an awsbox instance");
}
});
};
var error = (process.argv.length <= 2); var error = (process.argv.length <= 2);
if (!error) { if (!error) {

Просмотреть файл

@ -1,5 +1,5 @@
const const
child_process = require('child_process'); child_process = require('child_process'),
spawn = child_process.spawn, spawn = child_process.spawn,
path = require('path'); path = require('path');
@ -71,7 +71,7 @@ exports.push = function(dir, host, pr, cb) {
cb = pr; cb = pr;
pr = host; pr = host;
host = dir; host = dir;
dir = path.join(__dirname, '..', '..'); dir = path.join(__dirname, '..', '..', '..');
} }
var p = spawn('git', [ 'push', 'app@' + host + ":git", 'HEAD:master' ], { var p = spawn('git', [ 'push', 'app@' + host + ":git", 'HEAD:master' ], {