Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

initial commit

  • Loading branch information...
commit f8fbde798a6e07dab7bd2a4f729cf8db21e81059 1 parent c23bd8d
@zachwe zachwe authored
Showing with 24,953 additions and 0 deletions.
  1. +37 −0 app.js
  2. +1 −0  node_modules/.bin/express
  3. +1 −0  node_modules/.bin/jade
  4. +3 −0  node_modules/ejs/.gitignore
  5. +3 −0  node_modules/ejs/.gitmodules
  6. +65 −0 node_modules/ejs/History.md
  7. +19 −0 node_modules/ejs/Makefile
  8. +142 −0 node_modules/ejs/Readme.md
  9. +14 −0 node_modules/ejs/benchmark.js
  10. +526 −0 node_modules/ejs/ejs.js
  11. +2 −0  node_modules/ejs/ejs.min.js
  12. +5 −0 node_modules/ejs/examples/client.html
  13. +7 −0 node_modules/ejs/examples/list.ejs
  14. +16 −0 node_modules/ejs/examples/list.js
  15. +2 −0  node_modules/ejs/index.js
  16. +248 −0 node_modules/ejs/lib/ejs.js
  17. +198 −0 node_modules/ejs/lib/filters.js
  18. +23 −0 node_modules/ejs/lib/utils.js
  19. +8 −0 node_modules/ejs/package.json
  20. +173 −0 node_modules/ejs/support/compile.js
  21. +3 −0  node_modules/ejs/support/expresso/.gitignore
  22. +3 −0  node_modules/ejs/support/expresso/.gitmodules
  23. +87 −0 node_modules/ejs/support/expresso/History.md
  24. +50 −0 node_modules/ejs/support/expresso/Makefile
  25. +39 −0 node_modules/ejs/support/expresso/Readme.md
  26. +775 −0 node_modules/ejs/support/expresso/bin/expresso
  27. +989 −0 node_modules/ejs/support/expresso/docs/api.html
  28. +380 −0 node_modules/ejs/support/expresso/docs/index.html
  29. +292 −0 node_modules/ejs/support/expresso/docs/index.md
  30. +3 −0  node_modules/ejs/support/expresso/docs/layout/foot.html
  31. +47 −0 node_modules/ejs/support/expresso/docs/layout/head.html
  32. +4 −0 node_modules/ejs/support/expresso/lib/bar.js
  33. +16 −0 node_modules/ejs/support/expresso/lib/foo.js
  34. +9 −0 node_modules/ejs/support/expresso/package.json
  35. +84 −0 node_modules/ejs/support/expresso/test/assert.test.js
  36. +6 −0 node_modules/ejs/support/expresso/test/async.test.js
  37. +12 −0 node_modules/ejs/support/expresso/test/bar.test.js
  38. +13 −0 node_modules/ejs/support/expresso/test/foo.test.js
  39. +76 −0 node_modules/ejs/support/expresso/test/http.test.js
  40. +245 −0 node_modules/ejs/test/ejs.test.js
  41. +7 −0 node_modules/express/.npmignore
  42. +677 −0 node_modules/express/History.md
  43. +22 −0 node_modules/express/LICENSE
  44. +35 −0 node_modules/express/Makefile
  45. +141 −0 node_modules/express/Readme.md
  46. +419 −0 node_modules/express/bin/express
  47. +2 −0  node_modules/express/index.js
  48. +79 −0 node_modules/express/lib/express.js
  49. +524 −0 node_modules/express/lib/http.js
  50. +52 −0 node_modules/express/lib/https.js
  51. +289 −0 node_modules/express/lib/request.js
  52. +424 −0 node_modules/express/lib/response.js
  53. +53 −0 node_modules/express/lib/router/collection.js
  54. +383 −0 node_modules/express/lib/router/index.js
  55. +70 −0 node_modules/express/lib/router/methods.js
  56. +85 −0 node_modules/express/lib/router/route.js
  57. +139 −0 node_modules/express/lib/utils.js
  58. +457 −0 node_modules/express/lib/view.js
  59. +40 −0 node_modules/express/lib/view/partial.js
  60. +209 −0 node_modules/express/lib/view/view.js
  61. +11 −0 node_modules/express/node_modules/connect/.npmignore
  62. +24 −0 node_modules/express/node_modules/connect/LICENSE
  63. +2 −0  node_modules/express/node_modules/connect/index.js
  64. +106 −0 node_modules/express/node_modules/connect/lib/connect.js
  65. +218 −0 node_modules/express/node_modules/connect/lib/http.js
  66. +47 −0 node_modules/express/node_modules/connect/lib/https.js
  67. +41 −0 node_modules/express/node_modules/connect/lib/index.js
  68. +93 −0 node_modules/express/node_modules/connect/lib/middleware/basicAuth.js
  69. +92 −0 node_modules/express/node_modules/connect/lib/middleware/bodyParser.js
  70. +163 −0 node_modules/express/node_modules/connect/lib/middleware/compiler.js
  71. +46 −0 node_modules/express/node_modules/connect/lib/middleware/cookieParser.js
  72. +100 −0 node_modules/express/node_modules/connect/lib/middleware/errorHandler.js
  73. +76 −0 node_modules/express/node_modules/connect/lib/middleware/favicon.js
  74. +78 −0 node_modules/express/node_modules/connect/lib/middleware/limit.js
  75. +169 −0 node_modules/express/node_modules/connect/lib/middleware/logger.js
  76. +38 −0 node_modules/express/node_modules/connect/lib/middleware/methodOverride.js
  77. +100 −0 node_modules/express/node_modules/connect/lib/middleware/profiler.js
  78. +34 −0 node_modules/express/node_modules/connect/lib/middleware/responseTime.js
  79. +379 −0 node_modules/express/node_modules/connect/lib/middleware/router.js
  80. +345 −0 node_modules/express/node_modules/connect/lib/middleware/session.js
  81. +126 −0 node_modules/express/node_modules/connect/lib/middleware/session/cookie.js
  82. +131 −0 node_modules/express/node_modules/connect/lib/middleware/session/memory.js
  83. +137 −0 node_modules/express/node_modules/connect/lib/middleware/session/session.js
  84. +59 −0 node_modules/express/node_modules/connect/lib/middleware/session/store.js
  85. +224 −0 node_modules/express/node_modules/connect/lib/middleware/static.js
  86. +44 −0 node_modules/express/node_modules/connect/lib/middleware/vhost.js
  87. +51 −0 node_modules/express/node_modules/connect/lib/patch.js
  88. +13 −0 node_modules/express/node_modules/connect/lib/public/error.html
  89. BIN  node_modules/express/node_modules/connect/lib/public/favicon.ico
  90. +61 −0 node_modules/express/node_modules/connect/lib/public/style.css
  91. +405 −0 node_modules/express/node_modules/connect/lib/utils.js
  92. +22 −0 node_modules/express/node_modules/connect/package.json
  93. +15 −0 node_modules/express/node_modules/connect/test.js
  94. +19 −0 node_modules/express/node_modules/mime/LICENSE
  95. +54 −0 node_modules/express/node_modules/mime/README.md
  96. +1 −0  node_modules/express/node_modules/mime/index.js
  97. +89 −0 node_modules/express/node_modules/mime/mime.js
  98. +1,479 −0 node_modules/express/node_modules/mime/mime.types
  99. +7 −0 node_modules/express/node_modules/mime/node.types
  100. +11 −0 node_modules/express/node_modules/mime/package.json
  101. +74 −0 node_modules/express/node_modules/mime/test.js
  102. +6 −0 node_modules/express/node_modules/qs/.gitmodules
  103. +36 −0 node_modules/express/node_modules/qs/History.md
  104. +7 −0 node_modules/express/node_modules/qs/Makefile
  105. +38 −0 node_modules/express/node_modules/qs/Readme.md
  106. +32 −0 node_modules/express/node_modules/qs/benchmark.js
  107. +39 −0 node_modules/express/node_modules/qs/examples.js
  108. +2 −0  node_modules/express/node_modules/qs/index.js
  109. +123 −0 node_modules/express/node_modules/qs/lib/querystring.js
  110. +9 −0 node_modules/express/node_modules/qs/package.json
  111. +3 −0  node_modules/express/node_modules/qs/support/expresso/.gitignore
  112. +3 −0  node_modules/express/node_modules/qs/support/expresso/.gitmodules
  113. +128 −0 node_modules/express/node_modules/qs/support/expresso/History.md
  114. +53 −0 node_modules/express/node_modules/qs/support/expresso/Makefile
  115. +61 −0 node_modules/express/node_modules/qs/support/expresso/Readme.md
  116. +856 −0 node_modules/express/node_modules/qs/support/expresso/bin/expresso
  117. +1,080 −0 node_modules/express/node_modules/qs/support/expresso/docs/api.html
  118. +377 −0 node_modules/express/node_modules/qs/support/expresso/docs/index.html
  119. +290 −0 node_modules/express/node_modules/qs/support/expresso/docs/index.md
  120. +3 −0  node_modules/express/node_modules/qs/support/expresso/docs/layout/foot.html
  121. +42 −0 node_modules/express/node_modules/qs/support/expresso/docs/layout/head.html
  122. +4 −0 node_modules/express/node_modules/qs/support/expresso/lib/bar.js
  123. +16 −0 node_modules/express/node_modules/qs/support/expresso/lib/foo.js
  124. +12 −0 node_modules/express/node_modules/qs/support/expresso/package.json
  125. +91 −0 node_modules/express/node_modules/qs/support/expresso/test/assert.test.js
  126. +12 −0 node_modules/express/node_modules/qs/support/expresso/test/async.test.js
  127. +13 −0 node_modules/express/node_modules/qs/support/expresso/test/bar.test.js
  128. +14 −0 node_modules/express/node_modules/qs/support/expresso/test/foo.test.js
  129. +146 −0 node_modules/express/node_modules/qs/support/expresso/test/http.test.js
  130. +39 −0 node_modules/express/node_modules/qs/support/expresso/test/serial/async.test.js
  131. +48 −0 node_modules/express/node_modules/qs/support/expresso/test/serial/http.test.js
  132. +3 −0  node_modules/express/node_modules/qs/support/should/.gitmodules
  133. +22 −0 node_modules/express/node_modules/qs/support/should/History.md
  134. +6 −0 node_modules/express/node_modules/qs/support/should/Makefile
  135. +248 −0 node_modules/express/node_modules/qs/support/should/Readme.md
  136. +53 −0 node_modules/express/node_modules/qs/support/should/examples/runner.js
  137. +2 −0  node_modules/express/node_modules/qs/support/should/index.js
  138. +91 −0 node_modules/express/node_modules/qs/support/should/lib/eql.js
  139. +548 −0 node_modules/express/node_modules/qs/support/should/lib/should.js
  140. +8 −0 node_modules/express/node_modules/qs/support/should/package.json
  141. +358 −0 node_modules/express/node_modules/qs/support/should/test/should.test.js
  142. +133 −0 node_modules/express/node_modules/qs/test/querystring.test.js
  143. +38 −0 node_modules/express/package.json
  144. +4 −0 node_modules/jade/.gitignore
  145. +21 −0 node_modules/jade/.gitmodules
  146. +4 −0 node_modules/jade/.npmignore
  147. +361 −0 node_modules/jade/History.md
  148. +22 −0 node_modules/jade/LICENSE
  149. +31 −0 node_modules/jade/Makefile
  150. +554 −0 node_modules/jade/Readme.md
  151. +206 −0 node_modules/jade/bin/jade
  152. +2 −0  node_modules/jade/index.js
  153. +2,397 −0 node_modules/jade/jade.js
  154. +2 −0  node_modules/jade/jade.min.js
  155. +402 −0 node_modules/jade/lib/compiler.js
  156. +19 −0 node_modules/jade/lib/doctypes.js
  157. +92 −0 node_modules/jade/lib/filters.js
  158. +1 −0  node_modules/jade/lib/index.js
  159. +316 −0 node_modules/jade/lib/jade.js
  160. +523 −0 node_modules/jade/lib/lexer.js
  161. +33 −0 node_modules/jade/lib/nodes/block-comment.js
  162. +54 −0 node_modules/jade/lib/nodes/block.js
  163. +35 −0 node_modules/jade/lib/nodes/code.js
  164. +32 −0 node_modules/jade/lib/nodes/comment.js
  165. +29 −0 node_modules/jade/lib/nodes/doctype.js
  166. +35 −0 node_modules/jade/lib/nodes/each.js
  167. +35 −0 node_modules/jade/lib/nodes/filter.js
  168. +17 −0 node_modules/jade/lib/nodes/index.js
  169. +14 −0 node_modules/jade/lib/nodes/node.js
  170. +80 −0 node_modules/jade/lib/nodes/tag.js
  171. +42 −0 node_modules/jade/lib/nodes/text.js
  172. +434 −0 node_modules/jade/lib/parser.js
  173. +18 −0 node_modules/jade/lib/self-closing.js
  174. +49 −0 node_modules/jade/lib/utils.js
  175. +19 −0 node_modules/jade/package.json
  176. +9 −0 package.json
  177. +8 −0 public/stylesheets/style.css
  178. +28 −0 views/client.js
  179. +3 −0  views/design.txt
  180. +12 −0 views/index.ejs
View
37 app.js
@@ -0,0 +1,37 @@
+var ejs = require('ejs');
+/**
+ * Module dependencies.
+ */
+
+var express = require('express');
+
+var app = module.exports = express.createServer();
+
+// Configuration
+
+app.configure(function(){
+ app.set('views', __dirname + '/views');
+ app.use(express.bodyParser());
+ app.use(express.methodOverride());
+ app.use(app.router);
+ app.use(express.static(__dirname + '/public'));
+});
+app.set('view engine', 'ejs');
+app.set('view options', {layout: false});
+
+app.configure('development', function(){
+ app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
+});
+
+app.configure('production', function(){
+ app.use(express.errorHandler());
+});
+
+// Routes
+
+app.get('/', function(req, res){
+ res.render('index');
+});
+
+app.listen(3000);
+console.log("Express server listening on port %d", app.address().port);
View
1  node_modules/.bin/express
View
1  node_modules/.bin/jade
View
3  node_modules/ejs/.gitignore
@@ -0,0 +1,3 @@
+# ignore any vim files:
+*.sw[a-z]
+vim/.netrwhist
View
3  node_modules/ejs/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "support/expresso"]
+ path = support/expresso
+ url = http://github.com/visionmedia/expresso.git
View
65 node_modules/ejs/History.md
@@ -0,0 +1,65 @@
+
+0.4.2 / 2011-05-11
+==================
+
+ * Added client side support
+
+0.4.1 / 2011-04-21
+==================
+
+ * Fixed error context
+
+0.4.0 / 2011-04-21
+==================
+
+ * Added; ported jade's error reporting to ejs. [slaskis]
+
+0.3.1 / 2011-02-23
+==================
+
+ * Fixed optional `compile()` options
+
+0.3.0 / 2011-02-14
+==================
+
+ * Added 'json' filter [Yuriy Bogdanov]
+ * Use exported version of parse function to allow monkey-patching [Anatoliy Chakkaev]
+
+0.2.1 / 2010-10-07
+==================
+
+ * Added filter support
+ * Fixed _cache_ option. ~4x performance increase
+
+0.2.0 / 2010-08-05
+==================
+
+ * Added support for global tag config
+ * Added custom tag support. Closes #5
+ * Fixed whitespace bug. Closes #4
+
+0.1.0 / 2010-08-04
+==================
+
+ * Faster implementation [ashleydev]
+
+0.0.4 / 2010-08-02
+==================
+
+ * Fixed single quotes for content outside of template tags. [aniero]
+ * Changed; `exports.compile()` now expects only "locals"
+
+0.0.3 / 2010-07-15
+==================
+
+ * Fixed single quotes
+
+0.0.2 / 2010-07-09
+==================
+
+ * Fixed newline preservation
+
+0.0.1 / 2010-07-09
+==================
+
+ * Initial release
View
19 node_modules/ejs/Makefile
@@ -0,0 +1,19 @@
+SRC = $(shell find lib -name "*.js" -type f)
+UGLIFY_FLAGS = --no-mangle
+
+test:
+ @./support/expresso/bin/expresso -I lib test/*.test.js
+
+ejs.js: $(SRC)
+ @node support/compile.js $^
+
+ejs.min.js: ejs.js
+ @uglifyjs $(UGLIFY_FLAGS) $< > $@ \
+ && du ejs.min.js \
+ && du ejs.js
+
+clean:
+ rm -f ejs.js
+ rm -f ejs.min.js
+
+.PHONY: test
View
142 node_modules/ejs/Readme.md
@@ -0,0 +1,142 @@
+
+# EJS
+
+Embedded JavaScript templates.
+
+## Installation
+
+ $ npm install ejs
+
+## Features
+
+ * Complies with the [Express](http://expressjs.com) view system
+ * Static caching of intermediate JavaScript
+ * Unbuffered code for conditionals etc `<% code %>`
+ * Escapes html by default with `<%= code %>`
+ * Unescaped buffering with `<%- code %>`
+ * Supports tag customization
+ * Filter support for designer-friendly templates
+ * Client-side support
+
+## Example
+
+ <% if (user) { %>
+ <h2><%= user.name %></h2>
+ <% } %>
+
+## Usage
+
+ ejs.compile(str, options);
+ // => Function
+
+ ejs.render(str, options);
+ // => str
+
+## Options
+
+ - `locals` Local variables object
+ - `cache` Compiled functions are cached, requires `filename`
+ - `filename` Used by `cache` to key caches
+ - `scope` Function execution context
+ - `debug` Output generated function body
+ - `open` Open tag, defaulting to "<%"
+ - `close` Closing tag, defaulting to "%>"
+
+## Custom Tags
+
+Custom tags can also be applied globally:
+
+ var ejs = require('ejs');
+ ejs.open = '{{';
+ ejs.close = '}}';
+
+Which would make the following a valid template:
+
+ <h1>{{= title }}</h1>
+
+## Filters
+
+EJS conditionally supports the concept of "filters". A "filter chain"
+is a designer friendly api for manipulating data, without writing JavaScript.
+
+Filters can be applied by supplying the _:_ modifier, so for example if we wish to take the array `[{ name: 'tj' }, { name: 'mape' }, { name: 'guillermo' }]` and output a list of names we can do this simply with filters:
+
+Template:
+
+ <p><%=: users | map:'name' | join %></p>
+
+Output:
+
+ <p>Tj, Mape, Guillermo</p>
+
+Render call:
+
+ ejs.render(str, {
+ locals: {
+ users: [
+ { name: 'tj' },
+ { name: 'mape' },
+ { name: 'guillermo' }
+ ]
+ }
+ });
+
+Or perhaps capitalize the first user's name for display:
+
+ <p><%=: users | first | capitalize %></p>
+
+## Filter List
+
+Currently these filters are available:
+
+ - first
+ - last
+ - capitalize
+ - downcase
+ - upcase
+ - sort
+ - sort_by:'prop'
+ - size
+ - length
+ - plus:n
+ - minus:n
+ - times:n
+ - divided_by:n
+ - join:'val'
+ - truncate:n
+ - truncate_words:n
+ - replace:pattern,substitution
+ - prepend:val
+ - append:val
+ - map:'prop'
+ - reverse
+ - get:'prop'
+
+## client-side support
+
+ include `./ejs.js` or `./ejs.min.js` and `require("ejs").compile(str)`.
+
+## License
+
+(The MIT License)
+
+Copyright (c) 2009-2010 TJ Holowaychuk &lt;tj@vision-media.ca&gt;
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+'Software'), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
View
14 node_modules/ejs/benchmark.js
@@ -0,0 +1,14 @@
+
+
+var ejs = require('./lib/ejs'),
+ str = '<% if (foo) { %><p><%= foo %></p><% } %>',
+ times = 50000;
+
+console.log('rendering ' + times + ' times');
+
+var start = new Date;
+while (times--) {
+ ejs.render(str, { cache: true, filename: 'test', locals: { foo: 'bar' }});
+}
+
+console.log('took ' + (new Date - start) + 'ms');
View
526 node_modules/ejs/ejs.js
@@ -0,0 +1,526 @@
+
+// CommonJS require()
+
+function require(p){
+ var path = require.resolve(p)
+ , mod = require.modules[path];
+ if (!mod) throw new Error('failed to require "' + p + '"');
+ if (!mod.exports) {
+ mod.exports = {};
+ mod.call(mod.exports, mod, mod.exports, require.relative(path));
+ }
+ return mod.exports;
+ }
+
+require.modules = {};
+
+require.resolve = function (path){
+ var orig = path
+ , reg = path + '.js'
+ , index = path + '/index.js';
+ return require.modules[reg] && reg
+ || require.modules[index] && index
+ || orig;
+ };
+
+require.register = function (path, fn){
+ require.modules[path] = fn;
+ };
+
+require.relative = function (parent) {
+ return function(p){
+ if ('.' != p[0]) return require(p);
+
+ var path = parent.split('/')
+ , segs = p.split('/');
+ path.pop();
+
+ for (var i = 0; i < segs.length; i++) {
+ var seg = segs[i];
+ if ('..' == seg) path.pop();
+ else if ('.' != seg) path.push(seg);
+ }
+
+ return require(path.join('/'));
+ };
+ };
+
+
+require.register("ejs.js", function(module, exports, require){
+
+/*!
+ * EJS
+ * Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var utils = require('./utils');
+
+/**
+ * Library version.
+ */
+
+exports.version = '0.4.2';
+
+/**
+ * Filters.
+ *
+ * @type Object
+ */
+
+var filters = exports.filters = require('./filters');
+
+/**
+ * Intermediate js cache.
+ *
+ * @type Object
+ */
+
+var cache = {};
+
+/**
+ * Clear intermediate js cache.
+ *
+ * @api public
+ */
+
+exports.clearCache = function(){
+ cache = {};
+};
+
+/**
+ * Translate filtered code into function calls.
+ *
+ * @param {String} js
+ * @return {String}
+ * @api private
+ */
+
+function filtered(js) {
+ return js.substr(1).split('|').reduce(function(js, filter){
+ var parts = filter.split(':')
+ , name = parts.shift()
+ , args = parts.shift() || '';
+ if (args) args = ', ' + args;
+ return 'filters.' + name + '(' + js + args + ')';
+ });
+};
+
+/**
+ * Re-throw the given `err` in context to the
+ * `str` of ejs, `filename`, and `lineno`.
+ *
+ * @param {Error} err
+ * @param {String} str
+ * @param {String} filename
+ * @param {String} lineno
+ * @api private
+ */
+
+function rethrow(err, str, filename, lineno){
+ var lines = str.split('\n')
+ , start = Math.max(lineno - 3, 0)
+ , end = Math.min(lines.length, lineno + 3);
+
+ // Error context
+ var context = lines.slice(start, end).map(function(line, i){
+ var curr = i + start + 1;
+ return (curr == lineno ? ' >> ' : ' ')
+ + curr
+ + '| '
+ + line;
+ }).join('\n');
+
+ // Alter exception message
+ err.path = filename;
+ err.message = (filename || 'ejs') + ':'
+ + lineno + '\n'
+ + context + '\n\n'
+ + err.message;
+
+ throw err;
+}
+
+/**
+ * Parse the given `str` of ejs, returning the function body.
+ *
+ * @param {String} str
+ * @return {String}
+ * @api public
+ */
+
+var parse = exports.parse = function(str, options){
+ var options = options || {}
+ , open = options.open || exports.open || '<%'
+ , close = options.close || exports.close || '%>';
+
+ var buf = [
+ "var buf = [];"
+ , "\nwith (locals) {"
+ , "\n buf.push('"
+ ];
+
+ var lineno = 1;
+
+ for (var i = 0, len = str.length; i < len; ++i) {
+ if (str.slice(i, open.length + i) == open) {
+ i += open.length
+
+ var prefix, postfix, line = '__stack.lineno=' + lineno;
+ switch (str[i]) {
+ case '=':
+ prefix = "', escape((" + line + ', ';
+ postfix = ")), '";
+ ++i;
+ break;
+ case '-':
+ prefix = "', (" + line + ', ';
+ postfix = "), '";
+ ++i;
+ break;
+ default:
+ prefix = "');" + line + ';';
+ postfix = "; buf.push('";
+ }
+
+ var start = i;
+ var end = str.indexOf(close, i);
+ var js = str.substring(i, end);
+ if (js[0] == ':') js = filtered(js);
+ buf.push(prefix, js, postfix);
+ i += end - start + close.length - 1;
+
+ } else if (str[i] == "\\") {
+ buf.push("\\\\");
+ } else if (str[i] == "'") {
+ buf.push("\\'");
+ } else if (str[i] == "\r") {
+ buf.push(" ");
+ } else if (str[i] == "\n") {
+ buf.push("\\n");
+ lineno++;
+ } else {
+ buf.push(str[i]);
+ }
+ }
+
+ buf.push("');\n}\nreturn buf.join('');");
+ return buf.join('');
+};
+
+/**
+ * Compile the given `str` of ejs into a `Function`.
+ *
+ * @param {String} str
+ * @param {Object} options
+ * @return {Function}
+ * @api public
+ */
+
+var compile = exports.compile = function(str, options){
+ options = options || {};
+
+ var input = JSON.stringify(str)
+ , filename = options.filename
+ ? JSON.stringify(options.filename)
+ : 'undefined';
+
+ // Adds the fancy stack trace meta info
+ str = [
+ 'var __stack = { lineno: 1, input: ' + input + ', filename: ' + filename + ' };',
+ rethrow.toString(),
+ 'try {',
+ exports.parse(str, options),
+ '} catch (err) {',
+ ' rethrow(err, __stack.input, __stack.filename, __stack.lineno);',
+ '}'
+ ].join("\n");
+
+ if (options.debug) console.log(str);
+ var fn = new Function('locals, filters, escape', str);
+ return function(locals){
+ return fn.call(this, locals, filters, utils.escape);
+ }
+};
+
+/**
+ * Render the given `str` of ejs.
+ *
+ * Options:
+ *
+ * - `locals` Local variables object
+ * - `cache` Compiled functions are cached, requires `filename`
+ * - `filename` Used by `cache` to key caches
+ * - `scope` Function execution context
+ * - `debug` Output generated function body
+ * - `open` Open tag, defaulting to "<%"
+ * - `close` Closing tag, defaulting to "%>"
+ *
+ * @param {String} str
+ * @param {Object} options
+ * @return {String}
+ * @api public
+ */
+
+exports.render = function(str, options){
+ var fn
+ , options = options || {};
+ if (options.cache) {
+ if (options.filename) {
+ fn = cache[options.filename] || (cache[options.filename] = compile(str, options));
+ } else {
+ throw new Error('"cache" option requires "filename".');
+ }
+ } else {
+ fn = compile(str, options);
+ }
+ return fn.call(options.scope, options.locals || {});
+};
+
+/**
+ * Expose to require().
+ */
+
+if (require.extensions) {
+ require.extensions['.ejs'] = function(module, filename) {
+ source = require('fs').readFileSync(filename, 'utf-8');
+ module._compile(compile(source, {}), filename);
+ };
+} else if (require.registerExtension) {
+ require.registerExtension('.ejs', function(src) {
+ return compile(src, {});
+ });
+}
+
+}); // module: ejs.js
+
+require.register("filters.js", function(module, exports, require){
+
+/*!
+ * EJS - Filters
+ * Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
+ * MIT Licensed
+ */
+
+/**
+ * First element of the target `obj`.
+ */
+
+exports.first = function(obj) {
+ return obj[0];
+};
+
+/**
+ * Last element of the target `obj`.
+ */
+
+exports.last = function(obj) {
+ return obj[obj.length - 1];
+};
+
+/**
+ * Capitalize the first letter of the target `str`.
+ */
+
+exports.capitalize = function(str){
+ str = String(str);
+ return str[0].toUpperCase() + str.substr(1, str.length);
+};
+
+/**
+ * Downcase the target `str`.
+ */
+
+exports.downcase = function(str){
+ return String(str).toLowerCase();
+};
+
+/**
+ * Uppercase the target `str`.
+ */
+
+exports.upcase = function(str){
+ return String(str).toUpperCase();
+};
+
+/**
+ * Sort the target `obj`.
+ */
+
+exports.sort = function(obj){
+ return Object.create(obj).sort();
+};
+
+/**
+ * Sort the target `obj` by the given `prop` ascending.
+ */
+
+exports.sort_by = function(obj, prop){
+ return Object.create(obj).sort(function(a, b){
+ a = a[prop], b = b[prop];
+ if (a > b) return 1;
+ if (a < b) return -1;
+ return 0;
+ });
+};
+
+/**
+ * Size or length of the target `obj`.
+ */
+
+exports.size = exports.length = function(obj) {
+ return obj.length;
+};
+
+/**
+ * Add `a` and `b`.
+ */
+
+exports.plus = function(a, b){
+ return Number(a) + Number(b);
+};
+
+/**
+ * Subtract `b` from `a`.
+ */
+
+exports.minus = function(a, b){
+ return Number(a) - Number(b);
+};
+
+/**
+ * Multiply `a` by `b`.
+ */
+
+exports.times = function(a, b){
+ return Number(a) * Number(b);
+};
+
+/**
+ * Divide `a` by `b`.
+ */
+
+exports.divided_by = function(a, b){
+ return Number(a) / Number(b);
+};
+
+/**
+ * Join `obj` with the given `str`.
+ */
+
+exports.join = function(obj, str){
+ return obj.join(str || ', ');
+};
+
+/**
+ * Truncate `str` to `len`.
+ */
+
+exports.truncate = function(str, len){
+ str = String(str);
+ return str.substr(0, len);
+};
+
+/**
+ * Truncate `str` to `n` words.
+ */
+
+exports.truncate_words = function(str, n){
+ var str = String(str)
+ , words = str.split(/ +/);
+ return words.slice(0, n).join(' ');
+};
+
+/**
+ * Replace `pattern` with `substitution` in `str`.
+ */
+
+exports.replace = function(str, pattern, substitution){
+ return String(str).replace(pattern, substitution || '');
+};
+
+/**
+ * Prepend `val` to `obj`.
+ */
+
+exports.prepend = function(obj, val){
+ return Array.isArray(obj)
+ ? [val].concat(obj)
+ : val + obj;
+};
+
+/**
+ * Append `val` to `obj`.
+ */
+
+exports.append = function(obj, val){
+ return Array.isArray(obj)
+ ? obj.concat(val)
+ : obj + val;
+};
+
+/**
+ * Map the given `prop`.
+ */
+
+exports.map = function(arr, prop){
+ return arr.map(function(obj){
+ return obj[prop];
+ });
+};
+
+/**
+ * Reverse the given `obj`.
+ */
+
+exports.reverse = function(obj){
+ return Array.isArray(obj)
+ ? obj.reverse()
+ : String(obj).split('').reverse().join('');
+};
+
+/**
+ * Get `prop` of the given `obj`.
+ */
+
+exports.get = function(obj, prop){
+ return obj[prop];
+};
+
+/**
+ * Packs the given `obj` into json string
+ */
+exports.json = function(obj){
+ return JSON.stringify(obj);
+};
+}); // module: filters.js
+
+require.register("utils.js", function(module, exports, require){
+
+/*!
+ * EJS
+ * Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
+ * MIT Licensed
+ */
+
+/**
+ * Escape the given string of `html`.
+ *
+ * @param {String} html
+ * @return {String}
+ * @api private
+ */
+
+exports.escape = function(html){
+ return String(html)
+ .replace(/&(?!\w+;)/g, '&amp;')
+ .replace(/</g, '&lt;')
+ .replace(/>/g, '&gt;')
+ .replace(/"/g, '&quot;');
+};
+
+}); // module: utils.js
View
2  node_modules/ejs/ejs.min.js
@@ -0,0 +1,2 @@
+// CommonJS require()
+function require(p){var path=require.resolve(p),mod=require.modules[path];if(!mod)throw new Error('failed to require "'+p+'"');mod.exports||(mod.exports={},mod.call(mod.exports,mod,mod.exports,require.relative(path)));return mod.exports}require.modules={},require.resolve=function(path){var orig=path,reg=path+".js",index=path+"/index.js";return require.modules[reg]&&reg||require.modules[index]&&index||orig},require.register=function(path,fn){require.modules[path]=fn},require.relative=function(parent){return function(p){if("."!=p[0])return require(p);var path=parent.split("/"),segs=p.split("/");path.pop();for(var i=0;i<segs.length;i++){var seg=segs[i];".."==seg?path.pop():"."!=seg&&path.push(seg)}return require(path.join("/"))}},require.register("ejs.js",function(module,exports,require){var utils=require("./utils");exports.version="0.4.2";var filters=exports.filters=require("./filters"),cache={};exports.clearCache=function(){cache={}};function filtered(js){return js.substr(1).split("|").reduce(function(js,filter){var parts=filter.split(":"),name=parts.shift(),args=parts.shift()||"";args&&(args=", "+args);return"filters."+name+"("+js+args+")"})}function rethrow(err,str,filename,lineno){var lines=str.split("\n"),start=Math.max(lineno-3,0),end=Math.min(lines.length,lineno+3),context=lines.slice(start,end).map(function(line,i){var curr=i+start+1;return(curr==lineno?" >> ":" ")+curr+"| "+line}).join("\n");err.path=filename,err.message=(filename||"ejs")+":"+lineno+"\n"+context+"\n\n"+err.message;throw err}var parse=exports.parse=function(str,options){var options=options||{},open=options.open||exports.open||"<%",close=options.close||exports.close||"%>",buf=["var buf = [];","\nwith (locals) {","\n buf.push('"],lineno=1;for(var i=0,len=str.length;i<len;++i)if(str.slice(i,open.length+i)==open){i+=open.length;var prefix,postfix,line="__stack.lineno="+lineno;switch(str[i]){case"=":prefix="', escape(("+line+", ",postfix=")), '",++i;break;case"-":prefix="', ("+line+", ",postfix="), '",++i;break;default:prefix="');"+line+";",postfix="; buf.push('"}var start=i,end=str.indexOf(close,i),js=str.substring(i,end);js[0]==":"&&(js=filtered(js)),buf.push(prefix,js,postfix),i+=end-start+close.length-1}else str[i]=="\\"?buf.push("\\\\"):str[i]=="'"?buf.push("\\'"):str[i]=="\r"?buf.push(" "):str[i]=="\n"?(buf.push("\\n"),lineno++):buf.push(str[i]);buf.push("');\n}\nreturn buf.join('');");return buf.join("")},compile=exports.compile=function(str,options){options=options||{};var input=JSON.stringify(str),filename=options.filename?JSON.stringify(options.filename):"undefined";str=["var __stack = { lineno: 1, input: "+input+", filename: "+filename+" };",rethrow.toString(),"try {",exports.parse(str,options),"} catch (err) {"," rethrow(err, __stack.input, __stack.filename, __stack.lineno);","}"].join("\n"),options.debug&&console.log(str);var fn=new Function("locals, filters, escape",str);return function(locals){return fn.call(this,locals,filters,utils.escape)}};exports.render=function(str,options){var fn,options=options||{};if(options.cache)if(options.filename)fn=cache[options.filename]||(cache[options.filename]=compile(str,options));else throw new Error('"cache" option requires "filename".');else fn=compile(str,options);return fn.call(options.scope,options.locals||{})},require.extensions?require.extensions[".ejs"]=function(module,filename){source=require("fs").readFileSync(filename,"utf-8"),module._compile(compile(source,{}),filename)}:require.registerExtension&&require.registerExtension(".ejs",function(src){return compile(src,{})})}),require.register("filters.js",function(module,exports,require){exports.first=function(obj){return obj[0]},exports.last=function(obj){return obj[obj.length-1]},exports.capitalize=function(str){str=String(str);return str[0].toUpperCase()+str.substr(1,str.length)},exports.downcase=function(str){return String(str).toLowerCase()},exports.upcase=function(str){return String(str).toUpperCase()},exports.sort=function(obj){return Object.create(obj).sort()},exports.sort_by=function(obj,prop){return Object.create(obj).sort(function(a,b){a=a[prop],b=b[prop];if(a>b)return 1;if(a<b)return-1;return 0})},exports.size=exports.length=function(obj){return obj.length},exports.plus=function(a,b){return Number(a)+Number(b)},exports.minus=function(a,b){return Number(a)-Number(b)},exports.times=function(a,b){return Number(a)*Number(b)},exports.divided_by=function(a,b){return Number(a)/Number(b)},exports.join=function(obj,str){return obj.join(str||", ")},exports.truncate=function(str,len){str=String(str);return str.substr(0,len)},exports.truncate_words=function(str,n){var str=String(str),words=str.split(/ +/);return words.slice(0,n).join(" ")},exports.replace=function(str,pattern,substitution){return String(str).replace(pattern,substitution||"")},exports.prepend=function(obj,val){return Array.isArray(obj)?[val].concat(obj):val+obj},exports.append=function(obj,val){return Array.isArray(obj)?obj.concat(val):obj+val},exports.map=function(arr,prop){return arr.map(function(obj){return obj[prop]})},exports.reverse=function(obj){return Array.isArray(obj)?obj.reverse():String(obj).split("").reverse().join("")},exports.get=function(obj,prop){return obj[prop]},exports.json=function(obj){return JSON.stringify(obj)}}),require.register("utils.js",function(module,exports,require){exports.escape=function(html){return String(html).replace(/&(?!\w+;)/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}})
View
5 node_modules/ejs/examples/client.html
@@ -0,0 +1,5 @@
+<html>
+ <head>
+ <script src="../ejs.js"></script>
+ </head>
+</html>
View
7 node_modules/ejs/examples/list.ejs
@@ -0,0 +1,7 @@
+<% if (names.length) { %>
+ <ul>
+ <% names.forEach(function(name){ %>
+ <li><%= name %></li>
+ <% }) %>
+ </ul>
+<% } %>
View
16 node_modules/ejs/examples/list.js
@@ -0,0 +1,16 @@
+
+/**
+ * Module dependencies.
+ */
+
+var ejs = require('../')
+ , fs = require('fs')
+ , str = fs.readFileSync(__dirname + '/list.ejs', 'utf8');
+
+var ret = ejs.render(str, {
+ locals: {
+ names: ['foo', 'bar', 'baz']
+ }
+});
+
+console.log(ret);
View
2  node_modules/ejs/index.js
@@ -0,0 +1,2 @@
+
+module.exports = require('./lib/ejs');
View
248 node_modules/ejs/lib/ejs.js
@@ -0,0 +1,248 @@
+
+/*!
+ * EJS
+ * Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var utils = require('./utils');
+
+/**
+ * Library version.
+ */
+
+exports.version = '0.4.2';
+
+/**
+ * Filters.
+ *
+ * @type Object
+ */
+
+var filters = exports.filters = require('./filters');
+
+/**
+ * Intermediate js cache.
+ *
+ * @type Object
+ */
+
+var cache = {};
+
+/**
+ * Clear intermediate js cache.
+ *
+ * @api public
+ */
+
+exports.clearCache = function(){
+ cache = {};
+};
+
+/**
+ * Translate filtered code into function calls.
+ *
+ * @param {String} js
+ * @return {String}
+ * @api private
+ */
+
+function filtered(js) {
+ return js.substr(1).split('|').reduce(function(js, filter){
+ var parts = filter.split(':')
+ , name = parts.shift()
+ , args = parts.shift() || '';
+ if (args) args = ', ' + args;
+ return 'filters.' + name + '(' + js + args + ')';
+ });
+};
+
+/**
+ * Re-throw the given `err` in context to the
+ * `str` of ejs, `filename`, and `lineno`.
+ *
+ * @param {Error} err
+ * @param {String} str
+ * @param {String} filename
+ * @param {String} lineno
+ * @api private
+ */
+
+function rethrow(err, str, filename, lineno){
+ var lines = str.split('\n')
+ , start = Math.max(lineno - 3, 0)
+ , end = Math.min(lines.length, lineno + 3);
+
+ // Error context
+ var context = lines.slice(start, end).map(function(line, i){
+ var curr = i + start + 1;
+ return (curr == lineno ? ' >> ' : ' ')
+ + curr
+ + '| '
+ + line;
+ }).join('\n');
+
+ // Alter exception message
+ err.path = filename;
+ err.message = (filename || 'ejs') + ':'
+ + lineno + '\n'
+ + context + '\n\n'
+ + err.message;
+
+ throw err;
+}
+
+/**
+ * Parse the given `str` of ejs, returning the function body.
+ *
+ * @param {String} str
+ * @return {String}
+ * @api public
+ */
+
+var parse = exports.parse = function(str, options){
+ var options = options || {}
+ , open = options.open || exports.open || '<%'
+ , close = options.close || exports.close || '%>';
+
+ var buf = [
+ "var buf = [];"
+ , "\nwith (locals) {"
+ , "\n buf.push('"
+ ];
+
+ var lineno = 1;
+
+ for (var i = 0, len = str.length; i < len; ++i) {
+ if (str.slice(i, open.length + i) == open) {
+ i += open.length
+
+ var prefix, postfix, line = '__stack.lineno=' + lineno;
+ switch (str[i]) {
+ case '=':
+ prefix = "', escape((" + line + ', ';
+ postfix = ")), '";
+ ++i;
+ break;
+ case '-':
+ prefix = "', (" + line + ', ';
+ postfix = "), '";
+ ++i;
+ break;
+ default:
+ prefix = "');" + line + ';';
+ postfix = "; buf.push('";
+ }
+
+ var start = i;
+ var end = str.indexOf(close, i);
+ var js = str.substring(i, end);
+ if (js[0] == ':') js = filtered(js);
+ buf.push(prefix, js, postfix);
+ i += end - start + close.length - 1;
+
+ } else if (str[i] == "\\") {
+ buf.push("\\\\");
+ } else if (str[i] == "'") {
+ buf.push("\\'");
+ } else if (str[i] == "\r") {
+ buf.push(" ");
+ } else if (str[i] == "\n") {
+ buf.push("\\n");
+ lineno++;
+ } else {
+ buf.push(str[i]);
+ }
+ }
+
+ buf.push("');\n}\nreturn buf.join('');");
+ return buf.join('');
+};
+
+/**
+ * Compile the given `str` of ejs into a `Function`.
+ *
+ * @param {String} str
+ * @param {Object} options
+ * @return {Function}
+ * @api public
+ */
+
+var compile = exports.compile = function(str, options){
+ options = options || {};
+
+ var input = JSON.stringify(str)
+ , filename = options.filename
+ ? JSON.stringify(options.filename)
+ : 'undefined';
+
+ // Adds the fancy stack trace meta info
+ str = [
+ 'var __stack = { lineno: 1, input: ' + input + ', filename: ' + filename + ' };',
+ rethrow.toString(),
+ 'try {',
+ exports.parse(str, options),
+ '} catch (err) {',
+ ' rethrow(err, __stack.input, __stack.filename, __stack.lineno);',
+ '}'
+ ].join("\n");
+
+ if (options.debug) console.log(str);
+ var fn = new Function('locals, filters, escape', str);
+ return function(locals){
+ return fn.call(this, locals, filters, utils.escape);
+ }
+};
+
+/**
+ * Render the given `str` of ejs.
+ *
+ * Options:
+ *
+ * - `locals` Local variables object
+ * - `cache` Compiled functions are cached, requires `filename`
+ * - `filename` Used by `cache` to key caches
+ * - `scope` Function execution context
+ * - `debug` Output generated function body
+ * - `open` Open tag, defaulting to "<%"
+ * - `close` Closing tag, defaulting to "%>"
+ *
+ * @param {String} str
+ * @param {Object} options
+ * @return {String}
+ * @api public
+ */
+
+exports.render = function(str, options){
+ var fn
+ , options = options || {};
+ if (options.cache) {
+ if (options.filename) {
+ fn = cache[options.filename] || (cache[options.filename] = compile(str, options));
+ } else {
+ throw new Error('"cache" option requires "filename".');
+ }
+ } else {
+ fn = compile(str, options);
+ }
+ return fn.call(options.scope, options.locals || {});
+};
+
+/**
+ * Expose to require().
+ */
+
+if (require.extensions) {
+ require.extensions['.ejs'] = function(module, filename) {
+ source = require('fs').readFileSync(filename, 'utf-8');
+ module._compile(compile(source, {}), filename);
+ };
+} else if (require.registerExtension) {
+ require.registerExtension('.ejs', function(src) {
+ return compile(src, {});
+ });
+}
View
198 node_modules/ejs/lib/filters.js
@@ -0,0 +1,198 @@
+
+/*!
+ * EJS - Filters
+ * Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
+ * MIT Licensed
+ */
+
+/**
+ * First element of the target `obj`.
+ */
+
+exports.first = function(obj) {
+ return obj[0];
+};
+
+/**
+ * Last element of the target `obj`.
+ */
+
+exports.last = function(obj) {
+ return obj[obj.length - 1];
+};
+
+/**
+ * Capitalize the first letter of the target `str`.
+ */
+
+exports.capitalize = function(str){
+ str = String(str);
+ return str[0].toUpperCase() + str.substr(1, str.length);
+};
+
+/**
+ * Downcase the target `str`.
+ */
+
+exports.downcase = function(str){
+ return String(str).toLowerCase();
+};
+
+/**
+ * Uppercase the target `str`.
+ */
+
+exports.upcase = function(str){
+ return String(str).toUpperCase();
+};
+
+/**
+ * Sort the target `obj`.
+ */
+
+exports.sort = function(obj){
+ return Object.create(obj).sort();
+};
+
+/**
+ * Sort the target `obj` by the given `prop` ascending.
+ */
+
+exports.sort_by = function(obj, prop){
+ return Object.create(obj).sort(function(a, b){
+ a = a[prop], b = b[prop];
+ if (a > b) return 1;
+ if (a < b) return -1;
+ return 0;
+ });
+};
+
+/**
+ * Size or length of the target `obj`.
+ */
+
+exports.size = exports.length = function(obj) {
+ return obj.length;
+};
+
+/**
+ * Add `a` and `b`.
+ */
+
+exports.plus = function(a, b){
+ return Number(a) + Number(b);
+};
+
+/**
+ * Subtract `b` from `a`.
+ */
+
+exports.minus = function(a, b){
+ return Number(a) - Number(b);
+};
+
+/**
+ * Multiply `a` by `b`.
+ */
+
+exports.times = function(a, b){
+ return Number(a) * Number(b);
+};
+
+/**
+ * Divide `a` by `b`.
+ */
+
+exports.divided_by = function(a, b){
+ return Number(a) / Number(b);
+};
+
+/**
+ * Join `obj` with the given `str`.
+ */
+
+exports.join = function(obj, str){
+ return obj.join(str || ', ');
+};
+
+/**
+ * Truncate `str` to `len`.
+ */
+
+exports.truncate = function(str, len){
+ str = String(str);
+ return str.substr(0, len);
+};
+
+/**
+ * Truncate `str` to `n` words.
+ */
+
+exports.truncate_words = function(str, n){
+ var str = String(str)
+ , words = str.split(/ +/);
+ return words.slice(0, n).join(' ');
+};
+
+/**
+ * Replace `pattern` with `substitution` in `str`.
+ */
+
+exports.replace = function(str, pattern, substitution){
+ return String(str).replace(pattern, substitution || '');
+};
+
+/**
+ * Prepend `val` to `obj`.
+ */
+
+exports.prepend = function(obj, val){
+ return Array.isArray(obj)
+ ? [val].concat(obj)
+ : val + obj;
+};
+
+/**
+ * Append `val` to `obj`.
+ */
+
+exports.append = function(obj, val){
+ return Array.isArray(obj)
+ ? obj.concat(val)
+ : obj + val;
+};
+
+/**
+ * Map the given `prop`.
+ */
+
+exports.map = function(arr, prop){
+ return arr.map(function(obj){
+ return obj[prop];
+ });
+};
+
+/**
+ * Reverse the given `obj`.
+ */
+
+exports.reverse = function(obj){
+ return Array.isArray(obj)
+ ? obj.reverse()
+ : String(obj).split('').reverse().join('');
+};
+
+/**
+ * Get `prop` of the given `obj`.
+ */
+
+exports.get = function(obj, prop){
+ return obj[prop];
+};
+
+/**
+ * Packs the given `obj` into json string
+ */
+exports.json = function(obj){
+ return JSON.stringify(obj);
+};
View
23 node_modules/ejs/lib/utils.js
@@ -0,0 +1,23 @@
+
+/*!
+ * EJS
+ * Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
+ * MIT Licensed
+ */
+
+/**
+ * Escape the given string of `html`.
+ *
+ * @param {String} html
+ * @return {String}
+ * @api private
+ */
+
+exports.escape = function(html){
+ return String(html)
+ .replace(/&(?!\w+;)/g, '&amp;')
+ .replace(/</g, '&lt;')
+ .replace(/>/g, '&gt;')
+ .replace(/"/g, '&quot;');
+};
+
View
8 node_modules/ejs/package.json
@@ -0,0 +1,8 @@
+{
+ "name": "ejs",
+ "description": "Embedded JavaScript templates",
+ "version": "0.4.2",
+ "author": "TJ Holowaychuk <tj@vision-media.ca>",
+ "keywords": ["template", "engine", "ejs"],
+ "main": "./lib/ejs.js"
+}
View
173 node_modules/ejs/support/compile.js
@@ -0,0 +1,173 @@
+
+/**
+ * Module dependencies.
+ */
+
+var fs = require('fs');
+
+/**
+ * Arguments.
+ */
+
+var args = process.argv.slice(2)
+ , pending = args.length
+ , files = {};
+
+console.log('');
+
+// parse arguments
+
+args.forEach(function(file){
+ var mod = file.replace('lib/', '');
+ fs.readFile(file, 'utf8', function(err, js){
+ if (err) throw err;
+ console.log(' \033[90mcompile : \033[0m\033[36m%s\033[0m', file);
+ files[file] = parse(js);
+ --pending || compile();
+ });
+});
+
+/**
+ * Parse the given `js`.
+ */
+
+function parse(js) {
+ return parseInheritance(parseConditionals(js));
+}
+
+/**
+ * Parse __proto__.
+ */
+
+function parseInheritance(js) {
+ return js
+ .replace(/^ *(\w+)\.prototype\.__proto__ * = *(\w+)\.prototype *;?/gm, function(_, child, parent){
+ return child + '.prototype = new ' + parent + ';\n'
+ + child + '.prototype.constructor = '+ child + ';\n';
+ });
+}
+
+/**
+ * Parse the given `js`, currently supporting:
+ *
+ * 'if' ['node' | 'browser']
+ * 'end'
+ *
+ */
+
+function parseConditionals(js) {
+ var lines = js.split('\n')
+ , len = lines.length
+ , buffer = true
+ , browser = false
+ , buf = []
+ , line
+ , cond;
+
+ for (var i = 0; i < len; ++i) {
+ line = lines[i];
+ if (/^ *\/\/ *if *(node|browser)/gm.exec(line)) {
+ cond = RegExp.$1;
+ buffer = browser = 'browser' == cond;
+ } else if (/^ *\/\/ *end/.test(line)) {
+ buffer = true;
+ browser = false;
+ } else if (browser) {
+ buf.push(line.replace(/^( *)\/\//, '$1'));
+ } else if (buffer) {
+ buf.push(line);
+ }
+ }
+
+ return buf.join('\n');
+}
+
+/**
+ * Compile the files.
+ */
+
+function compile() {
+ var buf = '';
+ buf += '\n// CommonJS require()\n\n';
+ buf += browser.require + '\n\n';
+ buf += 'require.modules = {};\n\n';
+ buf += 'require.resolve = ' + browser.resolve + ';\n\n';
+ buf += 'require.register = ' + browser.register + ';\n\n';
+ buf += 'require.relative = ' + browser.relative + ';\n\n';
+ args.forEach(function(file){
+ var js = files[file];
+ file = file.replace('lib/', '');
+ buf += '\nrequire.register("' + file + '", function(module, exports, require){\n';
+ buf += js;
+ buf += '\n}); // module: ' + file + '\n';
+ });
+ fs.writeFile('ejs.js', buf, function(err){
+ if (err) throw err;
+ console.log(' \033[90m create : \033[0m\033[36m%s\033[0m', 'ejs.js');
+ console.log();
+ });
+}
+
+// refactored version of weepy's
+// https://github.com/weepy/brequire/blob/master/browser/brequire.js
+
+var browser = {
+
+ /**
+ * Require a module.
+ */
+
+ require: function require(p){
+ var path = require.resolve(p)
+ , mod = require.modules[path];
+ if (!mod) throw new Error('failed to require "' + p + '"');
+ if (!mod.exports) {
+ mod.exports = {};
+ mod.call(mod.exports, mod, mod.exports, require.relative(path));
+ }
+ return mod.exports;
+ },
+
+ /**
+ * Resolve module path.
+ */
+
+ resolve: function(path){
+ var orig = path
+ , reg = path + '.js'
+ , index = path + '/index.js';
+ return require.modules[reg] && reg
+ || require.modules[index] && index
+ || orig;
+ },
+
+ /**
+ * Return relative require().
+ */
+
+ relative: function(parent) {
+ return function(p){
+ if ('.' != p[0]) return require(p);
+
+ var path = parent.split('/')
+ , segs = p.split('/');
+ path.pop();
+
+ for (var i = 0; i < segs.length; i++) {
+ var seg = segs[i];
+ if ('..' == seg) path.pop();
+ else if ('.' != seg) path.push(seg);
+ }
+
+ return require(path.join('/'));
+ };
+ },
+
+ /**
+ * Register a module.
+ */
+
+ register: function(path, fn){
+ require.modules[path] = fn;
+ }
+};
View
3  node_modules/ejs/support/expresso/.gitignore
@@ -0,0 +1,3 @@
+.DS_Store
+lib-cov
+*.seed
View
3  node_modules/ejs/support/expresso/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "deps/jscoverage"]
+ path = deps/jscoverage
+ url = git://github.com/visionmedia/node-jscoverage.git
View
87 node_modules/ejs/support/expresso/History.md
@@ -0,0 +1,87 @@
+
+0.6.2 / 2010-08-03
+==================
+
+ * Added `assert.type()`
+ * Renamed `assert.isNotUndefined()` to `assert.isDefined()`
+ * Fixed `assert.includes()` param ordering
+
+0.6.0 / 2010-07-31
+==================
+
+ * Added _docs/api.html_
+ * Added -w, --watch
+ * Added `Array` support to `assert.includes()`
+ * Added; outputting exceptions immediately. Closes #19
+ * Fixed `assert.includes()` param ordering
+ * Fixed `assert.length()` param ordering
+ * Fixed jscoverage links
+
+0.5.0 / 2010-07-16
+==================
+
+ * Added support for async exports
+ * Added timeout support to `assert.response()`. Closes #3
+ * Added 4th arg callback support to `assert.response()`
+ * Added `assert.length()`
+ * Added `assert.match()`
+ * Added `assert.isUndefined()`
+ * Added `assert.isNull()`
+ * Added `assert.includes()`
+ * Added growlnotify support via -g, --growl
+ * Added -o, --only TESTS. Ex: --only "test foo()" --only "test foo(), test bar()"
+ * Removed profanity
+
+0.4.0 / 2010-07-09
+==================
+
+ * Added reporting source coverage (respects --boring for color haters)
+ * Added callback to assert.response(). Closes #12
+ * Fixed; putting exceptions to stderr. Closes #13
+
+0.3.1 / 2010-06-28
+==================
+
+ * Faster assert.response()
+
+0.3.0 / 2010-06-28
+==================
+
+ * Added -p, --port NUM flags
+ * Added assert.response(). Closes #11
+
+0.2.1 / 2010-06-25
+==================
+
+ * Fixed issue with reporting object assertions
+
+0.2.0 / 2010-06-21
+==================
+
+ * Added `make uninstall`
+ * Added better readdir() failure message
+ * Fixed `make install` for kiwi
+
+0.1.0 / 2010-06-15
+==================
+
+ * Added better usage docs via --help
+ * Added better conditional color support
+ * Added pre exit assertion support
+
+0.0.3 / 2010-06-02
+==================
+
+ * Added more room for filenames in test coverage
+ * Added boring output support via --boring (suppress colored output)
+ * Fixed async failure exit status
+
+0.0.2 / 2010-05-30
+==================
+
+ * Fixed exit status for CI support
+
+0.0.1 / 2010-05-30
+==================
+
+ * Initial release
View
50 node_modules/ejs/support/expresso/Makefile
@@ -0,0 +1,50 @@
+
+BIN = bin/expresso
+PREFIX = /usr/local
+JSCOV = deps/jscoverage/node-jscoverage
+DOCS = docs/index.md
+HTMLDOCS = $(DOCS:.md=.html)
+
+test: $(BIN)
+ @./$(BIN) -I lib --growl $(TEST_FLAGS) test/*.test.js
+
+test-cov:
+ @./$(BIN) -I lib --cov $(TEST_FLAGS) test/*.test.js
+
+install: install-jscov install-expresso
+
+uninstall:
+ rm -f $(PREFIX)/bin/expresso
+ rm -f $(PREFIX)/bin/node-jscoverage
+
+install-jscov: $(JSCOV)
+ install $(JSCOV) $(PREFIX)/bin
+
+install-expresso:
+ install $(BIN) $(PREFIX)/bin
+
+$(JSCOV):
+ cd deps/jscoverage && ./configure && make && mv jscoverage node-jscoverage
+
+clean:
+ @cd deps/jscoverage && git clean -fd
+
+docs: docs/api.html $(HTMLDOCS)
+
+%.html: %.md
+ @echo "... $< > $@"
+ @ronn -5 --pipe --fragment $< \
+ | cat docs/layout/head.html - docs/layout/foot.html \
+ > $@
+
+docs/api.html: bin/expresso
+ dox \
+ --title "Expresso" \
+ --ribbon "http://github.com/visionmedia/expresso" \
+ --desc "Insanely fast TDD framework for [node](http://nodejs.org) featuring code coverage reporting." \
+ $< > $@
+
+docclean:
+ rm -f docs/*.html
+
+.PHONY: test test-cov install uninstall install-expresso install-jscov clean docs docclean
View
39 node_modules/ejs/support/expresso/Readme.md
@@ -0,0 +1,39 @@
+
+# Expresso
+
+ TDD framework for [nodejs](http://nodejs.org).
+
+## Features
+
+ - light-weight
+ - intuitive async support
+ - intuitive test runner executable
+ - test coverage support and reporting
+ - uses the _assert_ module
+ - `assert.eql()` alias of `assert.deepEqual()`
+ - `assert.response()` http response utility
+ - `assert.includes()`
+ - `assert.type()`
+ - `assert.isNull()`
+ - `assert.isUndefined()`
+ - `assert.isNotNull()`
+ - `assert.isDefined()`
+ - `assert.match()`
+ - `assert.length()`
+
+## Installation
+
+To install both expresso _and_ node-jscoverage run:
+
+ $ make install
+
+To install expresso alone (no build required) run:
+
+ $ make install-expresso
+
+Install via npm:
+
+ $ npm install expresso
+
+
+
View
775 node_modules/ejs/support/expresso/bin/expresso
@@ -0,0 +1,775 @@
+#!/usr/bin/env node
+
+/*!
+ * Expresso
+ * Copyright(c) TJ Holowaychuk <tj@vision-media.ca>
+ * (MIT Licensed)
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var assert = require('assert'),
+ childProcess = require('child_process'),
+ http = require('http'),
+ path = require('path'),
+ sys = require('sys'),
+ cwd = process.cwd(),
+ fs = require('fs'),
+ defer;
+
+/**
+ * Expresso version.
+ */
+
+var version = '0.6.1';
+
+/**
+ * Failure count.
+ */
+
+var failures = 0;
+
+
+/**
+ * Number of tests executed.
+ */
+
+var testcount = 0;
+
+/**
+ * Whitelist of tests to run.
+ */
+
+var only = [];
+
+/**
+ * Boring output.
+ */
+
+var boring = false;
+
+/**
+ * Growl notifications.
+ */
+
+var growl = false;
+
+/**
+ * Server port.
+ */
+
+var port = 5555;
+
+/**
+ * Watch mode.
+ */
+
+var watch = false;
+
+/**
+ * Usage documentation.
+ */
+
+var usage = ''
+ + '[bold]{Usage}: expresso [options] <file ...>'
+ + '\n'
+ + '\n[bold]{Options}:'
+ + '\n -w, --watch Watch for modifications and re-execute tests'
+ + '\n -g, --growl Enable growl notifications'
+ + '\n -c, --coverage Generate and report test coverage'
+ + '\n -r, --require PATH Require the given module path'
+ + '\n -o, --only TESTS Execute only the comma sperated TESTS (can be set several times)'
+ + '\n -I, --include PATH Unshift the given path to require.paths'
+ + '\n -p, --port NUM Port number for test servers, starts at 5555'
+ + '\n -b, --boring Suppress ansi-escape colors'
+ + '\n -v, --version Output version number'
+ + '\n -h, --help Display help information'
+ + '\n';
+
+// Parse arguments
+
+var files = [],
+ args = process.argv.slice(2);
+
+while (args.length) {
+ var arg = args.shift();
+ switch (arg) {
+ case '-h':
+ case '--help':
+ print(usage + '\n');
+ process.exit(1);
+ break;
+ case '-v':
+ case '--version':
+ sys.puts(version);
+ process.exit(1);
+ break;
+ case '-i':
+ case '-I':
+ case '--include':
+ if (arg = args.shift()) {
+ require.paths.unshift(arg);
+ } else {
+ throw new Error('--include requires a path');
+ }
+ break;
+ case '-o':
+ case '--only':
+ if (arg = args.shift()) {
+ only = only.concat(arg.split(/ *, */));
+ } else {
+ throw new Error('--only requires comma-separated test names');
+ }
+ break;
+ case '-p':
+ case '--port':
+ if (arg = args.shift()) {
+ port = parseInt(arg, 10);
+ } else {
+ throw new Error('--port requires a number');
+ }
+ break;
+ case '-r':
+ case '--require':
+ if (arg = args.shift()) {
+ require(arg);
+ } else {
+ throw new Error('--require requires a path');
+ }
+ break;
+ case '-c':
+ case '--cov':
+ case '--coverage':
+ defer = true;
+ childProcess.exec('rm -fr lib-cov && node-jscoverage lib lib-cov', function(err){
+ if (err) throw err;
+ require.paths.unshift('lib-cov');
+ run(files);
+ })
+ break;
+ case '-b':
+ case '--boring':
+ boring = true;
+ break;
+ case '-w':
+ case '--watch':
+ watch = true;
+ break;
+ case '--g':
+ case '--growl':
+ growl = true;
+ break;
+ default:
+ if (/\.js$/.test(arg)) {
+ files.push(arg);
+ }
+ break;
+ }
+}
+
+/**
+ * Colorized sys.error().
+ *
+ * @param {String} str
+ */
+
+function print(str){
+ sys.error(colorize(str));
+}
+
+/**
+ * Colorize the given string using ansi-escape sequences.
+ * Disabled when --boring is set.
+ *
+ * @param {String} str
+ * @return {String}
+ */
+
+function colorize(str){
+ var colors = { bold: 1, red: 31, green: 32, yellow: 33 };
+ return str.replace(/\[(\w+)\]\{([^]*?)\}/g, function(_, color, str){
+ return boring
+ ? str
+ : '\x1B[' + colors[color] + 'm' + str + '\x1B[0m';
+ });
+}
+
+// Alias deepEqual as eql for complex equality
+
+assert.eql = assert.deepEqual;
+
+/**
+ * Assert that `val` is null.
+ *
+ * @param {Mixed} val
+ * @param {String} msg
+ */
+
+assert.isNull = function(val, msg) {
+ assert.strictEqual(null, val, msg);
+};
+
+/**
+ * Assert that `val` is not null.
+ *
+ * @param {Mixed} val
+ * @param {String} msg
+ */
+
+assert.isNotNull = function(val, msg) {
+ assert.notStrictEqual(null, val, msg);
+};
+
+/**
+ * Assert that `val` is undefined.
+ *
+ * @param {Mixed} val
+ * @param {String} msg
+ */
+
+assert.isUndefined = function(val, msg) {
+ assert.strictEqual(undefined, val, msg);
+};
+
+/**
+ * Assert that `val` is not undefined.
+ *
+ * @param {Mixed} val
+ * @param {String} msg
+ */
+
+assert.isDefined = function(val, msg) {
+ assert.notStrictEqual(undefined, val, msg);
+};
+
+/**
+ * Assert that `obj` is `type`.
+ *
+ * @param {Mixed} obj
+ * @param {String} type
+ * @api public
+ */
+
+assert.type = function(obj, type, msg){
+ var real = typeof obj;
+ msg = msg || 'typeof ' + sys.inspect(obj) + ' is ' + real + ', expected ' + type;
+ assert.ok(type === real, msg);
+};
+
+/**
+ * Assert that `str` matches `regexp`.
+ *
+ * @param {String} str
+ * @param {RegExp} regexp
+ * @param {String} msg
+ */
+
+assert.match = function(str, regexp, msg) {
+ msg = msg || sys.inspect(str) + ' does not match ' + sys.inspect(regexp);
+ assert.ok(regexp.test(str), msg);
+};
+
+/**
+ * Assert that `val` is within `obj`.
+ *
+ * Examples:
+ *
+ * assert.includes('foobar', 'bar');
+ * assert.includes(['foo', 'bar'], 'foo');
+ *
+ * @param {String|Array} obj
+ * @param {Mixed} val
+ * @param {String} msg
+ */
+
+assert.includes = function(obj, val, msg) {
+ msg = msg || sys.inspect(obj) + ' does not include ' + sys.inspect(val);
+ assert.ok(obj.indexOf(val) >= 0, msg);
+};
+
+/**
+ * Assert length of `val` is `n`.
+ *
+ * @param {Mixed} val
+ * @param {Number} n
+ * @param {String} msg
+ */
+
+assert.length = function(val, n, msg) {
+ msg = msg || sys.inspect(val) + ' has length of ' + val.length + ', expected ' + n;
+ assert.equal(n, val.length, msg);
+};
+
+/**
+ * Assert response from `server` with
+ * the given `req` object and `res` assertions object.
+ *
+ * @param {Server} server
+ * @param {Object} req
+ * @param {Object|Function} res
+ * @param {String} msg
+ */
+
+assert.response = function(server, req, res, msg){
+ // Callback as third or fourth arg
+ var callback = typeof res === 'function'
+ ? res
+ : typeof msg === 'function'
+ ? msg
+ : function(){};
+
+ // Default messate to test title
+ if (typeof msg === 'function') msg = null;
+ msg = msg || assert.testTitle;
+ msg += '. ';
+
+ // Pending responses
+ server.__pending = server.__pending || 0;
+ server.__pending++;
+
+ // Create client
+ if (!server.fd) {
+ server.listen(server.__port = port++);
+ server.client = http.createClient(server.__port);
+ }
+
+ // Issue request
+ var timer,
+ client = server.client,
+ method = req.method || 'GET',
+ status = res.status || res.statusCode,
+ data = req.data || req.body,
+ timeout = req.timeout || 0;
+
+ var request = client.request(method, req.url, req.headers);
+
+ // Timeout
+ if (timeout) {
+ timer = setTimeout(function(){
+ --server.__pending || server.close();
+ delete req.timeout;
+ assert.fail(msg + 'Request timed out after ' + timeout + 'ms.');
+ }, timeout);
+ }
+
+