opal 0.10.6 → 0.11.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.codeclimate.yml +19 -0
- data/.gitmodules +1 -1
- data/.jshintrc +1 -2
- data/.travis.yml +26 -18
- data/CHANGELOG.md +89 -23
- data/{CODE_OF_CONDUCT.md → CONDUCT.md} +0 -0
- data/Gemfile +19 -21
- data/HACKING.md +2 -0
- data/README.md +7 -6
- data/Rakefile +1 -1
- data/appveyor.yml +21 -4
- data/benchmark-ips/bm_case.rb +33 -0
- data/benchmark-ips/bm_constants_lookup.rb +13 -0
- data/benchmark-ips/bm_is_number.rb +29 -0
- data/benchmark-ips/bm_symbol_to_proc.rb +19 -0
- data/benchmark/bm_constant_lookup_big.rb +799 -0
- data/benchmark/bm_constant_lookup_small.rb +59 -0
- data/benchmark/bm_module_definition_big.rb +400 -0
- data/benchmark/bm_module_definition_small.rb +30 -0
- data/bin/opal-repl +23 -1
- data/docs/compiled_ruby.md +16 -14
- data/docs/faq.md +3 -3
- data/docs/rspec.md +2 -1
- data/docs/unsupported_features.md +6 -4
- data/examples/rack/Gemfile +1 -0
- data/examples/rack/app/application.rb +14 -3
- data/examples/rack/app/user.rb +2 -0
- data/examples/rack/config.ru +1 -1
- data/examples/rack/index.html.erb +1 -0
- data/lib/opal.rb +6 -1
- data/lib/opal/ast/builder.rb +17 -0
- data/lib/opal/ast/node.rb +30 -0
- data/lib/opal/builder.rb +14 -3
- data/lib/opal/builder_processors.rb +1 -0
- data/lib/opal/cli.rb +45 -59
- data/lib/opal/cli_options.rb +11 -7
- data/lib/opal/cli_runners.rb +1 -0
- data/lib/opal/cli_runners/applescript.rb +3 -3
- data/lib/opal/cli_runners/nashorn.rb +1 -0
- data/lib/opal/cli_runners/nodejs.rb +4 -1
- data/lib/opal/cli_runners/phantom.js +1 -2
- data/lib/opal/cli_runners/phantomjs.rb +3 -2
- data/lib/opal/cli_runners/server.rb +1 -0
- data/lib/opal/compiler.rb +145 -94
- data/lib/opal/config.rb +1 -0
- data/lib/opal/deprecations.rb +18 -0
- data/lib/opal/erb.rb +1 -0
- data/lib/opal/errors.rb +1 -0
- data/lib/opal/fragment.rb +1 -0
- data/lib/opal/hike_path_finder.rb +1 -0
- data/lib/opal/nodes.rb +3 -0
- data/lib/opal/nodes/arglist.rb +2 -1
- data/lib/opal/nodes/args/initialize_kwargs.rb +1 -0
- data/lib/opal/nodes/args/kwarg.rb +7 -7
- data/lib/opal/nodes/args/kwoptarg.rb +6 -7
- data/lib/opal/nodes/args/kwrestarg.rb +5 -5
- data/lib/opal/nodes/args/mlhsarg.rb +3 -2
- data/lib/opal/nodes/args/normarg.rb +6 -7
- data/lib/opal/nodes/args/optarg.rb +5 -7
- data/lib/opal/nodes/args/post_args.rb +6 -5
- data/lib/opal/nodes/args/post_kwargs.rb +1 -0
- data/lib/opal/nodes/args/restarg.rb +7 -7
- data/lib/opal/nodes/array.rb +1 -0
- data/lib/opal/nodes/base.rb +24 -3
- data/lib/opal/nodes/call.rb +167 -155
- data/lib/opal/nodes/call_special.rb +31 -217
- data/lib/opal/nodes/case.rb +36 -22
- data/lib/opal/nodes/class.rb +4 -3
- data/lib/opal/nodes/constants.rb +28 -48
- data/lib/opal/nodes/csend.rb +25 -0
- data/lib/opal/nodes/def.rb +49 -16
- data/lib/opal/nodes/defined.rb +170 -60
- data/lib/opal/nodes/definitions.rb +40 -133
- data/lib/opal/nodes/defs.rb +29 -0
- data/lib/opal/nodes/for.rb +52 -25
- data/lib/opal/nodes/hash.rb +12 -35
- data/lib/opal/nodes/helpers.rb +27 -54
- data/lib/opal/nodes/if.rb +21 -32
- data/lib/opal/nodes/inline_args.rb +12 -13
- data/lib/opal/nodes/iter.rb +61 -36
- data/lib/opal/nodes/literal.rb +189 -116
- data/lib/opal/nodes/logic.rb +20 -25
- data/lib/opal/nodes/masgn.rb +20 -18
- data/lib/opal/nodes/module.rb +10 -11
- data/lib/opal/nodes/node_with_args.rb +14 -17
- data/lib/opal/nodes/rescue.rb +37 -70
- data/lib/opal/nodes/runtime_helpers.rb +8 -3
- data/lib/opal/nodes/scope.rb +9 -5
- data/lib/opal/nodes/singleton_class.rb +4 -3
- data/lib/opal/nodes/super.rb +115 -87
- data/lib/opal/nodes/top.rb +7 -2
- data/lib/opal/nodes/variables.rb +46 -35
- data/lib/opal/nodes/while.rb +11 -1
- data/lib/opal/nodes/yield.rb +1 -17
- data/lib/opal/parser.rb +28 -770
- data/lib/opal/path_reader.rb +5 -1
- data/lib/opal/paths.rb +10 -4
- data/lib/opal/regexp_anchors.rb +1 -0
- data/lib/opal/rewriter.rb +60 -0
- data/lib/opal/rewriters/base.rb +60 -0
- data/lib/opal/rewriters/binary_operator_assignment.rb +144 -0
- data/lib/opal/rewriters/block_to_iter.rb +17 -0
- data/lib/opal/rewriters/break_finder.rb +34 -0
- data/lib/opal/rewriters/dot_js_syntax.rb +60 -0
- data/lib/opal/rewriters/explicit_writer_return.rb +58 -0
- data/lib/opal/rewriters/js_reserved_words.rb +111 -0
- data/lib/opal/rewriters/logical_operator_assignment.rb +155 -0
- data/lib/opal/rewriters/opal_engine_check.rb +42 -0
- data/lib/opal/rewriters/rubyspec/filters_rewriter.rb +67 -0
- data/lib/opal/server.rb +4 -0
- data/lib/opal/simple_server.rb +100 -0
- data/lib/opal/source_map.rb +1 -1
- data/lib/opal/util.rb +5 -5
- data/lib/opal/version.rb +2 -1
- data/lib/tilt/opal.rb +1 -0
- data/opal.gemspec +8 -7
- data/opal/README.md +1 -1
- data/opal/corelib/array.rb +137 -83
- data/opal/corelib/basic_object.rb +6 -6
- data/opal/corelib/class.rb +14 -11
- data/opal/corelib/complex.rb +5 -1
- data/opal/corelib/constants.rb +3 -3
- data/opal/corelib/enumerable.rb +129 -11
- data/opal/corelib/error.rb +35 -17
- data/opal/corelib/file.rb +65 -170
- data/opal/corelib/hash.rb +128 -13
- data/opal/corelib/helpers.rb +12 -15
- data/opal/corelib/io.rb +1 -0
- data/opal/corelib/kernel.rb +40 -21
- data/opal/corelib/marshal/read_buffer.rb +1 -1
- data/opal/corelib/method.rb +33 -13
- data/opal/corelib/module.rb +133 -81
- data/opal/corelib/number.rb +141 -25
- data/opal/corelib/numeric.rb +0 -8
- data/opal/corelib/process.rb +44 -4
- data/opal/corelib/random.rb +117 -0
- data/opal/corelib/random/seedrandom.js.rb +15 -0
- data/opal/corelib/range.rb +133 -10
- data/opal/corelib/regexp.rb +37 -9
- data/opal/corelib/runtime.js +601 -390
- data/opal/corelib/string.rb +39 -8
- data/opal/corelib/string/encoding.rb +51 -7
- data/opal/corelib/struct.rb +20 -0
- data/opal/corelib/time.rb +3 -3
- data/opal/corelib/variables.rb +1 -1
- data/opal/opal.rb +1 -0
- data/spec/filters/bugs/array.rb +5 -1
- data/spec/filters/bugs/basicobject.rb +2 -5
- data/spec/filters/bugs/bigdecimal.rb +8 -22
- data/spec/filters/bugs/class.rb +2 -1
- data/spec/filters/bugs/comparable.rb +5 -0
- data/spec/filters/bugs/date.rb +3 -3
- data/spec/filters/bugs/enumerable.rb +4 -11
- data/spec/filters/bugs/enumerator.rb +2 -4
- data/spec/filters/bugs/exception.rb +16 -2
- data/spec/filters/bugs/file.rb +8 -0
- data/spec/filters/bugs/float.rb +7 -1
- data/spec/filters/bugs/hash.rb +6 -2
- data/spec/filters/bugs/integer.rb +2 -0
- data/spec/filters/bugs/io.rb +8 -0
- data/spec/filters/bugs/kernel.rb +9 -138
- data/spec/filters/bugs/language.rb +89 -174
- data/spec/filters/bugs/marshal.rb +33 -35
- data/spec/filters/bugs/method.rb +0 -24
- data/spec/filters/bugs/module.rb +19 -55
- data/spec/filters/bugs/numeric.rb +0 -119
- data/spec/filters/bugs/pathname.rb +2 -0
- data/spec/filters/bugs/proc.rb +5 -4
- data/spec/filters/bugs/random.rb +7 -0
- data/spec/filters/bugs/range.rb +12 -120
- data/spec/filters/bugs/rational.rb +1 -1
- data/spec/filters/bugs/regexp.rb +2 -40
- data/spec/filters/bugs/set.rb +0 -1
- data/spec/filters/bugs/string.rb +5 -8
- data/spec/filters/bugs/stringscanner.rb +11 -19
- data/spec/filters/bugs/time.rb +7 -1
- data/spec/filters/bugs/unboundmethod.rb +1 -11
- data/spec/filters/unsupported/array.rb +5 -1
- data/spec/filters/unsupported/basicobject.rb +1 -1
- data/spec/filters/unsupported/bignum.rb +4 -1
- data/spec/filters/unsupported/class.rb +1 -1
- data/spec/filters/unsupported/delegator.rb +1 -1
- data/spec/filters/unsupported/enumerable.rb +1 -1
- data/spec/filters/unsupported/enumerator.rb +1 -1
- data/spec/filters/unsupported/file.rb +4 -0
- data/spec/filters/unsupported/fixnum.rb +1 -1
- data/spec/filters/unsupported/float.rb +4 -1
- data/spec/filters/unsupported/freeze.rb +27 -5
- data/spec/filters/unsupported/hash.rb +7 -15
- data/spec/filters/unsupported/integer.rb +1 -1
- data/spec/filters/unsupported/kernel.rb +2 -1
- data/spec/filters/unsupported/language.rb +6 -1
- data/spec/filters/unsupported/marshal.rb +1 -1
- data/spec/filters/unsupported/matchdata.rb +4 -1
- data/spec/filters/unsupported/math.rb +1 -1
- data/spec/filters/unsupported/pathname.rb +1 -1
- data/spec/filters/unsupported/privacy.rb +141 -9
- data/spec/filters/unsupported/proc.rb +1 -1
- data/spec/filters/unsupported/random.rb +4 -0
- data/spec/filters/unsupported/range.rb +7 -0
- data/spec/filters/unsupported/regexp.rb +25 -15
- data/spec/filters/unsupported/set.rb +1 -1
- data/spec/filters/unsupported/singleton.rb +1 -1
- data/spec/filters/unsupported/string.rb +110 -101
- data/spec/filters/unsupported/struct.rb +1 -1
- data/spec/filters/unsupported/symbol.rb +2 -1
- data/spec/filters/unsupported/taint.rb +22 -7
- data/spec/filters/unsupported/thread.rb +1 -1
- data/spec/filters/unsupported/time.rb +1 -1
- data/spec/lib/builder_spec.rb +17 -0
- data/spec/lib/cli_spec.rb +37 -8
- data/spec/lib/compiler/call_spec.rb +98 -66
- data/spec/lib/compiler_spec.rb +39 -30
- data/spec/lib/dependency_resolver_spec.rb +2 -2
- data/spec/lib/deprecations_spec.rb +16 -0
- data/spec/lib/fixtures/source_location_test.rb +7 -0
- data/spec/lib/rewriters/binary_operator_assignment_spec.rb +151 -0
- data/spec/lib/rewriters/block_to_iter_spec.rb +28 -0
- data/spec/lib/rewriters/dot_js_syntax_spec.rb +108 -0
- data/spec/lib/rewriters/explicit_writer_return_spec.rb +186 -0
- data/spec/lib/rewriters/js_reserved_words_spec.rb +116 -0
- data/spec/lib/rewriters/logical_operator_assignment_spec.rb +202 -0
- data/spec/lib/rewriters/opal_engine_check_spec.rb +82 -0
- data/spec/lib/rewriters/rubyspec/filters_rewriter_spec.rb +53 -0
- data/spec/lib/simple_server_spec.rb +54 -0
- data/spec/mspec-opal/formatters.rb +65 -17
- data/spec/mspec-opal/runner.rb +47 -67
- data/spec/opal/core/date_spec.rb +14 -0
- data/spec/opal/core/exception_spec.rb +10 -0
- data/spec/opal/core/hash/internals_spec.rb +10 -10
- data/spec/opal/core/kernel/rand_spec.rb +0 -4
- data/spec/opal/core/kernel/respond_to_spec.rb +5 -2
- data/spec/opal/core/language/constant_lookup_spec.rb +38 -0
- data/spec/opal/core/language/predefined_spec.rb +1 -1
- data/spec/opal/core/language/safe_navigator_spec.rb +7 -0
- data/spec/opal/core/language/send_spec.rb +1 -9
- data/spec/opal/core/language/string_spec.rb +8 -8
- data/spec/opal/core/language/versions/def_2_0_spec.rb +0 -4
- data/spec/opal/core/language_spec.rb +32 -0
- data/spec/opal/core/module/const_get_spec.rb +1 -1
- data/spec/opal/core/runtime/is_a_spec.rb +36 -0
- data/spec/opal/core/runtime/rescue_spec.rb +35 -0
- data/spec/opal/core/runtime_spec.rb +4 -4
- data/spec/opal/core/string_spec.rb +8 -8
- data/spec/opal/core/time_spec.rb +26 -17
- data/spec/opal/stdlib/erb/quoted.opalerb +1 -1
- data/spec/opal/stdlib/json/parse_spec.rb +4 -0
- data/spec/opal/stdlib/native/hash_spec.rb +16 -0
- data/spec/ruby_specs +2 -1
- data/spec/spec_helper.rb +1 -0
- data/spec/support/rewriters_helper.rb +24 -0
- data/stdlib/base64.rb +4 -2
- data/stdlib/bigdecimal/bignumber.js.rb +1 -1
- data/stdlib/date.rb +18 -19
- data/stdlib/json.rb +16 -4
- data/stdlib/nashorn/file.rb +15 -0
- data/stdlib/native.rb +21 -12
- data/stdlib/nodejs/dir.rb +1 -1
- data/stdlib/nodejs/file.rb +49 -20
- data/stdlib/nodejs/io.rb +22 -1
- data/stdlib/nodejs/{node_modules/js-yaml/dist/js-yaml.js → js-yaml-3-6-1.js} +815 -626
- data/stdlib/nodejs/kernel.rb +3 -1
- data/stdlib/nodejs/package.json +0 -1
- data/stdlib/nodejs/stacktrace.rb +163 -0
- data/stdlib/nodejs/yaml.rb +2 -1
- data/stdlib/opal-platform.rb +15 -0
- data/stdlib/opal/platform.rb +5 -13
- data/stdlib/pathname.rb +1 -1
- data/stdlib/strscan.rb +15 -1
- data/stdlib/yaml.rb +1 -1
- data/tasks/benchmarking.rake +9 -0
- data/tasks/building.rake +24 -20
- data/tasks/linting.rake +24 -13
- data/tasks/testing.rake +322 -205
- data/tasks/testing/mspec_special_calls.rb +44 -15
- data/tasks/testing/opal_rspec_smoketest.Gemfile +13 -0
- data/test/nodejs/fixtures/hello.rb +1 -0
- data/test/nodejs/test_file.rb +57 -0
- data/test/nodejs/test_io.rb +18 -0
- data/test/nodejs/test_opal_builder.rb +12 -0
- data/test/opal/unsupported_and_bugs.rb +9 -0
- metadata +127 -240
- data/lib/opal/parser/grammar.rb +0 -6157
- data/lib/opal/parser/grammar.y +0 -2011
- data/lib/opal/parser/keywords.rb +0 -66
- data/lib/opal/parser/lexer.rb +0 -1352
- data/lib/opal/parser/parser_scope.rb +0 -28
- data/lib/opal/parser/sexp.rb +0 -90
- data/lib/opal/sprockets.rb +0 -77
- data/lib/opal/sprockets/environment.rb +0 -23
- data/lib/opal/sprockets/erb.rb +0 -28
- data/lib/opal/sprockets/path_reader.rb +0 -36
- data/lib/opal/sprockets/processor.rb +0 -173
- data/lib/opal/sprockets/server.rb +0 -133
- data/lib/opal/sprockets/source_map_header_patch.rb +0 -41
- data/lib/opal/sprockets/source_map_server.rb +0 -117
- data/spec/filters/bugs/compiler_opal.rb +0 -5
- data/spec/filters/bugs/language_opal.rb +0 -88
- data/spec/filters/unsupported/module.rb +0 -8
- data/spec/lib/compiler/pre_processed_conditionals_spec.rb +0 -87
- data/spec/lib/lexer_spec.rb +0 -110
- data/spec/lib/parser/alias_spec.rb +0 -26
- data/spec/lib/parser/and_spec.rb +0 -13
- data/spec/lib/parser/aref_spec.rb +0 -10
- data/spec/lib/parser/attrasgn_spec.rb +0 -28
- data/spec/lib/parser/begin_spec.rb +0 -42
- data/spec/lib/parser/block_spec.rb +0 -12
- data/spec/lib/parser/break_spec.rb +0 -17
- data/spec/lib/parser/call_spec.rb +0 -201
- data/spec/lib/parser/class_spec.rb +0 -35
- data/spec/lib/parser/comments_spec.rb +0 -11
- data/spec/lib/parser/def_spec.rb +0 -109
- data/spec/lib/parser/if_spec.rb +0 -26
- data/spec/lib/parser/iter_spec.rb +0 -59
- data/spec/lib/parser/lambda_spec.rb +0 -219
- data/spec/lib/parser/literal_spec.rb +0 -118
- data/spec/lib/parser/masgn_spec.rb +0 -37
- data/spec/lib/parser/module_spec.rb +0 -27
- data/spec/lib/parser/not_spec.rb +0 -21
- data/spec/lib/parser/op_asgn1_spec.rb +0 -23
- data/spec/lib/parser/op_asgn2_spec.rb +0 -23
- data/spec/lib/parser/op_asgn_spec.rb +0 -17
- data/spec/lib/parser/or_spec.rb +0 -13
- data/spec/lib/parser/return_spec.rb +0 -22
- data/spec/lib/parser/sclass_spec.rb +0 -21
- data/spec/lib/parser/string_spec.rb +0 -286
- data/spec/lib/parser/super_spec.rb +0 -20
- data/spec/lib/parser/unary_spec.rb +0 -52
- data/spec/lib/parser/undef_spec.rb +0 -19
- data/spec/lib/parser/unless_spec.rb +0 -13
- data/spec/lib/parser/variables_spec.rb +0 -112
- data/spec/lib/parser/while_spec.rb +0 -15
- data/spec/lib/parser/yield_spec.rb +0 -20
- data/spec/lib/sprockets/erb_spec.rb +0 -38
- data/spec/lib/sprockets/path_reader_spec.rb +0 -41
- data/spec/lib/sprockets/processor_spec.rb +0 -79
- data/spec/lib/sprockets/server_spec.rb +0 -102
- data/spec/lib/sprockets_spec.rb +0 -39
- data/spec/lib/tilt/opal_spec.rb +0 -37
- data/spec/opal/core/language/block_spec.rb +0 -538
- data/spec/opal/core/language/proc_spec.rb +0 -263
- data/spec/opal/core/language/variables_spec.rb +0 -1366
- data/spec/opal/core/runtime/block_send_spec.rb +0 -28
- data/spec/opal/core/runtime/send_spec.rb +0 -34
- data/spec/support/parser_helpers.rb +0 -37
- data/stdlib/nodejs/node_modules/js-yaml/HISTORY.md +0 -277
- data/stdlib/nodejs/node_modules/js-yaml/LICENSE +0 -21
- data/stdlib/nodejs/node_modules/js-yaml/README.md +0 -288
- data/stdlib/nodejs/node_modules/js-yaml/bin/js-yaml.js +0 -140
- data/stdlib/nodejs/node_modules/js-yaml/bower.json +0 -23
- data/stdlib/nodejs/node_modules/js-yaml/dist/js-yaml.min.js +0 -3
- data/stdlib/nodejs/node_modules/js-yaml/examples/custom_types.js +0 -102
- data/stdlib/nodejs/node_modules/js-yaml/examples/custom_types.yml +0 -18
- data/stdlib/nodejs/node_modules/js-yaml/examples/dumper.js +0 -31
- data/stdlib/nodejs/node_modules/js-yaml/examples/dumper.json +0 -22
- data/stdlib/nodejs/node_modules/js-yaml/examples/sample_document.js +0 -18
- data/stdlib/nodejs/node_modules/js-yaml/examples/sample_document.yml +0 -197
- data/stdlib/nodejs/node_modules/js-yaml/index.js +0 -7
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml.js +0 -39
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/common.js +0 -62
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/dumper.js +0 -554
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/exception.js +0 -25
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/loader.js +0 -1581
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/mark.js +0 -78
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/schema.js +0 -103
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/schema/core.js +0 -18
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/schema/default_full.js +0 -25
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/schema/default_safe.js +0 -28
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/schema/failsafe.js +0 -17
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/schema/json.js +0 -25
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type.js +0 -61
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/binary.js +0 -133
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/bool.js +0 -37
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/float.js +0 -110
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/int.js +0 -183
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/js/function.js +0 -85
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/js/regexp.js +0 -84
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/js/undefined.js +0 -27
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/map.js +0 -8
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/merge.js +0 -12
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/null.js +0 -36
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/omap.js +0 -56
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/pairs.js +0 -61
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/seq.js +0 -8
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/set.js +0 -33
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/str.js +0 -8
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/timestamp.js +0 -98
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/HISTORY.md +0 -115
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/LICENSE +0 -21
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/README.md +0 -239
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/arguments.js +0 -36
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/choice.js +0 -22
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/constants.js +0 -59
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/help.js +0 -13
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/nargs.js +0 -33
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/parents.js +0 -28
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/prefix_chars.js +0 -23
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/sub_commands.js +0 -49
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/sum.js +0 -35
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/testformatters.js +0 -270
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/index.js +0 -1
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action.js +0 -146
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/append.js +0 -55
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/append/constant.js +0 -47
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/count.js +0 -40
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/help.js +0 -48
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/store.js +0 -50
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/store/constant.js +0 -43
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/store/false.js +0 -27
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/store/true.js +0 -26
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/subparsers.js +0 -148
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/version.js +0 -50
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action_container.js +0 -481
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/argparse.js +0 -14
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/argument/error.js +0 -50
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/argument/exclusive.js +0 -54
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/argument/group.js +0 -75
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/argument_parser.js +0 -1168
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/const.js +0 -18
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/help/added_formatters.js +0 -88
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/help/formatter.js +0 -798
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/namespace.js +0 -77
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/.npmignore +0 -2
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/.travis.yml +0 -8
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/README.markdown +0 -825
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/bower.json +0 -33
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/component.json +0 -11
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/foo.js +0 -10
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/gulpfile.js +0 -26
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/lib/underscore.string.js +0 -673
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/libpeerconnection.log +0 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/package.json +0 -107
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore/LICENSE +0 -23
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore/README.md +0 -22
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore/package.json +0 -69
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore/underscore-min.js +0 -6
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore/underscore.js +0 -1415
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/package.json +0 -62
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/README.md +0 -73
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/bin/esparse.js +0 -117
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/bin/esvalidate.js +0 -177
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/esprima.js +0 -3908
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/package.json +0 -69
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/test/compat.js +0 -239
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/test/reflect.js +0 -422
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/test/run.js +0 -66
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/test/runner.js +0 -387
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/test/test.js +0 -20238
- data/stdlib/nodejs/node_modules/js-yaml/package.json +0 -83
data/stdlib/nodejs/kernel.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
module Kernel
|
4
4
|
NODE_REQUIRE = `require`
|
5
5
|
|
6
|
-
def caller
|
6
|
+
def caller(*args)
|
7
7
|
%x{
|
8
8
|
var stack;
|
9
9
|
try {
|
@@ -24,6 +24,7 @@ end
|
|
24
24
|
ARGV = `process.argv.slice(2)`
|
25
25
|
|
26
26
|
ENV = Object.new
|
27
|
+
|
27
28
|
def ENV.[]= name, value
|
28
29
|
`process.env[#{name.to_s}] = #{value.to_s}`
|
29
30
|
end
|
@@ -31,3 +32,4 @@ end
|
|
31
32
|
def ENV.[] name
|
32
33
|
`process.env[#{name}] || nil`
|
33
34
|
end
|
35
|
+
|
data/stdlib/nodejs/package.json
CHANGED
@@ -0,0 +1,163 @@
|
|
1
|
+
# SOURCE: https://raw.githubusercontent.com/RReverser/stack-displayname/13732cedc506200ee8465edcbfce00a9e914853c/displayName.js
|
2
|
+
|
3
|
+
# Copyright 2014 Ingvar Stepanyan
|
4
|
+
#
|
5
|
+
# Copyright 2006-2011, the V8 project authors. All rights reserved.
|
6
|
+
# Redistribution and use in source and binary forms, with or without
|
7
|
+
# modification, are permitted provided that the following conditions are
|
8
|
+
# met:
|
9
|
+
#
|
10
|
+
# * Redistributions of source code must retain the above copyright
|
11
|
+
# notice, this list of conditions and the following disclaimer.
|
12
|
+
# * Redistributions in binary form must reproduce the above
|
13
|
+
# copyright notice, this list of conditions and the following
|
14
|
+
# disclaimer in the documentation and/or other materials provided
|
15
|
+
# with the distribution.
|
16
|
+
# * Neither the name of Google Inc. nor the names of its
|
17
|
+
# contributors may be used to endorse or promote products derived
|
18
|
+
# from this software without specific prior written permission.
|
19
|
+
#
|
20
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
21
|
+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
22
|
+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
23
|
+
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
24
|
+
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
25
|
+
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
26
|
+
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
27
|
+
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
28
|
+
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
29
|
+
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
30
|
+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
31
|
+
|
32
|
+
%x{
|
33
|
+
(function () {
|
34
|
+
|
35
|
+
if (!Error.captureStackTrace) {
|
36
|
+
return;
|
37
|
+
}
|
38
|
+
|
39
|
+
var ObjectToString = Object.prototype.toString;
|
40
|
+
|
41
|
+
var NODE = ObjectToString.call(this.process) === "[object process]";
|
42
|
+
|
43
|
+
// https://github.com/v8/v8/blob/cab94bbe3d532d85705950ed049a294050fcb4c9/src/messages.js#L1112-L1124 [converted to JS]
|
44
|
+
function GetTypeName(receiver, requireConstructor) {
|
45
|
+
var constructor = receiver.constructor;
|
46
|
+
if (!constructor) {
|
47
|
+
return requireConstructor ? null : ObjectToString.call(receiver);
|
48
|
+
}
|
49
|
+
var constructorName = constructor.name;
|
50
|
+
if (!constructorName) {
|
51
|
+
return requireConstructor ? null : ObjectToString.call(receiver);
|
52
|
+
}
|
53
|
+
return constructorName;
|
54
|
+
}
|
55
|
+
|
56
|
+
// https://github.com/v8/v8/blob/cab94bbe3d532d85705950ed049a294050fcb4c9/src/messages.js#L917-L981 [converted & modified]
|
57
|
+
function CallSiteToString() {
|
58
|
+
var fileName;
|
59
|
+
var fileLocation = "";
|
60
|
+
if (this.isNative()) {
|
61
|
+
fileLocation = "native";
|
62
|
+
} else {
|
63
|
+
fileName = this.getScriptNameOrSourceURL();
|
64
|
+
if (!fileName && this.isEval()) {
|
65
|
+
fileLocation = this.getEvalOrigin();
|
66
|
+
fileLocation += ", "; // Expecting source position to follow.
|
67
|
+
}
|
68
|
+
|
69
|
+
if (fileName) {
|
70
|
+
fileLocation += fileName;
|
71
|
+
} else {
|
72
|
+
// Source code does not originate from a file and is not native, but we
|
73
|
+
// can still get the source position inside the source string, e.g. in
|
74
|
+
// an eval string.
|
75
|
+
fileLocation += "<anonymous>";
|
76
|
+
}
|
77
|
+
var lineNumber = this.getLineNumber();
|
78
|
+
if (lineNumber !== null) {
|
79
|
+
fileLocation += ":" + lineNumber;
|
80
|
+
var columnNumber = this.getColumnNumber();
|
81
|
+
if (columnNumber) {
|
82
|
+
fileLocation += ":" + columnNumber;
|
83
|
+
}
|
84
|
+
}
|
85
|
+
}
|
86
|
+
|
87
|
+
var line = "";
|
88
|
+
var func = this.getFunction();
|
89
|
+
var customName = func.displayName;
|
90
|
+
if (NODE && customName) {
|
91
|
+
customName = "\x1B[32m" + customName + "\x1B[39m";
|
92
|
+
}
|
93
|
+
var functionName = customName || this.getFunctionName();
|
94
|
+
var addSuffix = true;
|
95
|
+
var isConstructor = this.isConstructor();
|
96
|
+
var isMethodCall = !(this.isToplevel() || isConstructor);
|
97
|
+
if (isMethodCall) {
|
98
|
+
var typeName = GetTypeName(this.receiver, true);
|
99
|
+
var methodName = this.getMethodName();
|
100
|
+
if (functionName) {
|
101
|
+
if (!customName && typeName && functionName.indexOf(typeName) !== 0) {
|
102
|
+
line += typeName + ".";
|
103
|
+
}
|
104
|
+
line += functionName;
|
105
|
+
if (methodName && functionName.indexOf("." + methodName) !== functionName.length - methodName.length - 1) {
|
106
|
+
line += " [as " + methodName + "]";
|
107
|
+
}
|
108
|
+
} else {
|
109
|
+
line += typeName + "." + (methodName || "<anonymous>");
|
110
|
+
}
|
111
|
+
} else if (isConstructor) {
|
112
|
+
line += "new " + (functionName || "<anonymous>");
|
113
|
+
} else if (functionName) {
|
114
|
+
line += functionName;
|
115
|
+
} else {
|
116
|
+
line += fileLocation;
|
117
|
+
addSuffix = false;
|
118
|
+
}
|
119
|
+
if (addSuffix) {
|
120
|
+
line += " (" + fileLocation + ")";
|
121
|
+
}
|
122
|
+
return line;
|
123
|
+
}
|
124
|
+
|
125
|
+
var ErrorToString = Error.prototype.toString;
|
126
|
+
|
127
|
+
// https://github.com/v8/v8/blob/cab94bbe3d532d85705950ed049a294050fcb4c9/src/messages.js#L1042-L1052 [converted]
|
128
|
+
function FormatErrorString(error) {
|
129
|
+
try {
|
130
|
+
return ErrorToString.call(error);
|
131
|
+
} catch (e) {
|
132
|
+
try {
|
133
|
+
return "<error: " + e + ">";
|
134
|
+
} catch (ee) {
|
135
|
+
return "<error>";
|
136
|
+
}
|
137
|
+
}
|
138
|
+
}
|
139
|
+
|
140
|
+
// https://github.com/v8/v8/blob/cab94bbe3d532d85705950ed049a294050fcb4c9/src/messages.js#L1091-L1108 [logic duplicated]
|
141
|
+
Error.prepareStackTrace = function (error, frames) {
|
142
|
+
var lines = [];
|
143
|
+
lines.push(FormatErrorString(error));
|
144
|
+
for (var i = 0; i < frames.length; i++) {
|
145
|
+
var frame = frames[i];
|
146
|
+
var line;
|
147
|
+
try {
|
148
|
+
line = CallSiteToString.call(frame);
|
149
|
+
} catch (e) {
|
150
|
+
try {
|
151
|
+
line = "<error: " + e + ">";
|
152
|
+
} catch (ee) {
|
153
|
+
// Any code that reaches this point is seriously nasty!
|
154
|
+
line = "<error>";
|
155
|
+
}
|
156
|
+
}
|
157
|
+
lines.push(" at " + line);
|
158
|
+
}
|
159
|
+
return lines.join("\n");
|
160
|
+
};
|
161
|
+
|
162
|
+
})();
|
163
|
+
}
|
data/stdlib/nodejs/yaml.rb
CHANGED
@@ -0,0 +1,15 @@
|
|
1
|
+
phantomjs = `typeof(callPhantom) !== "undefined"`
|
2
|
+
browser = `typeof(document) !== "undefined"`
|
3
|
+
node = `typeof(process) !== "undefined" && process.versions && process.versions.node`
|
4
|
+
nashorn = `typeof(Java) !== "undefined" && Java.type`
|
5
|
+
|
6
|
+
case
|
7
|
+
when nashorn
|
8
|
+
OPAL_PLATFORM = 'nashorn'
|
9
|
+
when phantomjs
|
10
|
+
OPAL_PLATFORM = 'phantomjs'
|
11
|
+
when node
|
12
|
+
OPAL_PLATFORM = 'nodejs'
|
13
|
+
else # possibly browser, which is the primary target
|
14
|
+
OPAL_PLATFORM = nil
|
15
|
+
end
|
data/stdlib/opal/platform.rb
CHANGED
@@ -1,19 +1,11 @@
|
|
1
|
-
|
2
|
-
browser = `typeof(document) !== "undefined"`
|
3
|
-
node = `typeof(process) !== "undefined" && process.versions && process.versions.node`
|
4
|
-
nashorn = `typeof(Java) !== "undefined" && Java.type`
|
1
|
+
require 'opal-platform'
|
5
2
|
|
6
|
-
case
|
7
|
-
when nashorn
|
8
|
-
OPAL_PLATFORM = 'nashorn'
|
3
|
+
case OPAL_PLATFORM
|
4
|
+
when 'nashorn'
|
9
5
|
require 'nashorn'
|
10
|
-
when phantomjs
|
11
|
-
OPAL_PLATFORM = 'phantomjs'
|
6
|
+
when 'phantomjs'
|
12
7
|
require 'phantomjs'
|
13
|
-
when
|
14
|
-
OPAL_PLATFORM = 'nodejs'
|
8
|
+
when 'nodejs'
|
15
9
|
require 'nodejs/kernel'
|
16
10
|
require 'nodejs/io'
|
17
|
-
else # browser, which is the primary target
|
18
|
-
# noop
|
19
11
|
end
|
data/stdlib/pathname.rb
CHANGED
@@ -110,7 +110,7 @@ class Pathname
|
|
110
110
|
basename_list2.shift
|
111
111
|
end
|
112
112
|
r1 = chop_basename(prefix1)
|
113
|
-
if !r1 && /#{SEPARATOR_PAT}/
|
113
|
+
if !r1 && /#{SEPARATOR_PAT}/ =~ File.basename(prefix1)
|
114
114
|
while !basename_list2.empty? && basename_list2.first == '..'
|
115
115
|
index_list2.shift
|
116
116
|
basename_list2.shift
|
data/stdlib/strscan.rb
CHANGED
@@ -244,6 +244,16 @@ class StringScanner
|
|
244
244
|
@working = `#{@string}.slice(pos)`
|
245
245
|
end
|
246
246
|
|
247
|
+
def matched_size
|
248
|
+
%x{
|
249
|
+
if (#@matched === nil) {
|
250
|
+
return nil;
|
251
|
+
}
|
252
|
+
|
253
|
+
return #@matched.length
|
254
|
+
}
|
255
|
+
end
|
256
|
+
|
247
257
|
def post_match
|
248
258
|
%x{
|
249
259
|
if (#@matched === nil) {
|
@@ -297,6 +307,10 @@ class StringScanner
|
|
297
307
|
|
298
308
|
private
|
299
309
|
def anchor(pattern)
|
300
|
-
|
310
|
+
%x{
|
311
|
+
var flags = pattern.toString().match(/\/([^\/]+)$/);
|
312
|
+
flags = flags ? flags[1] : undefined;
|
313
|
+
return new RegExp('^(?:' + pattern.source + ')', flags);
|
314
|
+
}
|
301
315
|
end
|
302
316
|
end
|
data/stdlib/yaml.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
require 'nodejs/yaml'
|
1
|
+
warn "REMOVED: use `require 'nodejs/yaml'` instead"
|
data/tasks/benchmarking.rake
CHANGED
@@ -85,4 +85,13 @@ namespace :bench do
|
|
85
85
|
printf fmt, *row
|
86
86
|
end
|
87
87
|
end
|
88
|
+
|
89
|
+
task :ips do
|
90
|
+
files = Dir[ENV['FILE'] || "#{__dir__}/benchmark-ips/bm_*.rb"]
|
91
|
+
raise ArgumentError, "no files provided" if files.empty?
|
92
|
+
puts "=== Files: #{files.join ', '}"
|
93
|
+
files.each do |bm_path|
|
94
|
+
sh "bundle exec opal -ropal/platform -gbenchmark-ips -rbenchmark/ips -A #{bm_path}"
|
95
|
+
end
|
96
|
+
end
|
88
97
|
end
|
data/tasks/building.rake
CHANGED
@@ -12,42 +12,46 @@ Example: rake dist DIR=cdn/opal/master
|
|
12
12
|
DESC
|
13
13
|
task :dist do
|
14
14
|
require 'opal/util'
|
15
|
-
require 'opal/
|
15
|
+
require 'opal/config'
|
16
16
|
|
17
17
|
Opal::Config.arity_check_enabled = false
|
18
18
|
Opal::Config.const_missing_enabled = false
|
19
19
|
Opal::Config.dynamic_require_severity = :warning
|
20
|
-
env = Opal::Environment.new
|
21
20
|
|
22
21
|
# Hike gem is required to build opal-builder
|
23
|
-
|
24
|
-
env.use_gem 'hike'
|
22
|
+
Opal.use_gem 'hike'
|
25
23
|
|
26
24
|
build_dir = ENV['DIR'] || 'build'
|
27
25
|
files = ENV['FILES'] ? ENV['FILES'].split(',') :
|
28
26
|
Dir['{opal,stdlib}/*.rb'].map { |lib| File.basename(lib, '.rb') }
|
29
27
|
|
30
|
-
|
28
|
+
mkdir_p build_dir unless File.directory? build_dir
|
31
29
|
width = files.map(&:size).max
|
32
30
|
|
33
|
-
files.
|
34
|
-
|
35
|
-
|
31
|
+
files.map do |lib|
|
32
|
+
Thread.new {
|
33
|
+
log = ''
|
34
|
+
log << "* building #{lib}...".ljust(width+'* building ... '.size)
|
35
|
+
$stdout.flush
|
36
36
|
|
37
|
-
|
38
|
-
|
39
|
-
|
37
|
+
# Set requirable to true to be consistent with previous builds, generated
|
38
|
+
# with sprockets.
|
39
|
+
src = Opal::Builder.build(lib, requirable: true).to_s
|
40
|
+
min = Opal::Util.uglify src
|
41
|
+
gzp = Opal::Util.gzip min
|
40
42
|
|
41
|
-
|
42
|
-
|
43
|
-
|
43
|
+
File.open("#{build_dir}/#{lib}.js", 'w+') { |f| f << src }
|
44
|
+
File.open("#{build_dir}/#{lib}.min.js", 'w+') { |f| f << min } if min
|
45
|
+
File.open("#{build_dir}/#{lib}.min.js.gz", 'w+') { |f| f << gzp } if gzp
|
44
46
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
47
|
+
log << "done. ("
|
48
|
+
log << "development: #{('%.2f' % (src.size/1000.0)).rjust(7)}KB"
|
49
|
+
log << ", minified: #{('%.2f' % (min.size/1000.0)).rjust(7)}KB" if min
|
50
|
+
log << ", gzipped: #{('%.2f' % (gzp.size/1000.0)).rjust(7)}KB" if gzp
|
51
|
+
log << ")."
|
52
|
+
log
|
53
|
+
}
|
54
|
+
end.map(&:value).map(&method(:puts))
|
51
55
|
end
|
52
56
|
|
53
57
|
desc 'Rebuild grammar.rb for opal parser'
|
data/tasks/linting.rake
CHANGED
@@ -1,18 +1,29 @@
|
|
1
|
-
directory 'tmp/lint'
|
2
|
-
|
3
1
|
desc "Build *corelib* and *stdlib* and lint the result"
|
4
|
-
task :
|
5
|
-
|
6
|
-
|
7
|
-
|
2
|
+
task :jshint do
|
3
|
+
dir = 'tmp/lint'
|
4
|
+
puts
|
5
|
+
puts "= Checking distributed files..."
|
6
|
+
unless ENV['SKIP_BUILD']
|
7
|
+
rm_rf dir if File.exist? dir
|
8
|
+
sh "bundle exec rake dist DIR=#{dir}"
|
9
|
+
end
|
8
10
|
|
9
|
-
|
11
|
+
Dir["#{dir}/*.js"].each {|path|
|
12
|
+
# opal-builder and opal-parser take so long travis stalls
|
13
|
+
next if path =~ /.min.js\z|opal-builder|opal-parser/
|
10
14
|
|
11
|
-
|
12
|
-
|
13
|
-
|
15
|
+
sh "jshint --verbose #{path}"
|
16
|
+
}
|
17
|
+
puts
|
18
|
+
puts "= Checking corelib files separately..."
|
19
|
+
js_paths = []
|
20
|
+
Dir['opal/{opal,corelib}/*.rb'].each do |path|
|
21
|
+
js_path = "#{dir}/#{path.tr('/', '-')}.js"
|
22
|
+
sh "bundle exec opal -Dignore -cEO #{path} > #{js_path}"
|
23
|
+
js_paths << js_path
|
14
24
|
end
|
15
|
-
|
16
|
-
|
25
|
+
js_paths.each do |js_path|
|
26
|
+
sh "jshint --verbose #{js_path}"
|
27
|
+
end
|
28
|
+
sh "jshint --verbose opal/corelib/runtime.js"
|
17
29
|
end
|
18
|
-
|
data/tasks/testing.rake
CHANGED
@@ -1,112 +1,234 @@
|
|
1
|
-
# Remove when we drop support for 1.9.3
|
2
|
-
__dir__ = defined?(Kernel.__dir__) ? Kernel.__dir__ : File.dirname(File.realpath(__FILE__))
|
3
|
-
|
4
|
-
require "#{__dir__}/testing/mspec_special_calls"
|
5
|
-
|
6
1
|
require 'rspec/core/rake_task'
|
7
2
|
RSpec::Core::RakeTask.new(:rspec) do |t|
|
8
3
|
t.pattern = 'spec/lib/**/*_spec.rb'
|
9
4
|
end
|
10
5
|
|
11
|
-
module
|
6
|
+
module Testing
|
12
7
|
extend self
|
13
8
|
|
14
|
-
def
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
mspec/guards/block_device
|
19
|
-
mspec/guards/endian
|
20
|
-
a_file
|
21
|
-
lib/spec_helper
|
22
|
-
]
|
9
|
+
def get_random_seed(env)
|
10
|
+
random_seed = env['RANDOM_SEED'] ? env['RANDOM_SEED'] : rand(100_000)
|
11
|
+
puts "export RANDOM_SEED=#{random_seed} # to re-use the same randomization"
|
12
|
+
random_seed
|
23
13
|
end
|
24
14
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
opalspecs = Dir['spec/{opal,lib/parser}/**/*_spec.rb'] + ['spec/lib/lexer_spec.rb', 'spec/lib/compiler_spec.rb']
|
40
|
-
userspecs = Dir[pattern] if pattern
|
41
|
-
userspecs &= rubyspecs if whitelist_pattern
|
42
|
-
|
43
|
-
opalspec_filters = Dir['spec/filters/**/*_opal.rb']
|
44
|
-
|
45
|
-
if ENV['INVERT_RUNNING_MODE']
|
46
|
-
# When we run an inverted test suite we should run only 'bugs'.
|
47
|
-
# Unsupported features are not supported anyway
|
48
|
-
rubyspec_filters = Dir['spec/filters/bugs/*.rb'] - opalspec_filters
|
49
|
-
else
|
50
|
-
rubyspec_filters = Dir['spec/filters/**/*.rb'] - opalspec_filters
|
15
|
+
module MSpec
|
16
|
+
extend self
|
17
|
+
|
18
|
+
def stubs
|
19
|
+
%w[
|
20
|
+
mspec/helpers/tmp
|
21
|
+
mspec/helpers/environment
|
22
|
+
mspec/guards/block_device
|
23
|
+
mspec/guards/endian
|
24
|
+
a_file
|
25
|
+
lib/spec_helper
|
26
|
+
mspec/commands/mspec-run
|
27
|
+
]
|
51
28
|
end
|
52
29
|
|
53
|
-
specs =
|
54
|
-
|
55
|
-
|
56
|
-
|
30
|
+
def specs(env = ENV)
|
31
|
+
suite = env['SUITE']
|
32
|
+
pattern = env['PATTERN']
|
33
|
+
whitelist_pattern = !!env['RUBYSPECS']
|
34
|
+
|
35
|
+
excepting = []
|
36
|
+
rubyspecs = File.read('spec/ruby_specs').lines.reject do |l|
|
37
|
+
l.strip!
|
38
|
+
l.start_with?('#') || l.empty? || (l.start_with?('!') && excepting.push(l.sub('!', 'spec/') + '.rb'))
|
39
|
+
end.flat_map do |path|
|
40
|
+
path = "spec/#{path}"
|
41
|
+
File.directory?(path) ? Dir[path+'/*.rb'] : "#{path}.rb"
|
42
|
+
end - excepting
|
43
|
+
|
44
|
+
opalspecs = Dir['spec/{opal,lib/parser}/**/*_spec.rb']
|
45
|
+
userspecs = Dir[pattern] if pattern
|
46
|
+
userspecs &= rubyspecs if whitelist_pattern
|
47
|
+
|
48
|
+
specs = []
|
49
|
+
add_specs = ->(name, new_specs) do
|
50
|
+
puts "Adding #{new_specs.size.to_s.rjust(3)} files (#{name})"
|
51
|
+
specs += new_specs
|
52
|
+
end
|
53
|
+
|
54
|
+
if pattern
|
55
|
+
add_specs["PATTERN=#{pattern}", userspecs.sort]
|
56
|
+
elsif suite == 'opal'
|
57
|
+
add_specs['spec/opal', opalspecs.sort]
|
58
|
+
elsif suite == 'ruby'
|
59
|
+
add_specs['spec/ruby', rubyspecs.sort]
|
60
|
+
else
|
61
|
+
warn 'Please provide at lease one of the following environment variables:'
|
62
|
+
warn 'PATTERN # e.g. PATTERN=spec/ruby/core/numeric/**_spec.rb'
|
63
|
+
warn 'SUITE # can be either SUITE=opal or SUITE=ruby'
|
64
|
+
exit 1
|
65
|
+
end
|
66
|
+
|
67
|
+
specs
|
57
68
|
end
|
58
69
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
warn 'PATTERN # e.g. PATTERN=spec/ruby/core/numeric/**_spec.rb'
|
72
|
-
warn 'SUITE # can be either SUITE=opal or SUITE=ruby'
|
73
|
-
exit 1
|
70
|
+
def filters(suite)
|
71
|
+
opalspec_filters = Dir['spec/filters/**/*_opal.rb']
|
72
|
+
|
73
|
+
if ENV['INVERT_RUNNING_MODE']
|
74
|
+
# When we run an inverted test suite we should run only 'bugs'.
|
75
|
+
# Unsupported features are not supported anyway
|
76
|
+
rubyspec_filters = Dir['spec/filters/bugs/*.rb'] - opalspec_filters
|
77
|
+
else
|
78
|
+
rubyspec_filters = Dir['spec/filters/**/*.rb'] - opalspec_filters
|
79
|
+
end
|
80
|
+
|
81
|
+
suite == 'opal' ? opalspec_filters : rubyspec_filters
|
74
82
|
end
|
75
83
|
|
76
|
-
specs
|
77
|
-
|
84
|
+
def write_file(filename, filters, specs, env)
|
85
|
+
bm_filepath = env['BM_FILEPATH']
|
86
|
+
|
87
|
+
[filters, specs].each do |files|
|
88
|
+
files.map! { |s| "'#{s.sub(/^spec\//,'')}'" }
|
89
|
+
end
|
90
|
+
|
91
|
+
filter_requires = filters.map { |s| "require #{s}" }.join("\n")
|
92
|
+
spec_requires = specs.map { |s| "requirable_spec_file #{s}" }.join("\n")
|
93
|
+
spec_registration = specs.join(",\n ")
|
94
|
+
|
95
|
+
if bm_filepath
|
96
|
+
enter_benchmarking_mode = "OpalBM.main.register(#{Integer(env['BM'])}, '#{bm_filepath}')"
|
97
|
+
end
|
98
|
+
|
99
|
+
random_seed = Testing.get_random_seed(env)
|
78
100
|
|
79
|
-
|
80
|
-
requires = specs.map{|s| "require '#{s.sub(/^spec\//,'')}'"}
|
101
|
+
env_data = env.map{ |k,v| "ENV[#{k.inspect}] = #{v.to_s.inspect}" unless v.nil? }.join("\n")
|
81
102
|
|
82
|
-
|
83
|
-
|
103
|
+
File.write filename, <<-RUBY
|
104
|
+
require 'opal/platform' # in node ENV is replaced
|
105
|
+
#{env_data}
|
106
|
+
|
107
|
+
require 'spec_helper'
|
108
|
+
require 'opal/full'
|
109
|
+
#{enter_benchmarking_mode}
|
110
|
+
|
111
|
+
#{filter_requires}
|
112
|
+
|
113
|
+
#{spec_requires}
|
114
|
+
|
115
|
+
MSpec.register_files [
|
116
|
+
#{spec_registration}
|
117
|
+
]
|
118
|
+
|
119
|
+
srand(#{random_seed})
|
120
|
+
MSpec.randomize(true)
|
121
|
+
|
122
|
+
MSpec.process
|
123
|
+
OSpecFilter.main.unused_filters_message(list: #{!!ENV['LIST_UNUSED_FILTERS']})
|
124
|
+
exit MSpec.exit_code
|
125
|
+
RUBY
|
126
|
+
end
|
127
|
+
|
128
|
+
def bm_filepath
|
129
|
+
mkdir_p 'tmp/bench'
|
130
|
+
index = 0
|
131
|
+
begin
|
132
|
+
index += 1
|
133
|
+
filepath = "tmp/bench/Spec#{index}"
|
134
|
+
end while File.exist?(filepath)
|
135
|
+
filepath
|
84
136
|
end
|
137
|
+
end
|
138
|
+
|
139
|
+
module Minitest
|
140
|
+
extend self
|
141
|
+
|
142
|
+
def write_file(filename, files = [], env = {})
|
143
|
+
env_data = env.map{ |k,v| "ENV[#{k.inspect}] = #{v.to_s.inspect}" unless v.nil? }.join("\n")
|
144
|
+
requires = files.map{|f| "require '#{f}'"}
|
145
|
+
mkdir_p File.dirname(filename)
|
85
146
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
147
|
+
random_seed = Testing.get_random_seed(env)
|
148
|
+
|
149
|
+
File.write filename, <<-RUBY
|
150
|
+
require 'opal/platform' # in node ENV is replaced
|
151
|
+
require 'opal-parser'
|
152
|
+
#{env_data}
|
153
|
+
srand(#{random_seed})
|
154
|
+
|
155
|
+
#{requires.join("\n")}
|
156
|
+
RUBY
|
157
|
+
end
|
97
158
|
end
|
98
159
|
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
160
|
+
class SauceLabs
|
161
|
+
include FileUtils
|
162
|
+
|
163
|
+
def initialize(options = {})
|
164
|
+
@host = options.fetch(:host, '127.0.0.1')
|
165
|
+
@port = options.fetch(:port, '3000')
|
166
|
+
@username = options.fetch(:username)
|
167
|
+
@access_key = options.fetch(:access_key)
|
168
|
+
@tunnel = options.fetch(:tunnel, nil)
|
169
|
+
end
|
170
|
+
attr_reader :host, :port, :username, :access_key, :tunnel
|
171
|
+
|
172
|
+
def with_server
|
173
|
+
cd 'examples/rack'
|
174
|
+
system 'bundle install' or raise 'bundle install failed'
|
175
|
+
begin
|
176
|
+
server = Process.spawn "bundle exec rackup --host #{host} --port #{port}"
|
177
|
+
puts 'Waiting for server…'
|
178
|
+
sleep 0.1 until system "curl -s 'http://#{host}:#{port}/' > /dev/null"
|
179
|
+
puts 'Server ready.'
|
180
|
+
yield self
|
181
|
+
ensure
|
182
|
+
Process.kill(:TERM, server)
|
183
|
+
Process.wait(server)
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
def on_platform(options = {})
|
188
|
+
browser = options.fetch(:browser)
|
189
|
+
version = options.fetch(:version)
|
190
|
+
platform = options.fetch(:platform, nil)
|
191
|
+
device = options.fetch(:device, nil)
|
192
|
+
|
193
|
+
puts "=============== Testing on browser: #{browser} v#{version} #{"(#{platform})" if platform}"
|
194
|
+
require "selenium/webdriver"
|
195
|
+
|
196
|
+
caps = {}
|
197
|
+
caps[:platform] = platform if platform
|
198
|
+
caps[:browserName] = browser if browser
|
199
|
+
caps[:version] = version if version
|
200
|
+
caps[:device] = device if device
|
201
|
+
caps['tunnel-identifier'] = tunnel if tunnel
|
202
|
+
|
203
|
+
driver = Selenium::WebDriver.for(
|
204
|
+
:remote,
|
205
|
+
url: "http://#{username}:#{access_key}@localhost:4445/wd/hub",
|
206
|
+
desired_capabilities: caps
|
207
|
+
)
|
208
|
+
|
209
|
+
driver.get("http://#{host}:#{port}/")
|
210
|
+
yield driver
|
211
|
+
driver.quit
|
212
|
+
end
|
213
|
+
|
214
|
+
def test_title(driver)
|
215
|
+
if (title = driver.title) == 'Bob is authenticated'
|
216
|
+
puts "SUCCESS! title of webpage is: #{title}"
|
217
|
+
else
|
218
|
+
raise "FAILED! title of webpage is: #{title}"
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
222
|
+
def run(**options)
|
223
|
+
on_platform(**options) do |driver|
|
224
|
+
test_title(driver)
|
225
|
+
end
|
226
|
+
end
|
107
227
|
end
|
228
|
+
|
108
229
|
end
|
109
230
|
|
231
|
+
|
110
232
|
pattern_usage = <<-DESC
|
111
233
|
Use PATTERN environment variable to manually set the glob for specs:
|
112
234
|
|
@@ -116,54 +238,29 @@ Use PATTERN environment variable to manually set the glob for specs:
|
|
116
238
|
bundle exec rake mspec_node PATTERN=spec/ruby/core/numeric/**_spec.rb
|
117
239
|
DESC
|
118
240
|
|
119
|
-
%w[
|
120
|
-
|
121
|
-
|
122
|
-
filename = File.expand_path('tmp/mspec_sprockets_phantomjs.rb')
|
123
|
-
runner = "#{__dir__}/testing/sprockets-phantomjs.js"
|
124
|
-
port = 9999
|
125
|
-
url = "http://localhost:#{port}/"
|
126
|
-
|
127
|
-
mkdir_p File.dirname(filename)
|
128
|
-
MSpecSuite.write_file filename, MSpecSuite.specs(ENV.to_hash.merge 'SUITE' => suite)
|
129
|
-
|
130
|
-
MSpecSuite.stubs.each {|s| ::Opal::Config.stubbed_files << s }
|
131
|
-
|
132
|
-
Opal::Config.arity_check_enabled = true
|
133
|
-
Opal::Config.freezing_stubs_enabled = true
|
134
|
-
Opal::Config.tainting_stubs_enabled = false
|
135
|
-
Opal::Config.dynamic_require_severity = :warning
|
136
|
-
|
137
|
-
Opal.use_gem 'mspec'
|
138
|
-
Opal.append_path 'spec'
|
139
|
-
Opal.append_path 'lib'
|
140
|
-
Opal.append_path File.dirname(filename)
|
141
|
-
|
142
|
-
app = Opal::Server.new { |s| s.main = File.basename(filename) }
|
143
|
-
server = Thread.new { Rack::Server.start(app: app, Port: port) }
|
144
|
-
sleep 1
|
145
|
-
|
146
|
-
begin
|
147
|
-
sh 'phantomjs', runner, url
|
148
|
-
ensure
|
149
|
-
server.kill if server.alive?
|
150
|
-
end
|
151
|
-
end
|
241
|
+
platforms = %w[nodejs phantomjs server]
|
242
|
+
mspec_suites = %w[ruby opal]
|
243
|
+
minitest_suites = %w[cruby]
|
152
244
|
|
153
|
-
|
245
|
+
platforms.each do |platform|
|
246
|
+
mspec_suites.each do |suite|
|
154
247
|
desc "Run the MSpec test suite on Opal::Builder/#{platform}" + pattern_usage
|
155
248
|
task :"mspec_#{suite}_#{platform}" do
|
156
|
-
include_paths = '-Ispec -Ilib'
|
157
|
-
|
158
249
|
filename = "tmp/mspec_#{platform}.rb"
|
159
250
|
mkdir_p File.dirname(filename)
|
160
|
-
bm_filepath =
|
161
|
-
|
251
|
+
bm_filepath = Testing::MSpec.bm_filepath if ENV['BM']
|
252
|
+
specs_env = {
|
253
|
+
'SUITE' => suite,
|
254
|
+
'FORMATTER' => platform, # Use the current platform as the default formatter
|
255
|
+
'BM_FILEPATH' => bm_filepath,
|
256
|
+
}.merge(ENV.to_hash)
|
257
|
+
|
258
|
+
Testing::MSpec.write_file filename, Testing::MSpec.filters(suite), Testing::MSpec.specs(specs_env), specs_env
|
162
259
|
|
163
|
-
stubs =
|
260
|
+
stubs = Testing::MSpec.stubs.map{|s| "-s#{s}"}.join(' ')
|
164
261
|
|
165
262
|
sh "ruby -rbundler/setup -r#{__dir__}/testing/mspec_special_calls "\
|
166
|
-
"bin/opal -gmspec
|
263
|
+
"bin/opal -gmspec -Ispec -Ilib #{stubs} -R#{platform} -Dwarning -A --enable-source-location #{filename}"
|
167
264
|
|
168
265
|
if bm_filepath
|
169
266
|
puts "Benchmark results have been written to #{bm_filepath}"
|
@@ -171,100 +268,120 @@ DESC
|
|
171
268
|
end
|
172
269
|
end
|
173
270
|
end
|
174
|
-
end
|
175
271
|
|
176
|
-
|
177
|
-
task :
|
178
|
-
|
272
|
+
minitest_suites.each do |suite|
|
273
|
+
task :"minitest_#{suite}_#{platform}" do
|
274
|
+
if ENV.key? 'FILES'
|
275
|
+
files = Dir[ENV['FILES']]
|
276
|
+
includes = "-Itmp"
|
277
|
+
else
|
278
|
+
includes = "-Itest/cruby/test"
|
279
|
+
files = %w[
|
280
|
+
benchmark/test_benchmark.rb
|
281
|
+
ruby/test_call.rb
|
282
|
+
opal/test_keyword.rb
|
283
|
+
base64/test_base64.rb
|
284
|
+
opal/unsupported_and_bugs.rb
|
285
|
+
]
|
286
|
+
end
|
179
287
|
|
180
|
-
|
181
|
-
|
182
|
-
mkdir_p 'tmp'
|
288
|
+
filename = "tmp/minitest_#{suite}_#{platform}.rb"
|
289
|
+
Testing::Minitest.write_file(filename, files, ENV)
|
183
290
|
|
184
|
-
|
185
|
-
|
186
|
-
sh "jshint --verbose #{js_filename}"
|
187
|
-
elsif ENV['SUITE'] == 'stdlib'
|
188
|
-
sh "rake dist"
|
291
|
+
stubs = "-soptparse -sio/console -stimeout -smutex_m -srubygems -stempfile -smonitor"
|
292
|
+
includes = "-Itest -Ilib -Ivendored-minitest #{includes}"
|
189
293
|
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
end
|
194
|
-
}
|
195
|
-
else
|
196
|
-
warn 'Please provide at lease one of the following ENV vars:'
|
197
|
-
warn 'SUITE # can be either SUITE=core or SUITE=stdlib'
|
198
|
-
exit 1
|
294
|
+
sh "ruby -rbundler/setup "\
|
295
|
+
"bin/opal -ghike #{includes} #{stubs} -R#{platform} -Dwarning -A --enable-source-location #{filename}"
|
296
|
+
end
|
199
297
|
end
|
200
298
|
end
|
201
299
|
|
300
|
+
# The name ends with the platform, which is of course mandated in this case
|
301
|
+
task :minitest_node_nodejs do
|
302
|
+
Opal.use_gem 'hike'
|
303
|
+
|
304
|
+
platform = 'nodejs'
|
305
|
+
suite = 'node'
|
306
|
+
files = %w[
|
307
|
+
nodejs
|
308
|
+
opal-parser
|
309
|
+
nodejs/test_file.rb
|
310
|
+
nodejs/test_dir.rb
|
311
|
+
nodejs/test_io.rb
|
312
|
+
nodejs/test_opal_builder.rb
|
313
|
+
]
|
314
|
+
|
315
|
+
filename = "tmp/minitest_node_nodejs.rb"
|
316
|
+
Testing::Minitest.write_file(filename, files, ENV)
|
317
|
+
|
318
|
+
stubs = "-soptparse -sio/console -stimeout -smutex_m -srubygems -stempfile -smonitor"
|
319
|
+
includes = "-Itest -Ilib -Ivendored-minitest"
|
320
|
+
|
321
|
+
sh "ruby -rbundler/setup "\
|
322
|
+
"bin/opal -ghike #{includes} #{stubs} -R#{platform} -Dwarning -A --enable-source-location #{filename}"
|
323
|
+
end
|
202
324
|
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
325
|
+
desc 'Runs opal-rspec tests to augment unit testing/rubyspecs'
|
326
|
+
task :smoke_test do
|
327
|
+
opal_rspec_dir = 'tmp/smoke_test_opal_rspec'
|
328
|
+
# Travis caching might be creating this, manage the state idempotently
|
329
|
+
unless File.exist?(File.join(opal_rspec_dir, '.git'))
|
330
|
+
rm_rf opal_rspec_dir
|
331
|
+
sh "git clone https://github.com/opal/opal-rspec.git #{opal_rspec_dir}"
|
332
|
+
end
|
333
|
+
# Don't want conflicts with opal-rspec's Gemfile
|
334
|
+
gemfile_name = 'opal_rspec_smoketest.Gemfile'
|
335
|
+
cp File.join('tasks/testing', gemfile_name), opal_rspec_dir
|
336
|
+
Dir.chdir opal_rspec_dir do
|
337
|
+
sh 'git checkout releases/0-6-stable'
|
338
|
+
sh 'git pull'
|
339
|
+
# RSpec source itself
|
340
|
+
sh 'git submodule update --init'
|
341
|
+
Bundler.with_clean_env do
|
342
|
+
# Force new dependencies each time
|
343
|
+
rm_rf "#{gemfile_name}.lock"
|
344
|
+
with_gemfile = lambda {|command| sh "BUNDLE_GEMFILE=#{gemfile_name} RUNNER=node bundle #{command}"}
|
345
|
+
with_gemfile['install']
|
346
|
+
with_gemfile['exec rake rake_only']
|
347
|
+
end
|
221
348
|
end
|
222
349
|
end
|
223
350
|
|
224
|
-
task :
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
351
|
+
task :browser_test do
|
352
|
+
credentials = {
|
353
|
+
username: ENV['SAUCE_USERNAME'] || warn('missing SAUCE_USERNAME env var'),
|
354
|
+
access_key: ENV['SAUCE_ACCESS_KEY'] || warn('missing SAUCE_ACCESS_KEY env var'),
|
355
|
+
tunnel: ENV['TRAVIS_JOB_NUMBER'],
|
356
|
+
}
|
357
|
+
|
358
|
+
# Exit if we're missing credentials.
|
359
|
+
exit unless credentials[:username] && credentials[:access_key]
|
360
|
+
|
361
|
+
Testing::SauceLabs.new(credentials).with_server do |session|
|
362
|
+
session.run(browser: 'Internet Explorer', version: '9')
|
363
|
+
session.run(browser: 'Internet Explorer', version: '10')
|
364
|
+
session.run(browser: 'Internet Explorer', version: '11')
|
365
|
+
# session.run(browser: 'Edge', version: '13') # something goes wrong
|
366
|
+
session.run(browser: 'Firefox', version: '47')
|
367
|
+
session.run(browser: 'Firefox', version: '48')
|
368
|
+
# session.run(browser: 'Chrome', version: '52') # chrome webdriver is broken
|
369
|
+
# session.run(browser: 'Chrome', version: '53') # chrome webdriver is broken
|
370
|
+
session.run(browser: 'Safari', version: '8')
|
371
|
+
session.run(browser: 'Safari', version: '9')
|
372
|
+
session.run(browser: 'Safari', version: '10')
|
237
373
|
end
|
238
|
-
|
239
|
-
js_filename = 'tmp/cruby_tests.js'
|
240
|
-
build_js_command = MinitestSuite.build_js_command(
|
241
|
-
%w[
|
242
|
-
opal/platform
|
243
|
-
opal-parser
|
244
|
-
] + files,
|
245
|
-
includes: includes,
|
246
|
-
js_filename: js_filename,
|
247
|
-
)
|
248
|
-
sh build_js_command
|
249
|
-
sh "NODE_PATH=stdlib/nodejs/node_modules node #{js_filename}"
|
250
374
|
end
|
251
375
|
|
252
|
-
task :
|
253
|
-
|
254
|
-
build_js_command = MinitestSuite.build_js_command(
|
255
|
-
%w[
|
256
|
-
opal-parser.rb
|
257
|
-
test_file.rb
|
258
|
-
test_dir.rb
|
259
|
-
],
|
260
|
-
includes: %w[test/nodejs],
|
261
|
-
js_filename: js_filename,
|
262
|
-
)
|
263
|
-
sh build_js_command
|
264
|
-
sh "NODE_PATH=stdlib/nodejs/node_modules node #{js_filename}"
|
265
|
-
end
|
376
|
+
platforms.each { |platform| task(:"mspec_#{platform}" => mspec_suites.map { |suite| :"mspec_#{suite}_#{platform}" }) }
|
377
|
+
platforms.each { |platform| task(:"minitest_#{platform}" => minitest_suites.map { |suite| :"minitest_#{suite}_#{platform}" }) }
|
266
378
|
|
267
|
-
task :mspec => [:mspec_phantomjs, :mspec_nodejs
|
268
|
-
task :minitest => [:
|
379
|
+
task :mspec => [:mspec_phantomjs, :mspec_nodejs]
|
380
|
+
task :minitest => [:minitest_phantomjs, :minitest_nodejs, :minitest_node_nodejs]
|
269
381
|
task :test_all => [:rspec, :mspec, :minitest]
|
270
382
|
|
383
|
+
# deprecated, can be removed after 0.11
|
384
|
+
task(:cruby_tests) { warn "The task 'cruby_tests' has been renamed to 'minitest_cruby_nodejs'."; exit 1 }
|
385
|
+
task(:test_cruby) { warn "The task 'test_cruby' has been renamed to 'minitest_cruby_nodejs'."; exit 1 }
|
386
|
+
task(:test_nodejs) { warn "The task 'test_nodejs' has been renamed to 'minitest_node_nodejs'."; exit 1 }
|
387
|
+
|