mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
refactor(update) pull
This commit is contained in:
parent
7d19de318c
commit
af209c0fe4
1 changed files with 23 additions and 23 deletions
|
|
@ -1,9 +1,9 @@
|
|||
/* module update cloud commander */
|
||||
|
||||
(function(){
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
if(!global.cloudcmd)
|
||||
if (!global.cloudcmd)
|
||||
return console.log(
|
||||
'# update.js' + '\n' +
|
||||
'# -----------' + '\n' +
|
||||
|
|
@ -14,9 +14,9 @@
|
|||
|
||||
var main = global.cloudcmd.main,
|
||||
mainpackage = main.mainpackage || {},
|
||||
exec = main.child_process.exec,
|
||||
exec = require('child_process').exec,
|
||||
fs = require('fs'),
|
||||
Util = main.util,
|
||||
Util = require('../util'),
|
||||
DIR = main.DIR;
|
||||
|
||||
exports.get = function() {
|
||||
|
|
@ -30,30 +30,30 @@
|
|||
|
||||
/**
|
||||
* function pulls cloud cmd content from repo
|
||||
* @param pError
|
||||
* @param pStdout
|
||||
* @param pStderr
|
||||
* @param error
|
||||
* @param stdout
|
||||
* @param stderr
|
||||
*/
|
||||
function pull(pError, pStdout, pStderr){
|
||||
var lExec, lMsg,
|
||||
lError = pError || pStderr,
|
||||
lName = mainpackage.name,
|
||||
lVersion = mainpackage.version,
|
||||
lIsUpToDate = ' is up to date.';
|
||||
function pull(error, stdout, stderr) {
|
||||
var msg,
|
||||
msgError = error || stderr,
|
||||
name = mainpackage.name,
|
||||
version = mainpackage.version,
|
||||
isUpToDate = ' is up to date.';
|
||||
|
||||
if(!pError) {
|
||||
pStderr = '';
|
||||
if (msgError) {
|
||||
Util.log(msgError);
|
||||
} else {
|
||||
stderr = '';
|
||||
|
||||
if (Util.isContainStr(pStdout, lIsUpToDate))
|
||||
lMsg = lIsUpToDate;
|
||||
if (Util.isContainStr(stdout, isUpToDate))
|
||||
msg = isUpToDate;
|
||||
else
|
||||
lMsg = ' updated, restart to use new version.';
|
||||
msg = ' updated, restart to use new version.';
|
||||
|
||||
lMsg = lName + ' v' + lVersion + lMsg;
|
||||
msg = name + ' v' + version + msg;
|
||||
|
||||
lExec = pStderr || pError || lMsg;
|
||||
Util.log(lExec);
|
||||
} else
|
||||
Util.log(lError);
|
||||
Util.log(msg);
|
||||
}
|
||||
}
|
||||
})();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue