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,321 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
include Listen
|
|
4
|
+
|
|
5
|
+
RSpec.describe Listener do
|
|
6
|
+
let(:realdir1) { fake_path('/foo/dir1', children: []) }
|
|
7
|
+
let(:realdir2) { fake_path('/foo/dir2', children: []) }
|
|
8
|
+
|
|
9
|
+
let(:dir1) { fake_path('dir1', realpath: realdir1) }
|
|
10
|
+
let(:dir2) { fake_path('dir2', realpath: realdir2) }
|
|
11
|
+
|
|
12
|
+
let(:dirs) { ['dir1'] }
|
|
13
|
+
|
|
14
|
+
let(:block) { instance_double(Proc) }
|
|
15
|
+
|
|
16
|
+
subject do
|
|
17
|
+
described_class.new(*(dirs + [options]).compact) do |*changes|
|
|
18
|
+
block.call(*changes)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
let(:options) { {} }
|
|
23
|
+
|
|
24
|
+
let(:record) { instance_double(Record, build: true, root: 'dir2') }
|
|
25
|
+
let(:silencer) { instance_double(Silencer, configure: nil) }
|
|
26
|
+
|
|
27
|
+
let(:backend_class) { class_double('Listen::Backend') }
|
|
28
|
+
|
|
29
|
+
let(:backend) { instance_double(Backend) }
|
|
30
|
+
|
|
31
|
+
let(:optimizer_config) { instance_double(QueueOptimizer::Config) }
|
|
32
|
+
let(:optimizer) { instance_double(QueueOptimizer) }
|
|
33
|
+
|
|
34
|
+
let(:processor_config) { instance_double(Event::Config) }
|
|
35
|
+
let(:processor) { instance_double(Event::Loop) }
|
|
36
|
+
|
|
37
|
+
let(:event_queue) { instance_double(Event::Queue) }
|
|
38
|
+
|
|
39
|
+
let(:default_latency) { 0.1 }
|
|
40
|
+
let(:backend_wait_for_delay) { 0.123 }
|
|
41
|
+
|
|
42
|
+
let(:processing_thread) { instance_double(Thread) }
|
|
43
|
+
|
|
44
|
+
before do
|
|
45
|
+
allow(Silencer).to receive(:new) { silencer }
|
|
46
|
+
|
|
47
|
+
allow(Backend).to receive(:new).
|
|
48
|
+
with(anything, event_queue, silencer, anything).
|
|
49
|
+
and_return(backend)
|
|
50
|
+
|
|
51
|
+
allow(backend).to receive(:min_delay_between_events).
|
|
52
|
+
and_return(backend_wait_for_delay)
|
|
53
|
+
|
|
54
|
+
# TODO: use a configuration object to clean this up
|
|
55
|
+
|
|
56
|
+
allow(QueueOptimizer::Config).to receive(:new).with(backend, silencer).
|
|
57
|
+
and_return(optimizer_config)
|
|
58
|
+
|
|
59
|
+
allow(QueueOptimizer).to receive(:new).with(optimizer_config).
|
|
60
|
+
and_return(optimizer)
|
|
61
|
+
|
|
62
|
+
allow(Event::Queue).to receive(:new).and_return(event_queue)
|
|
63
|
+
|
|
64
|
+
allow(Event::Config).to receive(:new).
|
|
65
|
+
with(anything, event_queue, optimizer, backend_wait_for_delay).
|
|
66
|
+
and_return(processor_config)
|
|
67
|
+
|
|
68
|
+
allow(Event::Loop).to receive(:new).with(processor_config).
|
|
69
|
+
and_return(processor)
|
|
70
|
+
|
|
71
|
+
allow(Record).to receive(:new).and_return(record)
|
|
72
|
+
|
|
73
|
+
allow(Pathname).to receive(:new).with('dir1').and_return(dir1)
|
|
74
|
+
allow(Pathname).to receive(:new).with('dir2').and_return(dir2)
|
|
75
|
+
|
|
76
|
+
allow(Thread).to receive(:new).and_return(processing_thread)
|
|
77
|
+
allow(processing_thread).to receive(:alive?).and_return(true)
|
|
78
|
+
allow(processing_thread).to receive(:wakeup)
|
|
79
|
+
allow(processing_thread).to receive(:join)
|
|
80
|
+
|
|
81
|
+
allow(block).to receive(:call)
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
describe 'initialize' do
|
|
85
|
+
it { should_not be_paused }
|
|
86
|
+
|
|
87
|
+
context 'with a block' do
|
|
88
|
+
let(:myblock) { instance_double(Proc) }
|
|
89
|
+
let(:block) { proc { myblock.call } }
|
|
90
|
+
subject do
|
|
91
|
+
described_class.new('dir1') do |*args|
|
|
92
|
+
myblock.call(*args)
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
it 'passes the block to the event processor' do
|
|
97
|
+
allow(Event::Config).to receive(:new) do |*_args, &some_block|
|
|
98
|
+
expect(some_block).to be
|
|
99
|
+
some_block.call
|
|
100
|
+
processor_config
|
|
101
|
+
end
|
|
102
|
+
expect(myblock).to receive(:call)
|
|
103
|
+
subject
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
context 'with directories' do
|
|
108
|
+
subject { described_class.new('dir1', 'dir2') }
|
|
109
|
+
|
|
110
|
+
it 'passes directories to backend' do
|
|
111
|
+
allow(Backend).to receive(:new).
|
|
112
|
+
with(%w[dir1 dir2], anything, anything, anything).
|
|
113
|
+
and_return(backend)
|
|
114
|
+
subject
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
describe '#start' do
|
|
120
|
+
before do
|
|
121
|
+
allow(backend).to receive(:start)
|
|
122
|
+
allow(silencer).to receive(:silenced?) { false }
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
it 'sets paused to false' do
|
|
126
|
+
allow(processor).to receive(:start)
|
|
127
|
+
subject.start
|
|
128
|
+
expect(subject).to_not be_paused
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
it 'starts adapter' do
|
|
132
|
+
expect(backend).to receive(:start)
|
|
133
|
+
allow(processor).to receive(:start)
|
|
134
|
+
subject.start
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
describe '#stop' do
|
|
139
|
+
before do
|
|
140
|
+
allow(backend).to receive(:start)
|
|
141
|
+
allow(processor).to receive(:start)
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
context 'when fully started' do
|
|
145
|
+
before do
|
|
146
|
+
subject.start
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
it 'terminates' do
|
|
150
|
+
allow(backend).to receive(:stop)
|
|
151
|
+
allow(processor).to receive(:stop)
|
|
152
|
+
subject.stop
|
|
153
|
+
end
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
context 'when only initialized' do
|
|
157
|
+
before do
|
|
158
|
+
subject
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
it 'terminates' do
|
|
162
|
+
allow(backend).to receive(:stop)
|
|
163
|
+
allow(processor).to receive(:stop)
|
|
164
|
+
subject.stop
|
|
165
|
+
end
|
|
166
|
+
end
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
describe '#pause' do
|
|
170
|
+
before do
|
|
171
|
+
allow(backend).to receive(:start)
|
|
172
|
+
allow(processor).to receive(:start)
|
|
173
|
+
subject.start
|
|
174
|
+
end
|
|
175
|
+
it 'sets paused to true' do
|
|
176
|
+
allow(processor).to receive(:pause)
|
|
177
|
+
subject.pause
|
|
178
|
+
expect(subject).to be_paused
|
|
179
|
+
end
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
describe 'unpause with start' do
|
|
183
|
+
before do
|
|
184
|
+
allow(backend).to receive(:start)
|
|
185
|
+
allow(processor).to receive(:start)
|
|
186
|
+
subject.start
|
|
187
|
+
allow(processor).to receive(:pause)
|
|
188
|
+
subject.pause
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
it 'sets paused to false' do
|
|
192
|
+
subject.start
|
|
193
|
+
expect(subject).to_not be_paused
|
|
194
|
+
end
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
describe '#paused?' do
|
|
198
|
+
before do
|
|
199
|
+
allow(backend).to receive(:start)
|
|
200
|
+
allow(processor).to receive(:start)
|
|
201
|
+
subject.start
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
it 'returns true when paused' do
|
|
205
|
+
allow(processor).to receive(:pause)
|
|
206
|
+
subject.pause
|
|
207
|
+
expect(subject).to be_paused
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
it 'returns false when not paused' do
|
|
211
|
+
expect(subject).not_to be_paused
|
|
212
|
+
end
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
describe '#listen?' do
|
|
216
|
+
context 'when processing' do
|
|
217
|
+
before do
|
|
218
|
+
allow(backend).to receive(:start)
|
|
219
|
+
allow(processor).to receive(:start)
|
|
220
|
+
subject.start
|
|
221
|
+
end
|
|
222
|
+
it { should be_processing }
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
context 'when stopped' do
|
|
226
|
+
it { should_not be_processing }
|
|
227
|
+
end
|
|
228
|
+
|
|
229
|
+
context 'when paused' do
|
|
230
|
+
before do
|
|
231
|
+
allow(backend).to receive(:start)
|
|
232
|
+
allow(processor).to receive(:start)
|
|
233
|
+
subject.start
|
|
234
|
+
allow(processor).to receive(:pause)
|
|
235
|
+
subject.pause
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
it { should_not be_processing }
|
|
239
|
+
end
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
# TODO: move these to silencer_controller?
|
|
243
|
+
describe '#ignore' do
|
|
244
|
+
context 'with existing ignore options' do
|
|
245
|
+
let(:options) { { ignore: /bar/ } }
|
|
246
|
+
|
|
247
|
+
it 'adds up to existing ignore options' do
|
|
248
|
+
expect(silencer).to receive(:configure).once.with({ ignore: [/bar/] })
|
|
249
|
+
|
|
250
|
+
subject
|
|
251
|
+
|
|
252
|
+
expect(silencer).to receive(:configure).once.
|
|
253
|
+
with({ ignore: [/bar/, /foo/] })
|
|
254
|
+
|
|
255
|
+
subject.ignore(/foo/)
|
|
256
|
+
end
|
|
257
|
+
end
|
|
258
|
+
|
|
259
|
+
context 'with existing ignore options (array)' do
|
|
260
|
+
let(:options) { { ignore: [/bar/] } }
|
|
261
|
+
|
|
262
|
+
it 'adds up to existing ignore options' do
|
|
263
|
+
expect(silencer).to receive(:configure).once.with({ ignore: [/bar/] })
|
|
264
|
+
|
|
265
|
+
subject
|
|
266
|
+
|
|
267
|
+
expect(silencer).to receive(:configure).once.
|
|
268
|
+
with({ ignore: [/bar/, /foo/] })
|
|
269
|
+
|
|
270
|
+
subject.ignore(/foo/)
|
|
271
|
+
end
|
|
272
|
+
end
|
|
273
|
+
end
|
|
274
|
+
|
|
275
|
+
# TODO: move these to silencer_controller?
|
|
276
|
+
describe '#ignore!' do
|
|
277
|
+
context 'with no existing options' do
|
|
278
|
+
let(:options) { {} }
|
|
279
|
+
|
|
280
|
+
it 'sets options' do
|
|
281
|
+
expect(silencer).to receive(:configure).with(options)
|
|
282
|
+
subject
|
|
283
|
+
end
|
|
284
|
+
end
|
|
285
|
+
|
|
286
|
+
context 'with existing ignore! options' do
|
|
287
|
+
let(:options) { { ignore!: /bar/ } }
|
|
288
|
+
|
|
289
|
+
it 'overwrites existing ignore options' do
|
|
290
|
+
expect(silencer).to receive(:configure).once.with({ ignore!: [/bar/] })
|
|
291
|
+
subject
|
|
292
|
+
expect(silencer).to receive(:configure).once.with({ ignore!: [/foo/] })
|
|
293
|
+
subject.ignore!([/foo/])
|
|
294
|
+
end
|
|
295
|
+
end
|
|
296
|
+
|
|
297
|
+
context 'with existing ignore options' do
|
|
298
|
+
let(:options) { { ignore: /bar/ } }
|
|
299
|
+
|
|
300
|
+
it 'deletes ignore options' do
|
|
301
|
+
expect(silencer).to receive(:configure).once.with({ ignore: [/bar/] })
|
|
302
|
+
subject
|
|
303
|
+
expect(silencer).to receive(:configure).once.with({ ignore!: [/foo/] })
|
|
304
|
+
subject.ignore!([/foo/])
|
|
305
|
+
end
|
|
306
|
+
end
|
|
307
|
+
end
|
|
308
|
+
|
|
309
|
+
describe '#only' do
|
|
310
|
+
context 'with existing only options' do
|
|
311
|
+
let(:options) { { only: /bar/ } }
|
|
312
|
+
|
|
313
|
+
it 'overwrites existing ignore options' do
|
|
314
|
+
expect(silencer).to receive(:configure).once.with({ only: [/bar/] })
|
|
315
|
+
subject
|
|
316
|
+
expect(silencer).to receive(:configure).once.with({ only: [/foo/] })
|
|
317
|
+
subject.only([/foo/])
|
|
318
|
+
end
|
|
319
|
+
end
|
|
320
|
+
end
|
|
321
|
+
end
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'listen/logger'
|
|
4
|
+
|
|
5
|
+
RSpec.describe 'logger.rb' do
|
|
6
|
+
around do |spec|
|
|
7
|
+
orig_logger = Listen.instance_variable_get(:@logger)
|
|
8
|
+
|
|
9
|
+
spec.run
|
|
10
|
+
|
|
11
|
+
Listen.logger = orig_logger
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
describe 'Listen.logger' do
|
|
15
|
+
ENV_VARIABLE_NAME = 'LISTEN_GEM_DEBUGGING'
|
|
16
|
+
|
|
17
|
+
let(:logger) { instance_double(::Logger, "logger") }
|
|
18
|
+
|
|
19
|
+
around do |spec|
|
|
20
|
+
orig_debugging_env_variable = ENV.fetch(ENV_VARIABLE_NAME, :not_set)
|
|
21
|
+
|
|
22
|
+
spec.run
|
|
23
|
+
|
|
24
|
+
if orig_debugging_env_variable == :not_set
|
|
25
|
+
ENV.delete(ENV_VARIABLE_NAME)
|
|
26
|
+
else
|
|
27
|
+
ENV[ENV_VARIABLE_NAME] = orig_debugging_env_variable
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
describe 'logger=' do
|
|
32
|
+
it 'allows the logger to be set' do
|
|
33
|
+
Listen.logger = logger
|
|
34
|
+
expect(Listen.logger).to be(logger)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
it 'allows nil to be set (implying default logger)' do
|
|
38
|
+
Listen.logger = nil
|
|
39
|
+
expect(Listen.logger).to be_kind_of(::Logger)
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
describe 'logger' do
|
|
44
|
+
before do
|
|
45
|
+
Listen.instance_variable_set(:@logger, nil)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
it 'returns default logger if none set' do
|
|
49
|
+
expect(Listen.logger).to be_kind_of(::Logger)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
['debug', 'DEBUG', '2', 'level2', '2 '].each do |env_value|
|
|
53
|
+
it "infers DEBUG level from #{ENV_VARIABLE_NAME}=#{env_value.inspect}" do
|
|
54
|
+
ENV[ENV_VARIABLE_NAME] = env_value
|
|
55
|
+
expect(Listen.logger.level).to eq(::Logger::DEBUG)
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
['info', 'INFO', 'true', ' true', 'TRUE', 'TRUE ', 'yes', 'YES', ' yesss!', '1', 'level1'].each do |env_value|
|
|
60
|
+
it "infers INFO level from #{ENV_VARIABLE_NAME}=#{env_value.inspect}" do
|
|
61
|
+
ENV[ENV_VARIABLE_NAME] = env_value
|
|
62
|
+
expect(Listen.logger.level).to eq(::Logger::INFO)
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
['warn', 'WARN', ' warn', 'warning'].each do |env_value|
|
|
67
|
+
it "infers WARN level from #{ENV_VARIABLE_NAME}=#{env_value.inspect}" do
|
|
68
|
+
ENV[ENV_VARIABLE_NAME] = env_value
|
|
69
|
+
expect(Listen.logger.level).to eq(::Logger::WARN)
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
['error', 'ERROR', 'OTHER'].each do |env_value|
|
|
74
|
+
it "infers ERROR level from #{ENV_VARIABLE_NAME}=#{env_value.inspect}" do
|
|
75
|
+
ENV[ENV_VARIABLE_NAME] = env_value
|
|
76
|
+
expect(Listen.logger.level).to eq(::Logger::ERROR)
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
['fatal', 'FATAL', ' fatal'].each do |env_value|
|
|
81
|
+
it "infers FATAL level from #{ENV_VARIABLE_NAME}=#{env_value.inspect}" do
|
|
82
|
+
ENV[ENV_VARIABLE_NAME] = env_value
|
|
83
|
+
expect(Listen.logger.level).to eq(::Logger::FATAL)
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
describe 'Listen.adapter_warn_behavior' do
|
|
90
|
+
subject { Listen.adapter_warn(message) }
|
|
91
|
+
|
|
92
|
+
after do
|
|
93
|
+
Listen.adapter_warn_behavior = :warn
|
|
94
|
+
end
|
|
95
|
+
let(:message) { "warning message" }
|
|
96
|
+
|
|
97
|
+
it 'defaults to :warn' do
|
|
98
|
+
expect(Listen.adapter_warn_behavior).to eq(:warn)
|
|
99
|
+
|
|
100
|
+
expect(Listen).to receive(:warn).with(message)
|
|
101
|
+
|
|
102
|
+
subject
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
it 'allows the adapter_warn_behavior to be set to :log' do
|
|
106
|
+
Listen.adapter_warn_behavior = :log
|
|
107
|
+
|
|
108
|
+
expect(Listen.logger).to receive(:warn).with(message)
|
|
109
|
+
|
|
110
|
+
subject
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
[:silent, nil, false].each do |behavior|
|
|
114
|
+
it "allows the adapter_warn_behavior to be set to #{behavior} to silence the warnings" do
|
|
115
|
+
Listen.adapter_warn_behavior = behavior
|
|
116
|
+
|
|
117
|
+
expect(Listen.logger).not_to receive(:warn)
|
|
118
|
+
expect(Listen).not_to receive(:warn)
|
|
119
|
+
|
|
120
|
+
subject
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
context "when LISTEN_GEM_ADAPTER_WARN_BEHAVIOR is set to 'log'" do
|
|
125
|
+
around do |spec|
|
|
126
|
+
orig_debugging_env_variable = ENV.fetch('LISTEN_GEM_ADAPTER_WARN_BEHAVIOR', :not_set)
|
|
127
|
+
|
|
128
|
+
ENV['LISTEN_GEM_ADAPTER_WARN_BEHAVIOR'] = 'log'
|
|
129
|
+
|
|
130
|
+
spec.run
|
|
131
|
+
|
|
132
|
+
if orig_debugging_env_variable == :not_set
|
|
133
|
+
ENV.delete('LISTEN_GEM_ADAPTER_WARN_BEHAVIOR')
|
|
134
|
+
else
|
|
135
|
+
ENV['ENV_VARIABLE_NAME'] = orig_debugging_env_variable
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
[:silent, nil, false, :warn].each do |behavior|
|
|
140
|
+
it "respects the environment variable over #{behavior.inspect}" do
|
|
141
|
+
Listen.adapter_warn_behavior = behavior
|
|
142
|
+
|
|
143
|
+
expect(Listen.logger).to receive(:warn).with(message)
|
|
144
|
+
|
|
145
|
+
subject
|
|
146
|
+
end
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
it "respects the environment variable over a callable config" do
|
|
150
|
+
Listen.adapter_warn_behavior = ->(_message) { :warn }
|
|
151
|
+
|
|
152
|
+
expect(Listen.logger).to receive(:warn).with(message)
|
|
153
|
+
|
|
154
|
+
subject
|
|
155
|
+
end
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
context 'when adapter_warn_behavior is set to a callable object like a proc' do
|
|
159
|
+
before do
|
|
160
|
+
Listen.adapter_warn_behavior = ->(message) do
|
|
161
|
+
case message
|
|
162
|
+
when /USE warn/
|
|
163
|
+
:warn
|
|
164
|
+
when /USE log/
|
|
165
|
+
:log
|
|
166
|
+
when /USE silent/
|
|
167
|
+
:silent
|
|
168
|
+
when /USE false/
|
|
169
|
+
false
|
|
170
|
+
when /USE nil/
|
|
171
|
+
nil
|
|
172
|
+
else
|
|
173
|
+
true
|
|
174
|
+
end
|
|
175
|
+
end
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
[true, :warn].each do |behavior|
|
|
179
|
+
context "when the message matches a #{behavior.inspect} pattern" do
|
|
180
|
+
let(:message) { "USE #{behavior.inspect}" }
|
|
181
|
+
it 'respects :warn' do
|
|
182
|
+
expect(Listen).to receive(:warn).with(message)
|
|
183
|
+
|
|
184
|
+
subject
|
|
185
|
+
end
|
|
186
|
+
end
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
context 'when the message matches a :silent pattern' do
|
|
190
|
+
let(:message) { "USE silent" }
|
|
191
|
+
it 'respects :silent' do
|
|
192
|
+
expect(Listen).not_to receive(:warn).with(message)
|
|
193
|
+
expect(Listen).not_to receive(:warn)
|
|
194
|
+
|
|
195
|
+
subject
|
|
196
|
+
end
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
[false, nil].each do |behavior|
|
|
200
|
+
context "when the message matches a #{behavior} pattern" do
|
|
201
|
+
let(:message) { "USE #{behavior.inspect}" }
|
|
202
|
+
it 'respects :silent' do
|
|
203
|
+
expect(Listen).not_to receive(:warn).with(message)
|
|
204
|
+
expect(Listen).not_to receive(:warn)
|
|
205
|
+
|
|
206
|
+
subject
|
|
207
|
+
end
|
|
208
|
+
end
|
|
209
|
+
end
|
|
210
|
+
end
|
|
211
|
+
end
|
|
212
|
+
end
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'listen/monotonic_time'
|
|
4
|
+
|
|
5
|
+
RSpec.describe Listen::MonotonicTime do
|
|
6
|
+
after(:all) do
|
|
7
|
+
# load once more with constants unstubbed/unhidden
|
|
8
|
+
load './lib/listen/monotonic_time.rb'
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
context 'module methods' do
|
|
12
|
+
describe '.now' do
|
|
13
|
+
subject { described_class.now }
|
|
14
|
+
let(:tick_count) { 0.123 }
|
|
15
|
+
|
|
16
|
+
context 'when CLOCK_MONOTONIC defined' do
|
|
17
|
+
before do
|
|
18
|
+
stub_const('Process::CLOCK_MONOTONIC', 10)
|
|
19
|
+
load './lib/listen/monotonic_time.rb'
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
it 'returns the CLOCK_MONOTONIC tick count' do
|
|
23
|
+
expect(Process).to receive(:clock_gettime).with(Process::CLOCK_MONOTONIC).and_return(tick_count)
|
|
24
|
+
expect(subject).to eq(tick_count)
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
context 'when CLOCK_MONOTONIC not defined but CLOCK_MONOTONIC_RAW defined' do
|
|
29
|
+
before do
|
|
30
|
+
hide_const('Process::CLOCK_MONOTONIC')
|
|
31
|
+
stub_const('Process::CLOCK_MONOTONIC_RAW', 11)
|
|
32
|
+
load './lib/listen/monotonic_time.rb'
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
it 'returns the floating point Time.now' do
|
|
36
|
+
expect(Process).to receive(:clock_gettime).with(Process::CLOCK_MONOTONIC_RAW).and_return(tick_count)
|
|
37
|
+
expect(subject).to eq(tick_count)
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
context 'when neither CLOCK_MONOTONIC nor CLOCK_MONOTONIC_RAW defined' do
|
|
42
|
+
let(:now) { instance_double(Time, "time") }
|
|
43
|
+
|
|
44
|
+
before do
|
|
45
|
+
hide_const('Process::CLOCK_MONOTONIC')
|
|
46
|
+
hide_const('Process::CLOCK_MONOTONIC_RAW')
|
|
47
|
+
load './lib/listen/monotonic_time.rb'
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
it 'returns the floating point Time.now' do
|
|
51
|
+
expect(Time).to receive(:now).and_return(now)
|
|
52
|
+
expect(now).to receive(:to_f).and_return(tick_count)
|
|
53
|
+
expect(subject).to eq(tick_count)
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
RSpec.describe Listen::QueueOptimizer do
|
|
4
|
+
let(:config) { instance_double(Listen::QueueOptimizer::Config) }
|
|
5
|
+
subject { described_class.new(config) }
|
|
6
|
+
|
|
7
|
+
# watched dir
|
|
8
|
+
let(:dir) { fake_path('dir') }
|
|
9
|
+
|
|
10
|
+
# files
|
|
11
|
+
let(:foo) { fake_path('foo') }
|
|
12
|
+
let(:bar) { fake_path('bar') }
|
|
13
|
+
let(:ignored) { fake_path('ignored') }
|
|
14
|
+
|
|
15
|
+
before do
|
|
16
|
+
allow(config).to receive(:debug)
|
|
17
|
+
|
|
18
|
+
allow(dir).to receive(:+).with('foo') { foo }
|
|
19
|
+
allow(dir).to receive(:+).with('bar') { bar }
|
|
20
|
+
allow(dir).to receive(:+).with('ignored') { ignored }
|
|
21
|
+
|
|
22
|
+
allow(config).to receive(:silenced?).
|
|
23
|
+
with(Pathname('ignored'), :file) { true }
|
|
24
|
+
|
|
25
|
+
allow(config).to receive(:silenced?).
|
|
26
|
+
with(Pathname('foo'), :file) { false }
|
|
27
|
+
|
|
28
|
+
allow(config).to receive(:silenced?).
|
|
29
|
+
with(Pathname('bar'), :file) { false }
|
|
30
|
+
|
|
31
|
+
allow(config).to receive(:exist?).with(foo).and_return(true)
|
|
32
|
+
allow(config).to receive(:exist?).with(bar).and_return(true)
|
|
33
|
+
allow(config).to receive(:exist?).with(ignored).and_return(true)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
describe 'smoosh_changes' do
|
|
37
|
+
subject { described_class.new(config).smoosh_changes(changes) }
|
|
38
|
+
|
|
39
|
+
context 'with rename from temp file' do
|
|
40
|
+
let(:changes) do
|
|
41
|
+
[
|
|
42
|
+
[:file, :modified, dir, 'foo'],
|
|
43
|
+
[:file, :removed, dir, 'foo'],
|
|
44
|
+
[:file, :added, dir, 'foo'],
|
|
45
|
+
[:file, :modified, dir, 'foo']
|
|
46
|
+
]
|
|
47
|
+
end
|
|
48
|
+
it { is_expected.to eq(modified: ['foo'], added: [], removed: []) }
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
context 'with a detected temp file' do
|
|
52
|
+
before { allow(config).to receive(:exist?).with(foo).and_return(false) }
|
|
53
|
+
|
|
54
|
+
let(:changes) do
|
|
55
|
+
[
|
|
56
|
+
[:file, :added, dir, 'foo'],
|
|
57
|
+
[:file, :modified, dir, 'foo'],
|
|
58
|
+
[:file, :removed, dir, 'foo'],
|
|
59
|
+
[:file, :modified, dir, 'foo']
|
|
60
|
+
]
|
|
61
|
+
end
|
|
62
|
+
it { is_expected.to eq(modified: [], added: [], removed: []) }
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# e.g. "mv foo x && mv x foo" is like "touch foo"
|
|
66
|
+
context 'when double move' do
|
|
67
|
+
let(:changes) do
|
|
68
|
+
[
|
|
69
|
+
[:file, :removed, dir, 'foo'],
|
|
70
|
+
[:file, :added, dir, 'foo']
|
|
71
|
+
]
|
|
72
|
+
end
|
|
73
|
+
it { is_expected.to eq(modified: ['foo'], added: [], removed: []) }
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
context 'with cookie' do
|
|
77
|
+
context 'when single moved' do
|
|
78
|
+
let(:changes) { [[:file, :moved_to, dir, 'foo', { cookie: 4321 }]] }
|
|
79
|
+
it { is_expected.to eq(modified: [], added: ['foo'], removed: []) }
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
context 'when related moved_to' do
|
|
83
|
+
let(:changes) do
|
|
84
|
+
[
|
|
85
|
+
[:file, :moved_from, dir, 'foo', { cookie: 4321 }],
|
|
86
|
+
[:file, :moved_to, dir, 'bar', { cookie: 4321 }]
|
|
87
|
+
]
|
|
88
|
+
end
|
|
89
|
+
it { is_expected.to eq(modified: [], added: ['bar'], removed: []) }
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# Scenario with workaround for editors using rename()
|
|
93
|
+
context 'when related moved_to with ignored moved_from' do
|
|
94
|
+
let(:changes) do
|
|
95
|
+
[
|
|
96
|
+
[:file, :moved_from, dir, 'ignored', { cookie: 4321 }],
|
|
97
|
+
[:file, :moved_to, dir, 'foo', { cookie: 4321 }]
|
|
98
|
+
]
|
|
99
|
+
end
|
|
100
|
+
it { is_expected.to eq(modified: ['foo'], added: [], removed: []) }
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
context 'with no cookie' do
|
|
105
|
+
context 'with ignored file' do
|
|
106
|
+
let(:changes) { [[:file, :modified, dir, 'ignored']] }
|
|
107
|
+
it { is_expected.to eq(modified: [], added: [], removed: []) }
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
end
|