fluid_cli 0.1.2
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/README.md +1 -0
- data/dev.yml +5 -0
- data/exe/fluid +24 -0
- data/lib/fluid_cli/api.rb +135 -0
- data/lib/fluid_cli/assets/post_auth_page/index.html.erb +34 -0
- data/lib/fluid_cli/assets/post_auth_page/style.css +58 -0
- data/lib/fluid_cli/command.rb +55 -0
- data/lib/fluid_cli/commands/help.rb +21 -0
- data/lib/fluid_cli/commands/login.rb +30 -0
- data/lib/fluid_cli/commands/logout.rb +38 -0
- data/lib/fluid_cli/commands/switch.rb +23 -0
- data/lib/fluid_cli/commands/theme/common/company_helper.rb +15 -0
- data/lib/fluid_cli/commands/theme/common/root_helper.rb +95 -0
- data/lib/fluid_cli/commands/theme/dev.rb +61 -0
- data/lib/fluid_cli/commands/theme/help.rb +21 -0
- data/lib/fluid_cli/commands/theme/init.rb +46 -0
- data/lib/fluid_cli/commands/theme/pull.rb +68 -0
- data/lib/fluid_cli/commands/theme/push.rb +132 -0
- data/lib/fluid_cli/commands/theme.rb +23 -0
- data/lib/fluid_cli/commands/whoami.rb +23 -0
- data/lib/fluid_cli/commands.rb +19 -0
- data/lib/fluid_cli/company_switcher.rb +69 -0
- data/lib/fluid_cli/context.rb +691 -0
- data/lib/fluid_cli/db.rb +114 -0
- data/lib/fluid_cli/entry_point.rb +10 -0
- data/lib/fluid_cli/environment.rb +32 -0
- data/lib/fluid_cli/file_system_listener.rb +29 -0
- data/lib/fluid_cli/form.rb +42 -0
- data/lib/fluid_cli/git.rb +319 -0
- data/lib/fluid_cli/http_request.rb +54 -0
- data/lib/fluid_cli/identity_auth/servlet.rb +39 -0
- data/lib/fluid_cli/identity_auth.rb +126 -0
- data/lib/fluid_cli/options.rb +38 -0
- data/lib/fluid_cli/theme/dev_server/certificate_manager.rb +79 -0
- data/lib/fluid_cli/theme/dev_server/errors.rb +9 -0
- data/lib/fluid_cli/theme/dev_server/header_hash.rb +98 -0
- data/lib/fluid_cli/theme/dev_server/hooks/file_change_hook.rb +39 -0
- data/lib/fluid_cli/theme/dev_server/hot_reload/resources/hot-reload-no-script.html +27 -0
- data/lib/fluid_cli/theme/dev_server/hot_reload/resources/hot_reload.js +28 -0
- data/lib/fluid_cli/theme/dev_server/hot_reload/resources/sse_client.js +43 -0
- data/lib/fluid_cli/theme/dev_server/hot_reload/resources/theme.js +16 -0
- data/lib/fluid_cli/theme/dev_server/hot_reload/script_injector.rb +54 -0
- data/lib/fluid_cli/theme/dev_server/hot_reload.rb +75 -0
- data/lib/fluid_cli/theme/dev_server/local_assets.rb +92 -0
- data/lib/fluid_cli/theme/dev_server/proxy.rb +235 -0
- data/lib/fluid_cli/theme/dev_server/proxy_param_builder.rb +82 -0
- data/lib/fluid_cli/theme/dev_server/reload_mode.rb +34 -0
- data/lib/fluid_cli/theme/dev_server/sse.rb +75 -0
- data/lib/fluid_cli/theme/dev_server/watcher.rb +57 -0
- data/lib/fluid_cli/theme/dev_server/web_server.rb +140 -0
- data/lib/fluid_cli/theme/dev_server.rb +289 -0
- data/lib/fluid_cli/theme/development_theme.rb +101 -0
- data/lib/fluid_cli/theme/file.rb +105 -0
- data/lib/fluid_cli/theme/forms/select.rb +33 -0
- data/lib/fluid_cli/theme/mime_type.rb +34 -0
- data/lib/fluid_cli/theme/presenters/theme_presenter.rb +49 -0
- data/lib/fluid_cli/theme/presenters/themes_presenter.rb +31 -0
- data/lib/fluid_cli/theme/root.rb +62 -0
- data/lib/fluid_cli/theme/syncer/checksums.rb +66 -0
- data/lib/fluid_cli/theme/syncer/downloader.rb +54 -0
- data/lib/fluid_cli/theme/syncer/error_reporter.rb +45 -0
- data/lib/fluid_cli/theme/syncer/merger.rb +53 -0
- data/lib/fluid_cli/theme/syncer/operation.rb +58 -0
- data/lib/fluid_cli/theme/syncer/standard_reporter.rb +32 -0
- data/lib/fluid_cli/theme/syncer/unsupported_script_warning.rb +90 -0
- data/lib/fluid_cli/theme/syncer/uploader/forms/apply_to_all.rb +41 -0
- data/lib/fluid_cli/theme/syncer/uploader/forms/apply_to_all_form.rb +37 -0
- data/lib/fluid_cli/theme/syncer/uploader/forms/base_strategy_form.rb +64 -0
- data/lib/fluid_cli/theme/syncer/uploader/forms/select_delete_strategy.rb +29 -0
- data/lib/fluid_cli/theme/syncer/uploader/forms/select_update_strategy.rb +30 -0
- data/lib/fluid_cli/theme/syncer/uploader/json_delete_handler.rb +49 -0
- data/lib/fluid_cli/theme/syncer/uploader/json_update_handler.rb +71 -0
- data/lib/fluid_cli/theme/syncer/uploader.rb +105 -0
- data/lib/fluid_cli/theme/syncer.rb +412 -0
- data/lib/fluid_cli/theme/theme.rb +186 -0
- data/lib/fluid_cli/theme/ui/sync_progress_bar.rb +22 -0
- data/lib/fluid_cli/thread_pool/job.rb +35 -0
- data/lib/fluid_cli/thread_pool.rb +49 -0
- data/lib/fluid_cli/version.rb +3 -0
- data/lib/fluid_cli.rb +59 -0
- data/vendor/deps/base64/.document +5 -0
- data/vendor/deps/base64/.gitignore +9 -0
- data/vendor/deps/base64/BSDL +22 -0
- data/vendor/deps/base64/COPYING +56 -0
- data/vendor/deps/base64/Gemfile +9 -0
- data/vendor/deps/base64/LEGAL +60 -0
- data/vendor/deps/base64/README.md +48 -0
- data/vendor/deps/base64/Rakefile +31 -0
- data/vendor/deps/base64/base64.gemspec +28 -0
- data/vendor/deps/base64/bin/console +14 -0
- data/vendor/deps/base64/bin/setup +8 -0
- data/vendor/deps/base64/lib/base64.rb +382 -0
- data/vendor/deps/base64/sig/base64.rbs +358 -0
- data/vendor/deps/base64/test/base64/test_base64.rb +115 -0
- data/vendor/deps/base64/test_sig/test_base64.rb +44 -0
- data/vendor/deps/cli-kit/REVISION +1 -0
- data/vendor/deps/cli-kit/lib/cli/kit/args/definition.rb +286 -0
- data/vendor/deps/cli-kit/lib/cli/kit/args/evaluation.rb +215 -0
- data/vendor/deps/cli-kit/lib/cli/kit/args/parser/node.rb +128 -0
- data/vendor/deps/cli-kit/lib/cli/kit/args/parser.rb +125 -0
- data/vendor/deps/cli-kit/lib/cli/kit/args/tokenizer.rb +130 -0
- data/vendor/deps/cli-kit/lib/cli/kit/args.rb +16 -0
- data/vendor/deps/cli-kit/lib/cli/kit/base_command.rb +30 -0
- data/vendor/deps/cli-kit/lib/cli/kit/command_help.rb +268 -0
- data/vendor/deps/cli-kit/lib/cli/kit/command_registry.rb +150 -0
- data/vendor/deps/cli-kit/lib/cli/kit/config.rb +137 -0
- data/vendor/deps/cli-kit/lib/cli/kit/core_ext.rb +28 -0
- data/vendor/deps/cli-kit/lib/cli/kit/error_handler.rb +166 -0
- data/vendor/deps/cli-kit/lib/cli/kit/executor.rb +92 -0
- data/vendor/deps/cli-kit/lib/cli/kit/ini.rb +91 -0
- data/vendor/deps/cli-kit/lib/cli/kit/levenshtein.rb +92 -0
- data/vendor/deps/cli-kit/lib/cli/kit/logger.rb +94 -0
- data/vendor/deps/cli-kit/lib/cli/kit/opts.rb +248 -0
- data/vendor/deps/cli-kit/lib/cli/kit/parse_args.rb +55 -0
- data/vendor/deps/cli-kit/lib/cli/kit/resolver.rb +66 -0
- data/vendor/deps/cli-kit/lib/cli/kit/support/test_helper.rb +260 -0
- data/vendor/deps/cli-kit/lib/cli/kit/support.rb +11 -0
- data/vendor/deps/cli-kit/lib/cli/kit/system.rb +290 -0
- data/vendor/deps/cli-kit/lib/cli/kit/util.rb +118 -0
- data/vendor/deps/cli-kit/lib/cli/kit/version.rb +7 -0
- data/vendor/deps/cli-kit/lib/cli/kit.rb +139 -0
- data/vendor/deps/cli-ui/REVISION +1 -0
- data/vendor/deps/cli-ui/lib/cli/ui/ansi.rb +218 -0
- data/vendor/deps/cli-ui/lib/cli/ui/color.rb +101 -0
- data/vendor/deps/cli-ui/lib/cli/ui/formatter.rb +219 -0
- data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_stack.rb +67 -0
- data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style/box.rb +179 -0
- data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style/bracket.rb +152 -0
- data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style.rb +127 -0
- data/vendor/deps/cli-ui/lib/cli/ui/frame.rb +286 -0
- data/vendor/deps/cli-ui/lib/cli/ui/glyph.rb +92 -0
- data/vendor/deps/cli-ui/lib/cli/ui/os.rb +63 -0
- data/vendor/deps/cli-ui/lib/cli/ui/printer.rb +64 -0
- data/vendor/deps/cli-ui/lib/cli/ui/progress.rb +132 -0
- data/vendor/deps/cli-ui/lib/cli/ui/progress_reporter.rb +209 -0
- data/vendor/deps/cli-ui/lib/cli/ui/prompt/interactive_options.rb +583 -0
- data/vendor/deps/cli-ui/lib/cli/ui/prompt/options_handler.rb +36 -0
- data/vendor/deps/cli-ui/lib/cli/ui/prompt.rb +381 -0
- data/vendor/deps/cli-ui/lib/cli/ui/spinner/async.rb +48 -0
- data/vendor/deps/cli-ui/lib/cli/ui/spinner/spin_group.rb +602 -0
- data/vendor/deps/cli-ui/lib/cli/ui/spinner.rb +79 -0
- data/vendor/deps/cli-ui/lib/cli/ui/stdout_router.rb +399 -0
- data/vendor/deps/cli-ui/lib/cli/ui/table.rb +83 -0
- data/vendor/deps/cli-ui/lib/cli/ui/terminal.rb +55 -0
- data/vendor/deps/cli-ui/lib/cli/ui/truncater.rb +106 -0
- data/vendor/deps/cli-ui/lib/cli/ui/version.rb +8 -0
- data/vendor/deps/cli-ui/lib/cli/ui/widgets/base.rb +46 -0
- data/vendor/deps/cli-ui/lib/cli/ui/widgets/status.rb +79 -0
- data/vendor/deps/cli-ui/lib/cli/ui/widgets.rb +89 -0
- data/vendor/deps/cli-ui/lib/cli/ui/work_queue.rb +142 -0
- data/vendor/deps/cli-ui/lib/cli/ui/wrap.rb +61 -0
- data/vendor/deps/cli-ui/lib/cli/ui.rb +359 -0
- data/vendor/deps/cli-ui/vendor/reentrant_mutex.rb +78 -0
- data/vendor/deps/debug/CONTRIBUTING.md +573 -0
- data/vendor/deps/debug/Gemfile +10 -0
- data/vendor/deps/debug/LICENSE.txt +22 -0
- data/vendor/deps/debug/README.md +996 -0
- data/vendor/deps/debug/Rakefile +57 -0
- data/vendor/deps/debug/TODO.md +23 -0
- data/vendor/deps/debug/debug.gemspec +33 -0
- data/vendor/deps/debug/exe/rdbg +53 -0
- data/vendor/deps/debug/ext/debug/Makefile +273 -0
- data/vendor/deps/debug/ext/debug/debug.c +228 -0
- data/vendor/deps/debug/ext/debug/debug_version.h +1 -0
- data/vendor/deps/debug/ext/debug/extconf.rb +27 -0
- data/vendor/deps/debug/ext/debug/iseq_collector.c +93 -0
- data/vendor/deps/debug/lib/debug/abbrev_command.rb +77 -0
- data/vendor/deps/debug/lib/debug/breakpoint.rb +556 -0
- data/vendor/deps/debug/lib/debug/client.rb +263 -0
- data/vendor/deps/debug/lib/debug/color.rb +123 -0
- data/vendor/deps/debug/lib/debug/config.rb +592 -0
- data/vendor/deps/debug/lib/debug/console.rb +224 -0
- data/vendor/deps/debug/lib/debug/dap_custom/traceInspector.rb +336 -0
- data/vendor/deps/debug/lib/debug/debug.bundle +0 -0
- data/vendor/deps/debug/lib/debug/frame_info.rb +190 -0
- data/vendor/deps/debug/lib/debug/irb_integration.rb +37 -0
- data/vendor/deps/debug/lib/debug/local.rb +115 -0
- data/vendor/deps/debug/lib/debug/open.rb +13 -0
- data/vendor/deps/debug/lib/debug/open_nonstop.rb +15 -0
- data/vendor/deps/debug/lib/debug/prelude.rb +50 -0
- data/vendor/deps/debug/lib/debug/server.rb +534 -0
- data/vendor/deps/debug/lib/debug/server_cdp.rb +1348 -0
- data/vendor/deps/debug/lib/debug/server_dap.rb +1108 -0
- data/vendor/deps/debug/lib/debug/session.rb +2667 -0
- data/vendor/deps/debug/lib/debug/source_repository.rb +150 -0
- data/vendor/deps/debug/lib/debug/start.rb +5 -0
- data/vendor/deps/debug/lib/debug/thread_client.rb +1457 -0
- data/vendor/deps/debug/lib/debug/tracer.rb +241 -0
- data/vendor/deps/debug/lib/debug/version.rb +5 -0
- data/vendor/deps/debug/lib/debug.rb +9 -0
- data/vendor/deps/debug/misc/README.md.erb +660 -0
- data/vendor/deps/listen/.github/release-drafter.yml +17 -0
- data/vendor/deps/listen/.github/workflows/development.yml +67 -0
- data/vendor/deps/listen/.github/workflows/push.yml +12 -0
- data/vendor/deps/listen/.gitignore +28 -0
- data/vendor/deps/listen/.rspec +3 -0
- data/vendor/deps/listen/.rubocop.yml +283 -0
- data/vendor/deps/listen/.yardopts +11 -0
- data/vendor/deps/listen/CHANGELOG.md +1 -0
- data/vendor/deps/listen/CONTRIBUTING.md +45 -0
- data/vendor/deps/listen/Gemfile +33 -0
- data/vendor/deps/listen/Guardfile +26 -0
- data/vendor/deps/listen/LICENSE.txt +22 -0
- data/vendor/deps/listen/README.md +490 -0
- data/vendor/deps/listen/Rakefile +154 -0
- data/vendor/deps/listen/bin/listen +11 -0
- data/vendor/deps/listen/lib/listen/adapter/base.rb +129 -0
- data/vendor/deps/listen/lib/listen/adapter/bsd.rb +104 -0
- data/vendor/deps/listen/lib/listen/adapter/config.rb +31 -0
- data/vendor/deps/listen/lib/listen/adapter/darwin.rb +77 -0
- data/vendor/deps/listen/lib/listen/adapter/linux.rb +108 -0
- data/vendor/deps/listen/lib/listen/adapter/polling.rb +40 -0
- data/vendor/deps/listen/lib/listen/adapter/windows.rb +96 -0
- data/vendor/deps/listen/lib/listen/adapter.rb +43 -0
- data/vendor/deps/listen/lib/listen/backend.rb +40 -0
- data/vendor/deps/listen/lib/listen/change.rb +69 -0
- data/vendor/deps/listen/lib/listen/cli.rb +65 -0
- data/vendor/deps/listen/lib/listen/directory.rb +93 -0
- data/vendor/deps/listen/lib/listen/error.rb +11 -0
- data/vendor/deps/listen/lib/listen/event/config.rb +39 -0
- data/vendor/deps/listen/lib/listen/event/loop.rb +92 -0
- data/vendor/deps/listen/lib/listen/event/processor.rb +128 -0
- data/vendor/deps/listen/lib/listen/event/queue.rb +52 -0
- data/vendor/deps/listen/lib/listen/file.rb +95 -0
- data/vendor/deps/listen/lib/listen/fsm.rb +131 -0
- data/vendor/deps/listen/lib/listen/listener/config.rb +41 -0
- data/vendor/deps/listen/lib/listen/listener.rb +136 -0
- data/vendor/deps/listen/lib/listen/logger.rb +65 -0
- data/vendor/deps/listen/lib/listen/monotonic_time.rb +27 -0
- data/vendor/deps/listen/lib/listen/options.rb +24 -0
- data/vendor/deps/listen/lib/listen/queue_optimizer.rb +129 -0
- data/vendor/deps/listen/lib/listen/record/entry.rb +66 -0
- data/vendor/deps/listen/lib/listen/record/symlink_detector.rb +47 -0
- data/vendor/deps/listen/lib/listen/record.rb +122 -0
- data/vendor/deps/listen/lib/listen/silencer/controller.rb +50 -0
- data/vendor/deps/listen/lib/listen/silencer.rb +106 -0
- data/vendor/deps/listen/lib/listen/thread.rb +54 -0
- data/vendor/deps/listen/lib/listen/version.rb +5 -0
- data/vendor/deps/listen/lib/listen.rb +47 -0
- data/vendor/deps/listen/listen.gemspec +40 -0
- data/vendor/deps/listen/spec/acceptance/listen_spec.rb +320 -0
- data/vendor/deps/listen/spec/lib/listen/adapter/base_spec.rb +101 -0
- data/vendor/deps/listen/spec/lib/listen/adapter/bsd_spec.rb +13 -0
- data/vendor/deps/listen/spec/lib/listen/adapter/config_spec.rb +122 -0
- data/vendor/deps/listen/spec/lib/listen/adapter/darwin_spec.rb +82 -0
- data/vendor/deps/listen/spec/lib/listen/adapter/linux_spec.rb +199 -0
- data/vendor/deps/listen/spec/lib/listen/adapter/polling_spec.rb +83 -0
- data/vendor/deps/listen/spec/lib/listen/adapter/windows_spec.rb +13 -0
- data/vendor/deps/listen/spec/lib/listen/adapter_spec.rb +69 -0
- data/vendor/deps/listen/spec/lib/listen/backend_spec.rb +82 -0
- data/vendor/deps/listen/spec/lib/listen/change_spec.rb +102 -0
- data/vendor/deps/listen/spec/lib/listen/cli_spec.rb +116 -0
- data/vendor/deps/listen/spec/lib/listen/directory_spec.rb +284 -0
- data/vendor/deps/listen/spec/lib/listen/event/config_spec.rb +33 -0
- data/vendor/deps/listen/spec/lib/listen/event/loop_spec.rb +118 -0
- data/vendor/deps/listen/spec/lib/listen/event/processor_spec.rb +250 -0
- data/vendor/deps/listen/spec/lib/listen/event/queue_spec.rb +118 -0
- data/vendor/deps/listen/spec/lib/listen/file_spec.rb +254 -0
- data/vendor/deps/listen/spec/lib/listen/fsm_spec.rb +147 -0
- data/vendor/deps/listen/spec/lib/listen/listener/config_spec.rb +29 -0
- data/vendor/deps/listen/spec/lib/listen/listener_spec.rb +321 -0
- data/vendor/deps/listen/spec/lib/listen/logger_spec.rb +212 -0
- data/vendor/deps/listen/spec/lib/listen/monotonic_time_spec.rb +58 -0
- data/vendor/deps/listen/spec/lib/listen/queue_optimizer_spec.rb +111 -0
- data/vendor/deps/listen/spec/lib/listen/record_spec.rb +424 -0
- data/vendor/deps/listen/spec/lib/listen/silencer/controller_spec.rb +97 -0
- data/vendor/deps/listen/spec/lib/listen/silencer_spec.rb +109 -0
- data/vendor/deps/listen/spec/lib/listen/thread_spec.rb +133 -0
- data/vendor/deps/listen/spec/lib/listen_spec.rb +25 -0
- data/vendor/deps/listen/spec/spec_helper.rb +49 -0
- data/vendor/deps/listen/spec/support/acceptance_helper.rb +260 -0
- data/vendor/deps/listen/spec/support/fixtures_helper.rb +32 -0
- data/vendor/deps/listen/spec/support/platform_helper.rb +17 -0
- data/vendor/deps/observer/.github/dependabot.yml +6 -0
- data/vendor/deps/observer/.github/workflows/test.yml +33 -0
- data/vendor/deps/observer/.gitignore +8 -0
- data/vendor/deps/observer/BSDL +22 -0
- data/vendor/deps/observer/COPYING +56 -0
- data/vendor/deps/observer/Gemfile +9 -0
- data/vendor/deps/observer/README.md +139 -0
- data/vendor/deps/observer/Rakefile +10 -0
- data/vendor/deps/observer/bin/console +14 -0
- data/vendor/deps/observer/bin/setup +8 -0
- data/vendor/deps/observer/lib/observer.rb +229 -0
- data/vendor/deps/observer/observer.gemspec +32 -0
- data/vendor/deps/observer/test/test_observer.rb +66 -0
- data/vendor/deps/webrick/.gitignore +9 -0
- data/vendor/deps/webrick/Gemfile +3 -0
- data/vendor/deps/webrick/LICENSE.txt +22 -0
- data/vendor/deps/webrick/README.md +61 -0
- data/vendor/deps/webrick/Rakefile +10 -0
- data/vendor/deps/webrick/lib/webrick/accesslog.rb +157 -0
- data/vendor/deps/webrick/lib/webrick/cgi.rb +313 -0
- data/vendor/deps/webrick/lib/webrick/compat.rb +36 -0
- data/vendor/deps/webrick/lib/webrick/config.rb +158 -0
- data/vendor/deps/webrick/lib/webrick/cookie.rb +172 -0
- data/vendor/deps/webrick/lib/webrick/htmlutils.rb +30 -0
- data/vendor/deps/webrick/lib/webrick/httpauth/authenticator.rb +117 -0
- data/vendor/deps/webrick/lib/webrick/httpauth/basicauth.rb +116 -0
- data/vendor/deps/webrick/lib/webrick/httpauth/digestauth.rb +395 -0
- data/vendor/deps/webrick/lib/webrick/httpauth/htdigest.rb +132 -0
- data/vendor/deps/webrick/lib/webrick/httpauth/htgroup.rb +97 -0
- data/vendor/deps/webrick/lib/webrick/httpauth/htpasswd.rb +158 -0
- data/vendor/deps/webrick/lib/webrick/httpauth/userdb.rb +53 -0
- data/vendor/deps/webrick/lib/webrick/httpauth.rb +96 -0
- data/vendor/deps/webrick/lib/webrick/httpproxy.rb +354 -0
- data/vendor/deps/webrick/lib/webrick/httprequest.rb +636 -0
- data/vendor/deps/webrick/lib/webrick/httpresponse.rb +564 -0
- data/vendor/deps/webrick/lib/webrick/https.rb +152 -0
- data/vendor/deps/webrick/lib/webrick/httpserver.rb +294 -0
- data/vendor/deps/webrick/lib/webrick/httpservlet/abstract.rb +152 -0
- data/vendor/deps/webrick/lib/webrick/httpservlet/cgi_runner.rb +47 -0
- data/vendor/deps/webrick/lib/webrick/httpservlet/cgihandler.rb +126 -0
- data/vendor/deps/webrick/lib/webrick/httpservlet/erbhandler.rb +88 -0
- data/vendor/deps/webrick/lib/webrick/httpservlet/filehandler.rb +552 -0
- data/vendor/deps/webrick/lib/webrick/httpservlet/prochandler.rb +47 -0
- data/vendor/deps/webrick/lib/webrick/httpservlet.rb +23 -0
- data/vendor/deps/webrick/lib/webrick/httpstatus.rb +194 -0
- data/vendor/deps/webrick/lib/webrick/httputils.rb +512 -0
- data/vendor/deps/webrick/lib/webrick/httpversion.rb +76 -0
- data/vendor/deps/webrick/lib/webrick/log.rb +156 -0
- data/vendor/deps/webrick/lib/webrick/server.rb +381 -0
- data/vendor/deps/webrick/lib/webrick/ssl.rb +215 -0
- data/vendor/deps/webrick/lib/webrick/utils.rb +265 -0
- data/vendor/deps/webrick/lib/webrick/version.rb +18 -0
- data/vendor/deps/webrick/lib/webrick.rb +232 -0
- data/vendor/deps/webrick/webrick.gemspec +74 -0
- metadata +412 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'listen/thread'
|
|
4
|
+
|
|
5
|
+
RSpec.describe Listen::Thread do
|
|
6
|
+
let(:raise_nested_exception_block) do
|
|
7
|
+
-> do
|
|
8
|
+
begin
|
|
9
|
+
begin
|
|
10
|
+
raise ArgumentError, 'boom!'
|
|
11
|
+
rescue
|
|
12
|
+
raise 'nested inner'
|
|
13
|
+
end
|
|
14
|
+
rescue
|
|
15
|
+
raise 'nested outer'
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
let(:raise_script_error_block) do
|
|
21
|
+
-> do
|
|
22
|
+
raise ScriptError, "ruby typo!"
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
describe '.new' do
|
|
27
|
+
let(:name) { "worker_thread" }
|
|
28
|
+
let(:block) { -> { } }
|
|
29
|
+
subject { described_class.new(name, &block) }
|
|
30
|
+
|
|
31
|
+
it "calls Thread.new" do
|
|
32
|
+
expect(Thread).to receive(:new) do
|
|
33
|
+
thread = instance_double(Thread, "thread")
|
|
34
|
+
expect(thread).to receive(:name=).with("listen-#{name}")
|
|
35
|
+
thread
|
|
36
|
+
end
|
|
37
|
+
subject
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
context "when exception raised" do
|
|
41
|
+
let(:block) do
|
|
42
|
+
-> { raise ArgumentError, 'boom!' }
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
it "rescues and logs exceptions" do
|
|
46
|
+
pattern = <<~EOS.strip
|
|
47
|
+
Exception rescued in listen-worker_thread:
|
|
48
|
+
ArgumentError: boom!
|
|
49
|
+
.*\\/listen\\/thread_spec\\.rb
|
|
50
|
+
EOS
|
|
51
|
+
expect(Listen.logger).to receive(:error).with(/#{pattern}/)
|
|
52
|
+
subject.join
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
it "rescues and logs backtrace + exception backtrace" do
|
|
56
|
+
pattern = <<~EOS.strip
|
|
57
|
+
Exception rescued in listen-worker_thread:
|
|
58
|
+
ArgumentError: boom!
|
|
59
|
+
.*\\/listen\\/thread\\.rb.*--- Thread.new ---.*\\/listen\\/thread_spec\\.rb
|
|
60
|
+
EOS
|
|
61
|
+
expect(Listen.logger).to receive(:error).with(/#{pattern}/m)
|
|
62
|
+
subject.join
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
class TestExceptionDerivedFromException < Exception; end # rubocop:disable Lint/InheritException
|
|
67
|
+
|
|
68
|
+
context "when exception raised that is not derived from StandardError" do
|
|
69
|
+
[SystemExit, SystemStackError, NoMemoryError, SecurityError, TestExceptionDerivedFromException].each do |exception|
|
|
70
|
+
context exception.name do
|
|
71
|
+
let(:block) do
|
|
72
|
+
-> { raise exception, 'boom!' }
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
it "does not rescue" do
|
|
76
|
+
expect(Thread).to receive(:new) do |&block|
|
|
77
|
+
expect do
|
|
78
|
+
block.call
|
|
79
|
+
end.to raise_exception(exception, 'boom!')
|
|
80
|
+
|
|
81
|
+
thread = instance_double(Thread, "thread")
|
|
82
|
+
allow(thread).to receive(:name=).with(any_args)
|
|
83
|
+
thread
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
subject
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
context "when nested exceptions raised" do
|
|
93
|
+
let(:block) { raise_nested_exception_block }
|
|
94
|
+
|
|
95
|
+
it "details exception causes" do
|
|
96
|
+
pattern = <<~EOS
|
|
97
|
+
RuntimeError: nested outer
|
|
98
|
+
--- Caused by: ---
|
|
99
|
+
RuntimeError: nested inner
|
|
100
|
+
--- Caused by: ---
|
|
101
|
+
ArgumentError: boom!
|
|
102
|
+
EOS
|
|
103
|
+
expect(Listen.logger).to receive(:error).with(/#{pattern}/)
|
|
104
|
+
subject.join
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
describe '.rescue_and_log' do
|
|
110
|
+
it 'rescues and logs nested exceptions' do
|
|
111
|
+
pattern = <<~EOS
|
|
112
|
+
Exception rescued in method:
|
|
113
|
+
RuntimeError: nested outer
|
|
114
|
+
--- Caused by: ---
|
|
115
|
+
RuntimeError: nested inner
|
|
116
|
+
--- Caused by: ---
|
|
117
|
+
ArgumentError: boom!
|
|
118
|
+
EOS
|
|
119
|
+
expect(Listen.logger).to receive(:error).with(/#{pattern}/)
|
|
120
|
+
described_class.rescue_and_log("method", &raise_nested_exception_block)
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
context 'when exception raised that is not derived from StandardError' do
|
|
124
|
+
let(:block) { raise_script_error_block }
|
|
125
|
+
|
|
126
|
+
it "raises out" do
|
|
127
|
+
expect do
|
|
128
|
+
described_class.rescue_and_log("method", &raise_script_error_block)
|
|
129
|
+
end.to raise_exception(ScriptError, "ruby typo!")
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
RSpec.describe Listen do
|
|
4
|
+
let(:listener) { instance_double(Listen::Listener, stop: nil) }
|
|
5
|
+
|
|
6
|
+
after do
|
|
7
|
+
Listen.stop
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
describe '.to' do
|
|
11
|
+
it 'initalizes listener' do
|
|
12
|
+
expect(Listen::Listener).to receive(:new).with('/path') { listener }
|
|
13
|
+
described_class.to('/path')
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
describe '.stop' do
|
|
18
|
+
it 'stops all listeners' do
|
|
19
|
+
allow(Listen::Listener).to receive(:new).with('/path') { listener }
|
|
20
|
+
expect(listener).to receive(:stop)
|
|
21
|
+
described_class.to('/path')
|
|
22
|
+
Listen.stop
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# TODO: reduce requires everwhere and be more strict about it
|
|
4
|
+
require 'listen'
|
|
5
|
+
|
|
6
|
+
Listen.logger.level = Logger::WARN unless ENV['LISTEN_GEM_DEBUGGING']
|
|
7
|
+
|
|
8
|
+
def ci?
|
|
9
|
+
ENV['CI']
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
if ci?
|
|
13
|
+
require 'coveralls'
|
|
14
|
+
Coveralls.wear!
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
Dir["#{__dir__}/support/**/*.rb"].sort.each { |f| require f }
|
|
18
|
+
|
|
19
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
|
20
|
+
RSpec.configure do |config|
|
|
21
|
+
config.order = :random
|
|
22
|
+
config.filter_run focus: true
|
|
23
|
+
config.run_all_when_everything_filtered = true
|
|
24
|
+
# config.fail_fast = !ci?
|
|
25
|
+
config.expect_with :rspec do |c|
|
|
26
|
+
c.syntax = :expect
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
RSpec::Support::ObjectFormatter.default_instance.max_formatted_output_length = 2_000
|
|
30
|
+
|
|
31
|
+
config.mock_with :rspec do |mocks|
|
|
32
|
+
mocks.verify_doubled_constant_names = true
|
|
33
|
+
mocks.verify_partial_doubles = true
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
config.disable_monkey_patching!
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
module SpecHelpers
|
|
40
|
+
def fake_path(str, options = {})
|
|
41
|
+
instance_double(Pathname, str, { to_s: str, directory?: true }.merge(options))
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
RSpec.configure do |config|
|
|
46
|
+
config.include SpecHelpers
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
Thread.abort_on_exception = true
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
{
|
|
4
|
+
modification: :modified,
|
|
5
|
+
addition: :added,
|
|
6
|
+
removal: :removed,
|
|
7
|
+
queued_modification: :modified,
|
|
8
|
+
queued_addition: :added
|
|
9
|
+
}.each do |description, type|
|
|
10
|
+
RSpec::Matchers.define "process_#{description}_of".to_sym do |expected|
|
|
11
|
+
match do |actual|
|
|
12
|
+
# Use cases:
|
|
13
|
+
# 1. reset the changes so they don't have leftovers
|
|
14
|
+
# 2. keep the queue if we're testing for existing accumulated changes
|
|
15
|
+
|
|
16
|
+
# if were testing the queue (e.g. after unpause), don't reset
|
|
17
|
+
reset_queue = /queued_/ !~ description
|
|
18
|
+
|
|
19
|
+
actual.listen(reset_queue: reset_queue) do
|
|
20
|
+
change_fs(type, expected) if reset_queue
|
|
21
|
+
end
|
|
22
|
+
actual.changes[type].include? expected
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
failure_message do |actual|
|
|
26
|
+
"expected #{actual.changes.inspect} to include #{description} of #{expected}"
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
failure_message_when_negated do |actual|
|
|
30
|
+
"expected #{actual.changes.inspect} to not include #{description} of #{expected}"
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# rubocop:disable Metrics/MethodLength
|
|
36
|
+
def change_fs(type, path)
|
|
37
|
+
case type
|
|
38
|
+
when :modified
|
|
39
|
+
File.exist?(path) or fail "Bad test: cannot modify #{path.inspect} (it doesn't exist)"
|
|
40
|
+
|
|
41
|
+
# wait until full second, because this might be followed by a modification
|
|
42
|
+
# event (which otherwise may not be detected every time)
|
|
43
|
+
_sleep_until_next_second(Pathname.pwd)
|
|
44
|
+
|
|
45
|
+
File.open(path, 'a') { |f| f.write('foo') }
|
|
46
|
+
|
|
47
|
+
# separate it from upcoming modifications"
|
|
48
|
+
_sleep_to_separate_events
|
|
49
|
+
when :added
|
|
50
|
+
File.exist?(path) and fail "Bad test: cannot add #{path.inspect} (it already exists)"
|
|
51
|
+
|
|
52
|
+
# wait until full second, because this might be followed by a modification
|
|
53
|
+
# event (which otherwise may not be detected every time)
|
|
54
|
+
_sleep_until_next_second(Pathname.pwd)
|
|
55
|
+
|
|
56
|
+
File.write(path, 'foo')
|
|
57
|
+
|
|
58
|
+
# separate it from upcoming modifications"
|
|
59
|
+
_sleep_to_separate_events
|
|
60
|
+
when :removed
|
|
61
|
+
File.exist?(path) or fail "Bad test: cannot remove #{path.inspect} (it doesn't exist)"
|
|
62
|
+
File.unlink(path)
|
|
63
|
+
else
|
|
64
|
+
fail "bad test: unknown type: #{type.inspect}"
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
# rubocop:enable Metrics/MethodLength
|
|
68
|
+
|
|
69
|
+
# Used by change_fs() above so that the FS change (e.g. file created) happens
|
|
70
|
+
# as close to the start of a new second (time) as possible.
|
|
71
|
+
#
|
|
72
|
+
# E.g. if file is created at 1234567.999 (unix time), it's mtime on some
|
|
73
|
+
# filesystems is rounded, so it becomes 1234567.0, but if the change
|
|
74
|
+
# notification happens a little while later, e.g. at 1234568.111, now the file
|
|
75
|
+
# mtime and the current time in seconds are different (1234567 vs 1234568), and
|
|
76
|
+
# so the MD5 test won't kick in (see file.rb) - the file will not be considered
|
|
77
|
+
# for content checking (sha), so File.change will consider the file unmodified.
|
|
78
|
+
#
|
|
79
|
+
# This means, that if a file is added at 1234567.888 (and updated in Record),
|
|
80
|
+
# and then its content is modified at 1234567.999, and checking for changes
|
|
81
|
+
# happens at 1234568.111, the modification won't be detected.
|
|
82
|
+
# (because Record mtime is 1234567.0, current FS mtime from stat() is the
|
|
83
|
+
# same, and the checking happens in another second - 1234568).
|
|
84
|
+
#
|
|
85
|
+
# So basically, adding a file and detecting its later modification should all
|
|
86
|
+
# happen within 1 second (which makes testing and debugging difficult).
|
|
87
|
+
#
|
|
88
|
+
def _sleep_until_next_second(path)
|
|
89
|
+
Listen::File.inaccurate_mac_time?(path)
|
|
90
|
+
|
|
91
|
+
t = Time.now.utc
|
|
92
|
+
diff = t.to_f - t.to_i
|
|
93
|
+
|
|
94
|
+
sleep(1.05 - diff)
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# Special class to only allow changes within a specific time window
|
|
98
|
+
|
|
99
|
+
class TimedChanges
|
|
100
|
+
attr_reader :changes
|
|
101
|
+
|
|
102
|
+
def initialize
|
|
103
|
+
# Set to non-nil, because changes can immediately come after unpausing
|
|
104
|
+
# listener in an Rspec 'before()' block
|
|
105
|
+
@changes = { modified: [], added: [], removed: [] }
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def change_offset
|
|
109
|
+
Time.now.to_f - @yield_time
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
def freeze_offset
|
|
113
|
+
result = @freeze_time - @yield_time
|
|
114
|
+
# Make an "almost zero" value more readable
|
|
115
|
+
result < 1e-4 ? 1e-4 : result
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
# Allow changes only during specific time wine
|
|
119
|
+
def allow_changes(reset_queue: true)
|
|
120
|
+
@freeze_time = nil
|
|
121
|
+
if reset_queue
|
|
122
|
+
# Clear to prepare for collecting new FS events
|
|
123
|
+
@changes = { modified: [], added: [], removed: [] }
|
|
124
|
+
else
|
|
125
|
+
# Since we're testing the queue and the listener callback is adding
|
|
126
|
+
# changes to the same hash (e.g. after a pause), copy the existing data
|
|
127
|
+
# to a new, unfrozen hash
|
|
128
|
+
@changes = @changes.dup if @changes.frozen?
|
|
129
|
+
@changes ||= { modified: [], added: [], removed: [] }
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
@yield_time = Time.now.to_f
|
|
133
|
+
yield
|
|
134
|
+
# Prevent recording changes after timeout
|
|
135
|
+
@changes.freeze
|
|
136
|
+
@freeze_time = Time.now.to_f
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
# Conveniently wrap a Listener instance for testing
|
|
141
|
+
class ListenerWrapper
|
|
142
|
+
attr_reader :listener
|
|
143
|
+
attr_accessor :lag
|
|
144
|
+
|
|
145
|
+
def initialize(callback, paths, *args)
|
|
146
|
+
# Lag depends mostly on wait_for_delay On Linux desktop, it's 0.06 - 0.11
|
|
147
|
+
#
|
|
148
|
+
# On Travis it used to be > 0.5, but that was before broadcaster sent
|
|
149
|
+
# changes immediately, so 0.2-0.4 might be enough for Travis, but we set it
|
|
150
|
+
# to 0.8 (because 0.75 wasn't enough recently)
|
|
151
|
+
#
|
|
152
|
+
# The value should be 2-3 x wait_for_delay + time between fs operation and
|
|
153
|
+
# notification, which for polling and FSEvent means the configured latency
|
|
154
|
+
@lag = Float(ENV['LISTEN_TESTS_DEFAULT_LAG'] || 1.0)
|
|
155
|
+
|
|
156
|
+
@paths = paths
|
|
157
|
+
|
|
158
|
+
# Isolate collected changes between tests/listener instances
|
|
159
|
+
@timed_changes = TimedChanges.new
|
|
160
|
+
|
|
161
|
+
@listener = if callback
|
|
162
|
+
Listen.send(*args) do |modified, added, removed|
|
|
163
|
+
# Add changes to trigger frozen Hash error, making sure lag is enough
|
|
164
|
+
_add_changes(:modified, modified, changes)
|
|
165
|
+
_add_changes(:added, added, changes)
|
|
166
|
+
_add_changes(:removed, removed, changes)
|
|
167
|
+
|
|
168
|
+
callback.call(modified, added, removed) unless callback == :track_changes
|
|
169
|
+
end
|
|
170
|
+
else
|
|
171
|
+
Listen.send(*args)
|
|
172
|
+
end
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
def changes
|
|
176
|
+
@timed_changes.changes
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
def listen(reset_queue: true)
|
|
180
|
+
# Give previous events time to be received, queued and processed
|
|
181
|
+
# so they complete and don't interfere
|
|
182
|
+
sleep(lag)
|
|
183
|
+
|
|
184
|
+
@timed_changes.allow_changes(reset_queue: reset_queue) do
|
|
185
|
+
yield
|
|
186
|
+
|
|
187
|
+
# Polling sleep (default: 1s)
|
|
188
|
+
backend = @listener.instance_variable_get(:@backend)
|
|
189
|
+
adapter = backend.instance_variable_get(:@adapter)
|
|
190
|
+
sleep(1.0) if adapter.is_a?(Listen::Adapter::Polling)
|
|
191
|
+
|
|
192
|
+
# Lag should include:
|
|
193
|
+
# 0.1s - 0.2s if the test needs Listener queue to be processed
|
|
194
|
+
# 0.1s in case the system is busy
|
|
195
|
+
sleep(lag)
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
# Keep this to detect a lag too small (changes during this sleep
|
|
199
|
+
# will trigger "frozen hash" error caught below (and displaying timeout
|
|
200
|
+
# details)
|
|
201
|
+
sleep(1)
|
|
202
|
+
|
|
203
|
+
changes
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
private
|
|
207
|
+
|
|
208
|
+
def _add_changes(type, changes, dst)
|
|
209
|
+
dst[type] += _relative_path(changes)
|
|
210
|
+
dst[type].uniq!
|
|
211
|
+
dst[type].sort!
|
|
212
|
+
rescue RuntimeError => e
|
|
213
|
+
raise unless e.message == "can't modify frozen Hash"
|
|
214
|
+
|
|
215
|
+
# Show how by much the changes missed the timeout
|
|
216
|
+
change_offset = @timed_changes.change_offset
|
|
217
|
+
freeze_offset = @timed_changes.freeze_offset
|
|
218
|
+
|
|
219
|
+
raise "Changes took #{change_offset}s (allowed lag: #{freeze_offset})s"
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
def _relative_path(changes)
|
|
223
|
+
changes.map do |change|
|
|
224
|
+
unfrozen_copy = change.dup
|
|
225
|
+
[@paths].flatten.each do |path|
|
|
226
|
+
sub = path.sub(%r{/$}, '').to_s
|
|
227
|
+
unfrozen_copy.gsub!(%r{^#{sub}/}, '')
|
|
228
|
+
end
|
|
229
|
+
unfrozen_copy
|
|
230
|
+
end
|
|
231
|
+
end
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
def setup_listener(options, callback = nil)
|
|
235
|
+
ListenerWrapper.new(callback, paths, :to, paths, options)
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
def setup_recipient(port, callback = nil)
|
|
239
|
+
ListenerWrapper.new(callback, paths, :on, port)
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
def _sleep_to_separate_events
|
|
243
|
+
# separate the events or Darwin and Polling
|
|
244
|
+
# will detect only the :added event
|
|
245
|
+
#
|
|
246
|
+
# (This is because both use directory scanning which may not kick in time
|
|
247
|
+
# before the next filesystem change)
|
|
248
|
+
#
|
|
249
|
+
# The minimum for this is the time it takes between a syscall
|
|
250
|
+
# changing the filesystem ... and ... an async
|
|
251
|
+
# Listen::File.scan to finish comparing the file with the
|
|
252
|
+
# Record
|
|
253
|
+
#
|
|
254
|
+
# This necessary for:
|
|
255
|
+
# - Darwin Adapter
|
|
256
|
+
# - Polling Adapter
|
|
257
|
+
# - Linux Adapter in FSEvent emulation mode
|
|
258
|
+
# - maybe Windows adapter (probably not)
|
|
259
|
+
sleep(0.4)
|
|
260
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'tmpdir'
|
|
4
|
+
|
|
5
|
+
include FileUtils
|
|
6
|
+
|
|
7
|
+
# Prepares temporary fixture-directories and
|
|
8
|
+
# cleans them afterwards.
|
|
9
|
+
#
|
|
10
|
+
# @param [Fixnum] number_of_directories the number of fixture-directories to
|
|
11
|
+
# make
|
|
12
|
+
#
|
|
13
|
+
# @yield [path1, path2, ...] the empty fixture-directories
|
|
14
|
+
# @yieldparam [String] path the path to a fixture directory
|
|
15
|
+
#
|
|
16
|
+
def fixtures(number_of_directories = 1)
|
|
17
|
+
current_pwd = Dir.pwd
|
|
18
|
+
paths = 1.upto(number_of_directories).map { mk_fixture_tmp_dir }
|
|
19
|
+
|
|
20
|
+
FileUtils.cd(paths.first) if number_of_directories == 1
|
|
21
|
+
|
|
22
|
+
yield(*paths)
|
|
23
|
+
ensure
|
|
24
|
+
FileUtils.cd current_pwd
|
|
25
|
+
paths.map { |p| FileUtils.rm_rf(p) if File.exist?(p) }
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def mk_fixture_tmp_dir
|
|
29
|
+
timestamp = Time.now.to_f.to_s.sub('.', '') + rand(9999).to_s
|
|
30
|
+
path = Pathname.pwd.join('spec', '.fixtures', timestamp).expand_path
|
|
31
|
+
path.tap(&:mkpath)
|
|
32
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
def darwin?
|
|
4
|
+
RbConfig::CONFIG['target_os'] =~ /darwin/i
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def linux?
|
|
8
|
+
RbConfig::CONFIG['target_os'] =~ /linux/i
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def bsd?
|
|
12
|
+
RbConfig::CONFIG['target_os'] =~ /bsd|dragonfly/i
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def windows?
|
|
16
|
+
RbConfig::CONFIG['target_os'] =~ /mswin|mingw|cygwin/i
|
|
17
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
name: test
|
|
2
|
+
|
|
3
|
+
on: [push, pull_request]
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
ruby-versions:
|
|
7
|
+
uses: ruby/actions/.github/workflows/ruby_versions.yml@master
|
|
8
|
+
with:
|
|
9
|
+
engine: cruby
|
|
10
|
+
min_version: 2.4
|
|
11
|
+
|
|
12
|
+
test:
|
|
13
|
+
needs: ruby-versions
|
|
14
|
+
name: build (${{ matrix.ruby }} / ${{ matrix.os }})
|
|
15
|
+
strategy:
|
|
16
|
+
matrix:
|
|
17
|
+
ruby: ${{ fromJson(needs.ruby-versions.outputs.versions) }}
|
|
18
|
+
os: [ ubuntu-latest, macos-latest ]
|
|
19
|
+
exclude:
|
|
20
|
+
- ruby: 2.4
|
|
21
|
+
os: macos-latest
|
|
22
|
+
- ruby: 2.5
|
|
23
|
+
os: macos-latest
|
|
24
|
+
runs-on: ${{ matrix.os }}
|
|
25
|
+
steps:
|
|
26
|
+
- uses: actions/checkout@v5
|
|
27
|
+
- name: Set up Ruby
|
|
28
|
+
uses: ruby/setup-ruby@v1
|
|
29
|
+
with:
|
|
30
|
+
ruby-version: ${{ matrix.ruby }}
|
|
31
|
+
bundler-cache: true # Run "bundle install", and cache the result automatically.
|
|
32
|
+
- name: Run test
|
|
33
|
+
run: bundle exec rake test
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (C) 1993-2013 Yukihiro Matsumoto. All rights reserved.
|
|
2
|
+
|
|
3
|
+
Redistribution and use in source and binary forms, with or without
|
|
4
|
+
modification, are permitted provided that the following conditions
|
|
5
|
+
are met:
|
|
6
|
+
1. Redistributions of source code must retain the above copyright
|
|
7
|
+
notice, this list of conditions and the following disclaimer.
|
|
8
|
+
2. Redistributions in binary form must reproduce the above copyright
|
|
9
|
+
notice, this list of conditions and the following disclaimer in the
|
|
10
|
+
documentation and/or other materials provided with the distribution.
|
|
11
|
+
|
|
12
|
+
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
13
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
14
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
15
|
+
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
16
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
17
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
18
|
+
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
19
|
+
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
20
|
+
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
21
|
+
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
22
|
+
SUCH DAMAGE.
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
Ruby is copyrighted free software by Yukihiro Matsumoto <matz@netlab.jp>.
|
|
2
|
+
You can redistribute it and/or modify it under either the terms of the
|
|
3
|
+
2-clause BSDL (see the file BSDL), or the conditions below:
|
|
4
|
+
|
|
5
|
+
1. You may make and give away verbatim copies of the source form of the
|
|
6
|
+
software without restriction, provided that you duplicate all of the
|
|
7
|
+
original copyright notices and associated disclaimers.
|
|
8
|
+
|
|
9
|
+
2. You may modify your copy of the software in any way, provided that
|
|
10
|
+
you do at least ONE of the following:
|
|
11
|
+
|
|
12
|
+
a. place your modifications in the Public Domain or otherwise
|
|
13
|
+
make them Freely Available, such as by posting said
|
|
14
|
+
modifications to Usenet or an equivalent medium, or by allowing
|
|
15
|
+
the author to include your modifications in the software.
|
|
16
|
+
|
|
17
|
+
b. use the modified software only within your corporation or
|
|
18
|
+
organization.
|
|
19
|
+
|
|
20
|
+
c. give non-standard binaries non-standard names, with
|
|
21
|
+
instructions on where to get the original software distribution.
|
|
22
|
+
|
|
23
|
+
d. make other distribution arrangements with the author.
|
|
24
|
+
|
|
25
|
+
3. You may distribute the software in object code or binary form,
|
|
26
|
+
provided that you do at least ONE of the following:
|
|
27
|
+
|
|
28
|
+
a. distribute the binaries and library files of the software,
|
|
29
|
+
together with instructions (in the manual page or equivalent)
|
|
30
|
+
on where to get the original distribution.
|
|
31
|
+
|
|
32
|
+
b. accompany the distribution with the machine-readable source of
|
|
33
|
+
the software.
|
|
34
|
+
|
|
35
|
+
c. give non-standard binaries non-standard names, with
|
|
36
|
+
instructions on where to get the original software distribution.
|
|
37
|
+
|
|
38
|
+
d. make other distribution arrangements with the author.
|
|
39
|
+
|
|
40
|
+
4. You may modify and include the part of the software into any other
|
|
41
|
+
software (possibly commercial). But some files in the distribution
|
|
42
|
+
are not written by the author, so that they are not under these terms.
|
|
43
|
+
|
|
44
|
+
For the list of those files and their copying conditions, see the
|
|
45
|
+
file LEGAL.
|
|
46
|
+
|
|
47
|
+
5. The scripts and library files supplied as input to or produced as
|
|
48
|
+
output from the software do not automatically fall under the
|
|
49
|
+
copyright of the software, but belong to whomever generated them,
|
|
50
|
+
and may be sold commercially, and may be aggregated with this
|
|
51
|
+
software.
|
|
52
|
+
|
|
53
|
+
6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
|
54
|
+
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
|
55
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
56
|
+
PURPOSE.
|