From 561fd9447e940262880217e5bfe69cf098e35b76 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Mon, 9 Jul 2012 10:56:05 +0300 Subject: [PATCH 01/21] formatted installing section --- README.md | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 2e6a5f4d..42b5024d 100644 --- a/README.md +++ b/README.md @@ -28,16 +28,6 @@ Limited-mode features: - no local caching - full loading of all web page(with styles, js-scripts, html-page etc). -Installing ---------------- -**Cloud Commander** installing is very easy. All you need it's just clone -repository from github. Install and start, just 3 commands: - -git clone git://github.com/coderaiser/cloudcmd.git -cd cloudcmd -node server.js - - Hot keys: --------------- In all modern web browsers (but not in IE, becouse he special) hot keys works. @@ -48,6 +38,22 @@ There is a short list: - Alt + s - get all key bindings back - up, down, enter - filesystem navigation +Installing +--------------- +**Cloud Commander** installing is very easy. All you need it's just clone +repository from github. Install and start, just 3 commands: + + git clone git://github.com/coderaiser/cloudcmd.git + cd cloudcmd + node server.js + +Updating +--------------- +**Cloud Commander** is very buggy and alfa so it's very often updated. For update +you can just type in cloudcmd directory: + + git pull + Additional modules: --------------- **Cloud Commander** not using additional modules for main functionality. From 0780cd6e8e7b5defeedf5db2bb419893d9ce0c31 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Mon, 9 Jul 2012 04:10:09 -0400 Subject: [PATCH 02/21] minor changes --- README.md | 2 +- lib/server/minify | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 42b5024d..dcf038a0 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ Additional modules: --------------- **Cloud Commander** not using additional modules for main functionality. But for minification and optimization tricks optional can be -assingned (and installed) module: [Minify] (https://github.com/coderaiser/minify "Minify") +assingned (and installed) module: [Minify] (https://github.com/coderaiser/minify "Minify"). Install addtitional modules: diff --git a/lib/server/minify b/lib/server/minify index 9a18a323..9182145c 160000 --- a/lib/server/minify +++ b/lib/server/minify @@ -1 +1 @@ -Subproject commit 9a18a3234de35fed52ebb5d5b6211503ad774934 +Subproject commit 9182145ca9e60dd4aaf1729eb6dbc450641a80e6 From 0ca41cc923a378c4bfccfdd65c06eb8e2352d5d0 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Mon, 9 Jul 2012 13:21:09 +0300 Subject: [PATCH 03/21] add css linter recess --- test/test.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/test.sh b/test/test.sh index c0c6414b..66f739a5 100644 --- a/test/test.sh +++ b/test/test.sh @@ -1,4 +1,5 @@ #!/bin/sh +#linting js files npm i jshint -g echo "jshint server.js client.js lib/cloudfunc.js" jshint --config ./.jshintrc ./server.js ./client.js @@ -7,5 +8,9 @@ jshint --config ./.jshintrc ./lib/cloudfunc.js ./lib/server/minify/minify.js ./l echo "jshint ./package.json ./config.json" jshint --config ./.jshintrc ./package.json ./config.json npm i uglify-js clean-css html-minifier css-b64-images +#linting css files +npm i recess -g +echo "recess ./css/*.css" +recess css/*.css node server.js test ls ./min \ No newline at end of file From 0b1cd4ced8b75a3ca0659f06eb726342d170584b Mon Sep 17 00:00:00 2001 From: coderaiser Date: Mon, 9 Jul 2012 08:45:39 -0400 Subject: [PATCH 04/21] added onerror parametr to anyload, so now we can process situation when js-script(or something other) has not loaded --- README.md | 14 ++++++-- client.js | 88 ++++++++++++++++++++++++++--------------------- config.json | 4 +-- lib/server/minify | 2 +- 4 files changed, 63 insertions(+), 45 deletions(-) diff --git a/README.md b/README.md index dcf038a0..73875bab 100644 --- a/README.md +++ b/README.md @@ -56,11 +56,21 @@ you can just type in cloudcmd directory: Additional modules: --------------- -**Cloud Commander** not using additional modules for main functionality. +**Cloud Commander's Server Side** not using additional modules for main functionality. But for minification and optimization tricks optional can be assingned (and installed) module: [Minify] (https://github.com/coderaiser/minify "Minify"). Install addtitional modules: git submodule init - git submodule update \ No newline at end of file + git submodule update + +**Cloud Commander's Client Side** use module jquery for ajaxing. +We could not use this module, but this way is fast: +- google cdn +- gzip +- cache + +Perhaps in the future, it will not be used, but so far it has no effect on +start loading of Cloud Commander Client Side and do things fast and stable +it is using now. \ No newline at end of file diff --git a/client.js b/client.js index a071c62d..03ec22bf 100644 --- a/client.js +++ b/client.js @@ -133,7 +133,7 @@ CloudClient.Cache.clear=(function(){ CloudClient.keyBinding=(function(){ /* loading keyBinding module and start it */ CloudClient.jsload(CloudClient.LIBDIRCLIENT+'keyBinding.js',function(){ - CloudCommander.keyBinding(); + CloudCommander.keyBinding(); }); }); @@ -282,7 +282,6 @@ CloudClient._currentToParent = (function(pDirName){ var LoadingImage; var ErrorImage; -var $; var CloudFunc; /* Конструктор CloudClient, который * выполняет весь функционал по @@ -298,28 +297,25 @@ CloudClient.init=(function() if(lTitle.length>0)lTitle[0].textContent='Cloud Commander'; /* загружаем jquery: */ - CloudClient.jsload('//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js',function(){ - /* сохраняем переменную jQuery себе в область видимости */ - $=window.jQuery; - if(!window.jQuery)CloudClient.jsload('jquery.min.js', - function(){ - $=window.jQuery; - }); + CloudClient.jsload('//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js',{ + onerror: function(){ + CloudClient.jsload('lib/client/jquery.min.js'); + } }); /* загружаем общие функции для клиента и сервера*/ CloudClient.jsload(CloudClient.LIBDIR+'cloudfunc.js',function(){ - /* берём из обьекта window общий с сервером функционал */ - CloudFunc=window.CloudFunc; + /* берём из обьекта window общий с сервером функционал */ + CloudFunc=window.CloudFunc; - /* меняем ссылки на ajax'овые*/ - CloudClient._changeLinks(CloudFunc.LEFTPANEL); - CloudClient._changeLinks(CloudFunc.RIGHTPANEL); - - /* устанавливаем переменную доступности кэша*/ - CloudClient.Cache.isAllowed(); - /* Устанавливаем кэш корневого каталога */ - if(!CloudClient.Cache.get('/'))CloudClient.Cache.set('/',CloudClient._getJSONfromFileTable()); + /* меняем ссылки на ajax'овые*/ + CloudClient._changeLinks(CloudFunc.LEFTPANEL); + CloudClient._changeLinks(CloudFunc.RIGHTPANEL); + + /* устанавливаем переменную доступности кэша*/ + CloudClient.Cache.isAllowed(); + /* Устанавливаем кэш корневого каталога */ + if(!CloudClient.Cache.get('/'))CloudClient.Cache.set('/',CloudClient._getJSONfromFileTable()); } ); @@ -570,7 +566,9 @@ CloudClient._createFileTable = function(pElem,pJSON) * загружает файл с src. * @pName - название тэга * @pSrc - путь к файлу - * @pFunc - функци + * @pFunc - обьект, содержаий одну из функций + * или сразу две onload и onerror + * {onload: function(){}, onerror: function();} * @pStyle - стиль * @pId - id * @pElement - элемент, дочерним которо будет этот @@ -589,16 +587,24 @@ CloudClient._anyload = function(pName,pSrc,pFunc,pStyle,pId,pElement) { var element = document.createElement(pName); element.src = pSrc; - element.id=lID; + element.id=lID; if(arguments.length>=3){ - element.onload=pFunc; + /* if passed arguments function + * then it's onload by default + */ + if(typeof pFunc === 'function'){ + element.onload=pFunc; + /* if object - then onload or onerror */ + }else if (typeof pFunc === 'object'){ + if(pFunc.onload)element.onload = pFunc.onload; + if(pFunc.onerror)element.onerror=pFunc.onerror; + } if(arguments.length>=4){ element.style.cssText=pStyle; } - } - //document.body - pElement.appendChild(element); - return element;//'elem '+src+' loaded'; + } + pElement.appendChild(element); + return element; } /* если js-файл уже загружен * запускаем функцию onload @@ -683,20 +689,22 @@ CloudClient._getJSONfromFileTable=function() * можна заменить на любой другой код */ if(!document.getElementsByClassName){ - CloudClient.jsload('//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js',function(){ - /* сохраняем переменную jQuery себе в область видимости */ - document.getElementsByClassName=function(pClassName){ - return $('.'+pClassName)[0]; - }; - $=window.jQuery; - if(!window.jQuery)CloudClient.jsload('jquery.min.js', - function(){ - $=window.jQuery; - document.getElementsByClassName=function(pClassName){ - return $('.'+pClassName)[0]; - }; - }); - }); + CloudClient.jsload('//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js',{ + onload: function(){ + /* сохраняем переменную jQuery себе в область видимости */ + document.getElementsByClassName=function(pClassName){ + return window.jQuery('.'+pClassName)[0]; + }; + }, + onerror: function(){ + CloudClient.jsload(CloudClient.LIBDIRCLIENT + 'jquery.min.js', + function(){ + document.getElementsByClassName=function(pClassName){ + return window.jQuery('.'+pClassName)[0]; + }; + }); + } + }); } return CloudClient; diff --git a/config.json b/config.json index 66993965..263dbdb4 100644 --- a/config.json +++ b/config.json @@ -1,7 +1,7 @@ { - "cache" : {"allowed" : true}, + "cache" : {"allowed" : false}, "minification" : { - "js" : true, + "js" : false, "css" : true, "html" : true, "img" : true diff --git a/lib/server/minify b/lib/server/minify index 9182145c..f1b68d37 160000 --- a/lib/server/minify +++ b/lib/server/minify @@ -1 +1 @@ -Subproject commit 9182145ca9e60dd4aaf1729eb6dbc450641a80e6 +Subproject commit f1b68d371b7b26da14d0e2b6e3e5f9923c8fa0e4 From 0283a1a1db360b93524132ead75cf54aea554f9f Mon Sep 17 00:00:00 2001 From: coderaiser Date: Mon, 9 Jul 2012 08:49:59 -0400 Subject: [PATCH 05/21] added jquery file --- client.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client.js b/client.js index 03ec22bf..cadd6682 100644 --- a/client.js +++ b/client.js @@ -299,7 +299,7 @@ CloudClient.init=(function() /* загружаем jquery: */ CloudClient.jsload('//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js',{ onerror: function(){ - CloudClient.jsload('lib/client/jquery.min.js'); + CloudClient.jsload('lib/client/jquery.js'); } }); @@ -697,7 +697,7 @@ CloudClient._getJSONfromFileTable=function() }; }, onerror: function(){ - CloudClient.jsload(CloudClient.LIBDIRCLIENT + 'jquery.min.js', + CloudClient.jsload(CloudClient.LIBDIRCLIENT + 'jquery.js', function(){ document.getElementsByClassName=function(pClassName){ return window.jQuery('.'+pClassName)[0]; From 56188c377639dbf8a3d3dd59698f3124626c6b60 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Mon, 9 Jul 2012 10:16:23 -0400 Subject: [PATCH 06/21] fixed bug with processing situation when minify not loaded --- lib/server/minify | 2 +- server.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/server/minify b/lib/server/minify index f1b68d37..69756c6f 160000 --- a/lib/server/minify +++ b/lib/server/minify @@ -1 +1 @@ -Subproject commit f1b68d371b7b26da14d0e2b6e3e5f9923c8fa0e4 +Subproject commit 69756c6f1587ca1ba709f3c00b79797c08c6606b diff --git a/server.js b/server.js index dc7efa69..068d0ed2 100644 --- a/server.js +++ b/server.js @@ -157,7 +157,7 @@ CloudServer.Minify={ try{ lMinify = require(CloudServer.LIBDIRSERVER+'/minify'); }catch(pError){ - console.log('Could not minify withou minify module\n' + + return console.log('Could not minify withou minify module\n' + 'for fixing type:\n' + 'git submodule init\n' + 'git submodule update'); From dd96ddbc9aca8eb3b87ff236e8d69ec571c02c99 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Mon, 9 Jul 2012 10:50:52 -0400 Subject: [PATCH 07/21] changelog added --- config.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config.json b/config.json index 263dbdb4..66993965 100644 --- a/config.json +++ b/config.json @@ -1,7 +1,7 @@ { - "cache" : {"allowed" : false}, + "cache" : {"allowed" : true}, "minification" : { - "js" : false, + "js" : true, "css" : true, "html" : true, "img" : true diff --git a/package.json b/package.json index c3804fe5..9a2f1a0c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cloudcmd", - "version": "0.1.0", + "version": "0.1.1", "author": "coderaiser (https://github.com/coderaiser)", "description": "two-panels file manager, totally writed on js", "homepage": "http://github.com/coderaiser/cloudcmd", From 3c1839e2e710c4a3bb06b5b1a9e6bde06e82afc2 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Mon, 9 Jul 2012 10:53:52 -0400 Subject: [PATCH 08/21] changelog added --- changelog | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 changelog diff --git a/changelog b/changelog new file mode 100644 index 00000000..78a5c876 --- /dev/null +++ b/changelog @@ -0,0 +1,6 @@ +Cloud Commander v 0.1.1 + +- Added onerror parametr to anyload in Clinet Side, so now we can process situation when +js-script(or something other) has not loaded. +- Added jquery file, so from now Cloud Commander can totaly work offline. +- Added css-lint to travis ci. \ No newline at end of file From 3ef74cd55e46104aefc74918dbf84171e3e80fc0 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Mon, 9 Jul 2012 17:54:30 +0300 Subject: [PATCH 09/21] minor changes --- changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog b/changelog index 78a5c876..9d65b107 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,4 @@ -Cloud Commander v 0.1.1 +Cloud Commander v0.1.1 - Added onerror parametr to anyload in Clinet Side, so now we can process situation when js-script(or something other) has not loaded. From d52dd16230cc10c7dc299160db4268cb10cb699e Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 10 Jul 2012 04:18:27 -0400 Subject: [PATCH 10/21] added starting information --- README.md | 24 ++++++++++++++++++++---- changelog | 6 ------ 2 files changed, 20 insertions(+), 10 deletions(-) delete mode 100644 changelog diff --git a/README.md b/README.md index 73875bab..9e7b0917 100644 --- a/README.md +++ b/README.md @@ -43,10 +43,19 @@ Installing **Cloud Commander** installing is very easy. All you need it's just clone repository from github. Install and start, just 3 commands: - git clone git://github.com/coderaiser/cloudcmd.git - cd cloudcmd - node server.js + git clone git://github.com/coderaiser/cloudcmd.git --recursive +Starting +--------------- +To **Cloud Commander** only one command neaded: + node server.js +After thet Cloud Commander reads config file **config.json** and start server +on 31337 port, if none of port varibles(*cloud9*, *cloudfoundry* and *nodester*) +isn't exist. +Then type in browser + http://127.0.0.1:31337 +or + http://localhost:31337 Updating --------------- **Cloud Commander** is very buggy and alfa so it's very often updated. For update @@ -73,4 +82,11 @@ We could not use this module, but this way is fast: Perhaps in the future, it will not be used, but so far it has no effect on start loading of Cloud Commander Client Side and do things fast and stable -it is using now. \ No newline at end of file +it is using now. + +Contributing +--------------- +If you would like to contribute - send pull request to dev branch. +Getting dev version of **Cloud Commander**: + git clone cloudcmd --recursive + git checkout dev \ No newline at end of file diff --git a/changelog b/changelog deleted file mode 100644 index 9d65b107..00000000 --- a/changelog +++ /dev/null @@ -1,6 +0,0 @@ -Cloud Commander v0.1.1 - -- Added onerror parametr to anyload in Clinet Side, so now we can process situation when -js-script(or something other) has not loaded. -- Added jquery file, so from now Cloud Commander can totaly work offline. -- Added css-lint to travis ci. \ No newline at end of file From 09efbd02d2766e9db89ad93b8468567b7d42fcf7 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 10 Jul 2012 04:19:01 -0400 Subject: [PATCH 11/21] added starting information --- changeLog | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 changeLog diff --git a/changeLog b/changeLog new file mode 100644 index 00000000..9d65b107 --- /dev/null +++ b/changeLog @@ -0,0 +1,6 @@ +Cloud Commander v0.1.1 + +- Added onerror parametr to anyload in Clinet Side, so now we can process situation when +js-script(or something other) has not loaded. +- Added jquery file, so from now Cloud Commander can totaly work offline. +- Added css-lint to travis ci. \ No newline at end of file From 0e6875c55a5e567fb5eb392d5a3bdc471428330e Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 10 Jul 2012 11:20:43 +0300 Subject: [PATCH 12/21] minor changes --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9e7b0917..b20f5ee9 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ repository from github. Install and start, just 3 commands: Starting --------------- -To **Cloud Commander** only one command neaded: +To start **Cloud Commander** only one command neaded: node server.js After thet Cloud Commander reads config file **config.json** and start server on 31337 port, if none of port varibles(*cloud9*, *cloudfoundry* and *nodester*) From 62a517e4582ad59c0fc2cfc68291954f1abd5d89 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 10 Jul 2012 11:21:29 +0300 Subject: [PATCH 13/21] minor changes --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b20f5ee9..8ed79097 100644 --- a/README.md +++ b/README.md @@ -86,7 +86,8 @@ it is using now. Contributing --------------- -If you would like to contribute - send pull request to dev branch. +If you would like to contribute - send pull request to dev branch Getting dev version of **Cloud Commander**: + git clone cloudcmd --recursive git checkout dev \ No newline at end of file From 33e8562641f3ff0411a1b94c93abfddabf084cff Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 10 Jul 2012 11:28:55 +0300 Subject: [PATCH 14/21] minor changes --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8ed79097..49b19bb8 100644 --- a/README.md +++ b/README.md @@ -86,7 +86,7 @@ it is using now. Contributing --------------- -If you would like to contribute - send pull request to dev branch +If you would like to contribute - send pull request to dev branch. Getting dev version of **Cloud Commander**: git clone cloudcmd --recursive From 25a076b7ea54c843da5e768f375898eba5428670 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 10 Jul 2012 04:45:50 -0400 Subject: [PATCH 15/21] fixed bug in object Minify, doit function, more processing function did not return final_code so changes was not saving, and clien side loaded keyBinding.js and cloudfunc.js full sized versions --- lib/server/minify | 2 +- server.js | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/server/minify b/lib/server/minify index 69756c6f..e3dc2e6f 160000 --- a/lib/server/minify +++ b/lib/server/minify @@ -1 +1 @@ -Subproject commit 69756c6f1587ca1ba709f3c00b79797c08c6606b +Subproject commit e3dc2e6f085172e5fea02cb767994a145219723c diff --git a/server.js b/server.js index 068d0ed2..10aa1d76 100644 --- a/server.js +++ b/server.js @@ -163,7 +163,7 @@ CloudServer.Minify={ 'git submodule update'); } this.MinFolder = '/' + lMinify.MinFolder; - + var lMinFolder=this.MinFolder; this.done.js=this._allowed.js? lMinify.jsScripts(['client.js', 'lib/cloudfunc.js', @@ -187,8 +187,9 @@ CloudServer.Minify={ (pFinalCode = pFinalCode .replace('cloudfunc.js','cloudfunc.min.js') .replace('keyBinding.js','keyBinding.min.js') - .replace('/lib/', this.MinFolder) - .replace('/lib/client/', this.MinFolder)).length); + .replace('/lib/', lMinFolder) + .replace('/lib/client/', lMinFolder)).length); + return pFinalCode; }}) :false; From a2694bbe5fb8f032debe269994ab993ebdf94f28 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 10 Jul 2012 04:47:43 -0400 Subject: [PATCH 16/21] fixed bug in object Minify, doit function, more processing function did not return final_code so changes was not saving, and clien side loaded keyBinding.js and cloudfunc.js full sized versions --- changeLog | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/changeLog b/changeLog index 9d65b107..4fc0c1f7 100644 --- a/changeLog +++ b/changeLog @@ -3,4 +3,7 @@ Cloud Commander v0.1.1 - Added onerror parametr to anyload in Clinet Side, so now we can process situation when js-script(or something other) has not loaded. - Added jquery file, so from now Cloud Commander can totaly work offline. -- Added css-lint to travis ci. \ No newline at end of file +- Added css-lint to travis ci. +- fixed bug in object Minify, doit function, more processing function did not +return final_code so changes was not saving, and clien side loaded keyBinding.js +and cloudfunc.js full sized versions. \ No newline at end of file From fd0001eaa04675141c39811a7381d78a4f92c523 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 10 Jul 2012 11:49:49 +0300 Subject: [PATCH 17/21] minor changes --- changeLog | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/changeLog b/changeLog index 4fc0c1f7..c44d46ce 100644 --- a/changeLog +++ b/changeLog @@ -1,9 +1,12 @@ -Cloud Commander v0.1.1 +Version 0.1.1 -- Added onerror parametr to anyload in Clinet Side, so now we can process situation when +* Added onerror parametr to anyload in Clinet Side, so now we can process situation when js-script(or something other) has not loaded. -- Added jquery file, so from now Cloud Commander can totaly work offline. -- Added css-lint to travis ci. -- fixed bug in object Minify, doit function, more processing function did not + +* Added jquery file, so from now Cloud Commander can totaly work offline. + +* Added css-lint to travis ci. + +* Fixed bug in object Minify, doit function, more processing function did not return final_code so changes was not saving, and clien side loaded keyBinding.js and cloudfunc.js full sized versions. \ No newline at end of file From 53181018db408e4a8c1c77180f5e077d6a32f4ba Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 10 Jul 2012 04:50:22 -0400 Subject: [PATCH 18/21] changed name of ChangeLog --- changeLog => ChangeLog | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename changeLog => ChangeLog (100%) diff --git a/changeLog b/ChangeLog similarity index 100% rename from changeLog rename to ChangeLog From ac8f9f20c6dc4ea9a74357965f30c4d1e608d9ec Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 10 Jul 2012 07:36:08 -0400 Subject: [PATCH 19/21] Changed the way Minify post-processing js-files so, from now in Minify object post-processing functions passed like this {client.js: function(){}} --- ChangeLog | 5 ++++- lib/server/minify | 2 +- server.js | 21 ++++++++++----------- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index c44d46ce..8af8c533 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,4 +9,7 @@ js-script(or something other) has not loaded. * Fixed bug in object Minify, doit function, more processing function did not return final_code so changes was not saving, and clien side loaded keyBinding.js -and cloudfunc.js full sized versions. \ No newline at end of file +and cloudfunc.js full sized versions. + +* Changed the way Minify post-processing js-files so, from now in Minify object +post-processing functions passed like this {'client.js': function(){}} \ No newline at end of file diff --git a/lib/server/minify b/lib/server/minify index e3dc2e6f..080b6e74 160000 --- a/lib/server/minify +++ b/lib/server/minify @@ -1 +1 @@ -Subproject commit e3dc2e6f085172e5fea02cb767994a145219723c +Subproject commit 080b6e746f773649fd06aa113a2298fa285478c3 diff --git a/server.js b/server.js index 10aa1d76..b3261a4e 100644 --- a/server.js +++ b/server.js @@ -162,23 +162,22 @@ CloudServer.Minify={ 'git submodule init\n' + 'git submodule update'); } + /* + * temporary changed dir path, + * becouse directory lib is write + * protected by others by default + * so if node process is started + * from other user (root for example + * in nodester) we can not write + * minified versions + */ this.MinFolder = '/' + lMinify.MinFolder; var lMinFolder=this.MinFolder; this.done.js=this._allowed.js? lMinify.jsScripts(['client.js', 'lib/cloudfunc.js', 'lib/client/keyBinding.js'], - {Name: 'client.js', - /* - * temporary changed dir path, - * becouse directory lib is write - * protected by others by default - * so if node process is started - * from other user (root for example - * in nodester) we can not write - * minified versions - */ - Func: function(pFinalCode){ + {'client.js' : function(pFinalCode){ console.log('file name of ' + 'cloudfunc.js' + ' in ' + From a12695512436fd246d09427b02dcc4ab39b13574 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 10 Jul 2012 09:07:02 -0400 Subject: [PATCH 20/21] Added ability to read file data from Minify Cache, without writing to disk --- ChangeLog | 4 +++- lib/server/minify | 2 +- server.js | 58 +++++++++++++++++++++++++++++++++++------------ 3 files changed, 48 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8af8c533..7050e4eb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,4 +12,6 @@ return final_code so changes was not saving, and clien side loaded keyBinding.js and cloudfunc.js full sized versions. * Changed the way Minify post-processing js-files so, from now in Minify object -post-processing functions passed like this {'client.js': function(){}} \ No newline at end of file +post-processing functions passed like this {'client.js': function(){}} + +* Added ability to read file data from Minify Cache, without writing to disk \ No newline at end of file diff --git a/lib/server/minify b/lib/server/minify index 080b6e74..04d536b9 160000 --- a/lib/server/minify +++ b/lib/server/minify @@ -1 +1 @@ -Subproject commit 080b6e746f773649fd06aa113a2298fa285478c3 +Subproject commit 04d536b9941088ef25294a03e0ca75047dd30131 diff --git a/server.js b/server.js index b3261a4e..e474bde6 100644 --- a/server.js +++ b/server.js @@ -189,7 +189,7 @@ CloudServer.Minify={ .replace('/lib/', lMinFolder) .replace('/lib/client/', lMinFolder)).length); return pFinalCode; - }}) + }},true) :false; this.done.html=this._allowed.html? @@ -198,14 +198,17 @@ CloudServer.Minify={ this.done.css=this._allowed.css? lMinify.cssStyles([CloudServer.CSSDIR + '/style.css', CloudServer.CSSDIR + '/reset.css'], - this._allowed.img):false; + this._allowed.img):false; + + this.Cache = lMinify.Cache; } }), /* свойство показывающее случилась ли ошибка*/ done:{js: false,css: false, html:false}, /* minification folder name */ - MinFolder:'' + MinFolder :'', + Cache :{} }; @@ -276,7 +279,7 @@ CloudServer.init=(function(){ */ CloudServer.Minify.setAllowed(CloudServer.Config.minification); /* Если нужно минимизируем скрипты */ - CloudServer.Minify.doit(); + CloudServer.Minify.doit(); }); @@ -435,18 +438,43 @@ CloudServer._controller=function(pReq, pRes) * не сжатый - в обратном случае */ var lFileData=CloudServer.Cache.get(CloudServer.Gzip?(lName+'_gzip'):lName); - + console.log(Path.basename(lName)); + + var lMinify=CloudServer.Minify; + + /* object thet contains information + * about the source of file data + */ + var lFromCache_o={'cache': true}; + + /* if cache is empty and Cache allowed and Minify_allowed + * and in Minifys cache is files, so save it to + * CloudServer cache + */ + if(!lFileData && + lMinify._allowed){ + console.log('trying to read data from Minify.Cache'); + lFromCache_o.cache=false; + lFileData = CloudServer.Minify.Cache[ + Path.basename(lName)]; + } var lReadFileFunc_f=CloudServer.getReadFileFunc(lName); /* если там что-то есть передаём данные в функцию * readFile */ - if(lFileData){ - console.log('readed from cache'); + if(lFileData){ + /* if file readed not from cache - he readed from minified cache */ + if(lFromCache_o.cache===false) + lFromCache_o.minify=true; + else + lFromCache_o.minify=false; + + console.log(lName + ' readed from cache'); /* передаём данные с кэша, * если gzip включен - сжатые * в обратном случае - несжатые */ - lReadFileFunc_f(undefined,lFileData,true); + lReadFileFunc_f(undefined,lFileData,lFromCache_o); } else Fs.readFile(lName,lReadFileFunc_f); @@ -674,11 +702,13 @@ CloudServer._readDir=function (pError, pFiles) */ CloudServer.getReadFileFunc = function(pName){ /* - * @pError - ошибка - * @pData - данные - * @pFromFile - прочитано с файла bool + * @pError - ошибка + * @pData - данные + * @pFromCache_o - прочитано с файла, + * или из одного из кешей + * Пример {cache: false, minify: true} */ - var lReadFile=function(pError,pData,pFromCache_b){ + var lReadFile=function(pError, pData, pFromCache_o){ if (!pError){ console.log('file ' + pName + ' readed'); @@ -686,7 +716,7 @@ CloudServer.getReadFileFunc = function(pName){ * если их нет в кэше - * сохраняем */ - if(!pFromCache_b && CloudServer.Cache.isAllowed) + if(pFromCache_o && !pFromCache_o.cache && CloudServer.Cache.isAllowed) CloudServer.Cache.set(pName,pData); /* если кэш есть * сохраняем его в переменную @@ -697,7 +727,7 @@ CloudServer.getReadFileFunc = function(pName){ var lHeader=CloudServer.generateHeaders(pName,CloudServer.Gzip); /* если браузер поддерживает gzip-сжатие - сжимаем данные*/ - if(CloudServer.Gzip &&!pFromCache_b){ + if( CloudServer.Gzip && !(pFromCache_o && pFromCache_o.cache) ){ /* сжимаем содержимое */ Zlib.gzip(pData,CloudServer.getGzipDataFunc(lHeader,pName)); } From 809d61e2c9958460deb37942f2bd31a96431779e Mon Sep 17 00:00:00 2001 From: coderaiser Date: Wed, 11 Jul 2012 04:07:04 -0400 Subject: [PATCH 21/21] Changed the passing MoreProcessing agrument to jsScripts function Minify module, no it passes with a file name, and js file name writing only once. --- ChangeLog | 5 ++++- lib/server/minify | 2 +- server.js | 40 +++++++++++++++++++++++----------------- 3 files changed, 28 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7050e4eb..0f2a8f47 100644 --- a/ChangeLog +++ b/ChangeLog @@ -14,4 +14,7 @@ and cloudfunc.js full sized versions. * Changed the way Minify post-processing js-files so, from now in Minify object post-processing functions passed like this {'client.js': function(){}} -* Added ability to read file data from Minify Cache, without writing to disk \ No newline at end of file +* Added ability to read file data from Minify Cache, without writing to disk + +* Changed the passing MoreProcessing agrument to jsScripts function Minify module, +no it passes with a file name, and js file name writing only once. \ No newline at end of file diff --git a/lib/server/minify b/lib/server/minify index 04d536b9..cc198d1d 160000 --- a/lib/server/minify +++ b/lib/server/minify @@ -1 +1 @@ -Subproject commit 04d536b9941088ef25294a03e0ca75047dd30131 +Subproject commit cc198d1df010fb6db406383293e8234c5c6a1ede diff --git a/server.js b/server.js index e474bde6..f3c17b50 100644 --- a/server.js +++ b/server.js @@ -63,7 +63,7 @@ var CloudServer={ CSSDIR :'./css', Port :31337, /* server port */ - IP :'127.0.0.1' + IP :'127.0.0.1' }; /* @@ -173,24 +173,31 @@ CloudServer.Minify={ */ this.MinFolder = '/' + lMinify.MinFolder; var lMinFolder=this.MinFolder; + + /* post processing function for file + * client.js + */ + var lPostProcessing_f = function(pFinalCode){ + console.log('file name of ' + + 'cloudfunc.js' + + ' in ' + + 'client.js' + + ' changed. size:', + (pFinalCode = pFinalCode + .replace('cloudfunc.js','cloudfunc.min.js') + .replace('keyBinding.js','keyBinding.min.js') + .replace('/lib/', lMinFolder) + .replace('/lib/client/', lMinFolder)).length); + return pFinalCode; + }; + this.done.js=this._allowed.js? - lMinify.jsScripts(['client.js', + lMinify.jsScripts([{ + 'client.js': lPostProcessing_f}, 'lib/cloudfunc.js', 'lib/client/keyBinding.js'], - {'client.js' : function(pFinalCode){ - console.log('file name of ' + - 'cloudfunc.js' + - ' in ' + - 'client.js' + - ' changed. size:', - (pFinalCode = pFinalCode - .replace('cloudfunc.js','cloudfunc.min.js') - .replace('keyBinding.js','keyBinding.min.js') - .replace('/lib/', lMinFolder) - .replace('/lib/client/', lMinFolder)).length); - return pFinalCode; - }},true) - :false; + true) + :false; this.done.html=this._allowed.html? lMinify.html(CloudServer.INDEX):false; @@ -409,7 +416,6 @@ CloudServer._controller=function(pReq, pRes) var lNoJS_s=CloudFunc.NOJS; var lFS_s=CloudFunc.FS; - console.log(pathname); if(pathname!=='/favicon.ico') { console.log("request for " + pathname + " received...");