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,499 @@
|
|
1
|
+
var Q = require("q");
|
2
|
+
var Boot = require("./fs-boot");
|
3
|
+
var RootFs = require("./fs-root");
|
4
|
+
var MockFs = require("./fs-mock");
|
5
|
+
|
6
|
+
// TODO patternToRegExp
|
7
|
+
// TODO glob
|
8
|
+
// TODO match
|
9
|
+
|
10
|
+
var concat = function (arrays) {
|
11
|
+
return Array.prototype.concat.apply([], arrays);
|
12
|
+
};
|
13
|
+
|
14
|
+
exports.update = function (exports, workingDirectory) {
|
15
|
+
|
16
|
+
for (var name in Boot) {
|
17
|
+
exports[name] = Boot[name];
|
18
|
+
}
|
19
|
+
|
20
|
+
/**
|
21
|
+
* Read a complete file.
|
22
|
+
* @param {String} path Path to the file.
|
23
|
+
* @param {String} [options.flags] The mode to open the file with.
|
24
|
+
* @param {String} [options.charset] The charset to open the file with.
|
25
|
+
* @param {Object} [options] An object with options.
|
26
|
+
* second argument.
|
27
|
+
* @returns {Promise * (String || Buffer)}
|
28
|
+
*/
|
29
|
+
exports.read = function (path, flags, charset, options) {
|
30
|
+
if (typeof flags === "object") {
|
31
|
+
options = flags;
|
32
|
+
} else if (typeof charset === "object") {
|
33
|
+
options = charset;
|
34
|
+
options.flags = flags;
|
35
|
+
} else {
|
36
|
+
options = options || {};
|
37
|
+
options.flags = flags;
|
38
|
+
options.charset = charset;
|
39
|
+
}
|
40
|
+
options.flags = options.flags || "r";
|
41
|
+
return Q.when(this.open(path, options), function (stream) {
|
42
|
+
return stream.read();
|
43
|
+
}, function (error) {
|
44
|
+
error.message = "Can't read " + path + " because " + error.message;
|
45
|
+
error.path = path;
|
46
|
+
error.flags = flags;
|
47
|
+
error.charset = charset;
|
48
|
+
throw error;
|
49
|
+
});
|
50
|
+
};
|
51
|
+
|
52
|
+
/**
|
53
|
+
* Write content to a file, overwriting the existing content.
|
54
|
+
* @param {String} path Path to the file.
|
55
|
+
* @param {String || Buffer} content
|
56
|
+
* @param {String} [options.flags] The mode to open the file with.
|
57
|
+
* @param {String} [options.charset] The charset to open the file with.
|
58
|
+
* @param {Object} [options] An object with options.
|
59
|
+
* @returns {Promise * Undefined} a promise that resolves
|
60
|
+
* when the writing is complete.
|
61
|
+
*/
|
62
|
+
exports.write = function (path, content, flags, charset, options) {
|
63
|
+
var self = this;
|
64
|
+
if (typeof flags === "object") {
|
65
|
+
options = flags;
|
66
|
+
} else if (typeof charset === "object") {
|
67
|
+
options = charset;
|
68
|
+
options.flags = flags;
|
69
|
+
} else {
|
70
|
+
options = options || {};
|
71
|
+
options.flags = flags;
|
72
|
+
options.charset = charset;
|
73
|
+
}
|
74
|
+
flags = options.flags || "w";
|
75
|
+
if (flags.indexOf("b") !== -1) {
|
76
|
+
if (!(content instanceof Buffer)) {
|
77
|
+
content = new Buffer(content);
|
78
|
+
}
|
79
|
+
} else if (content instanceof Buffer) {
|
80
|
+
flags += "b";
|
81
|
+
}
|
82
|
+
options.flags = flags;
|
83
|
+
return Q.when(self.open(path, options), function (stream) {
|
84
|
+
return Q.when(stream.write(content), function () {
|
85
|
+
return stream.close();
|
86
|
+
});
|
87
|
+
});
|
88
|
+
};
|
89
|
+
|
90
|
+
/**
|
91
|
+
* Append content to the end of a file.
|
92
|
+
* @param {String} path Path to the file.
|
93
|
+
* @param {String || Buffer} content
|
94
|
+
* @param {String} [options.flags] The mode to open the file with.
|
95
|
+
* @param {String} [options.charset] The charset to open the file with.
|
96
|
+
* @param {Object} [options] An object with options.
|
97
|
+
* @returns {Promise * Undefined} a promise that resolves
|
98
|
+
* when the writing is complete.
|
99
|
+
*/
|
100
|
+
exports.append = function (path, content, flags, charset, options) {
|
101
|
+
var self = this;
|
102
|
+
if (typeof flags === "object") {
|
103
|
+
options = flags;
|
104
|
+
} else if (typeof charset === "object") {
|
105
|
+
options = charset;
|
106
|
+
options.flags = flags;
|
107
|
+
} else {
|
108
|
+
options = options || {};
|
109
|
+
options.flags = flags;
|
110
|
+
options.charset = charset;
|
111
|
+
}
|
112
|
+
flags = options.flags || "a";
|
113
|
+
if (content instanceof Buffer) {
|
114
|
+
flags += "b";
|
115
|
+
}
|
116
|
+
options.flags = flags;
|
117
|
+
return Q.when(self.open(path, options), function (stream) {
|
118
|
+
return Q.when(stream.write(content), function () {
|
119
|
+
return stream.close();
|
120
|
+
});
|
121
|
+
});
|
122
|
+
};
|
123
|
+
|
124
|
+
exports.move = function (source, target) {
|
125
|
+
var self = this;
|
126
|
+
return this.rename(source, target)
|
127
|
+
.catch(function (error) {
|
128
|
+
if (error.crossDevice) {
|
129
|
+
return self.copyTree(source, target)
|
130
|
+
.then(function () {
|
131
|
+
return self.removeTree(source);
|
132
|
+
});
|
133
|
+
} else {
|
134
|
+
throw error;
|
135
|
+
}
|
136
|
+
});
|
137
|
+
};
|
138
|
+
|
139
|
+
exports.copy = function (source, target) {
|
140
|
+
var self = this;
|
141
|
+
return Q.spread([
|
142
|
+
self.open(source, {flags: "rb"}),
|
143
|
+
self.open(target, {flags: "wb"})
|
144
|
+
], function (reader, writer) {
|
145
|
+
return Q.when(reader.forEach(function (block) {
|
146
|
+
return writer.write(block);
|
147
|
+
}), function () {
|
148
|
+
return Q.all([
|
149
|
+
reader.close(),
|
150
|
+
writer.close()
|
151
|
+
]);
|
152
|
+
});
|
153
|
+
});
|
154
|
+
};
|
155
|
+
|
156
|
+
exports.copyTree = function (source, target) {
|
157
|
+
var self = this;
|
158
|
+
return Q.when(self.stat(source), function (stat) {
|
159
|
+
if (stat.isFile()) {
|
160
|
+
return self.copy(source, target);
|
161
|
+
} else if (stat.isDirectory()) {
|
162
|
+
return self.exists(target).then(function (targetExists) {
|
163
|
+
var copySubTree = Q.when(self.list(source), function (list) {
|
164
|
+
return Q.all(list.map(function (child) {
|
165
|
+
return self.copyTree(
|
166
|
+
self.join(source, child),
|
167
|
+
self.join(target, child)
|
168
|
+
);
|
169
|
+
}));
|
170
|
+
});
|
171
|
+
if (targetExists) {
|
172
|
+
return copySubTree;
|
173
|
+
} else {
|
174
|
+
return Q.when(self.makeDirectory(target), function () {
|
175
|
+
return copySubTree;
|
176
|
+
});
|
177
|
+
}
|
178
|
+
});
|
179
|
+
} else if (stat.isSymbolicLink()) {
|
180
|
+
// TODO copy the link and type with readPath (but what about
|
181
|
+
// Windows junction type?)
|
182
|
+
return self.symbolicCopy(source, target);
|
183
|
+
}
|
184
|
+
});
|
185
|
+
};
|
186
|
+
|
187
|
+
exports.listTree = function (basePath, guard) {
|
188
|
+
var self = this;
|
189
|
+
basePath = String(basePath || '');
|
190
|
+
if (!basePath)
|
191
|
+
basePath = ".";
|
192
|
+
guard = guard || function () {
|
193
|
+
return true;
|
194
|
+
};
|
195
|
+
var stat = self.stat(basePath);
|
196
|
+
return Q.when(stat, function (stat) {
|
197
|
+
var paths = [];
|
198
|
+
var mode; // true:include, false:exclude, null:no-recur
|
199
|
+
try {
|
200
|
+
var include = guard(basePath, stat);
|
201
|
+
} catch (exception) {
|
202
|
+
return Q.reject(exception);
|
203
|
+
}
|
204
|
+
return Q.when(include, function (include) {
|
205
|
+
if (include) {
|
206
|
+
paths.push([basePath]);
|
207
|
+
}
|
208
|
+
if (include !== null && stat.isDirectory()) {
|
209
|
+
return Q.when(self.list(basePath), function (children) {
|
210
|
+
paths.push.apply(paths, children.map(function (child) {
|
211
|
+
var path = self.join(basePath, child);
|
212
|
+
return self.listTree(path, guard);
|
213
|
+
}));
|
214
|
+
return paths;
|
215
|
+
});
|
216
|
+
} else {
|
217
|
+
return paths;
|
218
|
+
}
|
219
|
+
});
|
220
|
+
}, function noSuchFile(reason) {
|
221
|
+
return [];
|
222
|
+
}).then(Q.all).then(concat);
|
223
|
+
};
|
224
|
+
|
225
|
+
exports.listDirectoryTree = function (path) {
|
226
|
+
return this.listTree(path, function (path, stat) {
|
227
|
+
return stat.isDirectory();
|
228
|
+
});
|
229
|
+
};
|
230
|
+
|
231
|
+
exports.makeTree = function (path, mode) {
|
232
|
+
path = String(path);
|
233
|
+
var self = this;
|
234
|
+
var parts = self.split(path);
|
235
|
+
var at = [];
|
236
|
+
if (self.isAbsolute(path)) {
|
237
|
+
// On Windows use the root drive (e.g. "C:"), on *nix the first
|
238
|
+
// part is the falsey "", and so use the ROOT ("/")
|
239
|
+
at.push(parts.shift() || self.ROOT);
|
240
|
+
}
|
241
|
+
return parts.reduce(function (parent, part) {
|
242
|
+
return Q.when(parent, function () {
|
243
|
+
at.push(part);
|
244
|
+
var parts = self.join(at) || ".";
|
245
|
+
var made = self.makeDirectory(parts, mode);
|
246
|
+
return Q.when(made, null, function rejected(error) {
|
247
|
+
// throw away errors for already made directories
|
248
|
+
if (error.exists) {
|
249
|
+
return;
|
250
|
+
} else {
|
251
|
+
throw error;
|
252
|
+
}
|
253
|
+
});
|
254
|
+
});
|
255
|
+
}, undefined);
|
256
|
+
};
|
257
|
+
|
258
|
+
exports.removeTree = function (path) {
|
259
|
+
var self = this;
|
260
|
+
return Q.when(self.statLink(path), function (stat) {
|
261
|
+
if (stat.isSymbolicLink()) {
|
262
|
+
return self.remove(path);
|
263
|
+
} else if (stat.isDirectory()) {
|
264
|
+
return self.list(path)
|
265
|
+
.then(function (list) {
|
266
|
+
// asynchronously remove every subtree
|
267
|
+
return Q.all(list.map(function (name) {
|
268
|
+
return self.removeTree(self.join(path, name));
|
269
|
+
}))
|
270
|
+
.then(function () {
|
271
|
+
return self.removeDirectory(path);
|
272
|
+
});
|
273
|
+
});
|
274
|
+
} else {
|
275
|
+
return self.remove(path);
|
276
|
+
}
|
277
|
+
});
|
278
|
+
};
|
279
|
+
|
280
|
+
exports.symbolicCopy = function (source, target, type) {
|
281
|
+
var self = this;
|
282
|
+
return Q.when(self.relative(target, source), function (relative) {
|
283
|
+
return self.symbolicLink(target, relative, type || "file");
|
284
|
+
});
|
285
|
+
};
|
286
|
+
|
287
|
+
exports.exists = function (path) {
|
288
|
+
return Q.when(this.stat(path), function () {
|
289
|
+
return true;
|
290
|
+
}, function () {
|
291
|
+
return false;
|
292
|
+
});
|
293
|
+
};
|
294
|
+
|
295
|
+
exports.isFile = function (path) {
|
296
|
+
return Q.when(this.stat(path), function (stat) {
|
297
|
+
return stat.isFile();
|
298
|
+
}, function (reason) {
|
299
|
+
return false;
|
300
|
+
});
|
301
|
+
};
|
302
|
+
|
303
|
+
exports.isDirectory = function (path) {
|
304
|
+
return Q.when(this.stat(path), function (stat) {
|
305
|
+
return stat.isDirectory();
|
306
|
+
}, function (reason) {
|
307
|
+
return false;
|
308
|
+
});
|
309
|
+
};
|
310
|
+
|
311
|
+
exports.isSymbolicLink = function (path) {
|
312
|
+
return Q.when(this.statLink(path), function (stat) {
|
313
|
+
return stat.isSymbolicLink();
|
314
|
+
}, function (reason) {
|
315
|
+
return false;
|
316
|
+
});
|
317
|
+
};
|
318
|
+
|
319
|
+
exports.lastModified = function (path) {
|
320
|
+
var self = this;
|
321
|
+
return self.stat(path).invoke('lastModified');
|
322
|
+
};
|
323
|
+
|
324
|
+
exports.lastAccessed = function (path) {
|
325
|
+
var self = this;
|
326
|
+
return self.stat(path).invoke('lastAccessed');
|
327
|
+
};
|
328
|
+
|
329
|
+
exports.absolute = function (path) {
|
330
|
+
if (this.isAbsolute(path))
|
331
|
+
return this.normal(path);
|
332
|
+
return this.join(workingDirectory(), path);
|
333
|
+
};
|
334
|
+
|
335
|
+
exports.relative = function (source, target) {
|
336
|
+
var self = this;
|
337
|
+
return Q.when(this.isDirectory(source), function (isDirectory) {
|
338
|
+
if (isDirectory) {
|
339
|
+
return self.relativeFromDirectory(source, target);
|
340
|
+
} else {
|
341
|
+
return self.relativeFromFile(source, target);
|
342
|
+
}
|
343
|
+
});
|
344
|
+
};
|
345
|
+
|
346
|
+
exports.relativeFromFile = function (source, target) {
|
347
|
+
var self = this;
|
348
|
+
source = self.absolute(source);
|
349
|
+
target = self.absolute(target);
|
350
|
+
source = source.split(self.SEPARATORS_RE());
|
351
|
+
target = target.split(self.SEPARATORS_RE());
|
352
|
+
source.pop();
|
353
|
+
while (
|
354
|
+
source.length &&
|
355
|
+
target.length &&
|
356
|
+
target[0] == source[0]
|
357
|
+
) {
|
358
|
+
source.shift();
|
359
|
+
target.shift();
|
360
|
+
}
|
361
|
+
while (source.length) {
|
362
|
+
source.shift();
|
363
|
+
target.unshift("..");
|
364
|
+
}
|
365
|
+
return target.join(self.SEPARATOR);
|
366
|
+
};
|
367
|
+
|
368
|
+
exports.relativeFromDirectory = function (source, target) {
|
369
|
+
if (!target) {
|
370
|
+
target = source;
|
371
|
+
source = workingDirectory();
|
372
|
+
}
|
373
|
+
source = this.absolute(source);
|
374
|
+
target = this.absolute(target);
|
375
|
+
source = source.split(this.SEPARATORS_RE());
|
376
|
+
target = target.split(this.SEPARATORS_RE());
|
377
|
+
if (source.length === 2 && source[1] === "")
|
378
|
+
source.pop();
|
379
|
+
while (
|
380
|
+
source.length &&
|
381
|
+
target.length &&
|
382
|
+
target[0] == source[0]
|
383
|
+
) {
|
384
|
+
source.shift();
|
385
|
+
target.shift();
|
386
|
+
}
|
387
|
+
while (source.length) {
|
388
|
+
source.shift();
|
389
|
+
target.unshift("..");
|
390
|
+
}
|
391
|
+
return target.join(this.SEPARATOR);
|
392
|
+
};
|
393
|
+
|
394
|
+
exports.contains = function (parent, child) {
|
395
|
+
var i, ii;
|
396
|
+
parent = this.absolute(parent);
|
397
|
+
child = this.absolute(child);
|
398
|
+
parent = parent.split(this.SEPARATORS_RE());
|
399
|
+
child = child.split(this.SEPARATORS_RE());
|
400
|
+
if (parent.length === 2 && parent[1] === "")
|
401
|
+
parent.pop();
|
402
|
+
if (parent.length > child.length)
|
403
|
+
return false;
|
404
|
+
for (i = 0, ii = parent.length; i < ii; i++) {
|
405
|
+
if (parent[i] !== child[i])
|
406
|
+
break;
|
407
|
+
}
|
408
|
+
return i == ii;
|
409
|
+
};
|
410
|
+
|
411
|
+
exports.reroot = reroot;
|
412
|
+
function reroot(path) {
|
413
|
+
var self = this;
|
414
|
+
path = path || this.ROOT;
|
415
|
+
return Q.when(this.list(path), function (list) {
|
416
|
+
if (list.length !== 1)
|
417
|
+
return RootFs(self, path);
|
418
|
+
var nextPath = self.join(path, list[0]);
|
419
|
+
return Q.when(self.stat(nextPath), function (stat) {
|
420
|
+
if (stat.isDirectory()) {
|
421
|
+
return reroot(nextPath);
|
422
|
+
} else {
|
423
|
+
return RootFs(self, path);
|
424
|
+
}
|
425
|
+
});
|
426
|
+
});
|
427
|
+
}
|
428
|
+
|
429
|
+
exports.toObject = function (path) {
|
430
|
+
var self = this;
|
431
|
+
var list = self.listTree(path || "", function (path, stat) {
|
432
|
+
return stat.isFile();
|
433
|
+
});
|
434
|
+
return Q.when(list, function (list) {
|
435
|
+
var tree = {};
|
436
|
+
return Q.all(list.map(function (path) {
|
437
|
+
return Q.when(self.read(path, "rb"), function (content) {
|
438
|
+
tree[path] = content;
|
439
|
+
});
|
440
|
+
})).then(function () {
|
441
|
+
return tree;
|
442
|
+
});
|
443
|
+
});
|
444
|
+
};
|
445
|
+
|
446
|
+
exports.merge = function (fss) {
|
447
|
+
var tree = {};
|
448
|
+
var done;
|
449
|
+
fss.forEach(function (fs) {
|
450
|
+
done = Q.when(done, function () {
|
451
|
+
return fs.listTree("", function (path, stat) {
|
452
|
+
return stat.isFile();
|
453
|
+
})
|
454
|
+
.then(function (list) {
|
455
|
+
return Q.all(list.map(function (path) {
|
456
|
+
return Q.when(fs.read(path, "rb"), function (content) {
|
457
|
+
tree[path] = content;
|
458
|
+
});
|
459
|
+
}));
|
460
|
+
});
|
461
|
+
});
|
462
|
+
})
|
463
|
+
return Q.when(done, function () {
|
464
|
+
return MockFs(tree);
|
465
|
+
});
|
466
|
+
};
|
467
|
+
|
468
|
+
exports.Stats = Stats;
|
469
|
+
function Stats(nodeStat) {
|
470
|
+
this.node = nodeStat;
|
471
|
+
this.size = nodeStat.size;
|
472
|
+
}
|
473
|
+
|
474
|
+
var stats = [
|
475
|
+
"isDirectory",
|
476
|
+
"isFile",
|
477
|
+
"isBlockDevice",
|
478
|
+
"isCharacterDevice",
|
479
|
+
"isSymbolicLink",
|
480
|
+
"isFIFO",
|
481
|
+
"isSocket"
|
482
|
+
];
|
483
|
+
|
484
|
+
stats.forEach(function (name) {
|
485
|
+
Stats.prototype[name] = function () {
|
486
|
+
return this.node[name]();
|
487
|
+
};
|
488
|
+
});
|
489
|
+
|
490
|
+
Stats.prototype.lastModified = function () {
|
491
|
+
return new Date(this.node.mtime);
|
492
|
+
};
|
493
|
+
|
494
|
+
Stats.prototype.lastAccessed = function () {
|
495
|
+
return new Date(this.node.atime);
|
496
|
+
};
|
497
|
+
|
498
|
+
}
|
499
|
+
|