Skip to content

Commit

Permalink
Created Jade engine wrapper that mimics the layout for ejs, and vario…
Browse files Browse the repository at this point in the history
…us other changes/improvements
  • Loading branch information
larzconwell committed Jun 6, 2012
1 parent 884d921 commit 6f27387
Show file tree
Hide file tree
Showing 12 changed files with 684 additions and 496 deletions.
4 changes: 3 additions & 1 deletion Makefile
Expand Up @@ -15,7 +15,7 @@
# limitations under the License. # limitations under the License.
# #


.PHONY: all build install clean uninstall .PHONY: all build install clean uninstall reinstall


PREFIX=/usr/local PREFIX=/usr/local
DESTDIR= DESTDIR=
Expand All @@ -40,3 +40,5 @@ uninstall:
@rm -f $(DESTDIR)$(PREFIX)/bin/geddy && \ @rm -f $(DESTDIR)$(PREFIX)/bin/geddy && \
rm -fr $(DESTDIR)$(PREFIX)/lib/node_modules/geddy/ && \ rm -fr $(DESTDIR)$(PREFIX)/lib/node_modules/geddy/ && \
echo 'Geddy uninstalled.' echo 'Geddy uninstalled.'

reinstall: uninstall install
5 changes: 3 additions & 2 deletions examples/todo_app_jade/app/views/todos/add.html.jade
@@ -1,3 +1,4 @@
extends layout extends ../layouts/application.html


.hero-unit= partial('_form', {params: params, todo: todo}) block content
.hero-unit= partial('_form', {params: params, todo: todo})
5 changes: 3 additions & 2 deletions examples/todo_app_jade/app/views/todos/edit.html.jade
@@ -1,3 +1,4 @@
extends layout extends ../layouts/application.html


.hero-unit= partial('_form', {params: params, todo: todo}) block content
.hero-unit= partial('_form', {params: params, todo: todo})
30 changes: 16 additions & 14 deletions examples/todo_app_jade/app/views/todos/index.html.jade
@@ -1,16 +1,18 @@
extends layout extends ../layouts/application.html


.hero-unit block content
h2 To Do List .hero-unit
a.btn.pull-right(href="/todos/add") Create a new To Do h2 To Do List
a.btn.pull-right(href="/todos/add") Create a new To Do


- if (todos && todos.length) //-Currently commented out so I can test rendering
- for (var i in todos) - if (todos && todos.length)
.row.todo-item - for (var i in todos)
.span8 .row.todo-item
h3 .span8
a(href="/todos/" + todos[i].id + "/edit")= todos[i].title h3
.span4 a(href="/todos/" + todos[i].id + "/edit")= todos[i].title
h3= .span4
i.icon-list-alt h3=
todos[i].status i.icon-list-alt
todos[i].status
13 changes: 7 additions & 6 deletions examples/todo_app_jade/app/views/todos/show.html.jade
@@ -1,7 +1,8 @@
extends layout extends ../layouts/application.html


.hero-unit block content
h3 Params .hero-unit
ul h3 Params
- for (var p in params) ul
li= p + ': ' + params[p] - for (var p in params)
li= p + ': ' + params[p]
36 changes: 22 additions & 14 deletions lib/app.js
Expand Up @@ -403,26 +403,34 @@ var App = function () {
, entry = geddy.inFlight.getEntry(id) , entry = geddy.inFlight.getEntry(id)
, req = entry.request , req = entry.request
, stat = resp.statusCode , stat = resp.statusCode
, level = parseInt(stat, 10) > 499 ? 'error' : 'access' , endTime = new Date()
, endTime = new Date(); , level = parseInt(stat, 10);

// Status code representation for logging
if(level > 499) {
level = 'error';
} else level = 'access';

// Apache extended log-format // Apache extended log-format
geddy.log[level](req.connection.remoteAddress + ' ' + geddy.log[level](req.connection.remoteAddress + ' ' +
'- ' + '- ' +
'- ' + '- ' +
'[' + new Date(entry.accessTime) + '] ' + '[' + new Date(entry.accessTime) + '] ' +
'"' + entry.method + ' ' + req.url + ' ' + '"' + entry.method + ' ' + req.url + ' ' +
req.httpVersion + '" ' + req.httpVersion + '" ' +
stat + ' ' + stat + ' ' +
(resp._length || '-') + ' ' + (resp._length || '-') + ' ' +
'"' + (req.headers['referer'] || '-') + '" ' + '"' + (req.headers['referer'] || '-') + '" ' +
'"' + (req.headers['user-agent'] || '-') + '" '); '"' + (req.headers['user-agent'] || '-') + '" ');

geddy.inFlight.removeEntry(id); geddy.inFlight.removeEntry(id);

if (geddy.config.metrics) { if (geddy.config.metrics) {
allRequestTimer.update(endTime - accessTime); allRequestTimer.update(endTime - accessTime);
controllerActionTimers[controllerName] = controllerActionTimers[controller] || {} controllerActionTimers[controllerName] = controllerActionTimers[controller] || {};
controllerActionTimers[controllerName][actionName] = controllerActionTimers[controllerName][actionName] =
controllerActionTimers[controllerName][actionName] || controllerActionTimers[controllerName][actionName] ||
geddy.metrics.Timer("Geddy."+controllerName + '.' + actionName) geddy.metrics.Timer("Geddy."+controllerName + '.' + actionName);
controllerActionTimers[controllerName][actionName].update(endTime - accessTime); controllerActionTimers[controllerName][actionName].update(endTime - accessTime);
} }
}); });
Expand Down

0 comments on commit 6f27387

Please sign in to comment.