vulcan 0.6.1 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -0,0 +1,111 @@
|
|
1
|
+
// Generated by CoffeeScript 1.3.3
|
2
|
+
(function() {
|
3
|
+
var CoffeeScript, cakefileDirectory, fatalError, fs, helpers, missingTask, oparse, options, optparse, path, printTasks, switches, tasks;
|
4
|
+
|
5
|
+
fs = require('fs');
|
6
|
+
|
7
|
+
path = require('path');
|
8
|
+
|
9
|
+
helpers = require('./helpers');
|
10
|
+
|
11
|
+
optparse = require('./optparse');
|
12
|
+
|
13
|
+
CoffeeScript = require('./coffee-script');
|
14
|
+
|
15
|
+
tasks = {};
|
16
|
+
|
17
|
+
options = {};
|
18
|
+
|
19
|
+
switches = [];
|
20
|
+
|
21
|
+
oparse = null;
|
22
|
+
|
23
|
+
helpers.extend(global, {
|
24
|
+
task: function(name, description, action) {
|
25
|
+
var _ref;
|
26
|
+
if (!action) {
|
27
|
+
_ref = [description, action], action = _ref[0], description = _ref[1];
|
28
|
+
}
|
29
|
+
return tasks[name] = {
|
30
|
+
name: name,
|
31
|
+
description: description,
|
32
|
+
action: action
|
33
|
+
};
|
34
|
+
},
|
35
|
+
option: function(letter, flag, description) {
|
36
|
+
return switches.push([letter, flag, description]);
|
37
|
+
},
|
38
|
+
invoke: function(name) {
|
39
|
+
if (!tasks[name]) {
|
40
|
+
missingTask(name);
|
41
|
+
}
|
42
|
+
return tasks[name].action(options);
|
43
|
+
}
|
44
|
+
});
|
45
|
+
|
46
|
+
exports.run = function() {
|
47
|
+
var arg, args, _i, _len, _ref, _results;
|
48
|
+
global.__originalDirname = fs.realpathSync('.');
|
49
|
+
process.chdir(cakefileDirectory(__originalDirname));
|
50
|
+
args = process.argv.slice(2);
|
51
|
+
CoffeeScript.run(fs.readFileSync('Cakefile').toString(), {
|
52
|
+
filename: 'Cakefile'
|
53
|
+
});
|
54
|
+
oparse = new optparse.OptionParser(switches);
|
55
|
+
if (!args.length) {
|
56
|
+
return printTasks();
|
57
|
+
}
|
58
|
+
try {
|
59
|
+
options = oparse.parse(args);
|
60
|
+
} catch (e) {
|
61
|
+
return fatalError("" + e);
|
62
|
+
}
|
63
|
+
_ref = options["arguments"];
|
64
|
+
_results = [];
|
65
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
66
|
+
arg = _ref[_i];
|
67
|
+
_results.push(invoke(arg));
|
68
|
+
}
|
69
|
+
return _results;
|
70
|
+
};
|
71
|
+
|
72
|
+
printTasks = function() {
|
73
|
+
var cakefilePath, desc, name, relative, spaces, task;
|
74
|
+
relative = path.relative || path.resolve;
|
75
|
+
cakefilePath = path.join(relative(__originalDirname, process.cwd()), 'Cakefile');
|
76
|
+
console.log("" + cakefilePath + " defines the following tasks:\n");
|
77
|
+
for (name in tasks) {
|
78
|
+
task = tasks[name];
|
79
|
+
spaces = 20 - name.length;
|
80
|
+
spaces = spaces > 0 ? Array(spaces + 1).join(' ') : '';
|
81
|
+
desc = task.description ? "# " + task.description : '';
|
82
|
+
console.log("cake " + name + spaces + " " + desc);
|
83
|
+
}
|
84
|
+
if (switches.length) {
|
85
|
+
return console.log(oparse.help());
|
86
|
+
}
|
87
|
+
};
|
88
|
+
|
89
|
+
fatalError = function(message) {
|
90
|
+
console.error(message + '\n');
|
91
|
+
console.log('To see a list of all tasks/options, run "cake"');
|
92
|
+
return process.exit(1);
|
93
|
+
};
|
94
|
+
|
95
|
+
missingTask = function(task) {
|
96
|
+
return fatalError("No such task: " + task);
|
97
|
+
};
|
98
|
+
|
99
|
+
cakefileDirectory = function(dir) {
|
100
|
+
var parent;
|
101
|
+
if (path.existsSync(path.join(dir, 'Cakefile'))) {
|
102
|
+
return dir;
|
103
|
+
}
|
104
|
+
parent = path.normalize(path.join(dir, '..'));
|
105
|
+
if (parent !== dir) {
|
106
|
+
return cakefileDirectory(parent);
|
107
|
+
}
|
108
|
+
throw new Error("Cakefile not found in " + (process.cwd()));
|
109
|
+
};
|
110
|
+
|
111
|
+
}).call(this);
|
@@ -0,0 +1,167 @@
|
|
1
|
+
// Generated by CoffeeScript 1.3.3
|
2
|
+
(function() {
|
3
|
+
var Lexer, RESERVED, compile, fs, lexer, parser, path, vm, _ref,
|
4
|
+
__hasProp = {}.hasOwnProperty;
|
5
|
+
|
6
|
+
fs = require('fs');
|
7
|
+
|
8
|
+
path = require('path');
|
9
|
+
|
10
|
+
_ref = require('./lexer'), Lexer = _ref.Lexer, RESERVED = _ref.RESERVED;
|
11
|
+
|
12
|
+
parser = require('./parser').parser;
|
13
|
+
|
14
|
+
vm = require('vm');
|
15
|
+
|
16
|
+
if (require.extensions) {
|
17
|
+
require.extensions['.coffee'] = function(module, filename) {
|
18
|
+
var content;
|
19
|
+
content = compile(fs.readFileSync(filename, 'utf8'), {
|
20
|
+
filename: filename
|
21
|
+
});
|
22
|
+
return module._compile(content, filename);
|
23
|
+
};
|
24
|
+
} else if (require.registerExtension) {
|
25
|
+
require.registerExtension('.coffee', function(content) {
|
26
|
+
return compile(content);
|
27
|
+
});
|
28
|
+
}
|
29
|
+
|
30
|
+
exports.VERSION = '1.3.3';
|
31
|
+
|
32
|
+
exports.RESERVED = RESERVED;
|
33
|
+
|
34
|
+
exports.helpers = require('./helpers');
|
35
|
+
|
36
|
+
exports.compile = compile = function(code, options) {
|
37
|
+
var header, js, merge;
|
38
|
+
if (options == null) {
|
39
|
+
options = {};
|
40
|
+
}
|
41
|
+
merge = exports.helpers.merge;
|
42
|
+
try {
|
43
|
+
js = (parser.parse(lexer.tokenize(code))).compile(options);
|
44
|
+
if (!options.header) {
|
45
|
+
return js;
|
46
|
+
}
|
47
|
+
} catch (err) {
|
48
|
+
if (options.filename) {
|
49
|
+
err.message = "In " + options.filename + ", " + err.message;
|
50
|
+
}
|
51
|
+
throw err;
|
52
|
+
}
|
53
|
+
header = "Generated by CoffeeScript " + this.VERSION;
|
54
|
+
return "// " + header + "\n" + js;
|
55
|
+
};
|
56
|
+
|
57
|
+
exports.tokens = function(code, options) {
|
58
|
+
return lexer.tokenize(code, options);
|
59
|
+
};
|
60
|
+
|
61
|
+
exports.nodes = function(source, options) {
|
62
|
+
if (typeof source === 'string') {
|
63
|
+
return parser.parse(lexer.tokenize(source, options));
|
64
|
+
} else {
|
65
|
+
return parser.parse(source);
|
66
|
+
}
|
67
|
+
};
|
68
|
+
|
69
|
+
exports.run = function(code, options) {
|
70
|
+
var mainModule;
|
71
|
+
if (options == null) {
|
72
|
+
options = {};
|
73
|
+
}
|
74
|
+
mainModule = require.main;
|
75
|
+
mainModule.filename = process.argv[1] = options.filename ? fs.realpathSync(options.filename) : '.';
|
76
|
+
mainModule.moduleCache && (mainModule.moduleCache = {});
|
77
|
+
mainModule.paths = require('module')._nodeModulePaths(path.dirname(fs.realpathSync(options.filename)));
|
78
|
+
if (path.extname(mainModule.filename) !== '.coffee' || require.extensions) {
|
79
|
+
return mainModule._compile(compile(code, options), mainModule.filename);
|
80
|
+
} else {
|
81
|
+
return mainModule._compile(code, mainModule.filename);
|
82
|
+
}
|
83
|
+
};
|
84
|
+
|
85
|
+
exports["eval"] = function(code, options) {
|
86
|
+
var Module, Script, js, k, o, r, sandbox, v, _i, _len, _module, _ref1, _ref2, _require;
|
87
|
+
if (options == null) {
|
88
|
+
options = {};
|
89
|
+
}
|
90
|
+
if (!(code = code.trim())) {
|
91
|
+
return;
|
92
|
+
}
|
93
|
+
Script = vm.Script;
|
94
|
+
if (Script) {
|
95
|
+
if (options.sandbox != null) {
|
96
|
+
if (options.sandbox instanceof Script.createContext().constructor) {
|
97
|
+
sandbox = options.sandbox;
|
98
|
+
} else {
|
99
|
+
sandbox = Script.createContext();
|
100
|
+
_ref1 = options.sandbox;
|
101
|
+
for (k in _ref1) {
|
102
|
+
if (!__hasProp.call(_ref1, k)) continue;
|
103
|
+
v = _ref1[k];
|
104
|
+
sandbox[k] = v;
|
105
|
+
}
|
106
|
+
}
|
107
|
+
sandbox.global = sandbox.root = sandbox.GLOBAL = sandbox;
|
108
|
+
} else {
|
109
|
+
sandbox = global;
|
110
|
+
}
|
111
|
+
sandbox.__filename = options.filename || 'eval';
|
112
|
+
sandbox.__dirname = path.dirname(sandbox.__filename);
|
113
|
+
if (!(sandbox !== global || sandbox.module || sandbox.require)) {
|
114
|
+
Module = require('module');
|
115
|
+
sandbox.module = _module = new Module(options.modulename || 'eval');
|
116
|
+
sandbox.require = _require = function(path) {
|
117
|
+
return Module._load(path, _module, true);
|
118
|
+
};
|
119
|
+
_module.filename = sandbox.__filename;
|
120
|
+
_ref2 = Object.getOwnPropertyNames(require);
|
121
|
+
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
|
122
|
+
r = _ref2[_i];
|
123
|
+
if (r !== 'paths') {
|
124
|
+
_require[r] = require[r];
|
125
|
+
}
|
126
|
+
}
|
127
|
+
_require.paths = _module.paths = Module._nodeModulePaths(process.cwd());
|
128
|
+
_require.resolve = function(request) {
|
129
|
+
return Module._resolveFilename(request, _module);
|
130
|
+
};
|
131
|
+
}
|
132
|
+
}
|
133
|
+
o = {};
|
134
|
+
for (k in options) {
|
135
|
+
if (!__hasProp.call(options, k)) continue;
|
136
|
+
v = options[k];
|
137
|
+
o[k] = v;
|
138
|
+
}
|
139
|
+
o.bare = true;
|
140
|
+
js = compile(code, o);
|
141
|
+
if (sandbox === global) {
|
142
|
+
return vm.runInThisContext(js);
|
143
|
+
} else {
|
144
|
+
return vm.runInContext(js, sandbox);
|
145
|
+
}
|
146
|
+
};
|
147
|
+
|
148
|
+
lexer = new Lexer;
|
149
|
+
|
150
|
+
parser.lexer = {
|
151
|
+
lex: function() {
|
152
|
+
var tag, _ref1;
|
153
|
+
_ref1 = this.tokens[this.pos++] || [''], tag = _ref1[0], this.yytext = _ref1[1], this.yylineno = _ref1[2];
|
154
|
+
return tag;
|
155
|
+
},
|
156
|
+
setInput: function(tokens) {
|
157
|
+
this.tokens = tokens;
|
158
|
+
return this.pos = 0;
|
159
|
+
},
|
160
|
+
upcomingInput: function() {
|
161
|
+
return "";
|
162
|
+
}
|
163
|
+
};
|
164
|
+
|
165
|
+
parser.yy = require('./nodes');
|
166
|
+
|
167
|
+
}).call(this);
|
@@ -0,0 +1,500 @@
|
|
1
|
+
// Generated by CoffeeScript 1.3.3
|
2
|
+
(function() {
|
3
|
+
var BANNER, CoffeeScript, EventEmitter, SWITCHES, compileJoin, compileOptions, compilePath, compileScript, compileStdio, exec, forkNode, fs, helpers, hidden, joinTimeout, lint, loadRequires, notSources, optionParser, optparse, opts, outputPath, parseOptions, path, printLine, printTokens, printWarn, removeSource, sourceCode, sources, spawn, timeLog, unwatchDir, usage, version, wait, watch, watchDir, watchers, writeJs, _ref;
|
4
|
+
|
5
|
+
fs = require('fs');
|
6
|
+
|
7
|
+
path = require('path');
|
8
|
+
|
9
|
+
helpers = require('./helpers');
|
10
|
+
|
11
|
+
optparse = require('./optparse');
|
12
|
+
|
13
|
+
CoffeeScript = require('./coffee-script');
|
14
|
+
|
15
|
+
_ref = require('child_process'), spawn = _ref.spawn, exec = _ref.exec;
|
16
|
+
|
17
|
+
EventEmitter = require('events').EventEmitter;
|
18
|
+
|
19
|
+
helpers.extend(CoffeeScript, new EventEmitter);
|
20
|
+
|
21
|
+
printLine = function(line) {
|
22
|
+
return process.stdout.write(line + '\n');
|
23
|
+
};
|
24
|
+
|
25
|
+
printWarn = function(line) {
|
26
|
+
return process.stderr.write(line + '\n');
|
27
|
+
};
|
28
|
+
|
29
|
+
hidden = function(file) {
|
30
|
+
return /^\.|~$/.test(file);
|
31
|
+
};
|
32
|
+
|
33
|
+
BANNER = 'Usage: coffee [options] path/to/script.coffee -- [args]\n\nIf called without options, `coffee` will run your script.';
|
34
|
+
|
35
|
+
SWITCHES = [['-b', '--bare', 'compile without a top-level function wrapper'], ['-c', '--compile', 'compile to JavaScript and save as .js files'], ['-e', '--eval', 'pass a string from the command line as input'], ['-h', '--help', 'display this help message'], ['-i', '--interactive', 'run an interactive CoffeeScript REPL'], ['-j', '--join [FILE]', 'concatenate the source CoffeeScript before compiling'], ['-l', '--lint', 'pipe the compiled JavaScript through JavaScript Lint'], ['-n', '--nodes', 'print out the parse tree that the parser produces'], ['--nodejs [ARGS]', 'pass options directly to the "node" binary'], ['-o', '--output [DIR]', 'set the output directory for compiled JavaScript'], ['-p', '--print', 'print out the compiled JavaScript'], ['-r', '--require [FILE*]', 'require a library before executing your script'], ['-s', '--stdio', 'listen for and compile scripts over stdio'], ['-t', '--tokens', 'print out the tokens that the lexer/rewriter produce'], ['-v', '--version', 'display the version number'], ['-w', '--watch', 'watch scripts for changes and rerun commands']];
|
36
|
+
|
37
|
+
opts = {};
|
38
|
+
|
39
|
+
sources = [];
|
40
|
+
|
41
|
+
sourceCode = [];
|
42
|
+
|
43
|
+
notSources = {};
|
44
|
+
|
45
|
+
watchers = {};
|
46
|
+
|
47
|
+
optionParser = null;
|
48
|
+
|
49
|
+
exports.run = function() {
|
50
|
+
var literals, source, _i, _len, _results;
|
51
|
+
parseOptions();
|
52
|
+
if (opts.nodejs) {
|
53
|
+
return forkNode();
|
54
|
+
}
|
55
|
+
if (opts.help) {
|
56
|
+
return usage();
|
57
|
+
}
|
58
|
+
if (opts.version) {
|
59
|
+
return version();
|
60
|
+
}
|
61
|
+
if (opts.require) {
|
62
|
+
loadRequires();
|
63
|
+
}
|
64
|
+
if (opts.interactive) {
|
65
|
+
return require('./repl');
|
66
|
+
}
|
67
|
+
if (opts.watch && !fs.watch) {
|
68
|
+
return printWarn("The --watch feature depends on Node v0.6.0+. You are running " + process.version + ".");
|
69
|
+
}
|
70
|
+
if (opts.stdio) {
|
71
|
+
return compileStdio();
|
72
|
+
}
|
73
|
+
if (opts["eval"]) {
|
74
|
+
return compileScript(null, sources[0]);
|
75
|
+
}
|
76
|
+
if (!sources.length) {
|
77
|
+
return require('./repl');
|
78
|
+
}
|
79
|
+
literals = opts.run ? sources.splice(1) : [];
|
80
|
+
process.argv = process.argv.slice(0, 2).concat(literals);
|
81
|
+
process.argv[0] = 'coffee';
|
82
|
+
process.execPath = require.main.filename;
|
83
|
+
_results = [];
|
84
|
+
for (_i = 0, _len = sources.length; _i < _len; _i++) {
|
85
|
+
source = sources[_i];
|
86
|
+
_results.push(compilePath(source, true, path.normalize(source)));
|
87
|
+
}
|
88
|
+
return _results;
|
89
|
+
};
|
90
|
+
|
91
|
+
compilePath = function(source, topLevel, base) {
|
92
|
+
return fs.stat(source, function(err, stats) {
|
93
|
+
if (err && err.code !== 'ENOENT') {
|
94
|
+
throw err;
|
95
|
+
}
|
96
|
+
if ((err != null ? err.code : void 0) === 'ENOENT') {
|
97
|
+
if (topLevel && source.slice(-7) !== '.coffee') {
|
98
|
+
source = sources[sources.indexOf(source)] = "" + source + ".coffee";
|
99
|
+
return compilePath(source, topLevel, base);
|
100
|
+
}
|
101
|
+
if (topLevel) {
|
102
|
+
console.error("File not found: " + source);
|
103
|
+
process.exit(1);
|
104
|
+
}
|
105
|
+
return;
|
106
|
+
}
|
107
|
+
if (stats.isDirectory()) {
|
108
|
+
if (opts.watch) {
|
109
|
+
watchDir(source, base);
|
110
|
+
}
|
111
|
+
return fs.readdir(source, function(err, files) {
|
112
|
+
var file, index, _ref1, _ref2;
|
113
|
+
if (err && err.code !== 'ENOENT') {
|
114
|
+
throw err;
|
115
|
+
}
|
116
|
+
if ((err != null ? err.code : void 0) === 'ENOENT') {
|
117
|
+
return;
|
118
|
+
}
|
119
|
+
index = sources.indexOf(source);
|
120
|
+
files = files.filter(function(file) {
|
121
|
+
return !hidden(file);
|
122
|
+
});
|
123
|
+
[].splice.apply(sources, [index, index - index + 1].concat(_ref1 = (function() {
|
124
|
+
var _i, _len, _results;
|
125
|
+
_results = [];
|
126
|
+
for (_i = 0, _len = files.length; _i < _len; _i++) {
|
127
|
+
file = files[_i];
|
128
|
+
_results.push(path.join(source, file));
|
129
|
+
}
|
130
|
+
return _results;
|
131
|
+
})())), _ref1;
|
132
|
+
[].splice.apply(sourceCode, [index, index - index + 1].concat(_ref2 = files.map(function() {
|
133
|
+
return null;
|
134
|
+
}))), _ref2;
|
135
|
+
return files.forEach(function(file) {
|
136
|
+
return compilePath(path.join(source, file), false, base);
|
137
|
+
});
|
138
|
+
});
|
139
|
+
} else if (topLevel || path.extname(source) === '.coffee') {
|
140
|
+
if (opts.watch) {
|
141
|
+
watch(source, base);
|
142
|
+
}
|
143
|
+
return fs.readFile(source, function(err, code) {
|
144
|
+
if (err && err.code !== 'ENOENT') {
|
145
|
+
throw err;
|
146
|
+
}
|
147
|
+
if ((err != null ? err.code : void 0) === 'ENOENT') {
|
148
|
+
return;
|
149
|
+
}
|
150
|
+
return compileScript(source, code.toString(), base);
|
151
|
+
});
|
152
|
+
} else {
|
153
|
+
notSources[source] = true;
|
154
|
+
return removeSource(source, base);
|
155
|
+
}
|
156
|
+
});
|
157
|
+
};
|
158
|
+
|
159
|
+
compileScript = function(file, input, base) {
|
160
|
+
var o, options, t, task;
|
161
|
+
o = opts;
|
162
|
+
options = compileOptions(file);
|
163
|
+
try {
|
164
|
+
t = task = {
|
165
|
+
file: file,
|
166
|
+
input: input,
|
167
|
+
options: options
|
168
|
+
};
|
169
|
+
CoffeeScript.emit('compile', task);
|
170
|
+
if (o.tokens) {
|
171
|
+
return printTokens(CoffeeScript.tokens(t.input));
|
172
|
+
} else if (o.nodes) {
|
173
|
+
return printLine(CoffeeScript.nodes(t.input).toString().trim());
|
174
|
+
} else if (o.run) {
|
175
|
+
return CoffeeScript.run(t.input, t.options);
|
176
|
+
} else if (o.join && t.file !== o.join) {
|
177
|
+
sourceCode[sources.indexOf(t.file)] = t.input;
|
178
|
+
return compileJoin();
|
179
|
+
} else {
|
180
|
+
t.output = CoffeeScript.compile(t.input, t.options);
|
181
|
+
CoffeeScript.emit('success', task);
|
182
|
+
if (o.print) {
|
183
|
+
return printLine(t.output.trim());
|
184
|
+
} else if (o.compile) {
|
185
|
+
return writeJs(t.file, t.output, base);
|
186
|
+
} else if (o.lint) {
|
187
|
+
return lint(t.file, t.output);
|
188
|
+
}
|
189
|
+
}
|
190
|
+
} catch (err) {
|
191
|
+
CoffeeScript.emit('failure', err, task);
|
192
|
+
if (CoffeeScript.listeners('failure').length) {
|
193
|
+
return;
|
194
|
+
}
|
195
|
+
if (o.watch) {
|
196
|
+
return printLine(err.message + '\x07');
|
197
|
+
}
|
198
|
+
printWarn(err instanceof Error && err.stack || ("ERROR: " + err));
|
199
|
+
return process.exit(1);
|
200
|
+
}
|
201
|
+
};
|
202
|
+
|
203
|
+
compileStdio = function() {
|
204
|
+
var code, stdin;
|
205
|
+
code = '';
|
206
|
+
stdin = process.openStdin();
|
207
|
+
stdin.on('data', function(buffer) {
|
208
|
+
if (buffer) {
|
209
|
+
return code += buffer.toString();
|
210
|
+
}
|
211
|
+
});
|
212
|
+
return stdin.on('end', function() {
|
213
|
+
return compileScript(null, code);
|
214
|
+
});
|
215
|
+
};
|
216
|
+
|
217
|
+
joinTimeout = null;
|
218
|
+
|
219
|
+
compileJoin = function() {
|
220
|
+
if (!opts.join) {
|
221
|
+
return;
|
222
|
+
}
|
223
|
+
if (!sourceCode.some(function(code) {
|
224
|
+
return code === null;
|
225
|
+
})) {
|
226
|
+
clearTimeout(joinTimeout);
|
227
|
+
return joinTimeout = wait(100, function() {
|
228
|
+
return compileScript(opts.join, sourceCode.join('\n'), opts.join);
|
229
|
+
});
|
230
|
+
}
|
231
|
+
};
|
232
|
+
|
233
|
+
loadRequires = function() {
|
234
|
+
var realFilename, req, _i, _len, _ref1;
|
235
|
+
realFilename = module.filename;
|
236
|
+
module.filename = '.';
|
237
|
+
_ref1 = opts.require;
|
238
|
+
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
|
239
|
+
req = _ref1[_i];
|
240
|
+
require(req);
|
241
|
+
}
|
242
|
+
return module.filename = realFilename;
|
243
|
+
};
|
244
|
+
|
245
|
+
watch = function(source, base) {
|
246
|
+
var compile, compileTimeout, prevStats, rewatch, watchErr, watcher;
|
247
|
+
prevStats = null;
|
248
|
+
compileTimeout = null;
|
249
|
+
watchErr = function(e) {
|
250
|
+
if (e.code === 'ENOENT') {
|
251
|
+
if (sources.indexOf(source) === -1) {
|
252
|
+
return;
|
253
|
+
}
|
254
|
+
try {
|
255
|
+
rewatch();
|
256
|
+
return compile();
|
257
|
+
} catch (e) {
|
258
|
+
removeSource(source, base, true);
|
259
|
+
return compileJoin();
|
260
|
+
}
|
261
|
+
} else {
|
262
|
+
throw e;
|
263
|
+
}
|
264
|
+
};
|
265
|
+
compile = function() {
|
266
|
+
clearTimeout(compileTimeout);
|
267
|
+
return compileTimeout = wait(25, function() {
|
268
|
+
return fs.stat(source, function(err, stats) {
|
269
|
+
if (err) {
|
270
|
+
return watchErr(err);
|
271
|
+
}
|
272
|
+
if (prevStats && stats.size === prevStats.size && stats.mtime.getTime() === prevStats.mtime.getTime()) {
|
273
|
+
return rewatch();
|
274
|
+
}
|
275
|
+
prevStats = stats;
|
276
|
+
return fs.readFile(source, function(err, code) {
|
277
|
+
if (err) {
|
278
|
+
return watchErr(err);
|
279
|
+
}
|
280
|
+
compileScript(source, code.toString(), base);
|
281
|
+
return rewatch();
|
282
|
+
});
|
283
|
+
});
|
284
|
+
});
|
285
|
+
};
|
286
|
+
try {
|
287
|
+
watcher = fs.watch(source, compile);
|
288
|
+
} catch (e) {
|
289
|
+
watchErr(e);
|
290
|
+
}
|
291
|
+
return rewatch = function() {
|
292
|
+
if (watcher != null) {
|
293
|
+
watcher.close();
|
294
|
+
}
|
295
|
+
return watcher = fs.watch(source, compile);
|
296
|
+
};
|
297
|
+
};
|
298
|
+
|
299
|
+
watchDir = function(source, base) {
|
300
|
+
var readdirTimeout, watcher;
|
301
|
+
readdirTimeout = null;
|
302
|
+
try {
|
303
|
+
return watcher = fs.watch(source, function() {
|
304
|
+
clearTimeout(readdirTimeout);
|
305
|
+
return readdirTimeout = wait(25, function() {
|
306
|
+
return fs.readdir(source, function(err, files) {
|
307
|
+
var file, _i, _len, _results;
|
308
|
+
if (err) {
|
309
|
+
if (err.code !== 'ENOENT') {
|
310
|
+
throw err;
|
311
|
+
}
|
312
|
+
watcher.close();
|
313
|
+
return unwatchDir(source, base);
|
314
|
+
}
|
315
|
+
_results = [];
|
316
|
+
for (_i = 0, _len = files.length; _i < _len; _i++) {
|
317
|
+
file = files[_i];
|
318
|
+
if (!(!hidden(file) && !notSources[file])) {
|
319
|
+
continue;
|
320
|
+
}
|
321
|
+
file = path.join(source, file);
|
322
|
+
if (sources.some(function(s) {
|
323
|
+
return s.indexOf(file) >= 0;
|
324
|
+
})) {
|
325
|
+
continue;
|
326
|
+
}
|
327
|
+
sources.push(file);
|
328
|
+
sourceCode.push(null);
|
329
|
+
_results.push(compilePath(file, false, base));
|
330
|
+
}
|
331
|
+
return _results;
|
332
|
+
});
|
333
|
+
});
|
334
|
+
});
|
335
|
+
} catch (e) {
|
336
|
+
if (e.code !== 'ENOENT') {
|
337
|
+
throw e;
|
338
|
+
}
|
339
|
+
}
|
340
|
+
};
|
341
|
+
|
342
|
+
unwatchDir = function(source, base) {
|
343
|
+
var file, prevSources, toRemove, _i, _len;
|
344
|
+
prevSources = sources.slice(0);
|
345
|
+
toRemove = (function() {
|
346
|
+
var _i, _len, _results;
|
347
|
+
_results = [];
|
348
|
+
for (_i = 0, _len = sources.length; _i < _len; _i++) {
|
349
|
+
file = sources[_i];
|
350
|
+
if (file.indexOf(source) >= 0) {
|
351
|
+
_results.push(file);
|
352
|
+
}
|
353
|
+
}
|
354
|
+
return _results;
|
355
|
+
})();
|
356
|
+
for (_i = 0, _len = toRemove.length; _i < _len; _i++) {
|
357
|
+
file = toRemove[_i];
|
358
|
+
removeSource(file, base, true);
|
359
|
+
}
|
360
|
+
if (!sources.some(function(s, i) {
|
361
|
+
return prevSources[i] !== s;
|
362
|
+
})) {
|
363
|
+
return;
|
364
|
+
}
|
365
|
+
return compileJoin();
|
366
|
+
};
|
367
|
+
|
368
|
+
removeSource = function(source, base, removeJs) {
|
369
|
+
var index, jsPath;
|
370
|
+
index = sources.indexOf(source);
|
371
|
+
sources.splice(index, 1);
|
372
|
+
sourceCode.splice(index, 1);
|
373
|
+
if (removeJs && !opts.join) {
|
374
|
+
jsPath = outputPath(source, base);
|
375
|
+
return path.exists(jsPath, function(exists) {
|
376
|
+
if (exists) {
|
377
|
+
return fs.unlink(jsPath, function(err) {
|
378
|
+
if (err && err.code !== 'ENOENT') {
|
379
|
+
throw err;
|
380
|
+
}
|
381
|
+
return timeLog("removed " + source);
|
382
|
+
});
|
383
|
+
}
|
384
|
+
});
|
385
|
+
}
|
386
|
+
};
|
387
|
+
|
388
|
+
outputPath = function(source, base) {
|
389
|
+
var baseDir, dir, filename, srcDir;
|
390
|
+
filename = path.basename(source, path.extname(source)) + '.js';
|
391
|
+
srcDir = path.dirname(source);
|
392
|
+
baseDir = base === '.' ? srcDir : srcDir.substring(base.length);
|
393
|
+
dir = opts.output ? path.join(opts.output, baseDir) : srcDir;
|
394
|
+
return path.join(dir, filename);
|
395
|
+
};
|
396
|
+
|
397
|
+
writeJs = function(source, js, base) {
|
398
|
+
var compile, jsDir, jsPath;
|
399
|
+
jsPath = outputPath(source, base);
|
400
|
+
jsDir = path.dirname(jsPath);
|
401
|
+
compile = function() {
|
402
|
+
if (js.length <= 0) {
|
403
|
+
js = ' ';
|
404
|
+
}
|
405
|
+
return fs.writeFile(jsPath, js, function(err) {
|
406
|
+
if (err) {
|
407
|
+
return printLine(err.message);
|
408
|
+
} else if (opts.compile && opts.watch) {
|
409
|
+
return timeLog("compiled " + source);
|
410
|
+
}
|
411
|
+
});
|
412
|
+
};
|
413
|
+
return path.exists(jsDir, function(exists) {
|
414
|
+
if (exists) {
|
415
|
+
return compile();
|
416
|
+
} else {
|
417
|
+
return exec("mkdir -p " + jsDir, compile);
|
418
|
+
}
|
419
|
+
});
|
420
|
+
};
|
421
|
+
|
422
|
+
wait = function(milliseconds, func) {
|
423
|
+
return setTimeout(func, milliseconds);
|
424
|
+
};
|
425
|
+
|
426
|
+
timeLog = function(message) {
|
427
|
+
return console.log("" + ((new Date).toLocaleTimeString()) + " - " + message);
|
428
|
+
};
|
429
|
+
|
430
|
+
lint = function(file, js) {
|
431
|
+
var conf, jsl, printIt;
|
432
|
+
printIt = function(buffer) {
|
433
|
+
return printLine(file + ':\t' + buffer.toString().trim());
|
434
|
+
};
|
435
|
+
conf = __dirname + '/../../extras/jsl.conf';
|
436
|
+
jsl = spawn('jsl', ['-nologo', '-stdin', '-conf', conf]);
|
437
|
+
jsl.stdout.on('data', printIt);
|
438
|
+
jsl.stderr.on('data', printIt);
|
439
|
+
jsl.stdin.write(js);
|
440
|
+
return jsl.stdin.end();
|
441
|
+
};
|
442
|
+
|
443
|
+
printTokens = function(tokens) {
|
444
|
+
var strings, tag, token, value;
|
445
|
+
strings = (function() {
|
446
|
+
var _i, _len, _ref1, _results;
|
447
|
+
_results = [];
|
448
|
+
for (_i = 0, _len = tokens.length; _i < _len; _i++) {
|
449
|
+
token = tokens[_i];
|
450
|
+
_ref1 = [token[0], token[1].toString().replace(/\n/, '\\n')], tag = _ref1[0], value = _ref1[1];
|
451
|
+
_results.push("[" + tag + " " + value + "]");
|
452
|
+
}
|
453
|
+
return _results;
|
454
|
+
})();
|
455
|
+
return printLine(strings.join(' '));
|
456
|
+
};
|
457
|
+
|
458
|
+
parseOptions = function() {
|
459
|
+
var i, o, source, _i, _len;
|
460
|
+
optionParser = new optparse.OptionParser(SWITCHES, BANNER);
|
461
|
+
o = opts = optionParser.parse(process.argv.slice(2));
|
462
|
+
o.compile || (o.compile = !!o.output);
|
463
|
+
o.run = !(o.compile || o.print || o.lint);
|
464
|
+
o.print = !!(o.print || (o["eval"] || o.stdio && o.compile));
|
465
|
+
sources = o["arguments"];
|
466
|
+
for (i = _i = 0, _len = sources.length; _i < _len; i = ++_i) {
|
467
|
+
source = sources[i];
|
468
|
+
sourceCode[i] = null;
|
469
|
+
}
|
470
|
+
};
|
471
|
+
|
472
|
+
compileOptions = function(filename) {
|
473
|
+
return {
|
474
|
+
filename: filename,
|
475
|
+
bare: opts.bare,
|
476
|
+
header: opts.compile
|
477
|
+
};
|
478
|
+
};
|
479
|
+
|
480
|
+
forkNode = function() {
|
481
|
+
var args, nodeArgs;
|
482
|
+
nodeArgs = opts.nodejs.split(/\s+/);
|
483
|
+
args = process.argv.slice(1);
|
484
|
+
args.splice(args.indexOf('--nodejs'), 2);
|
485
|
+
return spawn(process.execPath, nodeArgs.concat(args), {
|
486
|
+
cwd: process.cwd(),
|
487
|
+
env: process.env,
|
488
|
+
customFds: [0, 1, 2]
|
489
|
+
});
|
490
|
+
};
|
491
|
+
|
492
|
+
usage = function() {
|
493
|
+
return printLine((new optparse.OptionParser(SWITCHES, BANNER)).help());
|
494
|
+
};
|
495
|
+
|
496
|
+
version = function() {
|
497
|
+
return printLine("CoffeeScript version " + CoffeeScript.VERSION);
|
498
|
+
};
|
499
|
+
|
500
|
+
}).call(this);
|