sublimetheme 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +230 -0
- data/Rakefile +8 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/lib/sublimetheme.rb +6832 -0
- data/lib/sublimetheme/version.rb +3 -0
- data/path/bin/htmldiff +25 -0
- data/path/bin/htmldiff.bat +6 -0
- data/path/bin/ldiff +25 -0
- data/path/bin/ldiff.bat +6 -0
- data/path/bin/rspec +23 -0
- data/path/bin/rspec.bat +6 -0
- data/path/cache/diff-lcs-1.2.5.gem +0 -0
- data/path/cache/rspec-3.3.0.gem +0 -0
- data/path/cache/rspec-core-3.3.2.gem +0 -0
- data/path/cache/rspec-expectations-3.3.1.gem +0 -0
- data/path/cache/rspec-mocks-3.3.2.gem +0 -0
- data/path/cache/rspec-support-3.3.0.gem +0 -0
- data/path/gems/diff-lcs-1.2.5/.autotest +3 -0
- data/path/gems/diff-lcs-1.2.5/.gemtest +0 -0
- data/path/gems/diff-lcs-1.2.5/.hoerc +2 -0
- data/path/gems/diff-lcs-1.2.5/.rspec +2 -0
- data/path/gems/diff-lcs-1.2.5/.travis.yml +22 -0
- data/path/gems/diff-lcs-1.2.5/Contributing.rdoc +64 -0
- data/path/gems/diff-lcs-1.2.5/Gemfile +20 -0
- data/path/gems/diff-lcs-1.2.5/History.rdoc +152 -0
- data/path/gems/diff-lcs-1.2.5/License.rdoc +39 -0
- data/path/gems/diff-lcs-1.2.5/Manifest.txt +38 -0
- data/path/gems/diff-lcs-1.2.5/README.rdoc +85 -0
- data/path/gems/diff-lcs-1.2.5/Rakefile +41 -0
- data/path/gems/diff-lcs-1.2.5/autotest/discover.rb +1 -0
- data/path/gems/diff-lcs-1.2.5/bin/htmldiff +32 -0
- data/path/gems/diff-lcs-1.2.5/bin/ldiff +6 -0
- data/path/gems/diff-lcs-1.2.5/docs/COPYING.txt +339 -0
- data/path/gems/diff-lcs-1.2.5/docs/artistic.txt +127 -0
- data/path/gems/diff-lcs-1.2.5/lib/diff-lcs.rb +3 -0
- data/path/gems/diff-lcs-1.2.5/lib/diff/lcs.rb +805 -0
- data/path/gems/diff-lcs-1.2.5/lib/diff/lcs/array.rb +7 -0
- data/path/gems/diff-lcs-1.2.5/lib/diff/lcs/block.rb +37 -0
- data/path/gems/diff-lcs-1.2.5/lib/diff/lcs/callbacks.rb +322 -0
- data/path/gems/diff-lcs-1.2.5/lib/diff/lcs/change.rb +177 -0
- data/path/gems/diff-lcs-1.2.5/lib/diff/lcs/htmldiff.rb +149 -0
- data/path/gems/diff-lcs-1.2.5/lib/diff/lcs/hunk.rb +276 -0
- data/path/gems/diff-lcs-1.2.5/lib/diff/lcs/internals.rb +301 -0
- data/path/gems/diff-lcs-1.2.5/lib/diff/lcs/ldiff.rb +195 -0
- data/path/gems/diff-lcs-1.2.5/lib/diff/lcs/string.rb +5 -0
- data/path/gems/diff-lcs-1.2.5/spec/change_spec.rb +65 -0
- data/path/gems/diff-lcs-1.2.5/spec/diff_spec.rb +47 -0
- data/path/gems/diff-lcs-1.2.5/spec/hunk_spec.rb +72 -0
- data/path/gems/diff-lcs-1.2.5/spec/issues_spec.rb +24 -0
- data/path/gems/diff-lcs-1.2.5/spec/lcs_spec.rb +54 -0
- data/path/gems/diff-lcs-1.2.5/spec/patch_spec.rb +414 -0
- data/path/gems/diff-lcs-1.2.5/spec/sdiff_spec.rb +214 -0
- data/path/gems/diff-lcs-1.2.5/spec/spec_helper.rb +290 -0
- data/path/gems/diff-lcs-1.2.5/spec/traverse_balanced_spec.rb +310 -0
- data/path/gems/diff-lcs-1.2.5/spec/traverse_sequences_spec.rb +139 -0
- data/path/gems/rspec-3.3.0/License.txt +24 -0
- data/path/gems/rspec-3.3.0/README.md +34 -0
- data/path/gems/rspec-3.3.0/lib/rspec.rb +3 -0
- data/path/gems/rspec-3.3.0/lib/rspec/version.rb +5 -0
- data/path/gems/rspec-core-3.3.2/.document +5 -0
- data/path/gems/rspec-core-3.3.2/.yardopts +8 -0
- data/path/gems/rspec-core-3.3.2/Changelog.md +1856 -0
- data/path/gems/rspec-core-3.3.2/License.txt +25 -0
- data/path/gems/rspec-core-3.3.2/README.md +369 -0
- data/path/gems/rspec-core-3.3.2/exe/rspec +4 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/autorun.rb +3 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core.rb +181 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/backtrace_formatter.rb +64 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/bisect/coordinator.rb +66 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/bisect/example_minimizer.rb +130 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/bisect/runner.rb +139 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/bisect/server.rb +61 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/bisect/subset_enumerator.rb +39 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/configuration.rb +1807 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/configuration_options.rb +191 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/drb.rb +111 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/dsl.rb +96 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/example.rb +573 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/example_group.rb +796 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/example_status_persister.rb +235 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/filter_manager.rb +231 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/flat_map.rb +20 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters.rb +254 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/base_formatter.rb +70 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/base_text_formatter.rb +77 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/bisect_formatter.rb +68 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/bisect_progress_formatter.rb +115 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/console_codes.rb +65 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/deprecation_formatter.rb +223 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/documentation_formatter.rb +70 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/exception_presenter.rb +393 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/fallback_message_formatter.rb +28 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/helpers.rb +109 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/html_formatter.rb +151 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/html_printer.rb +415 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/json_formatter.rb +96 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/profile_formatter.rb +68 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/progress_formatter.rb +28 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/protocol.rb +172 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/snippet_extractor.rb +116 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/hooks.rb +638 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/memoized_helpers.rb +532 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/metadata.rb +490 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/metadata_filter.rb +235 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/minitest_assertions_adapter.rb +31 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/mocking_adapters/flexmock.rb +31 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/mocking_adapters/mocha.rb +57 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/mocking_adapters/null.rb +14 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/mocking_adapters/rr.rb +31 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/mocking_adapters/rspec.rb +32 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/mutex.rb +63 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/notifications.rb +498 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/option_parser.rb +301 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/ordering.rb +158 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/pending.rb +165 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/profiler.rb +32 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/project_initializer.rb +48 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/project_initializer/.rspec +2 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/project_initializer/spec/spec_helper.rb +96 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/rake_task.rb +158 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/reentrant_mutex.rb +52 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/reporter.rb +220 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/ruby_project.rb +53 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb +179 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/sandbox.rb +37 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/set.rb +49 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/shared_context.rb +55 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/shared_example_group.rb +210 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/shell_escape.rb +49 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/test_unit_assertions_adapter.rb +30 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/version.rb +9 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/warnings.rb +40 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/world.rb +178 -0
- data/path/gems/rspec-expectations-3.3.1/.document +5 -0
- data/path/gems/rspec-expectations-3.3.1/.yardopts +6 -0
- data/path/gems/rspec-expectations-3.3.1/Changelog.md +953 -0
- data/path/gems/rspec-expectations-3.3.1/License.txt +24 -0
- data/path/gems/rspec-expectations-3.3.1/README.md +289 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/expectations.rb +81 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/expectations/configuration.rb +164 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/expectations/expectation_target.rb +113 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/expectations/fail_with.rb +31 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/expectations/failure_aggregator.rb +194 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/expectations/handler.rb +170 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/expectations/minitest_integration.rb +31 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/expectations/syntax.rb +132 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/expectations/version.rb +8 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers.rb +1009 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/aliased_matcher.rb +116 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in.rb +52 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/all.rb +85 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/base_matcher.rb +181 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/be.rb +285 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/be_between.rb +77 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/be_instance_of.rb +22 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/be_kind_of.rb +16 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/be_within.rb +72 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/change.rb +337 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/compound.rb +293 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/contain_exactly.rb +253 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/cover.rb +24 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/eq.rb +40 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/eql.rb +34 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/equal.rb +81 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/exist.rb +86 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/has.rb +103 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/have_attributes.rb +114 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/include.rb +130 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/match.rb +37 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/operators.rb +128 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/output.rb +200 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/raise_error.rb +216 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/respond_to.rb +90 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/satisfy.rb +37 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/start_or_end_with.rb +94 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/throw_symbol.rb +132 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/yield.rb +418 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/composable.rb +184 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/dsl.rb +453 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/english_phrasing.rb +42 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/expecteds_for_multiple_diffs.rb +73 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/fail_matchers.rb +42 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/generated_descriptions.rb +42 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/matcher_delegator.rb +35 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/matcher_protocol.rb +99 -0
- data/path/gems/rspec-mocks-3.3.2/.document +5 -0
- data/path/gems/rspec-mocks-3.3.2/.yardopts +6 -0
- data/path/gems/rspec-mocks-3.3.2/Changelog.md +965 -0
- data/path/gems/rspec-mocks-3.3.2/License.txt +24 -0
- data/path/gems/rspec-mocks-3.3.2/README.md +430 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks.rb +126 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/any_instance.rb +11 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/any_instance/chain.rb +110 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/any_instance/error_generator.rb +31 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/any_instance/expect_chain_chain.rb +35 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/any_instance/expectation_chain.rb +48 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/any_instance/message_chains.rb +83 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/any_instance/proxy.rb +116 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/any_instance/recorder.rb +264 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/any_instance/stub_chain.rb +46 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/any_instance/stub_chain_chain.rb +27 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/argument_list_matcher.rb +100 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/argument_matchers.rb +320 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/configuration.rb +188 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/error_generator.rb +362 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/example_methods.rb +421 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/instance_method_stasher.rb +135 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/marshal_extension.rb +41 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/matchers/expectation_customization.rb +20 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/matchers/have_received.rb +116 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/matchers/receive.rb +130 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/matchers/receive_message_chain.rb +80 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/matchers/receive_messages.rb +75 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/message_chain.rb +87 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/message_expectation.rb +717 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/method_double.rb +287 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/method_reference.rb +192 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/mutate_const.rb +335 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/mutex.rb +73 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/object_reference.rb +149 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/order_group.rb +81 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/proxy.rb +439 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/reentrant_mutex.rb +53 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/space.rb +238 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/standalone.rb +3 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/syntax.rb +325 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/targets.rb +97 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/test_double.rb +170 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/verifying_double.rb +129 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/verifying_message_expecation.rb +54 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/verifying_proxy.rb +213 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/version.rb +9 -0
- data/path/gems/rspec-support-3.3.0/Changelog.md +125 -0
- data/path/gems/rspec-support-3.3.0/LICENSE.txt +22 -0
- data/path/gems/rspec-support-3.3.0/README.md +26 -0
- data/path/gems/rspec-support-3.3.0/lib/rspec/support.rb +111 -0
- data/path/gems/rspec-support-3.3.0/lib/rspec/support/caller_filter.rb +83 -0
- data/path/gems/rspec-support-3.3.0/lib/rspec/support/differ.rb +215 -0
- data/path/gems/rspec-support-3.3.0/lib/rspec/support/directory_maker.rb +63 -0
- data/path/gems/rspec-support-3.3.0/lib/rspec/support/encoded_string.rb +155 -0
- data/path/gems/rspec-support-3.3.0/lib/rspec/support/fuzzy_matcher.rb +48 -0
- data/path/gems/rspec-support-3.3.0/lib/rspec/support/hunk_generator.rb +47 -0
- data/path/gems/rspec-support-3.3.0/lib/rspec/support/matcher_definition.rb +42 -0
- data/path/gems/rspec-support-3.3.0/lib/rspec/support/method_signature_verifier.rb +273 -0
- data/path/gems/rspec-support-3.3.0/lib/rspec/support/object_formatter.rb +93 -0
- data/path/gems/rspec-support-3.3.0/lib/rspec/support/recursive_const_methods.rb +76 -0
- data/path/gems/rspec-support-3.3.0/lib/rspec/support/ruby_features.rb +118 -0
- data/path/gems/rspec-support-3.3.0/lib/rspec/support/spec.rb +81 -0
- data/path/gems/rspec-support-3.3.0/lib/rspec/support/spec/deprecation_helpers.rb +64 -0
- data/path/gems/rspec-support-3.3.0/lib/rspec/support/spec/formatting_support.rb +9 -0
- data/path/gems/rspec-support-3.3.0/lib/rspec/support/spec/in_sub_process.rb +52 -0
- data/path/gems/rspec-support-3.3.0/lib/rspec/support/spec/library_wide_checks.rb +145 -0
- data/path/gems/rspec-support-3.3.0/lib/rspec/support/spec/shell_out.rb +71 -0
- data/path/gems/rspec-support-3.3.0/lib/rspec/support/spec/stderr_splitter.rb +63 -0
- data/path/gems/rspec-support-3.3.0/lib/rspec/support/spec/string_matcher.rb +46 -0
- data/path/gems/rspec-support-3.3.0/lib/rspec/support/spec/with_isolated_directory.rb +9 -0
- data/path/gems/rspec-support-3.3.0/lib/rspec/support/spec/with_isolated_stderr.rb +13 -0
- data/path/gems/rspec-support-3.3.0/lib/rspec/support/version.rb +7 -0
- data/path/gems/rspec-support-3.3.0/lib/rspec/support/version_checker.rb +53 -0
- data/path/gems/rspec-support-3.3.0/lib/rspec/support/warnings.rb +39 -0
- data/path/specifications/diff-lcs-1.2.5.gemspec +68 -0
- data/path/specifications/rspec-3.3.0.gemspec +42 -0
- data/path/specifications/rspec-core-3.3.2.gemspec +68 -0
- data/path/specifications/rspec-expectations-3.3.1.gemspec +50 -0
- data/path/specifications/rspec-mocks-3.3.2.gemspec +53 -0
- data/path/specifications/rspec-support-3.3.0.gemspec +38 -0
- data/sublimetheme.gemspec +32 -0
- metadata +363 -0
@@ -0,0 +1,393 @@
|
|
1
|
+
module RSpec
|
2
|
+
module Core
|
3
|
+
module Formatters
|
4
|
+
# @private
|
5
|
+
class ExceptionPresenter
|
6
|
+
attr_reader :exception, :example, :description, :message_color,
|
7
|
+
:detail_formatter, :extra_detail_formatter, :backtrace_formatter
|
8
|
+
private :message_color, :detail_formatter, :extra_detail_formatter, :backtrace_formatter
|
9
|
+
|
10
|
+
def initialize(exception, example, options={})
|
11
|
+
@exception = exception
|
12
|
+
@example = example
|
13
|
+
@message_color = options.fetch(:message_color) { RSpec.configuration.failure_color }
|
14
|
+
@description = options.fetch(:description_formatter) { Proc.new { example.full_description } }.call(self)
|
15
|
+
@detail_formatter = options.fetch(:detail_formatter) { Proc.new {} }
|
16
|
+
@extra_detail_formatter = options.fetch(:extra_detail_formatter) { Proc.new {} }
|
17
|
+
@backtrace_formatter = options.fetch(:backtrace_formatter) { RSpec.configuration.backtrace_formatter }
|
18
|
+
@indentation = options.fetch(:indentation, 2)
|
19
|
+
@skip_shared_group_trace = options.fetch(:skip_shared_group_trace, false)
|
20
|
+
@failure_lines = options[:failure_lines]
|
21
|
+
end
|
22
|
+
|
23
|
+
def message_lines
|
24
|
+
add_shared_group_lines(failure_lines, Notifications::NullColorizer)
|
25
|
+
end
|
26
|
+
|
27
|
+
def colorized_message_lines(colorizer=::RSpec::Core::Formatters::ConsoleCodes)
|
28
|
+
add_shared_group_lines(failure_lines, colorizer).map do |line|
|
29
|
+
colorizer.wrap line, message_color
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def formatted_backtrace
|
34
|
+
backtrace_formatter.format_backtrace(exception_backtrace, example.metadata)
|
35
|
+
end
|
36
|
+
|
37
|
+
def colorized_formatted_backtrace(colorizer=::RSpec::Core::Formatters::ConsoleCodes)
|
38
|
+
formatted_backtrace.map do |backtrace_info|
|
39
|
+
colorizer.wrap "# #{backtrace_info}", RSpec.configuration.detail_color
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def fully_formatted(failure_number, colorizer=::RSpec::Core::Formatters::ConsoleCodes)
|
44
|
+
alignment_basis = "#{' ' * @indentation}#{failure_number}) "
|
45
|
+
indentation = ' ' * alignment_basis.length
|
46
|
+
|
47
|
+
"\n#{alignment_basis}#{description_and_detail(colorizer, indentation)}" \
|
48
|
+
"\n#{formatted_message_and_backtrace(colorizer, indentation)}" \
|
49
|
+
"#{extra_detail_formatter.call(failure_number, colorizer, indentation)}"
|
50
|
+
end
|
51
|
+
|
52
|
+
def failure_slash_error_line
|
53
|
+
@failure_slash_error_line ||= "Failure/Error: #{read_failed_line.strip}"
|
54
|
+
end
|
55
|
+
|
56
|
+
private
|
57
|
+
|
58
|
+
def description_and_detail(colorizer, indentation)
|
59
|
+
detail = detail_formatter.call(example, colorizer, indentation)
|
60
|
+
return (description || detail) unless description && detail
|
61
|
+
"#{description}\n#{indentation}#{detail}"
|
62
|
+
end
|
63
|
+
|
64
|
+
if String.method_defined?(:encoding)
|
65
|
+
def encoding_of(string)
|
66
|
+
string.encoding
|
67
|
+
end
|
68
|
+
|
69
|
+
def encoded_string(string)
|
70
|
+
RSpec::Support::EncodedString.new(string, Encoding.default_external)
|
71
|
+
end
|
72
|
+
else # for 1.8.7
|
73
|
+
# :nocov:
|
74
|
+
def encoding_of(_string)
|
75
|
+
end
|
76
|
+
|
77
|
+
def encoded_string(string)
|
78
|
+
RSpec::Support::EncodedString.new(string)
|
79
|
+
end
|
80
|
+
# :nocov:
|
81
|
+
end
|
82
|
+
|
83
|
+
def exception_class_name
|
84
|
+
name = exception.class.name.to_s
|
85
|
+
name = "(anonymous error class)" if name == ''
|
86
|
+
name
|
87
|
+
end
|
88
|
+
|
89
|
+
def failure_lines
|
90
|
+
@failure_lines ||=
|
91
|
+
begin
|
92
|
+
lines = []
|
93
|
+
lines << failure_slash_error_line unless (description == failure_slash_error_line)
|
94
|
+
lines << "#{exception_class_name}:" unless exception_class_name =~ /RSpec/
|
95
|
+
encoded_string(exception.message.to_s).split("\n").each do |line|
|
96
|
+
lines << " #{line}"
|
97
|
+
end
|
98
|
+
lines
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
def add_shared_group_lines(lines, colorizer)
|
103
|
+
return lines if @skip_shared_group_trace
|
104
|
+
|
105
|
+
example.metadata[:shared_group_inclusion_backtrace].each do |frame|
|
106
|
+
lines << colorizer.wrap(frame.description, RSpec.configuration.default_color)
|
107
|
+
end
|
108
|
+
|
109
|
+
lines
|
110
|
+
end
|
111
|
+
|
112
|
+
def read_failed_line
|
113
|
+
matching_line = find_failed_line
|
114
|
+
unless matching_line
|
115
|
+
return "Unable to find matching line from backtrace"
|
116
|
+
end
|
117
|
+
|
118
|
+
file_path, line_number = matching_line.match(/(.+?):(\d+)(|:\d+)/)[1..2]
|
119
|
+
|
120
|
+
if File.exist?(file_path)
|
121
|
+
File.readlines(file_path)[line_number.to_i - 1] ||
|
122
|
+
"Unable to find matching line in #{file_path}"
|
123
|
+
else
|
124
|
+
"Unable to find #{file_path} to read failed line"
|
125
|
+
end
|
126
|
+
rescue SecurityError
|
127
|
+
"Unable to read failed line"
|
128
|
+
end
|
129
|
+
|
130
|
+
def find_failed_line
|
131
|
+
example_path = example.metadata[:absolute_file_path].downcase
|
132
|
+
exception_backtrace.find do |line|
|
133
|
+
next unless (line_path = line[/(.+?):(\d+)(|:\d+)/, 1])
|
134
|
+
File.expand_path(line_path).downcase == example_path
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
def formatted_message_and_backtrace(colorizer, indentation)
|
139
|
+
lines = colorized_message_lines(colorizer) + colorized_formatted_backtrace(colorizer)
|
140
|
+
|
141
|
+
formatted = ""
|
142
|
+
|
143
|
+
lines.each do |line|
|
144
|
+
formatted << RSpec::Support::EncodedString.new("#{indentation}#{line}\n", encoding_of(formatted))
|
145
|
+
end
|
146
|
+
|
147
|
+
formatted
|
148
|
+
end
|
149
|
+
|
150
|
+
def exception_backtrace
|
151
|
+
exception.backtrace || []
|
152
|
+
end
|
153
|
+
|
154
|
+
# @private
|
155
|
+
# Configuring the `ExceptionPresenter` with the right set of options to handle
|
156
|
+
# pending vs failed vs skipped and aggregated (or not) failures is not simple.
|
157
|
+
# This class takes care of building an appropriate `ExceptionPresenter` for the
|
158
|
+
# provided example.
|
159
|
+
class Factory
|
160
|
+
def build
|
161
|
+
ExceptionPresenter.new(@exception, @example, options)
|
162
|
+
end
|
163
|
+
|
164
|
+
private
|
165
|
+
|
166
|
+
def initialize(example)
|
167
|
+
@example = example
|
168
|
+
@execution_result = example.execution_result
|
169
|
+
@exception = if @execution_result.status == :pending
|
170
|
+
@execution_result.pending_exception
|
171
|
+
else
|
172
|
+
@execution_result.exception
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
def options
|
177
|
+
with_multiple_error_options_as_needed(@exception, pending_options || {})
|
178
|
+
end
|
179
|
+
|
180
|
+
def pending_options
|
181
|
+
if @execution_result.pending_fixed?
|
182
|
+
{
|
183
|
+
:description_formatter => Proc.new { "#{@example.full_description} FIXED" },
|
184
|
+
:message_color => RSpec.configuration.fixed_color,
|
185
|
+
:failure_lines => [
|
186
|
+
"Expected pending '#{@execution_result.pending_message}' to fail. No Error was raised."
|
187
|
+
]
|
188
|
+
}
|
189
|
+
elsif @execution_result.status == :pending
|
190
|
+
{
|
191
|
+
:message_color => RSpec.configuration.pending_color,
|
192
|
+
:detail_formatter => PENDING_DETAIL_FORMATTER
|
193
|
+
}
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
def with_multiple_error_options_as_needed(exception, options)
|
198
|
+
return options unless multiple_exceptions_error?(exception)
|
199
|
+
|
200
|
+
options = options.merge(
|
201
|
+
:failure_lines => [],
|
202
|
+
:extra_detail_formatter => sub_failure_list_formatter(exception, options[:message_color]),
|
203
|
+
:detail_formatter => multiple_exception_summarizer(exception,
|
204
|
+
options[:detail_formatter],
|
205
|
+
options[:message_color])
|
206
|
+
)
|
207
|
+
|
208
|
+
options[:description_formatter] &&= Proc.new {}
|
209
|
+
|
210
|
+
return options unless exception.aggregation_metadata[:hide_backtrace]
|
211
|
+
options[:backtrace_formatter] = EmptyBacktraceFormatter
|
212
|
+
options
|
213
|
+
end
|
214
|
+
|
215
|
+
def multiple_exceptions_error?(exception)
|
216
|
+
MultipleExceptionError::InterfaceTag === exception
|
217
|
+
end
|
218
|
+
|
219
|
+
def multiple_exception_summarizer(exception, prior_detail_formatter, color)
|
220
|
+
lambda do |example, colorizer, indentation|
|
221
|
+
summary = if exception.aggregation_metadata[:hide_backtrace]
|
222
|
+
# Since the backtrace is hidden, the subfailures will come
|
223
|
+
# immediately after this, and using `:` will read well.
|
224
|
+
"Got #{exception.exception_count_description}:"
|
225
|
+
else
|
226
|
+
# The backtrace comes after this, so using a `:` doesn't make sense
|
227
|
+
# since the failures may be many lines below.
|
228
|
+
"#{exception.summary}."
|
229
|
+
end
|
230
|
+
|
231
|
+
summary = colorizer.wrap(summary, color || RSpec.configuration.failure_color)
|
232
|
+
return summary unless prior_detail_formatter
|
233
|
+
"#{prior_detail_formatter.call(example, colorizer, indentation)}\n#{indentation}#{summary}"
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
237
|
+
def sub_failure_list_formatter(exception, message_color)
|
238
|
+
common_backtrace_truncater = CommonBacktraceTruncater.new(exception)
|
239
|
+
|
240
|
+
lambda do |failure_number, colorizer, indentation|
|
241
|
+
exception.all_exceptions.each_with_index.map do |failure, index|
|
242
|
+
options = with_multiple_error_options_as_needed(
|
243
|
+
failure,
|
244
|
+
:description_formatter => :failure_slash_error_line.to_proc,
|
245
|
+
:indentation => indentation.length,
|
246
|
+
:message_color => message_color || RSpec.configuration.failure_color,
|
247
|
+
:skip_shared_group_trace => true
|
248
|
+
)
|
249
|
+
|
250
|
+
failure = common_backtrace_truncater.with_truncated_backtrace(failure)
|
251
|
+
presenter = ExceptionPresenter.new(failure, @example, options)
|
252
|
+
presenter.fully_formatted("#{failure_number}.#{index + 1}", colorizer)
|
253
|
+
end.join
|
254
|
+
end
|
255
|
+
end
|
256
|
+
|
257
|
+
# @private
|
258
|
+
# Used to prevent a confusing backtrace from showing up from the `aggregate_failures`
|
259
|
+
# block declared for `:aggregate_failures` metadata.
|
260
|
+
module EmptyBacktraceFormatter
|
261
|
+
def self.format_backtrace(*)
|
262
|
+
[]
|
263
|
+
end
|
264
|
+
end
|
265
|
+
|
266
|
+
# @private
|
267
|
+
class CommonBacktraceTruncater
|
268
|
+
def initialize(parent)
|
269
|
+
@parent = parent
|
270
|
+
end
|
271
|
+
|
272
|
+
def with_truncated_backtrace(child)
|
273
|
+
child_bt = child.backtrace
|
274
|
+
parent_bt = @parent.backtrace
|
275
|
+
return child if child_bt.nil? || child_bt.empty? || parent_bt.nil?
|
276
|
+
|
277
|
+
index_before_first_common_frame = -1.downto(-child_bt.size).find do |index|
|
278
|
+
parent_bt[index] != child_bt[index]
|
279
|
+
end
|
280
|
+
|
281
|
+
return child if index_before_first_common_frame == -1
|
282
|
+
|
283
|
+
child = child.dup
|
284
|
+
child.set_backtrace(child_bt[0..index_before_first_common_frame])
|
285
|
+
child
|
286
|
+
end
|
287
|
+
end
|
288
|
+
end
|
289
|
+
|
290
|
+
# @private
|
291
|
+
PENDING_DETAIL_FORMATTER = Proc.new do |example, colorizer|
|
292
|
+
colorizer.wrap("# #{example.execution_result.pending_message}", :detail)
|
293
|
+
end
|
294
|
+
end
|
295
|
+
end
|
296
|
+
|
297
|
+
# Provides a single exception instance that provides access to
|
298
|
+
# multiple sub-exceptions. This is used in situations where a single
|
299
|
+
# individual spec has multiple exceptions, such as one in the `it` block
|
300
|
+
# and one in an `after` block.
|
301
|
+
class MultipleExceptionError < StandardError
|
302
|
+
# @private
|
303
|
+
# Used so there is a common module in the ancestor chain of this class
|
304
|
+
# and `RSpec::Expectations::MultipleExpectationsNotMetError`, which allows
|
305
|
+
# code to detect exceptions that are instances of either, without first
|
306
|
+
# checking to see if rspec-expectations is loaded.
|
307
|
+
module InterfaceTag
|
308
|
+
# Appends the provided exception to the list.
|
309
|
+
# @param exception [Exception] Exception to append to the list.
|
310
|
+
# @private
|
311
|
+
def add(exception)
|
312
|
+
# `PendingExampleFixedError` can be assigned to an example that initially has no
|
313
|
+
# failures, but when the `aggregate_failures` around hook completes, it notifies of
|
314
|
+
# a failure. If we do not ignore `PendingExampleFixedError` it would be surfaced to
|
315
|
+
# the user as part of a multiple exception error, which is undesirable. While it's
|
316
|
+
# pretty weird we handle this here, it's the best solution I've been able to come
|
317
|
+
# up with, and `PendingExampleFixedError` always represents the _lack_ of any exception
|
318
|
+
# so clearly when we are transitioning to a `MultipleExceptionError`, it makes sense to
|
319
|
+
# ignore it.
|
320
|
+
return if Pending::PendingExampleFixedError === exception
|
321
|
+
|
322
|
+
all_exceptions << exception
|
323
|
+
|
324
|
+
if exception.class.name =~ /RSpec/
|
325
|
+
failures << exception
|
326
|
+
else
|
327
|
+
other_errors << exception
|
328
|
+
end
|
329
|
+
end
|
330
|
+
|
331
|
+
# Provides a way to force `ex` to be something that satisfies the multiple
|
332
|
+
# exception error interface. If it already satisfies it, it will be returned;
|
333
|
+
# otherwise it will wrap it in a `MultipleExceptionError`.
|
334
|
+
# @private
|
335
|
+
def self.for(ex)
|
336
|
+
return ex if self === ex
|
337
|
+
MultipleExceptionError.new(ex)
|
338
|
+
end
|
339
|
+
end
|
340
|
+
|
341
|
+
include InterfaceTag
|
342
|
+
|
343
|
+
# @return [Array<Exception>] The list of failures.
|
344
|
+
attr_reader :failures
|
345
|
+
|
346
|
+
# @return [Array<Exception>] The list of other errors.
|
347
|
+
attr_reader :other_errors
|
348
|
+
|
349
|
+
# @return [Array<Exception>] The list of failures and other exceptions, combined.
|
350
|
+
attr_reader :all_exceptions
|
351
|
+
|
352
|
+
# @return [Hash] Metadata used by RSpec for formatting purposes.
|
353
|
+
attr_reader :aggregation_metadata
|
354
|
+
|
355
|
+
# @return [nil] Provided only for interface compatibility with
|
356
|
+
# `RSpec::Expectations::MultipleExpectationsNotMetError`.
|
357
|
+
attr_reader :aggregation_block_label
|
358
|
+
|
359
|
+
# @param exceptions [Array<Exception>] The initial list of exceptions.
|
360
|
+
def initialize(*exceptions)
|
361
|
+
super()
|
362
|
+
|
363
|
+
@failures = []
|
364
|
+
@other_errors = []
|
365
|
+
@all_exceptions = []
|
366
|
+
@aggregation_metadata = { :hide_backtrace => true }
|
367
|
+
@aggregation_block_label = nil
|
368
|
+
|
369
|
+
exceptions.each { |e| add e }
|
370
|
+
end
|
371
|
+
|
372
|
+
# @return [String] Combines all the exception messages into a single string.
|
373
|
+
# @note RSpec does not actually use this -- instead it formats each exception
|
374
|
+
# individually.
|
375
|
+
def message
|
376
|
+
all_exceptions.map(&:message).join("\n\n")
|
377
|
+
end
|
378
|
+
|
379
|
+
# @return [String] A summary of the failure, including the block label and a count of failures.
|
380
|
+
def summary
|
381
|
+
"Got #{exception_count_description}"
|
382
|
+
end
|
383
|
+
|
384
|
+
# return [String] A description of the failure/error counts.
|
385
|
+
def exception_count_description
|
386
|
+
failure_count = Formatters::Helpers.pluralize(failures.size, "failure")
|
387
|
+
return failure_count if other_errors.empty?
|
388
|
+
error_count = Formatters::Helpers.pluralize(other_errors.size, "other error")
|
389
|
+
"#{failure_count} and #{error_count}"
|
390
|
+
end
|
391
|
+
end
|
392
|
+
end
|
393
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module RSpec
|
2
|
+
module Core
|
3
|
+
module Formatters
|
4
|
+
# @api private
|
5
|
+
# Formatter for providing message output as a fallback when no other
|
6
|
+
# profiler implements #message
|
7
|
+
class FallbackMessageFormatter
|
8
|
+
Formatters.register self, :message
|
9
|
+
|
10
|
+
def initialize(output)
|
11
|
+
@output = output
|
12
|
+
end
|
13
|
+
|
14
|
+
# @private
|
15
|
+
attr_reader :output
|
16
|
+
|
17
|
+
# @api public
|
18
|
+
#
|
19
|
+
# Used by the reporter to send messages to the output stream.
|
20
|
+
#
|
21
|
+
# @param notification [MessageNotification] containing message
|
22
|
+
def message(notification)
|
23
|
+
output.puts notification.message
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,109 @@
|
|
1
|
+
RSpec::Support.require_rspec_core "shell_escape"
|
2
|
+
|
3
|
+
module RSpec
|
4
|
+
module Core
|
5
|
+
module Formatters
|
6
|
+
# Formatters helpers.
|
7
|
+
module Helpers
|
8
|
+
# @private
|
9
|
+
SUB_SECOND_PRECISION = 5
|
10
|
+
|
11
|
+
# @private
|
12
|
+
DEFAULT_PRECISION = 2
|
13
|
+
|
14
|
+
# @api private
|
15
|
+
#
|
16
|
+
# Formats seconds into a human-readable string.
|
17
|
+
#
|
18
|
+
# @param duration [Float, Fixnum] in seconds
|
19
|
+
# @return [String] human-readable time
|
20
|
+
#
|
21
|
+
# @example
|
22
|
+
# format_duration(1) #=> "1 minute 1 second"
|
23
|
+
# format_duration(135.14) #=> "2 minutes 15.14 seconds"
|
24
|
+
def self.format_duration(duration)
|
25
|
+
precision = case
|
26
|
+
when duration < 1 then SUB_SECOND_PRECISION
|
27
|
+
when duration < 120 then DEFAULT_PRECISION
|
28
|
+
when duration < 300 then 1
|
29
|
+
else 0
|
30
|
+
end
|
31
|
+
|
32
|
+
if duration > 60
|
33
|
+
minutes = (duration.to_i / 60).to_i
|
34
|
+
seconds = duration - minutes * 60
|
35
|
+
|
36
|
+
"#{pluralize(minutes, 'minute')} #{pluralize(format_seconds(seconds, precision), 'second')}"
|
37
|
+
else
|
38
|
+
pluralize(format_seconds(duration, precision), 'second')
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
# @api private
|
43
|
+
#
|
44
|
+
# Formats seconds to have 5 digits of precision with trailing zeros
|
45
|
+
# removed if the number is less than 1 or with 2 digits of precision if
|
46
|
+
# the number is greater than zero.
|
47
|
+
#
|
48
|
+
# @param float [Float]
|
49
|
+
# @return [String] formatted float
|
50
|
+
#
|
51
|
+
# @example
|
52
|
+
# format_seconds(0.000006) #=> "0.00001"
|
53
|
+
# format_seconds(0.020000) #=> "0.02"
|
54
|
+
# format_seconds(1.00000000001) #=> "1"
|
55
|
+
#
|
56
|
+
# The precision used is set in {Helpers::SUB_SECOND_PRECISION} and
|
57
|
+
# {Helpers::DEFAULT_PRECISION}.
|
58
|
+
#
|
59
|
+
# @see #strip_trailing_zeroes
|
60
|
+
def self.format_seconds(float, precision=nil)
|
61
|
+
precision ||= (float < 1) ? SUB_SECOND_PRECISION : DEFAULT_PRECISION
|
62
|
+
formatted = "%.#{precision}f" % float
|
63
|
+
strip_trailing_zeroes(formatted)
|
64
|
+
end
|
65
|
+
|
66
|
+
# @api private
|
67
|
+
#
|
68
|
+
# Remove trailing zeros from a string.
|
69
|
+
#
|
70
|
+
# Only remove trailing zeros after a decimal place.
|
71
|
+
# see: http://rubular.com/r/ojtTydOgpn
|
72
|
+
#
|
73
|
+
# @param string [String] string with trailing zeros
|
74
|
+
# @return [String] string with trailing zeros removed
|
75
|
+
def self.strip_trailing_zeroes(string)
|
76
|
+
string.sub(/(?:(\..*[^0])0+|\.0+)$/, '\1')
|
77
|
+
end
|
78
|
+
private_class_method :strip_trailing_zeroes
|
79
|
+
|
80
|
+
# @api private
|
81
|
+
#
|
82
|
+
# Pluralize a word based on a count.
|
83
|
+
#
|
84
|
+
# @param count [Fixnum] number of objects
|
85
|
+
# @param string [String] word to be pluralized
|
86
|
+
# @return [String] pluralized word
|
87
|
+
def self.pluralize(count, string)
|
88
|
+
"#{count} #{string}#{'s' unless count.to_f == 1}"
|
89
|
+
end
|
90
|
+
|
91
|
+
# @api private
|
92
|
+
# Given a list of example ids, organizes them into a compact, ordered list.
|
93
|
+
def self.organize_ids(ids)
|
94
|
+
grouped = ids.inject(Hash.new { |h, k| h[k] = [] }) do |hash, id|
|
95
|
+
file, id = id.split(Configuration::ON_SQUARE_BRACKETS)
|
96
|
+
hash[file] << id
|
97
|
+
hash
|
98
|
+
end
|
99
|
+
|
100
|
+
grouped.sort_by(&:first).map do |file, grouped_ids|
|
101
|
+
grouped_ids = grouped_ids.sort_by { |id| id.split(':').map(&:to_i) }
|
102
|
+
id = Metadata.id_from(:rerun_file_path => file, :scoped_id => grouped_ids.join(','))
|
103
|
+
ShellEscape.conditionally_quote(id)
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|