fixed bug with starting node from other then projects dir

This commit is contained in:
coderaiser 2012-11-28 08:34:12 -05:00
parent d3b0315ebf
commit a83830caa0
6 changed files with 41 additions and 27 deletions

View file

@ -127,6 +127,8 @@ in any position in anyLoadOnLoad function.
* Changed default ip to null so IP would be geted from
config.json only if it setted up.
* Fixed bug with starting node from other then projects dir.
2012.10.01, Version 0.1.7

View file

@ -1,8 +1,6 @@
(function(){
"use strict";
global.cloudcmd = {};
var DIR = __dirname + '/',
main = require(DIR + 'lib/server/main'),

View file

@ -23,7 +23,8 @@
global.cloudcmd = {},
/* Constants */
exports.DIR = DIR = process.cwd() + '/',
/* current dir + 2 levels up */
exports.DIR = DIR = __dirname + '/../../',
exports.LIBDIR = LIBDIR = DIR + 'lib/',
exports.SRVDIR = SRVDIR = LIBDIR + 'server/',
exports.WIN32 = isWin32();
@ -52,7 +53,7 @@
/* Needed Modules */
exports.util = Util = require(LIBDIR + 'util'),
exports.zlib = mrequire('zlib'),
exports.zlib = mrequire('zlib'),
/* Main Information */
exports.config = rootrequire('config');
@ -76,7 +77,6 @@
exports.socket = srvrequire('socket'),
exports.update = srvrequire('update'),
exports.minify = srvrequire('minify').Minify;
/*
* second initializing after all modules load, so global var is
* totally filled of all information that should know all modules

View file

@ -4,11 +4,11 @@
"use strict";
var main = global.cloudcmd.main,
SRVDIR = main.SRVDIR;
DIR = main.DIR;
exports.Minify = {
/* pathes to directories */
INDEX :'index.html',
INDEX : DIR + 'index.html',
/* приватный переключатель минимизации */
_allowed :{
css : true,
@ -62,24 +62,30 @@
* in nodester) we can not write
* minified versions
*/
this.MinFolder = '/' + lMinify.MinFolder;
this.MinFolder = lMinify.MinFolder;
var lOptimizeParams = [];
var lOptimizeParams = [],
lStyleCSS = DIR + 'css/style.css',
lResetCSS = DIR + 'css/reset.css';
if (this._allowed.js) {
lOptimizeParams.push('client.js');
lOptimizeParams.push(DIR + 'client.js');
}
if (this._allowed.html)
lOptimizeParams.push(this.INDEX);
if (this._allowed.css) {
lOptimizeParams.push({
'./css/style.css' : this._allowed.img
});
var lStyles = [];
lOptimizeParams.push({
'./css/reset.css': this._allowed.img
});
lStyles[0] = {};
lStyles[0][lStyleCSS] = this._allowed.img;
lStyles[1] = {};
lStyles[1][lResetCSS] = this._allowed.img;
lOptimizeParams.push(lStyles[0]);
lOptimizeParams.push(lStyles[1]);
lOptimizeParams.push();
}
if (lOptimizeParams.length)

View file

@ -2,13 +2,21 @@
(function(){
"use strict";
var main = global.cloudcmd.main,
mainpackage = main.mainpackage,
exec = main.child_process.exec;
exec = main.child_process.exec,
DIR = main.DIR;
exports.get = function(){
exec('git pull', pull);
var lPull = function(){
exec('git pull', pull);
};
if( process.cwd === DIR )
lPull();
else
exec('cd ' + DIR, lPull);
};
/**
@ -26,7 +34,7 @@
}
else pStdout = 'Cloud Commander is up to date.';
console.log( process.cwd() );
console.log(DIR);
if(mainpackage)
pStdout = 'Version ' + mainpackage.version + '\n' + pStdout;
}

View file

@ -56,17 +56,15 @@
Server :{},
/* КОНСТАНТЫ */
INDEX : 'index.html'
INDEX : __dirname + '/' + 'index.html'
},
DirPath = '/',
OK = 200,
DIR = process.cwd() + '/',
main = require(DIR + 'lib/server/main'),
main = global.cloudcmd.main,
DIR = main.Dir,
LIBDIR = main.LIBDIR,
SRVDIR = main.SRVDIR,
@ -402,7 +400,7 @@
* загружаем сжатый html-файл в дальнейшем
*/
CloudServer.INDEX = (CloudServer.Minify._allowed.html ?
'.' + CloudServer.Minify.MinFolder + 'index.min.html'
CloudServer.Minify.MinFolder + 'index.min.html'
: CloudServer.INDEX);
/*
@ -581,7 +579,9 @@
/* если браузер поддерживает gzip-сжатие - сжимаем данные*/
if(CloudServer.Gzip){
Zlib.gzip(lList,CloudServer.getGzipDataFunc(lHeader,CloudServer.INDEX));
var lGzipCB = CloudServer.getGzipDataFunc(lHeader, CloudServer.INDEX);
Zlib.gzip(lList, lGzipCB);
}
/* если не поддерживаеться - отсылаем данные без сжатия*/
else