feature(update) exec -> exec(cwd)

modified:   lib/server/update.js
	modified:   ChangeLog
This commit is contained in:
coderaiser 2013-07-12 15:04:18 +00:00
parent fb1dcc4acc
commit 5e145d496f
2 changed files with 16 additions and 24 deletions

View file

@ -112,6 +112,8 @@ getJSONfromFileTable.
* feauture(client) add unload event
* feature(update) exec -> exec(cwd)
2012.04.22, v0.2.0

View file

@ -13,20 +13,13 @@
'# http://coderaiser.github.com/cloudcmd' + '\n');
var main = global.cloudcmd.main,
mainpackage = main.mainpackage,
mainpackage = main.mainpackage || {},
exec = main.child_process.exec,
Util = main.util,
DIR = main.DIR;
exports.get = function(){
var lPull = function(){
exec('git pull', pull);
};
if( process.cwd === DIR )
lPull();
else
exec('cd ' + DIR, lPull);
exec('git pull', {cwd : DIR}, pull);
};
/**
@ -36,30 +29,27 @@
* @param pStderr
*/
function pull(pError, pStdout, pStderr){
var lExec, lStdout = 'Cloud Commander ';
var lExec, lStdout,
lName = mainpackage.name,
lVersion = mainpackage.version;
if(!pError) {
pStderr = '';
if (pStdout !== 'Already up-to-date.\n')
lStdout += 'updated. Restart to use new version.';
lStdout = ' updated, restart to use new version.';
else
lStdout += 'is up to date.';
lStdout = ' is up to date.';
Util.log(DIR);
lStdout = lName + ' v' + lVersion + lStdout;
if (mainpackage)
lStdout = 'Version ' + mainpackage.version + '\n' + lStdout;
lExec = {
stdout : pStdout,
stderr : pStderr || pError
};
} else
lExec = pStderr || pError || lStdout;
Util.log(lExec);
} else {
lExec = ['install git to get auto updates (works for cloned version)',
'or start cloudcmd from root of Cloud Commander dir',
'git clone http://github.com/coderaiser/cloudcmd'];
Util.logArray(lExec);
Util.logArray(lExec);
}
}
})();