chore(server, minify, ischanged) add " "

This commit is contained in:
coderaiser 2013-08-09 12:55:55 +00:00
parent de42e83fbf
commit 8a02b1cd69
3 changed files with 19 additions and 20 deletions

View file

@ -1,4 +1,4 @@
(function(){
(function() {
'use strict';
if(!global.cloudcmd)
@ -30,7 +30,7 @@
Server, Rest, Route, Minimize;
/* базовая инициализация */
function init(pAppCachProcessing){
function init(pAppCachProcessing) {
var lConfig = main.config,
lMinifyAllowed = lConfig.minification;
@ -74,12 +74,12 @@
lConfig.ip ||
(main.WIN32 ? '127.0.0.1' : '0.0.0.0'),
lSSL = pProcessing.ssl,
lSSL = pProcessing.ssl,
lSSLPort = lConfig.sslPort,
lHTTP = 'http://',
lHTTPS = 'https://',
lSockets = function(pServer){
lSockets = function(pServer) {
var lListen;
if(lConfig.socket && Socket)
lListen = Socket.listen(pServer);
@ -87,7 +87,7 @@
Util.log('* Sockets ' + (lListen ? 'running' : 'disabled'));
},
lHTTPServer = function(){
lHTTPServer = function() {
Server = http.createServer( controller );
Server.on('error', function (pError) {
Util.log(pError);
@ -97,15 +97,15 @@
lSockets(Server);
},
lServerLog = function(pHTTP, pPort){
lServerLog = function(pHTTP, pPort) {
Util.log('* Server running at ' + pHTTP + lIP + ':' + pPort);
};
/* server mode or testing mode */
if (lConfig.server) {
if(lSSL){
if(lSSL) {
Util.log('* Redirection http -> https is setted up');
lServerLog(lHTTP, lPort);
var lRedirectServer = http.createServer( function(pReq, pRes){
var lRedirectServer = http.createServer( function(pReq, pRes) {
var lHost = pReq.headers.host;
main.redirect({
@ -143,8 +143,7 @@
* @param req - запрос клиента (Request)
* @param res - ответ сервера (Response)
*/
function controller(pReq, pRes)
{
function controller(pReq, pRes) {
/* Читаем содержимое папки, переданное в url */
var lRet, lName, lMin, lExt, lResult,
lConfig = main.config,
@ -169,7 +168,7 @@
if( !lRet && Route)
lRet = Util.exec(Route, lData);
if(!lRet){
if(!lRet) {
/* добавляем текующий каталог к пути */
lName = lData.name;
Util.log('reading ' + lName);
@ -189,7 +188,7 @@
lExt === '.html' && lMin.html;
Util.ifExec(!lResult,
function(pParams){
function(pParams) {
var lSendName = pParams && pParams.name || lName;
main.sendFile({
@ -199,7 +198,7 @@
request : pReq,
response : pRes
});
}, function(pCallBack){
}, function(pCallBack) {
Minify.optimize(lName, {
callback : pCallBack,
returnName : true