mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
refactor(cloudcmd) mv argv parsing to bin
This commit is contained in:
parent
c42c9f8be5
commit
e2a720425c
4 changed files with 24 additions and 16 deletions
|
|
@ -12,7 +12,7 @@ before_install:
|
|||
|
||||
script:
|
||||
- gulp default
|
||||
- node cloudcmd test
|
||||
- node bin/cloudcmd test
|
||||
|
||||
notifications:
|
||||
#webhooks:
|
||||
|
|
|
|||
|
|
@ -3,9 +3,22 @@
|
|||
(function(){
|
||||
'use strict';
|
||||
|
||||
var CloudCmd = require('../cloudcmd');
|
||||
var CloudCmd = require('../cloudcmd'),
|
||||
DIR = '../lib/',
|
||||
Util = require(DIR + 'util'),
|
||||
argv = process.argv,
|
||||
length = argv.length - 1,
|
||||
argvFirst = argv[length],
|
||||
isTest = Util.isContainStr(argvFirst, 'test');
|
||||
|
||||
CloudCmd.start();
|
||||
if (isTest) {
|
||||
Util.log('Cloud Commander testing mode');
|
||||
Util.log('argv: ', argv);
|
||||
}
|
||||
|
||||
CloudCmd.start({
|
||||
isTest: isTest
|
||||
});
|
||||
|
||||
})();
|
||||
|
||||
|
|
|
|||
16
cloudcmd.js
16
cloudcmd.js
|
|
@ -42,13 +42,17 @@
|
|||
'link',
|
||||
],
|
||||
|
||||
IsTest,
|
||||
|
||||
Template = {},
|
||||
|
||||
FS = CloudFunc.FS;
|
||||
/* reinit main dir os if we on Win32 should be backslashes */
|
||||
DIR = main.DIR;
|
||||
|
||||
exports.start = function() {
|
||||
exports.start = function(params) {
|
||||
IsTest = params.isTest;
|
||||
|
||||
readConfig(init);
|
||||
win.prepareCodePage();
|
||||
};
|
||||
|
|
@ -115,21 +119,15 @@
|
|||
|
||||
|
||||
function init() {
|
||||
var params,
|
||||
argv = process.argv,
|
||||
length = argv.length - 1,
|
||||
argvFirst = argv[length],
|
||||
isTest = Util.isContainStr(argvFirst, 'test');
|
||||
var params;
|
||||
|
||||
if (update)
|
||||
update.get();
|
||||
|
||||
Util.log('server dir: ' + DIR);
|
||||
|
||||
if (isTest) {
|
||||
Util.log('argv: ', argv);
|
||||
if (IsTest)
|
||||
Config.server = false;
|
||||
}
|
||||
|
||||
if (Config.logs) {
|
||||
Util.log('log param setted up in config.json\n' +
|
||||
|
|
|
|||
|
|
@ -75,10 +75,7 @@
|
|||
ssl = options.ssl,
|
||||
sslPort = config.sslPort;
|
||||
|
||||
/* server mode or testing mode */
|
||||
if (!config.server)
|
||||
Util.log('Cloud Commander testing mode');
|
||||
else
|
||||
if (config.server)
|
||||
if (!ssl)
|
||||
createServer(port, ip, HTTP);
|
||||
else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue