vulcan 0.6.1 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/vulcan/cli.rb +20 -10
- data/lib/vulcan/version.rb +1 -1
- data/server/Procfile +1 -1
- data/server/bin/web +10 -0
- data/server/lib/cloudant.coffee +20 -0
- data/server/lib/logger.coffee +17 -0
- data/server/lib/on.coffee +10 -0
- data/server/lib/spawner.coffee +65 -0
- data/server/node_modules/coffee-script/CNAME +1 -0
- data/server/node_modules/coffee-script/LICENSE +22 -0
- data/server/node_modules/coffee-script/README +51 -0
- data/server/node_modules/coffee-script/Rakefile +78 -0
- data/server/node_modules/coffee-script/bin/cake +7 -0
- data/server/node_modules/coffee-script/bin/coffee +7 -0
- data/server/node_modules/coffee-script/extras/jsl.conf +44 -0
- data/server/node_modules/coffee-script/lib/coffee-script/browser.js +92 -0
- data/server/node_modules/coffee-script/lib/coffee-script/cake.js +111 -0
- data/server/node_modules/coffee-script/lib/coffee-script/coffee-script.js +167 -0
- data/server/node_modules/coffee-script/lib/coffee-script/command.js +500 -0
- data/server/node_modules/coffee-script/lib/coffee-script/grammar.js +606 -0
- data/server/node_modules/coffee-script/lib/coffee-script/helpers.js +77 -0
- data/server/node_modules/coffee-script/lib/coffee-script/index.js +11 -0
- data/server/node_modules/coffee-script/lib/coffee-script/lexer.js +788 -0
- data/server/node_modules/coffee-script/lib/coffee-script/nodes.js +2986 -0
- data/server/node_modules/coffee-script/lib/coffee-script/optparse.js +138 -0
- data/server/node_modules/coffee-script/lib/coffee-script/parser.js +683 -0
- data/server/node_modules/coffee-script/lib/coffee-script/repl.js +261 -0
- data/server/node_modules/coffee-script/lib/coffee-script/rewriter.js +349 -0
- data/server/node_modules/coffee-script/lib/coffee-script/scope.js +146 -0
- data/server/node_modules/coffee-script/package.json +55 -0
- data/server/node_modules/connect-form/History.md +0 -6
- data/server/node_modules/connect-form/lib/connect-form.js +2 -4
- data/server/node_modules/connect-form/node_modules/formidable/Readme.md +64 -36
- data/server/node_modules/connect-form/node_modules/formidable/lib/incoming_form.js +5 -1
- data/server/node_modules/connect-form/node_modules/formidable/package.json +20 -6
- data/server/node_modules/connect-form/node_modules/formidable/test/common.js +5 -6
- data/server/node_modules/connect-form/node_modules/formidable/test/fixture/file/funkyfilename.txt +1 -0
- data/server/node_modules/connect-form/node_modules/formidable/test/fixture/js/special-chars-in-filename.js +1 -1
- data/server/node_modules/connect-form/node_modules/formidable/test/{slow → integration}/test-fixtures.js +38 -33
- data/server/node_modules/connect-form/node_modules/formidable/test/legacy/simple/test-incoming-form.js +11 -0
- data/server/node_modules/connect-form/node_modules/formidable/test/run.js +1 -6
- data/server/node_modules/connect-form/node_modules/formidable/test/unit/test-incoming-form.js +63 -0
- data/server/node_modules/connect-form/package.json +27 -5
- data/server/node_modules/cradle/README.md +10 -10
- data/server/node_modules/cradle/lib/cradle.js +117 -523
- data/server/node_modules/cradle/lib/cradle/database/attachments.js +120 -0
- data/server/node_modules/cradle/lib/cradle/database/changes.js +56 -0
- data/server/node_modules/cradle/lib/cradle/database/documents.js +215 -0
- data/server/node_modules/cradle/lib/cradle/database/index.js +65 -0
- data/server/node_modules/cradle/lib/cradle/database/views.js +125 -0
- data/server/node_modules/cradle/node_modules/follow/LICENSE +202 -0
- data/server/node_modules/cradle/node_modules/follow/README.md +164 -0
- data/server/node_modules/cradle/node_modules/follow/Rakefile +54 -0
- data/server/node_modules/cradle/node_modules/follow/api.js +35 -0
- data/server/node_modules/cradle/node_modules/follow/browser/eventemitter2.js +453 -0
- data/server/node_modules/cradle/node_modules/follow/browser/export.js +78 -0
- data/server/node_modules/cradle/node_modules/follow/browser/index.html +14 -0
- data/server/node_modules/cradle/node_modules/follow/browser/jquery-1.6.1.min.js +18 -0
- data/server/node_modules/cradle/node_modules/follow/browser/log4js.js +46 -0
- data/server/node_modules/cradle/node_modules/follow/browser/main.js +92 -0
- data/server/node_modules/cradle/node_modules/follow/browser/querystring.js +28 -0
- data/server/node_modules/cradle/node_modules/follow/browser/request.jquery.js +237 -0
- data/server/node_modules/cradle/node_modules/follow/browser/require.js +33 -0
- data/server/node_modules/cradle/node_modules/follow/browser/util.js +28 -0
- data/server/node_modules/cradle/node_modules/follow/cli.js +101 -0
- data/server/node_modules/cradle/node_modules/follow/lib/feed.js +556 -0
- data/server/node_modules/cradle/node_modules/follow/lib/index.js +66 -0
- data/server/node_modules/cradle/node_modules/follow/lib/stream.js +305 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/LICENSE +55 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/README.md +285 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/main.js +618 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/mimetypes.js +146 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/oauth.js +34 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/package.json +42 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/tests/googledoodle.png +0 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/tests/run.sh +6 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/tests/server.js +57 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-body.js +90 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-cookie.js +29 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-cookiejar.js +90 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-errors.js +30 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-oauth.js +109 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-pipes.js +167 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-proxy.js +39 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-timeout.js +87 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/uuid.js +19 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/vendor/cookie/index.js +55 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/vendor/cookie/jar.js +72 -0
- data/server/node_modules/cradle/node_modules/follow/package.json +45 -0
- data/server/node_modules/cradle/node_modules/follow/test/couch.js +153 -0
- data/server/node_modules/cradle/node_modules/follow/test/follow.js +136 -0
- data/server/node_modules/cradle/node_modules/follow/test/issues.js +178 -0
- data/server/node_modules/cradle/node_modules/follow/test/issues/10.js +24 -0
- data/server/node_modules/cradle/node_modules/follow/test/stream.js +493 -0
- data/server/node_modules/cradle/node_modules/request/LICENSE +55 -0
- data/server/node_modules/cradle/node_modules/request/README.md +287 -0
- data/server/node_modules/cradle/node_modules/request/forever.js +103 -0
- data/server/node_modules/cradle/node_modules/request/main.js +913 -0
- data/server/node_modules/cradle/node_modules/request/mimetypes.js +152 -0
- data/server/node_modules/cradle/node_modules/request/oauth.js +34 -0
- data/server/node_modules/cradle/node_modules/request/package.json +42 -0
- data/server/node_modules/cradle/node_modules/request/tests/googledoodle.png +0 -0
- data/server/node_modules/cradle/node_modules/request/tests/run.js +38 -0
- data/server/node_modules/cradle/node_modules/request/tests/server.js +82 -0
- data/server/node_modules/cradle/node_modules/request/tests/squid.conf +77 -0
- data/server/node_modules/cradle/node_modules/request/tests/ssl/ca/ca.cnf +20 -0
- data/server/node_modules/cradle/node_modules/request/tests/ssl/ca/ca.crl +0 -0
- data/server/node_modules/cradle/node_modules/request/tests/ssl/ca/ca.crt +17 -0
- data/server/node_modules/cradle/node_modules/request/tests/ssl/ca/ca.csr +13 -0
- data/server/node_modules/cradle/node_modules/request/tests/ssl/ca/ca.key +18 -0
- data/server/node_modules/cradle/node_modules/request/tests/ssl/ca/ca.srl +1 -0
- data/server/node_modules/cradle/node_modules/request/tests/ssl/ca/server.cnf +19 -0
- data/server/node_modules/cradle/node_modules/request/tests/ssl/ca/server.crt +16 -0
- data/server/node_modules/cradle/node_modules/request/tests/ssl/ca/server.csr +11 -0
- data/server/node_modules/cradle/node_modules/request/tests/ssl/ca/server.js +28 -0
- data/server/node_modules/cradle/node_modules/request/tests/ssl/ca/server.key +9 -0
- data/server/node_modules/cradle/node_modules/request/tests/ssl/npm-ca.crt +16 -0
- data/server/node_modules/cradle/node_modules/request/tests/ssl/test.crt +15 -0
- data/server/node_modules/cradle/node_modules/request/tests/ssl/test.key +15 -0
- data/server/node_modules/cradle/node_modules/request/tests/test-body.js +95 -0
- data/server/node_modules/cradle/node_modules/request/tests/test-cookie.js +29 -0
- data/server/node_modules/cradle/node_modules/request/tests/test-cookiejar.js +90 -0
- data/server/node_modules/cradle/node_modules/request/tests/test-defaults.js +68 -0
- data/server/node_modules/cradle/node_modules/request/tests/test-errors.js +37 -0
- data/server/node_modules/cradle/node_modules/request/tests/test-headers.js +52 -0
- data/server/node_modules/cradle/node_modules/request/tests/test-httpModule.js +94 -0
- data/server/node_modules/cradle/node_modules/request/tests/test-https-strict.js +97 -0
- data/server/node_modules/cradle/node_modules/request/tests/test-https.js +86 -0
- data/server/node_modules/cradle/node_modules/request/tests/test-oauth.js +117 -0
- data/server/node_modules/cradle/node_modules/request/tests/test-params.js +92 -0
- data/server/node_modules/cradle/node_modules/request/tests/test-pipes.js +202 -0
- data/server/node_modules/cradle/node_modules/request/tests/test-proxy.js +39 -0
- data/server/node_modules/cradle/node_modules/request/tests/test-qs.js +28 -0
- data/server/node_modules/cradle/node_modules/request/tests/test-redirect.js +154 -0
- data/server/node_modules/cradle/node_modules/request/tests/test-timeout.js +87 -0
- data/server/node_modules/cradle/node_modules/request/tests/test-toJSON.js +14 -0
- data/server/node_modules/cradle/node_modules/request/tests/test-tunnel.js +61 -0
- data/server/node_modules/cradle/node_modules/request/tunnel.js +229 -0
- data/server/node_modules/cradle/node_modules/request/uuid.js +19 -0
- data/server/node_modules/cradle/node_modules/request/vendor/cookie/index.js +65 -0
- data/server/node_modules/cradle/node_modules/request/vendor/cookie/jar.js +72 -0
- data/server/node_modules/cradle/node_modules/vargs/package.json +33 -10
- data/server/node_modules/cradle/package.json +50 -12
- data/server/node_modules/cradle/test/cache-test.js +1 -4
- data/server/node_modules/cradle/test/connection-test.js +179 -0
- data/server/node_modules/cradle/test/database-attachment-test.js +344 -0
- data/server/node_modules/cradle/test/database-cache-test.js +132 -0
- data/server/node_modules/cradle/test/database-test.js +219 -0
- data/server/node_modules/cradle/test/database-view-test.js +141 -0
- data/server/node_modules/cradle/test/fixtures/databases.json +28 -1
- data/server/node_modules/cradle/test/helpers/seed.js +14 -5
- data/server/node_modules/cradle/test/response-test.js +1 -1
- data/server/node_modules/express/History.md +16 -0
- data/server/node_modules/express/bin/express +7 -6
- data/server/node_modules/express/lib-cov/application.js +510 -0
- data/server/node_modules/express/lib-cov/express.js +65 -0
- data/server/node_modules/express/lib-cov/middleware.js +54 -0
- data/server/node_modules/express/lib-cov/request.js +225 -0
- data/server/node_modules/express/lib-cov/response.js +611 -0
- data/server/node_modules/express/lib-cov/router/collection.js +40 -0
- data/server/node_modules/express/lib-cov/router/index.js +515 -0
- data/server/node_modules/express/lib-cov/router/methods.js +9 -0
- data/server/node_modules/express/lib-cov/router/route.js +68 -0
- data/server/node_modules/express/lib-cov/utils.js +151 -0
- data/server/node_modules/express/lib-cov/view.js +81 -0
- data/server/node_modules/express/lib/express.js +1 -1
- data/server/node_modules/express/lib/http.js +1 -2
- data/server/node_modules/express/lib/request.js +2 -2
- data/server/node_modules/express/lib/router/methods.js +10 -1
- data/server/node_modules/express/node_modules/connect/lib/connect.js +1 -1
- data/server/node_modules/express/node_modules/connect/lib/http.js +3 -2
- data/server/node_modules/express/node_modules/connect/lib/middleware/limit.js +0 -2
- data/server/node_modules/express/node_modules/connect/lib/middleware/session.js +1 -2
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/Readme.md +42 -25
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/lib/incoming_form.js +1 -0
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/package.json +14 -3
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-incoming-form.js +11 -0
- data/server/node_modules/express/node_modules/connect/package.json +35 -7
- data/server/node_modules/express/node_modules/mime/package.json +30 -8
- data/server/node_modules/express/node_modules/mkdirp/README.markdown +35 -2
- data/server/node_modules/express/node_modules/mkdirp/examples/pow.js +1 -1
- data/server/node_modules/express/node_modules/mkdirp/index.js +72 -13
- data/server/node_modules/express/node_modules/mkdirp/package.json +39 -21
- data/server/node_modules/express/node_modules/mkdirp/test/chmod.js +38 -0
- data/server/node_modules/express/node_modules/mkdirp/test/clobber.js +37 -0
- data/server/node_modules/express/node_modules/mkdirp/test/perm.js +32 -0
- data/server/node_modules/express/node_modules/mkdirp/test/perm_sync.js +39 -0
- data/server/node_modules/express/node_modules/mkdirp/test/sync.js +27 -0
- data/server/node_modules/express/node_modules/mkdirp/test/umask.js +28 -0
- data/server/node_modules/express/node_modules/mkdirp/test/umask_sync.js +27 -0
- data/server/node_modules/express/node_modules/qs/History.md +10 -0
- data/server/node_modules/express/node_modules/qs/Readme.md +9 -2
- data/server/node_modules/express/node_modules/qs/examples.js +3 -0
- data/server/node_modules/express/node_modules/qs/lib/querystring.js +8 -6
- data/server/node_modules/express/node_modules/qs/package.json +26 -8
- data/server/node_modules/express/node_modules/qs/test/parse.js +13 -1
- data/server/node_modules/express/node_modules/qs/test/stringify.js +45 -37
- data/server/node_modules/express/package.json +55 -16
- data/server/node_modules/express/test.js +41 -0
- data/server/node_modules/knox/package.json +26 -4
- data/server/node_modules/node-uuid/package.json +40 -11
- data/server/node_modules/node-uuid/test/test.js +1 -1
- data/server/node_modules/nodemon/README.md +120 -0
- data/server/node_modules/nodemon/nodemon.js +518 -0
- data/server/node_modules/nodemon/nodemonignore.example +11 -0
- data/server/node_modules/nodemon/package.json +49 -0
- data/server/node_modules/restler/README.md +144 -94
- data/server/node_modules/restler/lib/multipartform.js +2 -0
- data/server/node_modules/restler/lib/restler.js +218 -61
- data/server/node_modules/restler/package.json +35 -8
- data/server/node_modules/restler/test/all.js +6 -1
- data/server/node_modules/restler/test/restler.js +624 -118
- data/server/package.json +14 -10
- data/server/web.coffee +64 -0
- data/server/web.js +15 -3
- metadata +170 -57
- data/server/index.js +0 -14
- data/server/node_modules/connect-form/LICENSE +0 -22
- data/server/node_modules/connect-form/index.js +0 -100
- data/server/node_modules/connect-form/node_modules/formidable/test/fast/test-incoming-form.js +0 -45
- data/server/node_modules/connect-form/node_modules/formidable/test/fixture/http/no-filename/generic.http +0 -13
- data/server/node_modules/connect-form/node_modules/formidable/test/fixture/http/special-chars-in-filename/osx-chrome-13.http +0 -26
- data/server/node_modules/connect-form/node_modules/formidable/test/fixture/http/special-chars-in-filename/osx-firefox-3.6.http +0 -24
- data/server/node_modules/connect-form/node_modules/formidable/test/fixture/http/special-chars-in-filename/osx-safari-5.http +0 -23
- data/server/node_modules/connect-form/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-chrome-12.http +0 -24
- data/server/node_modules/connect-form/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-ie-7.http +0 -22
- data/server/node_modules/connect-form/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-ie-8.http +0 -22
- data/server/node_modules/connect-form/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-safari-5.http +0 -22
- data/server/node_modules/connect-form/node_modules/formidable/test/fixture/multi_video.upload +0 -0
- data/server/node_modules/cradle/Makefile +0 -10
- data/server/node_modules/cradle/test/cradle-test.js +0 -650
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/no-filename/generic.http +0 -13
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/osx-chrome-13.http +0 -26
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/osx-firefox-3.6.http +0 -24
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/osx-safari-5.http +0 -23
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-chrome-12.http +0 -24
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-ie-7.http +0 -22
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-ie-8.http +0 -22
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-safari-5.http +0 -22
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/multi_video.upload +0 -0
- data/server/node_modules/express/node_modules/connect/test.js +0 -52
- data/server/node_modules/express/testing/foo/app.js +0 -35
- data/server/node_modules/express/testing/foo/package.json +0 -9
- data/server/node_modules/express/testing/foo/public/stylesheets/style.css +0 -8
- data/server/node_modules/express/testing/foo/routes/index.js +0 -10
- data/server/node_modules/express/testing/foo/views/index.jade +0 -2
- data/server/node_modules/express/testing/foo/views/layout.jade +0 -6
- data/server/node_modules/express/testing/index.js +0 -43
- data/server/node_modules/express/testing/public/test.txt +0 -2971
- data/server/node_modules/express/testing/views/page.html +0 -1
- data/server/node_modules/express/testing/views/page.jade +0 -3
- data/server/node_modules/express/testing/views/test.md +0 -1
- data/server/node_modules/express/testing/views/user/index.jade +0 -1
- data/server/node_modules/express/testing/views/user/list.jade +0 -1
- data/server/node_modules/knox/lib/knox/mime/index.js +0 -308
- data/server/node_modules/knox/lib/knox/mime/test.js +0 -59
- data/server/node_modules/node-uuid/test/benchmark-native +0 -0
- data/server/node_modules/on/index.js +0 -13
- data/server/node_modules/restler/test/test_helper.js +0 -163
- data/server/node_modules/spawner/index.js +0 -106
|
@@ -1 +0,0 @@
|
|
|
1
|
-
p register test
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
testing _some_ markdown
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
p user page
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
p user list page
|
|
@@ -1,308 +0,0 @@
|
|
|
1
|
-
var path = require('path');
|
|
2
|
-
|
|
3
|
-
/* Functions for translating file extensions into mime types
|
|
4
|
-
*
|
|
5
|
-
* based on simonw's djangode: http://github.com/simonw/djangode
|
|
6
|
-
* with extensions/mimetypes added from felixge's
|
|
7
|
-
* node-paperboy: http://github.com/felixge/node-paperboy
|
|
8
|
-
*/
|
|
9
|
-
exports.lookup = function(filename, fallback) {
|
|
10
|
-
// the path library's extname function won't return an extension if the
|
|
11
|
-
// entire string IS the extesion, so we check for that case
|
|
12
|
-
if (filename.charAt(0) === '.' && filename.substr(1).indexOf('.') < 0) {
|
|
13
|
-
var ext = filename.substr(1);
|
|
14
|
-
}
|
|
15
|
-
// either the string doesn't have an extension or it is the extension, we
|
|
16
|
-
// assume the latter. Most of the time we're right.
|
|
17
|
-
else if (filename.indexOf('.') < 0) {
|
|
18
|
-
var ext = filename;
|
|
19
|
-
}
|
|
20
|
-
// simple lookup
|
|
21
|
-
else {
|
|
22
|
-
var ext = path.extname(filename).substr(1);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
ext = ext.toLowerCase();
|
|
26
|
-
|
|
27
|
-
return exports.types[ext] || fallback || exports.default_type;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
exports.default_type = 'application/octet-stream';
|
|
31
|
-
|
|
32
|
-
exports.types =
|
|
33
|
-
{ "3gp" : "video/3gpp"
|
|
34
|
-
, "a" : "application/octet-stream"
|
|
35
|
-
, "ai" : "application/postscript"
|
|
36
|
-
, "aif" : "audio/x-aiff"
|
|
37
|
-
, "aiff" : "audio/x-aiff"
|
|
38
|
-
, "arj" : "application/x-arj-compressed"
|
|
39
|
-
, "asc" : "application/pgp-signature"
|
|
40
|
-
, "asf" : "video/x-ms-asf"
|
|
41
|
-
, "asm" : "text/x-asm"
|
|
42
|
-
, "asx" : "video/x-ms-asf"
|
|
43
|
-
, "atom" : "application/atom+xml"
|
|
44
|
-
, "au" : "audio/basic"
|
|
45
|
-
, "avi" : "video/x-msvideo"
|
|
46
|
-
, "bat" : "application/x-msdownload"
|
|
47
|
-
, "bcpio" : "application/x-bcpio"
|
|
48
|
-
, "bin" : "application/octet-stream"
|
|
49
|
-
, "bmp" : "image/bmp"
|
|
50
|
-
, "bz2" : "application/x-bzip2"
|
|
51
|
-
, "c" : "text/x-c"
|
|
52
|
-
, "cab" : "application/vnd.ms-cab-compressed"
|
|
53
|
-
, "cc" : "text/x-c"
|
|
54
|
-
, "ccad" : "application/clariscad"
|
|
55
|
-
, "chm" : "application/vnd.ms-htmlhelp"
|
|
56
|
-
, "class" : "application/octet-stream"
|
|
57
|
-
, "cod" : "application/vnd.rim.cod"
|
|
58
|
-
, "com" : "application/x-msdownload"
|
|
59
|
-
, "conf" : "text/plain"
|
|
60
|
-
, "cpio" : "application/x-cpio"
|
|
61
|
-
, "cpp" : "text/x-c"
|
|
62
|
-
, "cpt" : "application/mac-compactpro"
|
|
63
|
-
, "crt" : "application/x-x509-ca-cert"
|
|
64
|
-
, "csh" : "application/x-csh"
|
|
65
|
-
, "css" : "text/css"
|
|
66
|
-
, "csv" : "text/csv"
|
|
67
|
-
, "cxx" : "text/x-c"
|
|
68
|
-
, "deb" : "application/x-debian-package"
|
|
69
|
-
, "der" : "application/x-x509-ca-cert"
|
|
70
|
-
, "diff" : "text/x-diff"
|
|
71
|
-
, "djv" : "image/vnd.djvu"
|
|
72
|
-
, "djvu" : "image/vnd.djvu"
|
|
73
|
-
, "dl" : "video/dl"
|
|
74
|
-
, "dll" : "application/x-msdownload"
|
|
75
|
-
, "dmg" : "application/octet-stream"
|
|
76
|
-
, "doc" : "application/msword"
|
|
77
|
-
, "dot" : "application/msword"
|
|
78
|
-
, "drw" : "application/drafting"
|
|
79
|
-
, "dtd" : "application/xml-dtd"
|
|
80
|
-
, "dvi" : "application/x-dvi"
|
|
81
|
-
, "dwg" : "application/acad"
|
|
82
|
-
, "dxf" : "application/dxf"
|
|
83
|
-
, "dxr" : "application/x-director"
|
|
84
|
-
, "ear" : "application/java-archive"
|
|
85
|
-
, "eml" : "message/rfc822"
|
|
86
|
-
, "eps" : "application/postscript"
|
|
87
|
-
, "etx" : "text/x-setext"
|
|
88
|
-
, "exe" : "application/x-msdownload"
|
|
89
|
-
, "ez" : "application/andrew-inset"
|
|
90
|
-
, "f" : "text/x-fortran"
|
|
91
|
-
, "f77" : "text/x-fortran"
|
|
92
|
-
, "f90" : "text/x-fortran"
|
|
93
|
-
, "fli" : "video/x-fli"
|
|
94
|
-
, "flv" : "video/x-flv"
|
|
95
|
-
, "flv" : "video/x-flv"
|
|
96
|
-
, "for" : "text/x-fortran"
|
|
97
|
-
, "gem" : "application/octet-stream"
|
|
98
|
-
, "gemspec" : "text/x-script.ruby"
|
|
99
|
-
, "gif" : "image/gif"
|
|
100
|
-
, "gl" : "video/gl"
|
|
101
|
-
, "gtar" : "application/x-gtar"
|
|
102
|
-
, "gz" : "application/x-gzip"
|
|
103
|
-
, "h" : "text/x-c"
|
|
104
|
-
, "hdf" : "application/x-hdf"
|
|
105
|
-
, "hh" : "text/x-c"
|
|
106
|
-
, "hqx" : "application/mac-binhex40"
|
|
107
|
-
, "htm" : "text/html"
|
|
108
|
-
, "html" : "text/html"
|
|
109
|
-
, "ice" : "x-conference/x-cooltalk"
|
|
110
|
-
, "ico" : "image/vnd.microsoft.icon"
|
|
111
|
-
, "ics" : "text/calendar"
|
|
112
|
-
, "ief" : "image/ief"
|
|
113
|
-
, "ifb" : "text/calendar"
|
|
114
|
-
, "igs" : "model/iges"
|
|
115
|
-
, "ips" : "application/x-ipscript"
|
|
116
|
-
, "ipx" : "application/x-ipix"
|
|
117
|
-
, "iso" : "application/octet-stream"
|
|
118
|
-
, "jad" : "text/vnd.sun.j2me.app-descriptor"
|
|
119
|
-
, "jar" : "application/java-archive"
|
|
120
|
-
, "java" : "text/x-java-source"
|
|
121
|
-
, "jnlp" : "application/x-java-jnlp-file"
|
|
122
|
-
, "jpeg" : "image/jpeg"
|
|
123
|
-
, "jpg" : "image/jpeg"
|
|
124
|
-
, "js" : "application/javascript"
|
|
125
|
-
, "json" : "application/json"
|
|
126
|
-
, "latex" : "application/x-latex"
|
|
127
|
-
, "log" : "text/plain"
|
|
128
|
-
, "lsp" : "application/x-lisp"
|
|
129
|
-
, "lzh" : "application/octet-stream"
|
|
130
|
-
, "m" : "text/plain"
|
|
131
|
-
, "m3u" : "audio/x-mpegurl"
|
|
132
|
-
, "m4v" : "video/mp4"
|
|
133
|
-
, "man" : "text/troff"
|
|
134
|
-
, "mathml" : "application/mathml+xml"
|
|
135
|
-
, "mbox" : "application/mbox"
|
|
136
|
-
, "mdoc" : "text/troff"
|
|
137
|
-
, "me" : "text/troff"
|
|
138
|
-
, "me" : "application/x-troff-me"
|
|
139
|
-
, "mid" : "audio/midi"
|
|
140
|
-
, "midi" : "audio/midi"
|
|
141
|
-
, "mif" : "application/x-mif"
|
|
142
|
-
, "mime" : "www/mime"
|
|
143
|
-
, "mml" : "application/mathml+xml"
|
|
144
|
-
, "mng" : "video/x-mng"
|
|
145
|
-
, "mov" : "video/quicktime"
|
|
146
|
-
, "movie" : "video/x-sgi-movie"
|
|
147
|
-
, "mp3" : "audio/mpeg"
|
|
148
|
-
, "mp4" : "video/mp4"
|
|
149
|
-
, "mp4v" : "video/mp4"
|
|
150
|
-
, "mpeg" : "video/mpeg"
|
|
151
|
-
, "mpg" : "video/mpeg"
|
|
152
|
-
, "mpga" : "audio/mpeg"
|
|
153
|
-
, "ms" : "text/troff"
|
|
154
|
-
, "msi" : "application/x-msdownload"
|
|
155
|
-
, "nc" : "application/x-netcdf"
|
|
156
|
-
, "oda" : "application/oda"
|
|
157
|
-
, "odp" : "application/vnd.oasis.opendocument.presentation"
|
|
158
|
-
, "ods" : "application/vnd.oasis.opendocument.spreadsheet"
|
|
159
|
-
, "odt" : "application/vnd.oasis.opendocument.text"
|
|
160
|
-
, "ogg" : "application/ogg"
|
|
161
|
-
, "ogm" : "application/ogg"
|
|
162
|
-
, "p" : "text/x-pascal"
|
|
163
|
-
, "pas" : "text/x-pascal"
|
|
164
|
-
, "pbm" : "image/x-portable-bitmap"
|
|
165
|
-
, "pdf" : "application/pdf"
|
|
166
|
-
, "pem" : "application/x-x509-ca-cert"
|
|
167
|
-
, "pgm" : "image/x-portable-graymap"
|
|
168
|
-
, "pgn" : "application/x-chess-pgn"
|
|
169
|
-
, "pgp" : "application/pgp"
|
|
170
|
-
, "pkg" : "application/octet-stream"
|
|
171
|
-
, "pl" : "text/x-script.perl"
|
|
172
|
-
, "pm" : "application/x-perl"
|
|
173
|
-
, "png" : "image/png"
|
|
174
|
-
, "pnm" : "image/x-portable-anymap"
|
|
175
|
-
, "ppm" : "image/x-portable-pixmap"
|
|
176
|
-
, "pps" : "application/vnd.ms-powerpoint"
|
|
177
|
-
, "ppt" : "application/vnd.ms-powerpoint"
|
|
178
|
-
, "ppz" : "application/vnd.ms-powerpoint"
|
|
179
|
-
, "pre" : "application/x-freelance"
|
|
180
|
-
, "prt" : "application/pro_eng"
|
|
181
|
-
, "ps" : "application/postscript"
|
|
182
|
-
, "psd" : "image/vnd.adobe.photoshop"
|
|
183
|
-
, "py" : "text/x-script.python"
|
|
184
|
-
, "qt" : "video/quicktime"
|
|
185
|
-
, "ra" : "audio/x-realaudio"
|
|
186
|
-
, "rake" : "text/x-script.ruby"
|
|
187
|
-
, "ram" : "audio/x-pn-realaudio"
|
|
188
|
-
, "rar" : "application/x-rar-compressed"
|
|
189
|
-
, "ras" : "image/x-cmu-raster"
|
|
190
|
-
, "rb" : "text/x-script.ruby"
|
|
191
|
-
, "rdf" : "application/rdf+xml"
|
|
192
|
-
, "rgb" : "image/x-rgb"
|
|
193
|
-
, "rm" : "audio/x-pn-realaudio"
|
|
194
|
-
, "roff" : "text/troff"
|
|
195
|
-
, "rpm" : "application/x-redhat-package-manager"
|
|
196
|
-
, "rpm" : "audio/x-pn-realaudio-plugin"
|
|
197
|
-
, "rss" : "application/rss+xml"
|
|
198
|
-
, "rtf" : "text/rtf"
|
|
199
|
-
, "rtx" : "text/richtext"
|
|
200
|
-
, "ru" : "text/x-script.ruby"
|
|
201
|
-
, "s" : "text/x-asm"
|
|
202
|
-
, "scm" : "application/x-lotusscreencam"
|
|
203
|
-
, "set" : "application/set"
|
|
204
|
-
, "sgm" : "text/sgml"
|
|
205
|
-
, "sgml" : "text/sgml"
|
|
206
|
-
, "sh" : "application/x-sh"
|
|
207
|
-
, "shar" : "application/x-shar"
|
|
208
|
-
, "sig" : "application/pgp-signature"
|
|
209
|
-
, "silo" : "model/mesh"
|
|
210
|
-
, "sit" : "application/x-stuffit"
|
|
211
|
-
, "skt" : "application/x-koan"
|
|
212
|
-
, "smil" : "application/smil"
|
|
213
|
-
, "snd" : "audio/basic"
|
|
214
|
-
, "so" : "application/octet-stream"
|
|
215
|
-
, "sol" : "application/solids"
|
|
216
|
-
, "spl" : "application/x-futuresplash"
|
|
217
|
-
, "src" : "application/x-wais-source"
|
|
218
|
-
, "stl" : "application/SLA"
|
|
219
|
-
, "stp" : "application/STEP"
|
|
220
|
-
, "sv4cpio" : "application/x-sv4cpio"
|
|
221
|
-
, "sv4crc" : "application/x-sv4crc"
|
|
222
|
-
, "svg" : "image/svg+xml"
|
|
223
|
-
, "svgz" : "image/svg+xml"
|
|
224
|
-
, "swf" : "application/x-shockwave-flash"
|
|
225
|
-
, "t" : "text/troff"
|
|
226
|
-
, "tar" : "application/x-tar"
|
|
227
|
-
, "tbz" : "application/x-bzip-compressed-tar"
|
|
228
|
-
, "tcl" : "application/x-tcl"
|
|
229
|
-
, "tex" : "application/x-tex"
|
|
230
|
-
, "texi" : "application/x-texinfo"
|
|
231
|
-
, "texinfo" : "application/x-texinfo"
|
|
232
|
-
, "text" : "text/plain"
|
|
233
|
-
, "tgz" : "application/x-tar-gz"
|
|
234
|
-
, "tif" : "image/tiff"
|
|
235
|
-
, "tiff" : "image/tiff"
|
|
236
|
-
, "torrent" : "application/x-bittorrent"
|
|
237
|
-
, "tr" : "text/troff"
|
|
238
|
-
, "tsi" : "audio/TSP-audio"
|
|
239
|
-
, "tsp" : "application/dsptype"
|
|
240
|
-
, "tsv" : "text/tab-separated-values"
|
|
241
|
-
, "txt" : "text/plain"
|
|
242
|
-
, "unv" : "application/i-deas"
|
|
243
|
-
, "ustar" : "application/x-ustar"
|
|
244
|
-
, "vcd" : "application/x-cdlink"
|
|
245
|
-
, "vcf" : "text/x-vcard"
|
|
246
|
-
, "vcs" : "text/x-vcalendar"
|
|
247
|
-
, "vda" : "application/vda"
|
|
248
|
-
, "vivo" : "video/vnd.vivo"
|
|
249
|
-
, "vrm" : "x-world/x-vrml"
|
|
250
|
-
, "vrml" : "model/vrml"
|
|
251
|
-
, "war" : "application/java-archive"
|
|
252
|
-
, "wav" : "audio/x-wav"
|
|
253
|
-
, "wax" : "audio/x-ms-wax"
|
|
254
|
-
, "wma" : "audio/x-ms-wma"
|
|
255
|
-
, "wmv" : "video/x-ms-wmv"
|
|
256
|
-
, "wmx" : "video/x-ms-wmx"
|
|
257
|
-
, "wrl" : "model/vrml"
|
|
258
|
-
, "wsdl" : "application/wsdl+xml"
|
|
259
|
-
, "wvx" : "video/x-ms-wvx"
|
|
260
|
-
, "xbm" : "image/x-xbitmap"
|
|
261
|
-
, "xhtml" : "application/xhtml+xml"
|
|
262
|
-
, "xls" : "application/vnd.ms-excel"
|
|
263
|
-
, "xlw" : "application/vnd.ms-excel"
|
|
264
|
-
, "xml" : "application/xml"
|
|
265
|
-
, "xpm" : "image/x-xpixmap"
|
|
266
|
-
, "xsl" : "application/xml"
|
|
267
|
-
, "xslt" : "application/xslt+xml"
|
|
268
|
-
, "xwd" : "image/x-xwindowdump"
|
|
269
|
-
, "xyz" : "chemical/x-pdb"
|
|
270
|
-
, "yaml" : "text/yaml"
|
|
271
|
-
, "yml" : "text/yaml"
|
|
272
|
-
, "zip" : "application/zip"
|
|
273
|
-
};
|
|
274
|
-
|
|
275
|
-
var charsets = exports.charsets = {
|
|
276
|
-
lookup: function(mimetype, fallback) {
|
|
277
|
-
return charsets.sets[mimetype] || fallback;
|
|
278
|
-
},
|
|
279
|
-
|
|
280
|
-
sets: {
|
|
281
|
-
"text/calendar": "UTF-8",
|
|
282
|
-
"text/css": "UTF-8",
|
|
283
|
-
"text/csv": "UTF-8",
|
|
284
|
-
"text/html": "UTF-8",
|
|
285
|
-
"text/plain": "UTF-8",
|
|
286
|
-
"text/rtf": "UTF-8",
|
|
287
|
-
"text/richtext": "UTF-8",
|
|
288
|
-
"text/sgml": "UTF-8",
|
|
289
|
-
"text/tab-separated-values": "UTF-8",
|
|
290
|
-
"text/troff": "UTF-8",
|
|
291
|
-
"text/x-asm": "UTF-8",
|
|
292
|
-
"text/x-c": "UTF-8",
|
|
293
|
-
"text/x-diff": "UTF-8",
|
|
294
|
-
"text/x-fortran": "UTF-8",
|
|
295
|
-
"text/x-java-source": "UTF-8",
|
|
296
|
-
"text/x-pascal": "UTF-8",
|
|
297
|
-
"text/x-script.perl": "UTF-8",
|
|
298
|
-
"text/x-script.perl-module": "UTF-8",
|
|
299
|
-
"text/x-script.python": "UTF-8",
|
|
300
|
-
"text/x-script.ruby": "UTF-8",
|
|
301
|
-
"text/x-setext": "UTF-8",
|
|
302
|
-
"text/vnd.sun.j2me.app-descriptor": "UTF-8",
|
|
303
|
-
"text/x-vcalendar": "UTF-8",
|
|
304
|
-
"text/x-vcard": "UTF-8",
|
|
305
|
-
"text/yaml": "UTF-8"
|
|
306
|
-
}
|
|
307
|
-
};
|
|
308
|
-
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
var mime = require('./mime');
|
|
2
|
-
|
|
3
|
-
exports["test mime lookup"] = function(test) {
|
|
4
|
-
// easy
|
|
5
|
-
test.equal('text/plain', mime.lookup('text.txt'));
|
|
6
|
-
|
|
7
|
-
// hidden file or multiple periods
|
|
8
|
-
test.equal('text/plain', mime.lookup('.text.txt'));
|
|
9
|
-
|
|
10
|
-
// just an extension
|
|
11
|
-
test.equal('text/plain', mime.lookup('.txt'));
|
|
12
|
-
|
|
13
|
-
// just an extension without a dot
|
|
14
|
-
test.equal('text/plain', mime.lookup('txt'));
|
|
15
|
-
|
|
16
|
-
// default
|
|
17
|
-
test.equal('application/octet-stream', mime.lookup('text.nope'));
|
|
18
|
-
|
|
19
|
-
// fallback
|
|
20
|
-
test.equal('fallback', mime.lookup('text.fallback', 'fallback'));
|
|
21
|
-
|
|
22
|
-
test.finish();
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
exports["test mime lookup uppercase"] = function(test) {
|
|
26
|
-
// easy
|
|
27
|
-
test.equal('text/plain', mime.lookup('TEXT.TXT'));
|
|
28
|
-
|
|
29
|
-
// just an extension
|
|
30
|
-
test.equal('text/plain', mime.lookup('.TXT'));
|
|
31
|
-
|
|
32
|
-
// just an extension without a dot
|
|
33
|
-
test.equal('text/plain', mime.lookup('TXT'));
|
|
34
|
-
|
|
35
|
-
// default
|
|
36
|
-
test.equal('application/octet-stream', mime.lookup('TEXT.NOPE'));
|
|
37
|
-
|
|
38
|
-
// fallback
|
|
39
|
-
test.equal('fallback', mime.lookup('TEXT.FALLBACK', 'fallback'));
|
|
40
|
-
|
|
41
|
-
test.finish();
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
exports["test charset lookup"] = function(test) {
|
|
45
|
-
// easy
|
|
46
|
-
test.equal('UTF-8', mime.charsets.lookup('text/plain'));
|
|
47
|
-
|
|
48
|
-
// none
|
|
49
|
-
test.ok(typeof mime.charsets.lookup('text/nope') == 'undefined');
|
|
50
|
-
|
|
51
|
-
// fallback
|
|
52
|
-
test.equal('fallback', mime.charsets.lookup('text/fallback', 'fallback'));
|
|
53
|
-
|
|
54
|
-
test.finish();
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
if (module == require.main) {
|
|
58
|
-
require('async_testing').run(__filename, process.ARGV);
|
|
59
|
-
}
|
|
Binary file
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
var events = require('events');
|
|
2
|
-
|
|
3
|
-
module.exports.inject = function(object) {
|
|
4
|
-
object.emitter = events.EventEmitter();
|
|
5
|
-
|
|
6
|
-
object.on = function(key, handler) {
|
|
7
|
-
object.emitter.on(key, handler);
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
object.emit = function() {
|
|
11
|
-
object.emitter.emit(arguments);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
var http = require("http"),
|
|
2
|
-
sys = require('util'),
|
|
3
|
-
test = require('assert');
|
|
4
|
-
|
|
5
|
-
exports.echoServer = function() {
|
|
6
|
-
var server = http.createServer(function(request, response) {
|
|
7
|
-
var echo = [request.method, request.url, "HTTP/" +
|
|
8
|
-
request.httpVersion].join(' ') + "\r\n";
|
|
9
|
-
for (var header in request.headers) {
|
|
10
|
-
echo += header + ": " + request.headers[header] + "\r\n";
|
|
11
|
-
}
|
|
12
|
-
echo += '\r\n';
|
|
13
|
-
|
|
14
|
-
request.addListener('data', function(chunk) {
|
|
15
|
-
echo += chunk.toString('binary');
|
|
16
|
-
});
|
|
17
|
-
request.addListener('end', function() {
|
|
18
|
-
|
|
19
|
-
var requestedCode = request.headers['x-give-me-status'];
|
|
20
|
-
|
|
21
|
-
response.writeHead(requestedCode || 200, {
|
|
22
|
-
'Content-Type': 'text/plain',
|
|
23
|
-
'Content-Length': echo.length
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
response.write(echo);
|
|
27
|
-
response.end();
|
|
28
|
-
server.close();
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
var port = exports.port++;
|
|
33
|
-
server.listen(port, "localhost");
|
|
34
|
-
return ["http://localhost:" + port, server];
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
exports.dataServer = function() {
|
|
38
|
-
var json = "{ \"ok\": true }";
|
|
39
|
-
var xml = "<document><ok>true</ok></document>";
|
|
40
|
-
var yaml = "ok: true";
|
|
41
|
-
|
|
42
|
-
var server = http.createServer(function(request, response) {
|
|
43
|
-
response.writeHead(200, { 'Content-Type': request.headers['accepts'], 'test': 'thing' });
|
|
44
|
-
|
|
45
|
-
if (request.headers['accepts'] == 'application/json') {
|
|
46
|
-
response.write(json);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
if (request.headers['accepts'] == 'application/xml') {
|
|
50
|
-
response.write(xml);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
if (request.headers['accepts'] == 'application/yaml') {
|
|
54
|
-
response.write(yaml);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
response.end();
|
|
58
|
-
server.close();
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
var port = exports.port++;
|
|
62
|
-
server.listen(port, "localhost");
|
|
63
|
-
return ["http://localhost:" + port, server];
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
exports.redirectServer = function() {
|
|
67
|
-
var port = exports.port++;
|
|
68
|
-
|
|
69
|
-
var server = http.createServer(function(request, response) {
|
|
70
|
-
if (request.url == '/redirected') {
|
|
71
|
-
response.writeHead(200, { 'Content-Type': 'text/plain' });
|
|
72
|
-
response.write('Hell Yeah!');
|
|
73
|
-
response.end();
|
|
74
|
-
server.close();
|
|
75
|
-
} else {
|
|
76
|
-
response.writeHead(301, { 'Location': 'http://localhost:' + port + '/redirected' });
|
|
77
|
-
response.write('Redirecting...');
|
|
78
|
-
response.end();
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
server.listen(port, "localhost");
|
|
84
|
-
return ["http://localhost:" + port, server];
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
exports.contentLengthServer = function (){
|
|
88
|
-
var port = exports.port++;
|
|
89
|
-
|
|
90
|
-
var server = http.createServer(function(request, response){
|
|
91
|
-
response.writeHead(200, { 'Content-Type': 'text/plain' });
|
|
92
|
-
if('content-length' in request.headers){
|
|
93
|
-
response.write(request.headers['content-length']);
|
|
94
|
-
} else {
|
|
95
|
-
response.write('content-length isnot set');
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
response.end();
|
|
99
|
-
server.close();
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
server.listen(port, 'localhost');
|
|
103
|
-
return ['http://localhost:' + port, server];
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
exports.port = 7000;
|
|
107
|
-
|
|
108
|
-
exports.testCase = function(caseName, serverFunc, tests) {
|
|
109
|
-
var testCount = 0, passes = 0, fails = 0;
|
|
110
|
-
|
|
111
|
-
function wrapAssertions(name) {
|
|
112
|
-
var assertions = {};
|
|
113
|
-
|
|
114
|
-
[
|
|
115
|
-
'ok',
|
|
116
|
-
'equal',
|
|
117
|
-
'notEqual',
|
|
118
|
-
'deepEqual',
|
|
119
|
-
'notDeepEqual',
|
|
120
|
-
'strictEqual',
|
|
121
|
-
'notStrictEqual',
|
|
122
|
-
'throws',
|
|
123
|
-
'doesNotThrow',
|
|
124
|
-
'ifError'
|
|
125
|
-
].forEach(function(assert) {
|
|
126
|
-
assertions[assert] = function() {
|
|
127
|
-
testCount++;
|
|
128
|
-
try {
|
|
129
|
-
test[assert].apply(this, arguments);
|
|
130
|
-
passes++;
|
|
131
|
-
} catch(e) {
|
|
132
|
-
sys.puts(name + ': ' + e);
|
|
133
|
-
fails++;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
return assertions;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
if (typeof serverFunc != 'function') {
|
|
142
|
-
tests = serverFunc;
|
|
143
|
-
serverFunc = null;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
for (var name in tests) {
|
|
147
|
-
if (name.match(/^test/)) {
|
|
148
|
-
if (typeof serverFunc == 'function') {
|
|
149
|
-
var res = serverFunc(), host = res[0],
|
|
150
|
-
server = res[1];
|
|
151
|
-
tests[name](host, wrapAssertions(name));
|
|
152
|
-
} else {
|
|
153
|
-
tests[name](wrapAssertions(name));
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
process.addListener('exit', function() {
|
|
159
|
-
var passFail = (testCount == passes) ? ' \033[0;32mPASS\033[1;37m' : ' \033[0;31mFAIL\033[1;37m';
|
|
160
|
-
sys.puts(caseName + " - Assertions: " + testCount + " Passed: " + passes + " Failed: " + fails + passFail);
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
|