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,54 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
LIBRARY = [ "api.js", "feed.js", "lib.js", "cli.js" ]
|
4
|
+
BROWSER_TOOLS = Dir.glob("browser/*").select{|x| x != "browser/export.js" }
|
5
|
+
|
6
|
+
task :default => :export
|
7
|
+
|
8
|
+
desc 'Export Follow for use in web browsers'
|
9
|
+
task :export => ([:clean, "cli.js"] + LIBRARY + BROWSER_TOOLS) do |task|
|
10
|
+
build = "./build"
|
11
|
+
target = "#{build}/follow"
|
12
|
+
|
13
|
+
sh "mkdir", "-p", target
|
14
|
+
LIBRARY.each do |js|
|
15
|
+
sh "node", "browser/export.js", js, "#{target}/#{js}"
|
16
|
+
end
|
17
|
+
|
18
|
+
BROWSER_TOOLS.each do |file|
|
19
|
+
sh "cp", file, build
|
20
|
+
end
|
21
|
+
|
22
|
+
# EventEmitter2 needs wrapping.
|
23
|
+
sh "node", "browser/export.js", "browser/eventemitter2.js", "#{build}/eventemitter2.js"
|
24
|
+
|
25
|
+
File.open("#{build}/boot.js", 'w') do |boot|
|
26
|
+
requirejs_paths = { 'request' => 'request.jquery',
|
27
|
+
'events' => 'eventemitter2',
|
28
|
+
# 'foo' => 'bar', etc.
|
29
|
+
}
|
30
|
+
|
31
|
+
opts = { # 'baseUrl' => "follow",
|
32
|
+
'paths' => requirejs_paths,
|
33
|
+
}
|
34
|
+
|
35
|
+
main_js = "main.js"
|
36
|
+
|
37
|
+
boot.write([ 'require(',
|
38
|
+
'// Options',
|
39
|
+
opts.to_json() + ',',
|
40
|
+
'',
|
41
|
+
'// Modules',
|
42
|
+
[main_js].to_json() + ',',
|
43
|
+
'',
|
44
|
+
'// Code to run when ready',
|
45
|
+
'function(main) { return main(); }',
|
46
|
+
');'
|
47
|
+
].join("\n"));
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
desc 'Clean up build files'
|
52
|
+
task :clean do
|
53
|
+
sh "rm", "-rf", "./build"
|
54
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
// The changes_couchdb API
|
2
|
+
//
|
3
|
+
// Copyright 2011 Iris Couch
|
4
|
+
//
|
5
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
// you may not use this file except in compliance with the License.
|
7
|
+
// You may obtain a copy of the License at
|
8
|
+
//
|
9
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
//
|
11
|
+
// Unless required by applicable law or agreed to in writing, software
|
12
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
// See the License for the specific language governing permissions and
|
15
|
+
// limitations under the License.
|
16
|
+
|
17
|
+
var feed = require('./lib/feed')
|
18
|
+
, stream = require('./lib/stream')
|
19
|
+
|
20
|
+
function follow_feed(opts, cb) {
|
21
|
+
var ch_feed = new feed.Feed(opts);
|
22
|
+
ch_feed.on('error' , function(er) { return cb && cb.call(ch_feed, er) });
|
23
|
+
ch_feed.on('change', function(ch) { return cb && cb.call(ch_feed, null, ch) });
|
24
|
+
|
25
|
+
// Give the caller a chance to hook into any events.
|
26
|
+
process.nextTick(function() {
|
27
|
+
ch_feed.follow();
|
28
|
+
})
|
29
|
+
|
30
|
+
return ch_feed;
|
31
|
+
}
|
32
|
+
|
33
|
+
module.exports = follow_feed;
|
34
|
+
module.exports.Feed = feed.Feed;
|
35
|
+
module.exports.Changes = stream.Changes
|
@@ -0,0 +1,453 @@
|
|
1
|
+
|
2
|
+
;!function(exports, undefined) {
|
3
|
+
|
4
|
+
var isArray = Array.isArray;
|
5
|
+
var defaultMaxListeners = 10;
|
6
|
+
|
7
|
+
function init() {
|
8
|
+
this._events = new Object;
|
9
|
+
}
|
10
|
+
|
11
|
+
function configure(conf) {
|
12
|
+
|
13
|
+
if (conf) {
|
14
|
+
this.wildcard = conf.wildcard;
|
15
|
+
this.delimiter = conf.delimiter || '.';
|
16
|
+
|
17
|
+
if (this.wildcard) {
|
18
|
+
this.listenerTree = new Object;
|
19
|
+
}
|
20
|
+
}
|
21
|
+
}
|
22
|
+
|
23
|
+
function EventEmitter(conf) {
|
24
|
+
this._events = new Object;
|
25
|
+
configure.call(this, conf);
|
26
|
+
}
|
27
|
+
|
28
|
+
function searchListenerTree(handlers, type, tree, i) {
|
29
|
+
if (!tree) {
|
30
|
+
return;
|
31
|
+
}
|
32
|
+
|
33
|
+
var listeners;
|
34
|
+
|
35
|
+
if (i === type.length && tree._listeners) {
|
36
|
+
//
|
37
|
+
// If at the end of the event(s) list and the tree has listeners
|
38
|
+
// invoke those listeners.
|
39
|
+
//
|
40
|
+
if (typeof tree._listeners === 'function') {
|
41
|
+
handlers && handlers.push(tree._listeners);
|
42
|
+
return tree;
|
43
|
+
} else {
|
44
|
+
for (var leaf = 0, len = tree._listeners.length; leaf < len; leaf++) {
|
45
|
+
handlers && handlers.push(tree._listeners[leaf]);
|
46
|
+
}
|
47
|
+
return tree;
|
48
|
+
}
|
49
|
+
}
|
50
|
+
|
51
|
+
if (type[i] === '*' || tree[type[i]]) {
|
52
|
+
//
|
53
|
+
// If the event emitted is '*' at this part
|
54
|
+
// or there is a concrete match at this patch
|
55
|
+
//
|
56
|
+
if (type[i] === '*') {
|
57
|
+
for (var branch in tree) {
|
58
|
+
if (branch !== '_listeners' && tree.hasOwnProperty(branch)) {
|
59
|
+
listeners = searchListenerTree(handlers, type, tree[branch], i+1);
|
60
|
+
}
|
61
|
+
}
|
62
|
+
return listeners;
|
63
|
+
}
|
64
|
+
|
65
|
+
listeners = searchListenerTree(handlers, type, tree[type[i]], i+1);
|
66
|
+
}
|
67
|
+
|
68
|
+
|
69
|
+
if (tree['*']) {
|
70
|
+
//
|
71
|
+
// If the listener tree will allow any match for this part,
|
72
|
+
// then recursively explore all branches of the tree
|
73
|
+
//
|
74
|
+
searchListenerTree(handlers, type, tree['*'], i+1);
|
75
|
+
}
|
76
|
+
|
77
|
+
return listeners;
|
78
|
+
};
|
79
|
+
|
80
|
+
function growListenerTree(type, listener) {
|
81
|
+
|
82
|
+
type = typeof type === 'string' ? type.split(this.delimiter) : type.slice();
|
83
|
+
|
84
|
+
var tree = this.listenerTree;
|
85
|
+
var name = type.shift();
|
86
|
+
|
87
|
+
while (name) {
|
88
|
+
|
89
|
+
if (!tree[name]) {
|
90
|
+
tree[name] = new Object;
|
91
|
+
}
|
92
|
+
|
93
|
+
tree = tree[name];
|
94
|
+
|
95
|
+
if (type.length === 0) {
|
96
|
+
|
97
|
+
if (!tree._listeners) {
|
98
|
+
tree._listeners = listener;
|
99
|
+
}
|
100
|
+
else if(typeof tree._listeners === 'function') {
|
101
|
+
tree._listeners = [tree._listeners, listener];
|
102
|
+
}
|
103
|
+
else if (isArray(tree._listeners)) {
|
104
|
+
|
105
|
+
tree._listeners.push(listener);
|
106
|
+
|
107
|
+
if (!tree._listeners.warned) {
|
108
|
+
|
109
|
+
var m = defaultMaxListeners;
|
110
|
+
|
111
|
+
if (m > 0 && tree._listeners.length > m) {
|
112
|
+
|
113
|
+
tree._listeners.warned = true;
|
114
|
+
console.error('(node) warning: possible EventEmitter memory ' +
|
115
|
+
'leak detected. %d listeners added. ' +
|
116
|
+
'Use emitter.setMaxListeners() to increase limit.',
|
117
|
+
tree._listeners.length);
|
118
|
+
console.trace();
|
119
|
+
}
|
120
|
+
}
|
121
|
+
}
|
122
|
+
return true;
|
123
|
+
}
|
124
|
+
name = type.shift();
|
125
|
+
}
|
126
|
+
return true;
|
127
|
+
};
|
128
|
+
|
129
|
+
// By default EventEmitters will print a warning if more than
|
130
|
+
// 10 listeners are added to it. This is a useful default which
|
131
|
+
// helps finding memory leaks.
|
132
|
+
//
|
133
|
+
// Obviously not all Emitters should be limited to 10. This function allows
|
134
|
+
// that to be increased. Set to zero for unlimited.
|
135
|
+
|
136
|
+
EventEmitter.prototype.setMaxListeners = function(n) {
|
137
|
+
this._events || init.call(this);
|
138
|
+
this._events.maxListeners = n;
|
139
|
+
};
|
140
|
+
|
141
|
+
EventEmitter.prototype.event = '';
|
142
|
+
|
143
|
+
EventEmitter.prototype.once = function(event, fn) {
|
144
|
+
this.many(event, 1, fn);
|
145
|
+
return this;
|
146
|
+
};
|
147
|
+
|
148
|
+
EventEmitter.prototype.many = function(event, ttl, fn) {
|
149
|
+
var self = this;
|
150
|
+
|
151
|
+
if (typeof fn !== 'function') {
|
152
|
+
throw new Error('many only accepts instances of Function');
|
153
|
+
}
|
154
|
+
|
155
|
+
function listener() {
|
156
|
+
if (--ttl === 0) {
|
157
|
+
self.off(event, listener);
|
158
|
+
}
|
159
|
+
fn.apply(null, arguments);
|
160
|
+
};
|
161
|
+
|
162
|
+
listener._origin = fn;
|
163
|
+
|
164
|
+
this.on(event, listener);
|
165
|
+
|
166
|
+
return self;
|
167
|
+
};
|
168
|
+
|
169
|
+
EventEmitter.prototype.emit = function() {
|
170
|
+
this._events || init.call(this);
|
171
|
+
|
172
|
+
var type = arguments[0];
|
173
|
+
|
174
|
+
if (type === 'newListener') {
|
175
|
+
if (!this._events.newListener) { return false; }
|
176
|
+
}
|
177
|
+
|
178
|
+
// Loop through the *_all* functions and invoke them.
|
179
|
+
if (this._all) {
|
180
|
+
var l = arguments.length;
|
181
|
+
var args = new Array(l - 1);
|
182
|
+
for (var i = 1; i < l; i++) args[i - 1] = arguments[i];
|
183
|
+
for (i = 0, l = this._all.length; i < l; i++) {
|
184
|
+
this.event = type;
|
185
|
+
this._all[i].apply(this, args);
|
186
|
+
}
|
187
|
+
}
|
188
|
+
|
189
|
+
// If there is no 'error' event listener then throw.
|
190
|
+
if (type === 'error') {
|
191
|
+
|
192
|
+
if (!this._all &&
|
193
|
+
!this._events.error &&
|
194
|
+
!(this.wildcard && this.listenerTree.error)) {
|
195
|
+
|
196
|
+
if (arguments[1] instanceof Error) {
|
197
|
+
throw arguments[1]; // Unhandled 'error' event
|
198
|
+
} else {
|
199
|
+
throw new Error("Uncaught, unspecified 'error' event.");
|
200
|
+
}
|
201
|
+
return false;
|
202
|
+
}
|
203
|
+
}
|
204
|
+
|
205
|
+
var handler;
|
206
|
+
|
207
|
+
if(this.wildcard) {
|
208
|
+
handler = [];
|
209
|
+
var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice();
|
210
|
+
searchListenerTree.call(this, handler, ns, this.listenerTree, 0);
|
211
|
+
}
|
212
|
+
else {
|
213
|
+
handler = this._events[type];
|
214
|
+
}
|
215
|
+
|
216
|
+
if (typeof handler === 'function') {
|
217
|
+
this.event = type;
|
218
|
+
if (arguments.length === 1) {
|
219
|
+
handler.call(this);
|
220
|
+
}
|
221
|
+
else if (arguments.length > 1)
|
222
|
+
switch (arguments.length) {
|
223
|
+
case 2:
|
224
|
+
handler.call(this, arguments[1]);
|
225
|
+
break;
|
226
|
+
case 3:
|
227
|
+
handler.call(this, arguments[1], arguments[2]);
|
228
|
+
break;
|
229
|
+
// slower
|
230
|
+
default:
|
231
|
+
var l = arguments.length;
|
232
|
+
var args = new Array(l - 1);
|
233
|
+
for (var i = 1; i < l; i++) args[i - 1] = arguments[i];
|
234
|
+
handler.apply(this, args);
|
235
|
+
}
|
236
|
+
return true;
|
237
|
+
}
|
238
|
+
else if (handler) {
|
239
|
+
var l = arguments.length;
|
240
|
+
var args = new Array(l - 1);
|
241
|
+
for (var i = 1; i < l; i++) args[i - 1] = arguments[i];
|
242
|
+
|
243
|
+
var listeners = handler.slice();
|
244
|
+
for (var i = 0, l = listeners.length; i < l; i++) {
|
245
|
+
this.event = type;
|
246
|
+
listeners[i].apply(this, args);
|
247
|
+
}
|
248
|
+
return true;
|
249
|
+
}
|
250
|
+
|
251
|
+
};
|
252
|
+
|
253
|
+
EventEmitter.prototype.on = function(type, listener) {
|
254
|
+
this._events || init.call(this);
|
255
|
+
|
256
|
+
// To avoid recursion in the case that type == "newListeners"! Before
|
257
|
+
// adding it to the listeners, first emit "newListeners".
|
258
|
+
this.emit('newListener', type, listener);
|
259
|
+
|
260
|
+
if(this.wildcard) {
|
261
|
+
growListenerTree.call(this, type, listener);
|
262
|
+
return this;
|
263
|
+
}
|
264
|
+
|
265
|
+
if (!this._events[type]) {
|
266
|
+
// Optimize the case of one listener. Don't need the extra array object.
|
267
|
+
this._events[type] = listener;
|
268
|
+
}
|
269
|
+
else if(typeof this._events[type] === 'function') {
|
270
|
+
// Adding the second element, need to change to array.
|
271
|
+
this._events[type] = [this._events[type], listener];
|
272
|
+
}
|
273
|
+
else if (isArray(this._events[type])) {
|
274
|
+
// If we've already got an array, just append.
|
275
|
+
this._events[type].push(listener);
|
276
|
+
|
277
|
+
// Check for listener leak
|
278
|
+
if (!this._events[type].warned) {
|
279
|
+
|
280
|
+
var m;
|
281
|
+
if (this._events.maxListeners !== undefined) {
|
282
|
+
m = this._events.maxListeners;
|
283
|
+
} else {
|
284
|
+
m = defaultMaxListeners;
|
285
|
+
}
|
286
|
+
|
287
|
+
if (m && m > 0 && this._events[type].length > m) {
|
288
|
+
|
289
|
+
this._events[type].warned = true;
|
290
|
+
console.error('(node) warning: possible EventEmitter memory ' +
|
291
|
+
'leak detected. %d listeners added. ' +
|
292
|
+
'Use emitter.setMaxListeners() to increase limit.',
|
293
|
+
this._events[type].length);
|
294
|
+
console.trace();
|
295
|
+
}
|
296
|
+
}
|
297
|
+
}
|
298
|
+
return this;
|
299
|
+
};
|
300
|
+
|
301
|
+
EventEmitter.prototype.onAny = function(fn) {
|
302
|
+
|
303
|
+
if(!this._all) {
|
304
|
+
this._all = [];
|
305
|
+
}
|
306
|
+
|
307
|
+
if (typeof fn !== 'function') {
|
308
|
+
throw new Error('onAny only accepts instances of Function');
|
309
|
+
}
|
310
|
+
|
311
|
+
// Add the function to the event listener collection.
|
312
|
+
this._all.push(fn);
|
313
|
+
return this;
|
314
|
+
};
|
315
|
+
|
316
|
+
EventEmitter.prototype.addListener = EventEmitter.prototype.on;
|
317
|
+
|
318
|
+
EventEmitter.prototype.off = function(type, listener) {
|
319
|
+
if (typeof listener !== 'function') {
|
320
|
+
throw new Error('removeListener only takes instances of Function');
|
321
|
+
}
|
322
|
+
|
323
|
+
var handlers;
|
324
|
+
|
325
|
+
if(this.wildcard) {
|
326
|
+
var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice();
|
327
|
+
var leaf = searchListenerTree.call(this, null, ns, this.listenerTree, 0);
|
328
|
+
|
329
|
+
if('undefined' === typeof leaf) { return this; }
|
330
|
+
handlers = leaf._listeners;
|
331
|
+
}
|
332
|
+
else {
|
333
|
+
// does not use listeners(), so no side effect of creating _events[type]
|
334
|
+
if (!this._events[type]) return this;
|
335
|
+
handlers = this._events[type];
|
336
|
+
}
|
337
|
+
|
338
|
+
if (isArray(handlers)) {
|
339
|
+
|
340
|
+
var position = -1;
|
341
|
+
|
342
|
+
for (var i = 0, length = handlers.length; i < length; i++) {
|
343
|
+
if (handlers[i] === listener ||
|
344
|
+
(handlers[i].listener && handlers[i].listener === listener) ||
|
345
|
+
(handlers[i]._origin && handlers[i]._origin === listener)) {
|
346
|
+
position = i;
|
347
|
+
break;
|
348
|
+
}
|
349
|
+
}
|
350
|
+
|
351
|
+
if (position < 0) {
|
352
|
+
return this;
|
353
|
+
}
|
354
|
+
|
355
|
+
if(this.wildcard) {
|
356
|
+
leaf._listeners.splice(position, 1)
|
357
|
+
}
|
358
|
+
else {
|
359
|
+
this._events[type].splice(position, 1);
|
360
|
+
}
|
361
|
+
|
362
|
+
if (handlers.length === 0) {
|
363
|
+
if(this.wildcard) {
|
364
|
+
delete leaf._listeners;
|
365
|
+
}
|
366
|
+
else {
|
367
|
+
delete this._events[type];
|
368
|
+
}
|
369
|
+
}
|
370
|
+
}
|
371
|
+
else if (handlers === listener ||
|
372
|
+
(handlers.listener && handlers.listener === listener) ||
|
373
|
+
(handlers._origin && handlers._origin === listener)) {
|
374
|
+
if(this.wildcard) {
|
375
|
+
delete leaf._listeners;
|
376
|
+
}
|
377
|
+
else {
|
378
|
+
delete this._events[type];
|
379
|
+
}
|
380
|
+
}
|
381
|
+
|
382
|
+
return this;
|
383
|
+
};
|
384
|
+
|
385
|
+
EventEmitter.prototype.offAny = function(fn) {
|
386
|
+
var i = 0, l = 0, fns;
|
387
|
+
if (fn && this._all && this._all.length > 0) {
|
388
|
+
fns = this._all;
|
389
|
+
for(i = 0, l = fns.length; i < l; i++) {
|
390
|
+
if(fn === fns[i]) {
|
391
|
+
fns.splice(i, 1);
|
392
|
+
return this;
|
393
|
+
}
|
394
|
+
}
|
395
|
+
} else {
|
396
|
+
this._all = [];
|
397
|
+
}
|
398
|
+
return this;
|
399
|
+
};
|
400
|
+
|
401
|
+
EventEmitter.prototype.removeListener = EventEmitter.prototype.off;
|
402
|
+
|
403
|
+
EventEmitter.prototype.removeAllListeners = function(type) {
|
404
|
+
if (arguments.length === 0) {
|
405
|
+
!this._events || init.call(this);
|
406
|
+
return this;
|
407
|
+
}
|
408
|
+
|
409
|
+
if(this.wildcard) {
|
410
|
+
var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice();
|
411
|
+
var leaf = searchListenerTree.call(this, null, ns, this.listenerTree, 0);
|
412
|
+
|
413
|
+
if('undefined' === typeof leaf) { return this; }
|
414
|
+
leaf._listeners = null;
|
415
|
+
}
|
416
|
+
else {
|
417
|
+
if (!this._events[type]) return this;
|
418
|
+
this._events[type] = null;
|
419
|
+
}
|
420
|
+
return this;
|
421
|
+
};
|
422
|
+
|
423
|
+
EventEmitter.prototype.listeners = function(type) {
|
424
|
+
if(this.wildcard) {
|
425
|
+
var handlers = [];
|
426
|
+
var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice();
|
427
|
+
searchListenerTree.call(this, handlers, ns, this.listenerTree, 0);
|
428
|
+
return handlers;
|
429
|
+
}
|
430
|
+
|
431
|
+
this._events || init.call(this);
|
432
|
+
|
433
|
+
if (!this._events[type]) this._events[type] = [];
|
434
|
+
if (!isArray(this._events[type])) {
|
435
|
+
this._events[type] = [this._events[type]];
|
436
|
+
}
|
437
|
+
return this._events[type];
|
438
|
+
};
|
439
|
+
|
440
|
+
EventEmitter.prototype.listenersAny = function() {
|
441
|
+
|
442
|
+
if(this._all) {
|
443
|
+
return this._all;
|
444
|
+
}
|
445
|
+
else {
|
446
|
+
return [];
|
447
|
+
}
|
448
|
+
|
449
|
+
};
|
450
|
+
|
451
|
+
exports.EventEmitter2 = EventEmitter;
|
452
|
+
|
453
|
+
}(typeof exports === 'undefined' ? window : exports);
|