diff --git a/node_modules/ejs/.gitignore b/node_modules/ejs/.gitignore new file mode 100644 index 0000000..99a4d6e --- /dev/null +++ b/node_modules/ejs/.gitignore @@ -0,0 +1,3 @@ +# ignore any vim files: +*.sw[a-z] +vim/.netrwhist diff --git a/node_modules/ejs/.gitmodules b/node_modules/ejs/.gitmodules new file mode 100644 index 0000000..51ea138 --- /dev/null +++ b/node_modules/ejs/.gitmodules @@ -0,0 +1,3 @@ +[submodule "support/expresso"] + path = support/expresso + url = http://github.com/visionmedia/expresso.git diff --git a/node_modules/ejs/History.md b/node_modules/ejs/History.md new file mode 100644 index 0000000..00d2b5b --- /dev/null +++ b/node_modules/ejs/History.md @@ -0,0 +1,70 @@ + +0.4.3 / 2011-06-20 +================== + + * Fixed stacktraces line number when used multiline js expressions [Octave] + +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 diff --git a/node_modules/ejs/Makefile b/node_modules/ejs/Makefile new file mode 100644 index 0000000..13c92d2 --- /dev/null +++ b/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 \ No newline at end of file diff --git a/node_modules/ejs/Readme.md b/node_modules/ejs/Readme.md new file mode 100644 index 0000000..0577dfe --- /dev/null +++ b/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) { %> +
<%=: users | map:'name' | join %>
+ +Output: + +Tj, Mape, Guillermo
+ +Render call: + + ejs.render(str, { + locals: { + users: [ + { name: 'tj' }, + { name: 'mape' }, + { name: 'guillermo' } + ] + } + }); + +Or perhaps capitalize the first user's name for display: + +<%=: users | first | capitalize %>
+ +## 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 <tj@vision-media.ca> + +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. diff --git a/node_modules/ejs/benchmark.js b/node_modules/ejs/benchmark.js new file mode 100644 index 0000000..7b267e1 --- /dev/null +++ b/node_modules/ejs/benchmark.js @@ -0,0 +1,14 @@ + + +var ejs = require('./lib/ejs'), + str = '<% if (foo) { %><%= foo %>
<% } %>', + 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'); \ No newline at end of file diff --git a/node_modules/ejs/ejs.js b/node_modules/ejs/ejs.js new file mode 100644 index 0000000..b8c6aa1 --- /dev/null +++ b/node_modules/ejs/ejs.js @@ -0,0 +1,531 @@ + +// 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 HolowaychukExpressoInsanely fast TDD framework for node featuring code coverage reporting. | |
expresso | bin/expresso |
+!/usr/bin/env node+ |
+
+
+ |
+
+ Module dependencies. + + |
+
+
+ |
+
+ Expresso version. + + |
+
+
+ |
+
+ Failure count. + + |
+
+
+ |
+
+ Whitelist of tests to run. + + |
+
+
+ |
+
+ Boring output. + + |
+
+
+ |
+
+ Growl notifications. + + |
+
+
+ |
+
+ Server port. + + |
+
+
+ |
+
+ Watch mode. + + |
+
+
+ |
+
+ Usage documentation. + + |
+
+
+ |
+
+ Colorized sys.error(). + + + +
|
+
+
+ |
+
+ Colorize the given string using ansi-escape sequences. +Disabled when --boring is set. + + + +
|
+
+
+ |
+
+ Assert that
|
+
+
+ |
+
+ Assert that
|
+
+
+ |
+
+ Assert that
|
+
+
+ |
+
+ Assert that
|
+
+
+ |
+
+ Assert that
|
+
+
+ |
+
+ Assert that
|
+
+
+ |
+
+ Assert that Examples+ +assert.includes('foobar', 'bar'); + assert.includes(['foo', 'bar'], 'foo'); + + + +
|
+
+
+ |
+
+ Assert length of
|
+
+
+ |
+
+ Assert response from
|
+
+
+ |
+
+ Pad the given string to the maximum width provided. + + + +
|
+
+
+ |
+
+ Pad the given string to the maximum width provided. + + + +
|
+
+
+ |
+
+ Report test coverage. + + + +
|
+
+
+ |
+
+ Populate code coverage data. + + + +
|
+
+
+ |
+
+ Total coverage for the given file data. + + + +
|
+
+
+ |
+
+ Run the given test
|
+
+
+ |
+
+ Show the cursor when
|
+
+
+ |
+
+ Run the given test
|
+
+
+ |
+
+ Run tests for the given
|
+
+
+ |
+
+ Clear the module cache for the given
|
+
+
+ |
+
+ Watch the given
|
+
+
+ |
+
+ Report
|
+
+
+ |
+
+ Run the given tests. + + + +
|
+
+
+ |
+
+ Report exceptions. + + |
+
+
+ |
+
+ Growl notify the given
|
+
+
+ |
+
Expresso is a JavaScript TDD framework written for nodejs. Expresso is extremely fast, and is packed with features such as additional assertion methods, code coverage reporting, CI support, and more.
+ +assert.eql()
alias of assert.deepEqual()
assert.response()
http response utilityassert.includes()
assert.isNull()
assert.isUndefined()
assert.isNotNull()
assert.isDefined()
assert.match()
assert.length()
To install both expresso and node-jscoverage run +the command below, which will first compile node-jscoverage:
+ +$ make install
+
+
+To install expresso alone without coverage reporting run:
+ +$ make install-expresso
+
+
+Install via npm:
+ +$ npm install expresso
+
+
+To define tests we simply export several functions:
+ +exports['test String#length'] = function(assert){
+ assert.equal(6, 'foobar'.length);
+};
+
+
+Alternatively for large numbers of tests you may want to +export your own object containing the tests, however this +is essentially the as above:
+ +module.exports = {
+ 'test String#length': function(assert){
+ assert.equal(6, 'foobar'.length);
+ }
+};
+
+
+If you prefer not to use quoted keys:
+ +exports.testsStringLength = function(assert){
+ assert.equal(6, 'foobar'.length);
+};
+
+
+The second argument passed to each callback is beforeExit, +which is typically used to assert that callbacks have been +invoked.
+ +exports.testAsync = function(assert, beforeExit){
+ var n = 0;
+ setTimeout(function(){
+ ++n;
+ assert.ok(true);
+ }, 200);
+ setTimeout(function(){
+ ++n;
+ assert.ok(true);
+ }, 200);
+ beforeExit(function(){
+ assert.equal(2, n, 'Ensure both timeouts are called');
+ });
+};
+
+
+Asserts that the given val is null.
+ +assert.isNull(null);
+
+
+Asserts that the given val is not null.
+ +assert.isNotNull(undefined);
+assert.isNotNull(false);
+
+
+Asserts that the given val is undefined.
+ +assert.isUndefined(undefined);
+
+
+Asserts that the given val is not undefined.
+ +assert.isDefined(null);
+assert.isDefined(false);
+
+
+Asserts that the given str matches regexp.
+ +assert.match('foobar', /^foo(bar)?/);
+assert.match('foo', /^foo(bar)?/);
+
+
+Assert that the given val has a length of n.
+ +assert.length([1,2,3], 3);
+assert.length('foo', 3);
+
+
+Assert that the given obj is typeof type.
+ +assert.type(3, 'number');
+
+
+Assert that object b is equal to object a. This is an +alias for the core assert.deepEqual() method which does complex +comparisons, opposed to assert.equal() which uses ==.
+ +assert.eql('foo', 'foo');
+assert.eql([1,2], [1,2]);
+assert.eql({ foo: 'bar' }, { foo: 'bar' });
+
+
+Assert that obj is within val. This method supports Array_s +and Strings_s.
+ +assert.includes([1,2,3], 3);
+assert.includes('foobar', 'foo');
+assert.includes('foobar', 'bar');
+
+
+Performs assertions on the given server, which should not call +listen(), as this is handled internally by expresso and the server +is killed after all responses have completed. This method works with +any http.Server instance, so Connect and Express servers will work +as well.
+ +The req object may contain:
+ +The res object may be a callback function which +receives the response for assertions, or an object +which is then used to perform several assertions +on the response with the following properties:
+ +When providing res you may then also pass a callback function +as the fourth argument for additional assertions.
+ +Below are some examples:
+ +assert.response(server, {
+ url: '/', timeout: 500
+}, {
+ body: 'foobar'
+});
+
+assert.response(server, {
+ url: '/',
+ method: 'GET'
+},{
+ body: '{"name":"tj"}',
+ status: 200,
+ headers: {
+ 'Content-Type': 'application/json; charset=utf8',
+ 'X-Foo': 'bar'
+ }
+});
+
+assert.response(server, {
+ url: '/foo',
+ method: 'POST',
+ data: 'bar baz'
+},{
+ body: '/foo bar baz',
+ status: 200
+}, 'Test POST');
+
+assert.response(server, {
+ url: '/foo',
+ method: 'POST',
+ data: 'bar baz'
+},{
+ body: '/foo bar baz',
+ status: 200
+}, function(res){
+ // All done, do some more tests if needed
+});
+
+assert.response(server, {
+ url: '/'
+}, function(res){
+ assert.ok(res.body.indexOf('tj') >= 0, 'Test assert.response() callback');
+});
+
+
+To run a single test suite (file) run:
+ +$ expresso test/a.test.js
+
+
+To run several suites we may simply append another:
+ +$ expresso test/a.test.js test/b.test.js
+
+
+We can also pass a whitelist of tests to run within all suites:
+ +$ expresso --only "foo()" --only "bar()"
+
+
+Or several with one call:
+ +$ expresso --only "foo(), bar()"
+
+
+Globbing is of course possible as well:
+ +$ expresso test/*
+
+
+When expresso is called without any files, test/* is the default, +so the following is equivalent to the command above:
+ +$ expresso
+
+
+If you wish to unshift a path to require.paths
before
+running tests, you may use the -I
or --include
flag.
$ expresso --include lib test/*
+
+
+The previous example is typically what I would recommend, since expresso +supports test coverage via node-jscoverage (bundled with expresso), +so you will need to expose an instrumented version of you library.
+ +To instrument your library, simply run node-jscoverage, +passing the src and dest directories:
+ +$ node-jscoverage lib lib-cov
+
+
+Now we can run our tests again, using the lib-cov directory that has been +instrumented with coverage statements:
+ +$ expresso -I lib-cov test/*
+
+
+The output will look similar to below, depending on your test coverage of course :)
+ + + +To make this process easier expresso has the -c or --cov which essentially +does the same as the two commands above. The following two commands will +run the same tests, however one will auto-instrument, and unshift lib-cov, +and the other will run tests normally:
+ +$ expresso -I lib test/*
+$ expresso -I lib --cov test/*
+
+
+Currently coverage is bound to the lib directory, however in the
+future --cov
will most likely accept a path.
Sometimes it is useful to postpone running of tests until a callback or event has fired, currently the exports.foo = function(){}; syntax is supported for this:
+ +setTimeout(function(){
+ exports['test async exports'] = function(assert){
+ assert.ok('wahoo');
+ };
+}, 100);
+
+
+