traceur-rb 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +22 -0
- data/.rspec +1 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/Gemfile +4 -0
- data/Guardfile +8 -0
- data/LICENSE.txt +22 -0
- data/README.md +87 -0
- data/Rakefile +2 -0
- data/lib/js/compile.js +31 -0
- data/lib/traceur-rb.rb +1 -0
- data/lib/traceur.rb +43 -0
- data/lib/traceur/compilation_options.rb +65 -0
- data/lib/traceur/compiler.rb +33 -0
- data/lib/traceur/configuration.rb +47 -0
- data/lib/traceur/node.rb +26 -0
- data/lib/traceur/node/command_result.rb +28 -0
- data/lib/traceur/node/runner.rb +40 -0
- data/lib/traceur/version.rb +3 -0
- data/spec/examples/classes.js +12 -0
- data/spec/integration/examples_spec.rb +28 -0
- data/spec/spec_helper.rb +1 -0
- data/spec/traceur/compilation_options_spec.rb +31 -0
- data/spec/traceur/configuration_spec.rb +54 -0
- data/spec/traceur/node_spec.rb +15 -0
- data/traceur-rb.gemspec +25 -0
- data/vendor/node_modules/.bin/traceur +3 -0
- data/vendor/node_modules/traceur/README.md +40 -0
- data/vendor/node_modules/traceur/bin/traceur-runtime.js +2101 -0
- data/vendor/node_modules/traceur/bin/traceur.js +23034 -0
- data/vendor/node_modules/traceur/node_modules/.bin/semver +125 -0
- data/vendor/node_modules/traceur/node_modules/commander/Readme.md +208 -0
- data/vendor/node_modules/traceur/node_modules/commander/index.js +852 -0
- data/vendor/node_modules/traceur/node_modules/commander/package.json +40 -0
- data/vendor/node_modules/traceur/node_modules/q-io/.npmignore +1 -0
- data/vendor/node_modules/traceur/node_modules/q-io/.travis.yml +3 -0
- data/vendor/node_modules/traceur/node_modules/q-io/CHANGES.md +122 -0
- data/vendor/node_modules/traceur/node_modules/q-io/LICENSE +19 -0
- data/vendor/node_modules/traceur/node_modules/q-io/README.md +928 -0
- data/vendor/node_modules/traceur/node_modules/q-io/buffer-stream.js +59 -0
- data/vendor/node_modules/traceur/node_modules/q-io/coverage-report.js +44 -0
- data/vendor/node_modules/traceur/node_modules/q-io/deprecate.js +51 -0
- data/vendor/node_modules/traceur/node_modules/q-io/fs-boot.js +307 -0
- data/vendor/node_modules/traceur/node_modules/q-io/fs-common.js +499 -0
- data/vendor/node_modules/traceur/node_modules/q-io/fs-mock.js +547 -0
- data/vendor/node_modules/traceur/node_modules/q-io/fs-root.js +105 -0
- data/vendor/node_modules/traceur/node_modules/q-io/fs.js +355 -0
- data/vendor/node_modules/traceur/node_modules/q-io/fs2http.js +65 -0
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps.js +152 -0
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/chain.js +24 -0
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/content.js +93 -0
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/cookie.js +154 -0
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/decorators.js +178 -0
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/fs.js +417 -0
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/html.js +58 -0
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/json.js +78 -0
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/negotiate.js +120 -0
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/proxy.js +27 -0
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/redirect.js +209 -0
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/route.js +125 -0
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/status.js +175 -0
- data/vendor/node_modules/traceur/node_modules/q-io/http-cookie.js +75 -0
- data/vendor/node_modules/traceur/node_modules/q-io/http.js +378 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/.npmignore +11 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/.travis.yml +4 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/CHANGES.md +78 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/LICENSE.md +21 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/README.md +1285 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/collections.js +22 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/dict.js +142 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/fast-map.js +57 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/fast-set.js +183 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/generic-collection.js +261 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/generic-map.js +186 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/generic-order.js +55 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/generic-set.js +59 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/heap.js +236 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/iterator.js +371 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/list.js +435 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/listen/array-changes.js +247 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/listen/map-changes.js +147 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/listen/property-changes.js +448 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/listen/range-changes.js +139 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/lru-map.js +79 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/lru-set.js +142 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/map.js +60 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/multi-map.js +41 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/node_modules/weak-map/package.json +12 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/node_modules/weak-map/sync +7 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/node_modules/weak-map/sync.patch +48 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/node_modules/weak-map/weak-map.js +590 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/package.json +49 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/set.js +173 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim-array.js +274 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim-function.js +59 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim-object.js +538 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim-regexp.js +14 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim.js +6 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-array-map.js +49 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-array-set.js +51 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-array.js +269 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-map.js +61 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-set.js +736 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/tree-log.js +40 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/weak-map.js +1 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/LICENSE +19 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/README.md +66 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/mime.js +114 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/package.json +35 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/test.js +84 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/types/mime.types +1588 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/types/node.types +77 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/CHANGES +15 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/LICENSE +19 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/README +96 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/lib/mimeparse.js +166 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/package.json +43 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/CONTRIBUTING.md +40 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/LICENSE +19 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/README.md +813 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/benchmark/compare-with-callbacks.js +71 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/benchmark/scenarios.js +36 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/package.json +93 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/q.js +1937 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/queue.js +35 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/.gitmodules +6 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/History.md +36 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/Makefile +7 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/Readme.md +38 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/benchmark.js +32 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/examples.js +39 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/index.js +2 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/lib/querystring.js +123 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/package.json +19 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/.gitmodules +3 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/.npmignore +3 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/History.md +128 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/Makefile +53 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/Readme.md +61 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/bin/expresso +856 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/api.html +1080 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/index.html +377 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/index.md +290 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/layout/foot.html +3 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/layout/head.html +42 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/lib/bar.js +4 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/lib/foo.js +16 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/package.json +12 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/assert.test.js +91 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/async.test.js +12 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/bar.test.js +13 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/foo.test.js +14 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/http.test.js +146 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/serial/async.test.js +39 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/serial/http.test.js +48 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/.gitmodules +3 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/History.md +22 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/Makefile +6 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/Readme.md +248 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/examples/runner.js +53 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/index.js +2 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/lib/eql.js +91 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/lib/should.js +548 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/package.json +8 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/test/should.test.js +358 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/test/querystring.test.js +133 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/.npmignore +3 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/.travis.yml +4 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/LICENSE.md +20 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/README.md +33 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/package.json +37 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/test/url2-spec.js +125 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/url2.js +151 -0
- data/vendor/node_modules/traceur/node_modules/q-io/package.json +51 -0
- data/vendor/node_modules/traceur/node_modules/q-io/reader.js +133 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/boot-directory-spec.js +47 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/contains-spec.js +11 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/fixtures/hello.txt +1 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/issues/1-spec.js +33 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/make-tree-spec.js +92 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/append-spec.js +41 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/copy-tree-spec.js +57 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/fixture/hello.txt +1 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/link-spec.js +70 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/make-tree-spec.js +109 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/merge-spec.js +67 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/move-spec.js +219 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/object-spec.js +20 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/range-spec.js +26 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/read-spec.js +40 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/remove-directory-spec.js +37 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/remove-tree-spec.js +39 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/root-spec.js +32 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/stat-spec.js +26 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/symbolic-link-spec.js +86 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/working-directory-spec.js +31 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/write-spec.js +73 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/range-spec.js +23 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/range-spec.txt +1 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/read-spec.js +22 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/relative-spec.js +25 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/reroot-spec.js +45 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/write-spec.js +38 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/cookie-spec.js +52 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/directory-list-spec.js +86 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/fixtures/01234.txt +1 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/fixtures/1234.txt +1 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/fixtures/5678.txt +0 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/fixtures/9012/3456.txt +0 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/hosts-spec.js +49 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/interpret-range-spec.js +47 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/partial-range-spec.js +186 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/proxy-spec.js +82 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/symbolic-link-spec.js +110 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http/agent-spec.js +96 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http/basic-spec.js +96 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/lib/jasmine-promise.js +42 -0
- data/vendor/node_modules/traceur/node_modules/q-io/writer.js +111 -0
- data/vendor/node_modules/traceur/node_modules/semver/.npmignore +1 -0
- data/vendor/node_modules/traceur/node_modules/semver/LICENSE +27 -0
- data/vendor/node_modules/traceur/node_modules/semver/Makefile +24 -0
- data/vendor/node_modules/traceur/node_modules/semver/README.md +158 -0
- data/vendor/node_modules/traceur/node_modules/semver/bin/semver +125 -0
- data/vendor/node_modules/traceur/node_modules/semver/foot.js +6 -0
- data/vendor/node_modules/traceur/node_modules/semver/head.js +2 -0
- data/vendor/node_modules/traceur/node_modules/semver/package.json +31 -0
- data/vendor/node_modules/traceur/node_modules/semver/semver.browser.js +1039 -0
- data/vendor/node_modules/traceur/node_modules/semver/semver.browser.js.gz +0 -0
- data/vendor/node_modules/traceur/node_modules/semver/semver.js +1043 -0
- data/vendor/node_modules/traceur/node_modules/semver/semver.min.js +1 -0
- data/vendor/node_modules/traceur/node_modules/semver/semver.min.js.gz +0 -0
- data/vendor/node_modules/traceur/node_modules/semver/test/amd.js +15 -0
- data/vendor/node_modules/traceur/node_modules/semver/test/gtr.js +173 -0
- data/vendor/node_modules/traceur/node_modules/semver/test/index.js +584 -0
- data/vendor/node_modules/traceur/node_modules/semver/test/ltr.js +174 -0
- data/vendor/node_modules/traceur/node_modules/semver/test/no-module.js +19 -0
- data/vendor/node_modules/traceur/package.json +64 -0
- data/vendor/node_modules/traceur/src/node/System.js +31 -0
- data/vendor/node_modules/traceur/src/node/api.js +124 -0
- data/vendor/node_modules/traceur/src/node/command.js +141 -0
- data/vendor/node_modules/traceur/src/node/compile-single-file.js +69 -0
- data/vendor/node_modules/traceur/src/node/compiler.js +116 -0
- data/vendor/node_modules/traceur/src/node/deferred.js +110 -0
- data/vendor/node_modules/traceur/src/node/file-util.js +73 -0
- data/vendor/node_modules/traceur/src/node/getopt.js +147 -0
- data/vendor/node_modules/traceur/src/node/inline-module.js +149 -0
- data/vendor/node_modules/traceur/src/node/interpreter.js +33 -0
- data/vendor/node_modules/traceur/src/node/nodeLoader.js +41 -0
- data/vendor/node_modules/traceur/src/node/require.js +85 -0
- data/vendor/node_modules/traceur/src/node/to-amd-compiler.js +33 -0
- data/vendor/node_modules/traceur/src/node/to-commonjs-compiler.js +33 -0
- data/vendor/node_modules/traceur/src/node/traceur.js +32 -0
- data/vendor/node_modules/traceur/traceur +3 -0
- metadata +359 -0
@@ -0,0 +1,547 @@
|
|
1
|
+
|
2
|
+
var Q = require("q");
|
3
|
+
var Boot = require("./fs-boot");
|
4
|
+
var Common = require("./fs-common");
|
5
|
+
var BufferStream = require("./buffer-stream");
|
6
|
+
var Reader = require("./reader");
|
7
|
+
var Set = require("collections/set");
|
8
|
+
|
9
|
+
module.exports = MockFs;
|
10
|
+
|
11
|
+
function MockFs(files, workingDirectory) {
|
12
|
+
if (!(this instanceof MockFs)) {
|
13
|
+
return new MockFs(files, workingDirectory);
|
14
|
+
}
|
15
|
+
this._root = new DirectoryNode(this, "/");
|
16
|
+
|
17
|
+
function init() {
|
18
|
+
// construct a file tree
|
19
|
+
}
|
20
|
+
|
21
|
+
Common.update(this, function () {
|
22
|
+
return workingDirectory;
|
23
|
+
});
|
24
|
+
|
25
|
+
workingDirectory = workingDirectory || this.ROOT;
|
26
|
+
if (files) {
|
27
|
+
this._init(files);
|
28
|
+
}
|
29
|
+
}
|
30
|
+
|
31
|
+
MockFs.prototype = Object.create(Boot);
|
32
|
+
|
33
|
+
MockFs.prototype._init = function (files, tree) {
|
34
|
+
tree = tree || this.ROOT;
|
35
|
+
Object.keys(files).forEach(function (path) {
|
36
|
+
var content = files[path];
|
37
|
+
path = this.join(tree, path);
|
38
|
+
var directory = this.directory(path);
|
39
|
+
var base = this.base(path);
|
40
|
+
var directoryNode = this._root._walk(directory, true);
|
41
|
+
var fileNode = new FileNode(this);
|
42
|
+
if (!(content instanceof Buffer)) {
|
43
|
+
if (typeof content === "object") {
|
44
|
+
// make directory
|
45
|
+
this._root._walk(path, true);
|
46
|
+
// make content
|
47
|
+
this._init(content, path);
|
48
|
+
return;
|
49
|
+
} else {
|
50
|
+
content = new Buffer(String(content), "utf-8");
|
51
|
+
}
|
52
|
+
}
|
53
|
+
directoryNode._entries[base] = fileNode;
|
54
|
+
fileNode._chunks = [content];
|
55
|
+
}, this);
|
56
|
+
};
|
57
|
+
|
58
|
+
MockFs.prototype.list = function (path) {
|
59
|
+
var self = this;
|
60
|
+
return Q.fcall(function () {
|
61
|
+
path = self.absolute(path);
|
62
|
+
var node = self._root._walk(path)._follow(path);
|
63
|
+
if (!node.isDirectory()) {
|
64
|
+
new Error("Can't list non-directory: " + JSON.stringify(path));
|
65
|
+
}
|
66
|
+
return Object.keys(node._entries).sort();
|
67
|
+
});
|
68
|
+
};
|
69
|
+
|
70
|
+
MockFs.prototype.open = function (path, flags, charset, options) {
|
71
|
+
var self = this;
|
72
|
+
return Q.fcall(function () {
|
73
|
+
path = self.absolute(path);
|
74
|
+
var directory = self.directory(path);
|
75
|
+
var base = self.base(path);
|
76
|
+
var node = self._root._walk(directory);
|
77
|
+
if (!node.isDirectory()) {
|
78
|
+
throw new Error("Can't find " + path + " because " + directory + " is not a directory");
|
79
|
+
}
|
80
|
+
if (typeof flags == "object") {
|
81
|
+
options = flags;
|
82
|
+
flags = options.flags;
|
83
|
+
charset = options.charset;
|
84
|
+
} else {
|
85
|
+
options = options || {};
|
86
|
+
}
|
87
|
+
flags = flags || "r";
|
88
|
+
var binary = flags.indexOf("b") >= 0;
|
89
|
+
var write = flags.indexOf("w") >= 0;
|
90
|
+
var append = flags.indexOf("a") >= 0;
|
91
|
+
if (!binary) {
|
92
|
+
charset = charset || "utf-8";
|
93
|
+
}
|
94
|
+
if (write || append) {
|
95
|
+
if (!node._entries[base]) {
|
96
|
+
node._entries[base] = new FileNode(this);
|
97
|
+
}
|
98
|
+
var fileNode = node._entries[base]._follow(path);
|
99
|
+
if (!fileNode.isFile()) {
|
100
|
+
throw new Error("Can't write non-file " + path);
|
101
|
+
}
|
102
|
+
fileNode._modified = new Date();
|
103
|
+
fileNode._accessed = new Date();
|
104
|
+
if (!append) {
|
105
|
+
fileNode._chunks.length = 0;
|
106
|
+
}
|
107
|
+
return new BufferStream(fileNode._chunks, charset);
|
108
|
+
} else { // read
|
109
|
+
if (!node._entries[base]) {
|
110
|
+
throw new Error("Can't read non-existant " + path);
|
111
|
+
}
|
112
|
+
var fileNode = node._entries[base]._follow(path);
|
113
|
+
if (!fileNode.isFile()) {
|
114
|
+
throw new Error("Can't read non-file " + path);
|
115
|
+
}
|
116
|
+
fileNode._accessed = new Date();
|
117
|
+
if ("begin" in options && "end" in options) {
|
118
|
+
return new BufferStream(
|
119
|
+
[
|
120
|
+
Reader.join(fileNode._chunks)
|
121
|
+
.slice(options.begin, options.end)
|
122
|
+
],
|
123
|
+
charset
|
124
|
+
);
|
125
|
+
} else {
|
126
|
+
return new BufferStream(fileNode._chunks, charset);
|
127
|
+
}
|
128
|
+
}
|
129
|
+
});
|
130
|
+
};
|
131
|
+
|
132
|
+
MockFs.prototype.remove = function (path) {
|
133
|
+
var self = this;
|
134
|
+
return Q.fcall(function () {
|
135
|
+
path = self.absolute(path);
|
136
|
+
var directory = self.directory(path);
|
137
|
+
var name = self.base(path);
|
138
|
+
var node = self._root._walk(directory);
|
139
|
+
if (!node.isDirectory()) {
|
140
|
+
throw new Error("Can't remove file from non-directory: " + path);
|
141
|
+
}
|
142
|
+
if (!node._entries[name]) {
|
143
|
+
throw new Error("Can't remove non-existant file: " + path);
|
144
|
+
}
|
145
|
+
if (node._entries[name].isDirectory()) {
|
146
|
+
throw new Error("Can't remove directory. Use removeDirectory: " + path);
|
147
|
+
}
|
148
|
+
delete node._entries[name];
|
149
|
+
});
|
150
|
+
};
|
151
|
+
|
152
|
+
MockFs.prototype.makeDirectory = function (path) {
|
153
|
+
var self = this;
|
154
|
+
return Q.fcall(function () {
|
155
|
+
path = self.absolute(path);
|
156
|
+
var directory = self.directory(path);
|
157
|
+
var name = self.base(path);
|
158
|
+
var node = self._root._walk(directory);
|
159
|
+
if (!node.isDirectory()) {
|
160
|
+
var error = new Error("Can't make directory in non-directory: " + path);
|
161
|
+
error.code = "EEXISTS";
|
162
|
+
error.exists = true;
|
163
|
+
throw error;
|
164
|
+
}
|
165
|
+
if (node._entries[name]) {
|
166
|
+
var error = new Error("Can't make directory. Entry exists: " + path);
|
167
|
+
error.code = "EISDIR";
|
168
|
+
error.exists = true;
|
169
|
+
error.isDirectory = true;
|
170
|
+
throw error;
|
171
|
+
}
|
172
|
+
node._entries[name] = new DirectoryNode(self);
|
173
|
+
});
|
174
|
+
};
|
175
|
+
|
176
|
+
MockFs.prototype.removeDirectory = function (path) {
|
177
|
+
var self = this;
|
178
|
+
return Q.fcall(function () {
|
179
|
+
path = self.absolute(path);
|
180
|
+
var directory = self.directory(path);
|
181
|
+
var name = self.base(path);
|
182
|
+
var node = self._root._walk(directory);
|
183
|
+
if (!node.isDirectory()) {
|
184
|
+
throw new Error("Can't remove directory from non-directory: " + path);
|
185
|
+
}
|
186
|
+
if (!node._entries[name]) {
|
187
|
+
throw new Error("Can't remove non-existant directory: " + path);
|
188
|
+
}
|
189
|
+
if (!node._entries[name].isDirectory()) {
|
190
|
+
throw new Error("Can't remove non-directory: " + path);
|
191
|
+
}
|
192
|
+
delete node._entries[name];
|
193
|
+
});
|
194
|
+
};
|
195
|
+
|
196
|
+
MockFs.prototype.stat = function (path) {
|
197
|
+
var self = this;
|
198
|
+
return Q.fcall(function () {
|
199
|
+
path = self.absolute(path);
|
200
|
+
return new self.Stats(self._root._walk(path)._follow(path));
|
201
|
+
});
|
202
|
+
};
|
203
|
+
|
204
|
+
MockFs.prototype.statLink = function (path) {
|
205
|
+
var self = this;
|
206
|
+
return Q.fcall(function () {
|
207
|
+
path = self.absolute(path);
|
208
|
+
var node = self._root._walk(path);
|
209
|
+
return node;
|
210
|
+
});
|
211
|
+
};
|
212
|
+
|
213
|
+
MockFs.prototype.link = function (source, target) {
|
214
|
+
var self = this;
|
215
|
+
return Q.fcall(function () {
|
216
|
+
source = self.absolute(source);
|
217
|
+
target = self.absolute(target);
|
218
|
+
var sourceNode = self._root._walk(source)._follow(source);
|
219
|
+
if (!sourceNode.isFile()) {
|
220
|
+
throw new Error("Can't link non-file: " + source);
|
221
|
+
}
|
222
|
+
var directory = self.directory(target);
|
223
|
+
var base = self.base(target);
|
224
|
+
var targetNode = self._root._walk(directory)._follow(directory);
|
225
|
+
if (!targetNode.isDirectory()) {
|
226
|
+
throw new Error("Can't create link in non-directory: " + target);
|
227
|
+
}
|
228
|
+
if (targetNode._entries[base] && targetNode._entries[base].isDirectory()) {
|
229
|
+
throw new Error("Can't overwrite existing directory with hard link: " + target);
|
230
|
+
}
|
231
|
+
targetNode._entries[base] = sourceNode;
|
232
|
+
});
|
233
|
+
};
|
234
|
+
|
235
|
+
MockFs.prototype.symbolicLink = function (target, relative, type) {
|
236
|
+
var self = this;
|
237
|
+
return Q.fcall(function () {
|
238
|
+
target = self.absolute(target);
|
239
|
+
var directory = self.directory(target);
|
240
|
+
var base = self.base(target);
|
241
|
+
var node = self._root._walk(directory);
|
242
|
+
if (node._entries[base] && node._entries[base].isDirectory()) {
|
243
|
+
throw new Error("Can't overwrite existing directory with symbolic link: " + target);
|
244
|
+
}
|
245
|
+
node._entries[base] = new LinkNode(self, relative);
|
246
|
+
});
|
247
|
+
};
|
248
|
+
|
249
|
+
MockFs.prototype.chown = function (path, owner) {
|
250
|
+
var self = this;
|
251
|
+
return Q.fcall(function () {
|
252
|
+
path = self.absolute(path);
|
253
|
+
self._root._walk(path)._follow(path)._owner = owner;
|
254
|
+
});
|
255
|
+
};
|
256
|
+
|
257
|
+
MockFs.prototype.chmod = function (path, mode) {
|
258
|
+
var self = this;
|
259
|
+
return Q.fcall(function () {
|
260
|
+
path = self.absolute(path);
|
261
|
+
self._root._walk(path)._follow(path)._mode = mode;
|
262
|
+
});
|
263
|
+
};
|
264
|
+
|
265
|
+
MockFs.prototype.rename = function (source, target) {
|
266
|
+
var self = this;
|
267
|
+
return Q.fcall(function () {
|
268
|
+
source = self.absolute(source);
|
269
|
+
target = self.absolute(target);
|
270
|
+
|
271
|
+
var sourceDirectory = self.directory(source);
|
272
|
+
var sourceDirectoryNode = self._root._walk(sourceDirectory)._follow(sourceDirectory);
|
273
|
+
var sourceName = self.base(source);
|
274
|
+
var sourceNode = sourceDirectoryNode._entries[sourceName];
|
275
|
+
|
276
|
+
if (!sourceNode) {
|
277
|
+
var error = new Error("Can't copy non-existent file: " + source);
|
278
|
+
error.code = "ENOENT";
|
279
|
+
throw error;
|
280
|
+
}
|
281
|
+
|
282
|
+
sourceNode = sourceNode._follow(source);
|
283
|
+
|
284
|
+
// check again after following symbolic links
|
285
|
+
if (!sourceNode) {
|
286
|
+
var error = new Error("Can't copy non-existent file: " + source);
|
287
|
+
error.code = "ENOENT";
|
288
|
+
throw error;
|
289
|
+
}
|
290
|
+
|
291
|
+
var targetDirectory = self.directory(target);
|
292
|
+
var targetDirectoryNode = self._root._walk(targetDirectory)._follow(targetDirectory);
|
293
|
+
var targetName = self.base(target);
|
294
|
+
var targetNode = targetDirectoryNode._entries[targetName]; // might not exist, not followed
|
295
|
+
|
296
|
+
if (targetNode) {
|
297
|
+
targetNode = targetNode._follow(target);
|
298
|
+
}
|
299
|
+
|
300
|
+
if (targetNode && targetNode.isDirectory()) {
|
301
|
+
var error = new Error("Can't copy over existing directory: " + target);
|
302
|
+
error.code = "EISDIR";
|
303
|
+
throw error;
|
304
|
+
}
|
305
|
+
|
306
|
+
// do not copy over self, even with symbolic links to confuse the issue
|
307
|
+
if (targetNode === sourceNode) {
|
308
|
+
return;
|
309
|
+
}
|
310
|
+
|
311
|
+
targetDirectoryNode._entries[targetName] = sourceNode;
|
312
|
+
delete sourceDirectoryNode._entries[sourceName];
|
313
|
+
});
|
314
|
+
};
|
315
|
+
|
316
|
+
MockFs.prototype.readLink = function (path) {
|
317
|
+
var self = this;
|
318
|
+
return Q.fcall(function () {
|
319
|
+
path = self.absolute(path);
|
320
|
+
var node = self._root._walk(path);
|
321
|
+
if (!self.isSymbolicLink()) {
|
322
|
+
throw new Error("Can't read non-symbolic link: " + path);
|
323
|
+
}
|
324
|
+
return node._link;
|
325
|
+
});
|
326
|
+
};
|
327
|
+
|
328
|
+
MockFs.prototype.canonical = function (path) {
|
329
|
+
var self = this;
|
330
|
+
return Q.fcall(function () {
|
331
|
+
path = self.absolute(path);
|
332
|
+
return self._root._canonical(path);
|
333
|
+
});
|
334
|
+
};
|
335
|
+
|
336
|
+
MockFs.mock = mock;
|
337
|
+
function mock(fs, root) {
|
338
|
+
return Q.when(fs.listTree(root), function (list) {
|
339
|
+
var tree = {};
|
340
|
+
return Q.all(list.map(function (path) {
|
341
|
+
var actual = fs.join(root, path);
|
342
|
+
var relative = fs.relativeFromDirectory(root, actual);
|
343
|
+
return Q.when(fs.stat(actual), function (stat) {
|
344
|
+
if (stat.isFile()) {
|
345
|
+
return Q.when(fs.read(path, "rb"), function (content) {
|
346
|
+
tree[relative] = content;
|
347
|
+
});
|
348
|
+
}
|
349
|
+
});
|
350
|
+
})).then(function () {
|
351
|
+
return MockFs(tree);
|
352
|
+
});
|
353
|
+
});
|
354
|
+
}
|
355
|
+
|
356
|
+
function Node(fs) {
|
357
|
+
if (!fs)
|
358
|
+
throw new Error("FS required argument");
|
359
|
+
this._fs = fs;
|
360
|
+
this._accessed = this._modified = new Date();
|
361
|
+
this._mode = parseInt("0644", 8);
|
362
|
+
this._owner = null;
|
363
|
+
}
|
364
|
+
|
365
|
+
Node.prototype._walk = function (path, make, via) {
|
366
|
+
var parts = this._fs.split(path);
|
367
|
+
if (this._fs.isAbsolute(path)) {
|
368
|
+
parts.shift();
|
369
|
+
return this._fs._root._walkParts(parts, make, this._fs.ROOT);
|
370
|
+
} else {
|
371
|
+
return this._walkParts(parts, make, via || this._fs.ROOT);
|
372
|
+
}
|
373
|
+
};
|
374
|
+
|
375
|
+
Node.prototype._walkParts = function (parts, make, via) {
|
376
|
+
if (parts.length === 0) {
|
377
|
+
return this;
|
378
|
+
} else {
|
379
|
+
var part = parts.shift();
|
380
|
+
if (part === "") {
|
381
|
+
return this._walkParts(parts, make, this._fs.join(via, part));
|
382
|
+
} else {
|
383
|
+
var error = new Error("Can't find " + JSON.stringify(this._fs.resolve(part, this._fs.join(parts))) + " via " + JSON.stringify(via));
|
384
|
+
error.code = "ENOENT";
|
385
|
+
throw error;
|
386
|
+
}
|
387
|
+
}
|
388
|
+
};
|
389
|
+
|
390
|
+
Node.prototype._canonical = function (path) {
|
391
|
+
if (!this._fs.isAbsolute(path)) {
|
392
|
+
throw new Error("Path must be absolute for _canonical: " + path);
|
393
|
+
}
|
394
|
+
var parts = this._fs.split(path);
|
395
|
+
parts.shift();
|
396
|
+
var via = this._fs.ROOT;
|
397
|
+
return via + this._fs._root._canonicalParts(parts, via);
|
398
|
+
};
|
399
|
+
|
400
|
+
Node.prototype._canonicalParts = function (parts, via) {
|
401
|
+
if (parts.length === 0) {
|
402
|
+
return via;
|
403
|
+
}
|
404
|
+
return this._fs.join(via, this._fs.join(parts));
|
405
|
+
};
|
406
|
+
|
407
|
+
Node.prototype._follow = function () {
|
408
|
+
return this;
|
409
|
+
};
|
410
|
+
|
411
|
+
Node.prototype._touch = function () {
|
412
|
+
this._modified = new Date();
|
413
|
+
};
|
414
|
+
|
415
|
+
var stats = [
|
416
|
+
"isDirectory",
|
417
|
+
"isFile",
|
418
|
+
"isBlockDevice",
|
419
|
+
"isCharacterDevice",
|
420
|
+
"isSymbolicLink",
|
421
|
+
"isFIFO",
|
422
|
+
"isSocket"
|
423
|
+
];
|
424
|
+
|
425
|
+
stats.forEach(function (name) {
|
426
|
+
Node.prototype[name] = function () {
|
427
|
+
return false;
|
428
|
+
};
|
429
|
+
});
|
430
|
+
|
431
|
+
Node.prototype.lastAccessed = function () {
|
432
|
+
return this._accessed;
|
433
|
+
};
|
434
|
+
|
435
|
+
Node.prototype.lastModified = function () {
|
436
|
+
return this._modified;
|
437
|
+
};
|
438
|
+
|
439
|
+
function FileNode(fs) {
|
440
|
+
Node.call(this, fs);
|
441
|
+
this._chunks = [];
|
442
|
+
}
|
443
|
+
|
444
|
+
FileNode.prototype = Object.create(Node.prototype);
|
445
|
+
|
446
|
+
FileNode.prototype.isFile = function () {
|
447
|
+
return true;
|
448
|
+
};
|
449
|
+
|
450
|
+
Object.defineProperty(FileNode.prototype, "size", {
|
451
|
+
configurable: true,
|
452
|
+
enumerable: true,
|
453
|
+
get: function () {
|
454
|
+
return this._chunks.reduce(function (size, chunk) {
|
455
|
+
return size += chunk.length;
|
456
|
+
}, 0);
|
457
|
+
}
|
458
|
+
});
|
459
|
+
|
460
|
+
function DirectoryNode(fs) {
|
461
|
+
Node.call(this, fs);
|
462
|
+
this._entries = Object.create(null);
|
463
|
+
this._mode = parseInt("0755", 8);
|
464
|
+
}
|
465
|
+
|
466
|
+
DirectoryNode.prototype = Object.create(Node.prototype);
|
467
|
+
|
468
|
+
DirectoryNode.prototype.isDirectory = function () {
|
469
|
+
return true;
|
470
|
+
};
|
471
|
+
|
472
|
+
DirectoryNode.prototype._walkParts = function (parts, make, via) {
|
473
|
+
via = via || this._fs.ROOT;
|
474
|
+
if (parts.length === 0) {
|
475
|
+
return this;
|
476
|
+
}
|
477
|
+
var part = parts.shift();
|
478
|
+
if (part === "") {
|
479
|
+
return this._walkParts(parts, make, this._fs.join(via, part));
|
480
|
+
}
|
481
|
+
if (!this._entries[part]) {
|
482
|
+
if (make) {
|
483
|
+
this._entries[part] = new DirectoryNode(this._fs);
|
484
|
+
} else {
|
485
|
+
var error = new Error("Can't find " + JSON.stringify(this._fs.join(parts)) + " via " + JSON.stringify(via));
|
486
|
+
error.code = "ENOENT";
|
487
|
+
throw error;
|
488
|
+
|
489
|
+
}
|
490
|
+
}
|
491
|
+
return this._entries[part]._walkParts(parts, make, this._fs.join(via, part));
|
492
|
+
};
|
493
|
+
|
494
|
+
DirectoryNode.prototype._canonicalParts = function (parts, via) {
|
495
|
+
if (parts.length === 0) {
|
496
|
+
return via;
|
497
|
+
}
|
498
|
+
var part = parts.shift();
|
499
|
+
if (part === "") {
|
500
|
+
return via;
|
501
|
+
}
|
502
|
+
if (via === this._fs.ROOT) {
|
503
|
+
via = "";
|
504
|
+
}
|
505
|
+
if (!this._entries[part]) {
|
506
|
+
return this._fs.join(via, part, this._fs.join(parts));
|
507
|
+
}
|
508
|
+
return this._entries[part]._canonicalParts(
|
509
|
+
parts,
|
510
|
+
this._fs.join(via, part)
|
511
|
+
);
|
512
|
+
};
|
513
|
+
|
514
|
+
function LinkNode(fs, link) {
|
515
|
+
Node.call(this, fs);
|
516
|
+
this._link = link;
|
517
|
+
}
|
518
|
+
|
519
|
+
LinkNode.prototype = Object.create(Node.prototype);
|
520
|
+
|
521
|
+
LinkNode.prototype.isSymbolicLink = function () {
|
522
|
+
return true;
|
523
|
+
};
|
524
|
+
|
525
|
+
LinkNode.prototype._follow = function (via, memo) {
|
526
|
+
memo = memo || Set();
|
527
|
+
if (memo.has(this)) {
|
528
|
+
var error = new Error("Can't follow symbolic link cycle at " + JSON.stringify(via));
|
529
|
+
error.code = "ELOOP";
|
530
|
+
throw error;
|
531
|
+
}
|
532
|
+
memo.add(this);
|
533
|
+
var link = this._fs.join(via, "..", this._link);
|
534
|
+
return this._walk(link, null, "<link>")._follow(link, memo);
|
535
|
+
};
|
536
|
+
|
537
|
+
LinkNode.prototype._canonicalParts = function (parts, via) {
|
538
|
+
return this._fs.relativeFromDirectory(this._fs.ROOT,
|
539
|
+
this._fs._root._canonical(
|
540
|
+
this._fs.absolute(this._fs.join(via, "..", this._link))
|
541
|
+
)
|
542
|
+
);
|
543
|
+
};
|
544
|
+
|
545
|
+
// cycle breaking
|
546
|
+
var FS = require("./fs");
|
547
|
+
|