";};this.__convert=function(h,i){var g=[].join("");g+="'use strict';";g+="var _=_||{};";g+="var _out='';_out+='";if(i!==false){g+=h.replace(/\\/g,"\\\\").replace(/[\r\t\n]/g," ").replace(/'(?=[^%]*%>)/g,"\t").split("'").join("\\'").split("\t").join("'").replace(/<%=(.+?)%>/g,"';_out+=$1;_out+='").split("<%").join("';").split("%>").join("_out+='")+"';return _out;";return g;}g+=h.replace(/\\/g,"\\\\").replace(/[\r]/g,"\\r").replace(/[\t]/g,"\\t").replace(/[\n]/g,"\\n").replace(/'(?=[^%]*%>)/g,"\t").split("'").join("\\'").split("\t").join("'").replace(/<%=(.+?)%>/g,"';_out+=$1;_out+='").split("<%").join("';").split("%>").join("_out+='")+"';return _out.replace(/[\\r\\n]\\s+[\\r\\n]/g, '\\r\\n');";return g;};this.parse=function(h,g){var i=this;if(!g||g.loose!==false){h=this.__lexicalAnalyze(h)+h;}h=this.__removeShell(h,g);h=this.__toNative(h,g);this._render=new Function("_, _method",h);this.render=function(k,j){if(!j||j!==f.options._method){j=a(j,f.options._method);}return i._render.call(this,k,j);};return this;};};c.compile=function(g,f){if(!f||f!==this.options){f=a(f,this.options);}try{var h=this.__cache[g]?this.__cache[g]:new this.template(this.options).parse(g,f);if(!f||f.cache!==false){this.__cache[g]=h;}return h;}catch(i){b("Juicer Compile Exception: "+i.message);return{render:function(){}};}};c.to_html=function(f,g,e){if(!e||e!==this.options){e=a(e,this.options);}return this.compile(f,e).render(g,e._method);};typeof(module)!=="undefined"&&module.exports?module.exports=c:this.juicer=c;})();
--------------------------------------------------------------------------------
/app/views/error.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Lor Framework - Error page
8 |
9 |
10 |
11 |
12 |
13 | Error
14 |
15 | {{msg}}
16 |
17 |
18 |
--------------------------------------------------------------------------------
/app/views/login.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Lor Framework - Login
8 |
9 |
10 |
11 |
12 |
13 | Login
14 |
15 |
20 | account: test/test or sumory/1
21 |
22 |
23 |
--------------------------------------------------------------------------------
/app/views/todo.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Lor Framework - Todo Example
7 |
8 |
9 |
10 |
11 |
12 |
13 |
36 |
59 |
64 |
65 |
66 |
78 |
79 |
94 |
95 |
96 |
97 |
98 |
99 |
102 |
103 |
104 |
--------------------------------------------------------------------------------
/app/views/welcome.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Lor Framework - Todo Example
4 |
5 |
6 |
7 |
8 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/conf/mime.types:
--------------------------------------------------------------------------------
1 |
2 | types {
3 | text/html html htm shtml;
4 | text/css css;
5 | text/xml xml;
6 | image/gif gif;
7 | image/jpeg jpeg jpg;
8 | application/javascript js;
9 | application/atom+xml atom;
10 | application/rss+xml rss;
11 |
12 | text/mathml mml;
13 | text/plain txt;
14 | text/vnd.sun.j2me.app-descriptor jad;
15 | text/vnd.wap.wml wml;
16 | text/x-component htc;
17 |
18 | image/png png;
19 | image/tiff tif tiff;
20 | image/vnd.wap.wbmp wbmp;
21 | image/x-icon ico;
22 | image/x-jng jng;
23 | image/x-ms-bmp bmp;
24 | image/svg+xml svg svgz;
25 | image/webp webp;
26 |
27 | application/font-woff woff;
28 | application/java-archive jar war ear;
29 | application/json json;
30 | application/mac-binhex40 hqx;
31 | application/msword doc;
32 | application/pdf pdf;
33 | application/postscript ps eps ai;
34 | application/rtf rtf;
35 | application/vnd.apple.mpegurl m3u8;
36 | application/vnd.ms-excel xls;
37 | application/vnd.ms-fontobject eot;
38 | application/vnd.ms-powerpoint ppt;
39 | application/vnd.wap.wmlc wmlc;
40 | application/vnd.google-earth.kml+xml kml;
41 | application/vnd.google-earth.kmz kmz;
42 | application/x-7z-compressed 7z;
43 | application/x-cocoa cco;
44 | application/x-java-archive-diff jardiff;
45 | application/x-java-jnlp-file jnlp;
46 | application/x-makeself run;
47 | application/x-perl pl pm;
48 | application/x-pilot prc pdb;
49 | application/x-rar-compressed rar;
50 | application/x-redhat-package-manager rpm;
51 | application/x-sea sea;
52 | application/x-shockwave-flash swf;
53 | application/x-stuffit sit;
54 | application/x-tcl tcl tk;
55 | application/x-x509-ca-cert der pem crt;
56 | application/x-xpinstall xpi;
57 | application/xhtml+xml xhtml;
58 | application/xspf+xml xspf;
59 | application/zip zip;
60 |
61 | application/octet-stream bin exe dll;
62 | application/octet-stream deb;
63 | application/octet-stream dmg;
64 | application/octet-stream iso img;
65 | application/octet-stream msi msp msm;
66 |
67 | application/vnd.openxmlformats-officedocument.wordprocessingml.document docx;
68 | application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx;
69 | application/vnd.openxmlformats-officedocument.presentationml.presentation pptx;
70 |
71 | audio/midi mid midi kar;
72 | audio/mpeg mp3;
73 | audio/ogg ogg;
74 | audio/x-m4a m4a;
75 | audio/x-realaudio ra;
76 |
77 | video/3gpp 3gpp 3gp;
78 | video/mp2t ts;
79 | video/mp4 mp4;
80 | video/mpeg mpeg mpg;
81 | video/quicktime mov;
82 | video/webm webm;
83 | video/x-flv flv;
84 | video/x-m4v m4v;
85 | video/x-mng mng;
86 | video/x-ms-asf asx asf;
87 | video/x-ms-wmv wmv;
88 | video/x-msvideo avi;
89 | }
90 |
--------------------------------------------------------------------------------
/conf/nginx-dev.conf:
--------------------------------------------------------------------------------
1 | pid tmp/nginx.pid;
2 |
3 | worker_processes 4;
4 |
5 | events {
6 | worker_connections 4096;
7 | }
8 |
9 | http {
10 | sendfile on;
11 | include ./mime.types;
12 |
13 | # lor initialization
14 | lua_package_path "./app/?.lua;./?.lua;/usr/local/lor/?.lua;;";
15 | lua_code_cache on;
16 |
17 | server {
18 | listen 9999;
19 | set $template_root '';
20 |
21 | location /s {
22 | content_by_lua_file ./app/test.lua;
23 | }
24 |
25 | location /static {
26 | alias ./app/static; #app/static;
27 | }
28 |
29 | access_log logs/dev-access.log;
30 | error_log logs/dev-error.log;
31 |
32 | location / {
33 | content_by_lua_file ./app/main.lua;
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/reload.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | #####################################################################
4 | # usage:
5 | # sh reload.sh -- reload application @dev
6 | # sh reload.sh ${env} -- reload application @${env}
7 |
8 | # examples:
9 | # sh reload.sh prod -- use conf/nginx-prod.conf to reload OpenResty
10 | # sh reload.sh -- use conf/nginx-dev.conf to reload OpenRest
11 | #####################################################################
12 |
13 | if [ -n "$1" ];then
14 | PROFILE="$1"
15 | else
16 | PROFILE=dev
17 | fi
18 |
19 | mkdir -p logs & mkdir -p tmp
20 | echo "Use profile: "${PROFILE}
21 | nginx -s reload -p `pwd`/ -c conf/nginx-${PROFILE}.conf
22 |
--------------------------------------------------------------------------------
/start.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | #####################################################################
4 | # usage:
5 | # sh start.sh -- start application @dev
6 | # sh start.sh ${env} -- start application @${env}
7 |
8 | # examples:
9 | # sh start.sh prod -- use conf/nginx-prod.conf to start OpenResty
10 | # sh start.sh -- use conf/nginx-dev.conf to start OpenRest
11 | #####################################################################
12 |
13 | if [ -n "$1" ];then
14 | PROFILE="$1"
15 | else
16 | PROFILE=dev
17 | fi
18 |
19 | mkdir -p logs & mkdir -p tmp
20 | echo "Use profile: "${PROFILE}
21 | nginx -p `pwd`/ -c conf/nginx-${PROFILE}.conf
22 |
--------------------------------------------------------------------------------
/stop.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | #####################################################################
4 | # usage:
5 | # sh stop.sh -- stop application @dev
6 | # sh stop.sh ${env} -- stop application @${env}
7 |
8 | # examples:
9 | # sh stop.sh prod -- use conf/nginx-prod.conf to stop OpenResty
10 | # sh stop.sh -- use conf/nginx-dev.conf to stop OpenRest
11 | #####################################################################
12 |
13 | if [ -n "$1" ];then
14 | PROFILE="$1"
15 | else
16 | PROFILE=dev
17 | fi
18 |
19 | mkdir -p logs & mkdir -p tmp
20 | echo "Use profile: "${PROFILE}
21 | nginx -s stop -p `pwd`/ -c conf/nginx-${PROFILE}.conf
22 |
--------------------------------------------------------------------------------