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:
Родитель
5e6550c6ca
Коммит
621f62b148
31
awsbox.js
31
awsbox.js
|
@ -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);
|
||||
|
||||
if (!error) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const
|
||||
child_process = require('child_process');
|
||||
child_process = require('child_process'),
|
||||
spawn = child_process.spawn,
|
||||
path = require('path');
|
||||
|
||||
|
@ -71,7 +71,7 @@ exports.push = function(dir, host, pr, cb) {
|
|||
cb = pr;
|
||||
pr = host;
|
||||
host = dir;
|
||||
dir = path.join(__dirname, '..', '..');
|
||||
dir = path.join(__dirname, '..', '..', '..');
|
||||
}
|
||||
|
||||
var p = spawn('git', [ 'push', 'app@' + host + ":git", 'HEAD:master' ], {
|
||||
|
|
Загрузка…
Ссылка в новой задаче