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,199 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
RSpec.describe Listen::Adapter::Linux do
|
|
4
|
+
describe 'class methods' do
|
|
5
|
+
subject { described_class }
|
|
6
|
+
|
|
7
|
+
if linux?
|
|
8
|
+
it { should be_usable }
|
|
9
|
+
else
|
|
10
|
+
it { should_not be_usable }
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
if linux?
|
|
15
|
+
describe 'instance methods' do
|
|
16
|
+
before(:all) do
|
|
17
|
+
require 'rb-inotify'
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
let(:dir1) { Pathname.new("/foo/dir1") }
|
|
21
|
+
|
|
22
|
+
let(:queue) { instance_double(Queue, "queue", close: nil) }
|
|
23
|
+
let(:config) { instance_double(Listen::Adapter::Config, "config", queue: queue) }
|
|
24
|
+
let(:silencer) { instance_double(Listen::Silencer, "silencer") }
|
|
25
|
+
let(:snapshot) { instance_double(Listen::Change, "snapshot") }
|
|
26
|
+
let(:record) { instance_double(Listen::Record, "record") }
|
|
27
|
+
|
|
28
|
+
# TODO: fix other adapters too!
|
|
29
|
+
subject { described_class.new(config) }
|
|
30
|
+
|
|
31
|
+
after do
|
|
32
|
+
subject.stop
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
describe 'watch events' do
|
|
36
|
+
let(:directories) { [Pathname.pwd] }
|
|
37
|
+
let(:adapter_options) { {} }
|
|
38
|
+
let(:default_events) { [:recursive, :attrib, :create, :modify, :delete, :move, :close_write] }
|
|
39
|
+
let(:fake_worker) { double(:fake_worker_for_watch_events) }
|
|
40
|
+
let(:fake_notifier) { double(:fake_notifier, new: fake_worker) }
|
|
41
|
+
|
|
42
|
+
before do
|
|
43
|
+
stub_const('INotify::Notifier', fake_notifier)
|
|
44
|
+
|
|
45
|
+
allow(config).to receive(:directories).and_return(directories)
|
|
46
|
+
allow(config).to receive(:adapter_options).and_return(adapter_options)
|
|
47
|
+
allow(config).to receive(:silencer).and_return(silencer)
|
|
48
|
+
allow(fake_worker).to receive(:close)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
after do
|
|
52
|
+
subject.stop
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
it 'starts by calling watch with default events' do
|
|
56
|
+
expect(fake_worker).to receive(:watch).with(*directories.map(&:to_s), *default_events)
|
|
57
|
+
subject.start
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
describe 'inotify max watches exceeded' do
|
|
62
|
+
let(:directories) { [Pathname.pwd] }
|
|
63
|
+
let(:adapter_options) { {} }
|
|
64
|
+
|
|
65
|
+
before do
|
|
66
|
+
fake_worker = double(:fake_worker_for_inotify_limit_message)
|
|
67
|
+
allow(fake_worker).to receive(:watch).and_raise(Errno::ENOSPC)
|
|
68
|
+
allow(fake_worker).to receive(:close)
|
|
69
|
+
|
|
70
|
+
fake_notifier = double(:fake_notifier, new: fake_worker)
|
|
71
|
+
stub_const('INotify::Notifier', fake_notifier)
|
|
72
|
+
|
|
73
|
+
allow(config).to receive(:directories).and_return(directories)
|
|
74
|
+
allow(config).to receive(:adapter_options).and_return(adapter_options)
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
it 'raises exception' do
|
|
78
|
+
expect { subject.start }.to raise_exception(Listen::Error::INotifyMaxWatchesExceeded, /inotify max watches exceeded/i)
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# TODO: should probably be adapted to be more like adapter/base_spec.rb
|
|
83
|
+
describe '_callback' do
|
|
84
|
+
let(:directories) { [dir1] }
|
|
85
|
+
let(:adapter_options) { { events: [:recursive, :close_write] } }
|
|
86
|
+
|
|
87
|
+
before do
|
|
88
|
+
fake_worker = double(:fake_worker_for_callback)
|
|
89
|
+
events = [:recursive, :close_write]
|
|
90
|
+
allow(fake_worker).to receive(:watch).with('/foo/dir1', *events)
|
|
91
|
+
allow(fake_worker).to receive(:close)
|
|
92
|
+
|
|
93
|
+
fake_notifier = double(:fake_notifier, new: fake_worker)
|
|
94
|
+
stub_const('INotify::Notifier', fake_notifier)
|
|
95
|
+
|
|
96
|
+
allow(config).to receive(:directories).and_return(directories)
|
|
97
|
+
allow(config).to receive(:adapter_options).and_return(adapter_options)
|
|
98
|
+
allow(config).to receive(:silencer).and_return(silencer)
|
|
99
|
+
|
|
100
|
+
allow(Listen::Record).to receive(:new).with(dir1, silencer).and_return(record)
|
|
101
|
+
allow(Listen::Change::Config).to receive(:new).with(queue, silencer).
|
|
102
|
+
and_return(config)
|
|
103
|
+
allow(Listen::Change).to receive(:new).with(config, record).
|
|
104
|
+
and_return(snapshot)
|
|
105
|
+
|
|
106
|
+
allow(subject).to receive(:require).with('rb-inotify')
|
|
107
|
+
subject.configure
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
let(:expect_change) do
|
|
111
|
+
lambda do |change|
|
|
112
|
+
expect(snapshot).to receive(:invalidate).with(
|
|
113
|
+
:file,
|
|
114
|
+
'path/foo.txt',
|
|
115
|
+
{
|
|
116
|
+
cookie: 123,
|
|
117
|
+
change: change
|
|
118
|
+
}
|
|
119
|
+
)
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
let(:event_callback) do
|
|
124
|
+
lambda do |flags|
|
|
125
|
+
callbacks = subject.instance_variable_get(:'@callbacks')
|
|
126
|
+
callbacks.values.flatten.each do |callback|
|
|
127
|
+
callback.call double(
|
|
128
|
+
:inotify_event,
|
|
129
|
+
name: 'foo.txt',
|
|
130
|
+
watcher: double(:watcher, path: '/foo/dir1/path'),
|
|
131
|
+
flags: flags,
|
|
132
|
+
cookie: 123)
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
# TODO: get fsevent adapter working like INotify
|
|
138
|
+
unless /1|true/ =~ ENV['LISTEN_GEM_SIMULATE_FSEVENT']
|
|
139
|
+
it 'recognizes close_write as modify' do
|
|
140
|
+
expect_change.call(:modified)
|
|
141
|
+
event_callback.call([:close_write])
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
it 'recognizes moved_to as moved_to' do
|
|
145
|
+
expect_change.call(:moved_to)
|
|
146
|
+
event_callback.call([:moved_to])
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
it 'recognizes moved_from as moved_from' do
|
|
150
|
+
expect_change.call(:moved_from)
|
|
151
|
+
event_callback.call([:moved_from])
|
|
152
|
+
end
|
|
153
|
+
end
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
describe '#stop' do
|
|
157
|
+
let(:fake_worker) { double(:fake_worker_for_stop, close: true) }
|
|
158
|
+
let(:directories) { [dir1] }
|
|
159
|
+
let(:adapter_options) { { events: [:recursive, :close_write] } }
|
|
160
|
+
|
|
161
|
+
before do
|
|
162
|
+
allow(config).to receive(:directories).and_return(directories)
|
|
163
|
+
allow(config).to receive(:adapter_options).and_return(adapter_options)
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
context 'when configured' do
|
|
167
|
+
before do
|
|
168
|
+
events = [:recursive, :close_write]
|
|
169
|
+
allow(fake_worker).to receive(:watch).with('/foo/dir1', *events)
|
|
170
|
+
|
|
171
|
+
fake_notifier = double(:fake_notifier, new: fake_worker)
|
|
172
|
+
stub_const('INotify::Notifier', fake_notifier)
|
|
173
|
+
|
|
174
|
+
allow(config).to receive(:silencer).and_return(silencer)
|
|
175
|
+
|
|
176
|
+
allow(subject).to receive(:require).with('rb-inotify')
|
|
177
|
+
subject.configure
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
it 'stops the worker' do
|
|
181
|
+
subject.stop
|
|
182
|
+
end
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
context 'when not even initialized' do
|
|
186
|
+
before do
|
|
187
|
+
allow(queue).to receive(:close)
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
it 'does not crash' do
|
|
191
|
+
expect do
|
|
192
|
+
subject.stop
|
|
193
|
+
end.to_not raise_error
|
|
194
|
+
end
|
|
195
|
+
end
|
|
196
|
+
end
|
|
197
|
+
end
|
|
198
|
+
end
|
|
199
|
+
end
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
include Listen
|
|
4
|
+
|
|
5
|
+
RSpec.describe Adapter::Polling do
|
|
6
|
+
describe 'class' do
|
|
7
|
+
subject { described_class }
|
|
8
|
+
it { should be_usable }
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
subject do
|
|
12
|
+
described_class.new(config)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
let(:dir1) do
|
|
16
|
+
instance_double(Pathname, 'dir1', to_s: '/foo/dir1', cleanpath: real_dir1)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# just so cleanpath works in above double
|
|
20
|
+
let(:real_dir1) { instance_double(Pathname, 'dir1', to_s: '/foo/dir1') }
|
|
21
|
+
|
|
22
|
+
let(:config) { instance_double(Listen::Adapter::Config, "config") }
|
|
23
|
+
let(:directories) { [dir1] }
|
|
24
|
+
let(:options) { {} }
|
|
25
|
+
let(:queue) { instance_double(Queue, "queue") }
|
|
26
|
+
let(:silencer) { instance_double(Listen::Silencer, "silencer") }
|
|
27
|
+
let(:snapshot) { instance_double(Listen::Change, "snapshot") }
|
|
28
|
+
|
|
29
|
+
let(:record) { instance_double(Listen::Record) }
|
|
30
|
+
|
|
31
|
+
context 'with a valid configuration' do
|
|
32
|
+
before do
|
|
33
|
+
allow(config).to receive(:directories).and_return(directories)
|
|
34
|
+
allow(config).to receive(:adapter_options).and_return(options)
|
|
35
|
+
allow(config).to receive(:queue).and_return(queue)
|
|
36
|
+
allow(config).to receive(:silencer).and_return(silencer)
|
|
37
|
+
|
|
38
|
+
allow(Listen::Record).to receive(:new).with(dir1, silencer).and_return(record)
|
|
39
|
+
|
|
40
|
+
allow(Listen::Change).to receive(:new).with(config, record).
|
|
41
|
+
and_return(snapshot)
|
|
42
|
+
allow(Listen::Change::Config).to receive(:new).with(queue, silencer).
|
|
43
|
+
and_return(config)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
describe '#start' do
|
|
47
|
+
before do
|
|
48
|
+
allow(snapshot).to receive(:record).and_return(record)
|
|
49
|
+
allow(record).to receive(:build)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
after do
|
|
53
|
+
allow(queue).to receive(:close)
|
|
54
|
+
subject.stop
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
it 'notifies change on every listener directories path' do
|
|
58
|
+
expect(snapshot).to receive(:invalidate).
|
|
59
|
+
with(:dir, '.', { recursive: true })
|
|
60
|
+
|
|
61
|
+
t = Thread.new { subject.start }
|
|
62
|
+
sleep 0.25
|
|
63
|
+
t.kill
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
describe '#_latency' do
|
|
68
|
+
subject do
|
|
69
|
+
adapter = described_class.new(config)
|
|
70
|
+
adapter.options.latency
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
context 'with no overriding option' do
|
|
74
|
+
it { should eq 1.0 }
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
context 'with custom latency overriding' do
|
|
78
|
+
let(:options) { { latency: 1234 } }
|
|
79
|
+
it { should eq 1234 }
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
RSpec.describe Listen::Adapter do
|
|
4
|
+
let(:listener) { instance_double(Listen::Listener, options: {}) }
|
|
5
|
+
before do
|
|
6
|
+
allow(Listen::Adapter::BSD).to receive(:usable?) { false }
|
|
7
|
+
allow(Listen::Adapter::Darwin).to receive(:usable?) { false }
|
|
8
|
+
allow(Listen::Adapter::Linux).to receive(:usable?) { false }
|
|
9
|
+
allow(Listen::Adapter::Windows).to receive(:usable?) { false }
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
describe '.select' do
|
|
13
|
+
it 'returns Polling adapter if forced' do
|
|
14
|
+
klass = Listen::Adapter.select(force_polling: true)
|
|
15
|
+
expect(klass).to eq Listen::Adapter::Polling
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
it 'returns BSD adapter when usable' do
|
|
19
|
+
allow(Listen::Adapter::BSD).to receive(:usable?) { true }
|
|
20
|
+
klass = Listen::Adapter.select
|
|
21
|
+
expect(klass).to eq Listen::Adapter::BSD
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it 'returns Darwin adapter when usable' do
|
|
25
|
+
allow(Listen::Adapter::Darwin).to receive(:usable?) { true }
|
|
26
|
+
klass = Listen::Adapter.select
|
|
27
|
+
expect(klass).to eq Listen::Adapter::Darwin
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it 'returns Linux adapter when usable' do
|
|
31
|
+
allow(Listen::Adapter::Linux).to receive(:usable?) { true }
|
|
32
|
+
klass = Listen::Adapter.select
|
|
33
|
+
expect(klass).to eq Listen::Adapter::Linux
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
it 'returns Windows adapter when usable' do
|
|
37
|
+
allow(Listen::Adapter::Windows).to receive(:usable?) { true }
|
|
38
|
+
klass = Listen::Adapter.select
|
|
39
|
+
expect(klass).to eq Listen::Adapter::Windows
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
context 'no usable adapters' do
|
|
43
|
+
before { allow(Kernel).to receive(:warn) }
|
|
44
|
+
|
|
45
|
+
it 'returns Polling adapter' do
|
|
46
|
+
klass = Listen::Adapter.select(force_polling: true)
|
|
47
|
+
expect(klass).to eq Listen::Adapter::Polling
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
it 'warns polling fallback with default message' do
|
|
51
|
+
msg = described_class::POLLING_FALLBACK_MESSAGE
|
|
52
|
+
expect(Listen).to receive(:adapter_warn).with("[Listen warning]:\n #{msg}")
|
|
53
|
+
Listen::Adapter.select
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
it "doesn't warn if polling_fallback_message is false" do
|
|
57
|
+
expect(Kernel).to_not receive(:warn)
|
|
58
|
+
Listen::Adapter.select(polling_fallback_message: false)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
it 'warns polling fallback with custom message if set' do
|
|
62
|
+
expected_msg = "[Listen warning]:\n custom fallback message"
|
|
63
|
+
expect(Listen).to receive(:adapter_warn).with(expected_msg)
|
|
64
|
+
msg = 'custom fallback message'
|
|
65
|
+
Listen::Adapter.select(polling_fallback_message: msg)
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'listen/backend'
|
|
4
|
+
|
|
5
|
+
RSpec.describe Listen::Backend do
|
|
6
|
+
let(:dir1) { instance_double(Pathname, 'dir1', to_s: '/foo/dir1') }
|
|
7
|
+
|
|
8
|
+
let(:silencer) { instance_double(Listen::Silencer) }
|
|
9
|
+
let(:queue) { instance_double(Queue) }
|
|
10
|
+
|
|
11
|
+
let(:select_options) do
|
|
12
|
+
{ force_polling: false, polling_fallback_message: 'foo' }
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
let(:adapter_options) { { latency: 1234 } }
|
|
16
|
+
let(:options) { select_options.merge(adapter_options) }
|
|
17
|
+
|
|
18
|
+
let(:adapter_config_class) { class_double('Listen::Adapter::Config') }
|
|
19
|
+
let(:adapter_config) { instance_double('Listen::Adapter::Config') }
|
|
20
|
+
|
|
21
|
+
let(:config) { instance_double(Listen::Listener::Config) }
|
|
22
|
+
|
|
23
|
+
subject { described_class.new([dir1], queue, silencer, config) }
|
|
24
|
+
|
|
25
|
+
# Use Polling since it has a valid :latency option
|
|
26
|
+
let(:adapter_defaults) { { latency: 5.4321 } }
|
|
27
|
+
let(:adapter_class) { Listen::Adapter::Polling }
|
|
28
|
+
let(:adapter) { instance_double('Listen::Adapter::Polling') }
|
|
29
|
+
|
|
30
|
+
let(:config_min_delay_between_events) { 0.1234 }
|
|
31
|
+
|
|
32
|
+
before do
|
|
33
|
+
stub_const('Listen::Adapter::Config', adapter_config_class)
|
|
34
|
+
|
|
35
|
+
allow(adapter_config_class).to receive(:new).
|
|
36
|
+
with([dir1], queue, silencer, adapter_options).
|
|
37
|
+
and_return(adapter_config)
|
|
38
|
+
|
|
39
|
+
allow(Listen::Adapter).to receive(:select).
|
|
40
|
+
with(select_options).and_return(adapter_class)
|
|
41
|
+
|
|
42
|
+
allow(adapter_class).to receive(:new).
|
|
43
|
+
with(adapter_config).and_return(adapter)
|
|
44
|
+
|
|
45
|
+
allow(Listen::Adapter::Polling).to receive(:new).with(adapter_config).
|
|
46
|
+
and_return(adapter)
|
|
47
|
+
|
|
48
|
+
allow(config).to receive(:adapter_select_options).
|
|
49
|
+
and_return(select_options)
|
|
50
|
+
|
|
51
|
+
allow(config).to receive(:adapter_instance_options).
|
|
52
|
+
and_return(adapter_options)
|
|
53
|
+
|
|
54
|
+
allow(config).to receive(:min_delay_between_events).
|
|
55
|
+
and_return(config_min_delay_between_events)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
describe '#initialize' do
|
|
59
|
+
context 'with config' do
|
|
60
|
+
it 'sets up an adapter class' do
|
|
61
|
+
expect(adapter_class).to receive(:new).
|
|
62
|
+
with(adapter_config).and_return(adapter)
|
|
63
|
+
|
|
64
|
+
subject
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
describe '#start' do
|
|
70
|
+
it 'starts the adapter' do
|
|
71
|
+
expect(adapter).to receive(:start)
|
|
72
|
+
subject.start
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
describe '#stop' do
|
|
77
|
+
it 'stops the adapter' do
|
|
78
|
+
expect(adapter).to receive(:stop)
|
|
79
|
+
subject.stop
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
RSpec.describe Listen::Change do
|
|
4
|
+
let(:config) { instance_double(Listen::Change::Config) }
|
|
5
|
+
let(:dir) { instance_double(Pathname) }
|
|
6
|
+
let(:record) { instance_double(Listen::Record, root: '/dir') }
|
|
7
|
+
subject { Listen::Change.new(config, record) }
|
|
8
|
+
|
|
9
|
+
let(:full_file_path) { instance_double(Pathname, to_s: '/dir/file.rb') }
|
|
10
|
+
let(:full_dir_path) { instance_double(Pathname, to_s: '/dir') }
|
|
11
|
+
|
|
12
|
+
before do
|
|
13
|
+
allow(dir).to receive(:+).with('file.rb') { full_file_path }
|
|
14
|
+
allow(dir).to receive(:+).with('dir1') { full_dir_path }
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
describe '#change' do
|
|
18
|
+
before do
|
|
19
|
+
allow(config).to receive(:silenced?).and_return(false)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
context 'with build options' do
|
|
23
|
+
it 'calls still_building! on record' do
|
|
24
|
+
allow(config).to receive(:queue)
|
|
25
|
+
allow(Listen::File).to receive(:change)
|
|
26
|
+
subject.invalidate(:file, 'file.rb', build: true)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
context 'file' do
|
|
31
|
+
context 'with known change' do
|
|
32
|
+
it 'notifies change directly to listener' do
|
|
33
|
+
expect(config).to receive(:queue).
|
|
34
|
+
with(:file, :modified, Pathname.new('/dir'), 'file.rb', {})
|
|
35
|
+
|
|
36
|
+
subject.invalidate(:file, 'file.rb', change: :modified)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
it "doesn't notify to listener if path is silenced" do
|
|
40
|
+
expect(config).to receive(:silenced?).and_return(true)
|
|
41
|
+
expect(config).to_not receive(:queue)
|
|
42
|
+
subject.invalidate(:file, 'file.rb', change: :modified)
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
context 'with unknown change' do
|
|
47
|
+
it 'calls Listen::File#change' do
|
|
48
|
+
expect(Listen::File).to receive(:change).with(record, 'file.rb')
|
|
49
|
+
subject.invalidate(:file, 'file.rb', {})
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
it "doesn't call Listen::File#change if path is silenced" do
|
|
53
|
+
expect(config).to receive(:silenced?).
|
|
54
|
+
with('file.rb', :file).and_return(true)
|
|
55
|
+
|
|
56
|
+
expect(Listen::File).to_not receive(:change)
|
|
57
|
+
subject.invalidate(:file, 'file.rb', {})
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
context 'that returns a change' do
|
|
61
|
+
before { allow(Listen::File).to receive(:change) { :modified } }
|
|
62
|
+
|
|
63
|
+
context 'listener listen' do
|
|
64
|
+
it 'notifies change to listener' do
|
|
65
|
+
expect(config).to receive(:queue).
|
|
66
|
+
with(:file, :modified, Pathname.new('/dir'), 'file.rb')
|
|
67
|
+
|
|
68
|
+
subject.invalidate(:file, 'file.rb', {})
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
context 'silence option' do
|
|
72
|
+
it 'notifies change to listener' do
|
|
73
|
+
expect(config).to_not receive(:queue)
|
|
74
|
+
subject.invalidate(:file, 'file.rb', silence: true)
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
context 'that returns no change' do
|
|
81
|
+
before { allow(Listen::File).to receive(:change) { nil } }
|
|
82
|
+
|
|
83
|
+
it "doesn't notifies no change" do
|
|
84
|
+
expect(config).to_not receive(:queue)
|
|
85
|
+
subject.invalidate(:file, 'file.rb', {})
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
context 'directory' do
|
|
92
|
+
let(:dir_options) { { recursive: true } }
|
|
93
|
+
|
|
94
|
+
it 'calls Listen::Directory#new' do
|
|
95
|
+
expect(Listen::Directory).to receive(:scan).
|
|
96
|
+
with(subject, 'dir1', dir_options)
|
|
97
|
+
|
|
98
|
+
subject.invalidate(:dir, 'dir1', dir_options)
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
end
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'listen/cli'
|
|
4
|
+
|
|
5
|
+
RSpec.describe Listen::CLI do
|
|
6
|
+
let(:options) { {} }
|
|
7
|
+
let(:forwarder) { instance_double(Listen::Forwarder) }
|
|
8
|
+
|
|
9
|
+
before do
|
|
10
|
+
allow(forwarder).to receive(:start)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe 'directories option' do
|
|
14
|
+
context 'not specified' do
|
|
15
|
+
let(:options) { %w[] }
|
|
16
|
+
it 'is set to local directory' do
|
|
17
|
+
expect(Listen::Forwarder).to receive(:new) do |options|
|
|
18
|
+
expect(options[:directory]).to eq(['.'])
|
|
19
|
+
forwarder
|
|
20
|
+
end
|
|
21
|
+
described_class.start(options)
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
context 'with a single directory' do
|
|
26
|
+
let(:options) { %w[-d app] }
|
|
27
|
+
it 'is set to app' do
|
|
28
|
+
expect(Listen::Forwarder).to receive(:new) do |options|
|
|
29
|
+
expect(options[:directory]).to eq(['app'])
|
|
30
|
+
forwarder
|
|
31
|
+
end
|
|
32
|
+
described_class.start(options)
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
context 'with a multiple directories' do
|
|
37
|
+
let(:options) { %w[-d app spec] }
|
|
38
|
+
it 'is set to an array of the directories' do
|
|
39
|
+
expect(Listen::Forwarder).to receive(:new) do |options|
|
|
40
|
+
expect(options[:directory]).to eq(%w[app spec])
|
|
41
|
+
forwarder
|
|
42
|
+
end
|
|
43
|
+
described_class.start(options)
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
describe 'relative option' do
|
|
49
|
+
context 'without relative option' do
|
|
50
|
+
let(:options) { %w[] }
|
|
51
|
+
it 'is set to false' do
|
|
52
|
+
expect(Listen::Forwarder).to receive(:new) do |options|
|
|
53
|
+
expect(options[:relative]).to be(false)
|
|
54
|
+
forwarder
|
|
55
|
+
end
|
|
56
|
+
described_class.start(options)
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
context 'when -r' do
|
|
61
|
+
let(:options) { %w[-r] }
|
|
62
|
+
|
|
63
|
+
it 'is set to true' do
|
|
64
|
+
expect(Listen::Forwarder).to receive(:new) do |options|
|
|
65
|
+
expect(options[:relative]).to be(true)
|
|
66
|
+
forwarder
|
|
67
|
+
end
|
|
68
|
+
described_class.start(options)
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
context 'when --relative' do
|
|
73
|
+
let(:options) { %w[--relative] }
|
|
74
|
+
|
|
75
|
+
it 'supports -r option' do
|
|
76
|
+
expect(Listen::Forwarder).to receive(:new) do |options|
|
|
77
|
+
expect(options[:relative]).to be(true)
|
|
78
|
+
forwarder
|
|
79
|
+
end
|
|
80
|
+
described_class.start(options)
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
it 'supports --relative option' do
|
|
84
|
+
expect(Listen::Forwarder).to receive(:new) do |options|
|
|
85
|
+
expect(options[:relative]).to be(true)
|
|
86
|
+
forwarder
|
|
87
|
+
end
|
|
88
|
+
described_class.start(options)
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
RSpec.describe Listen::Forwarder do
|
|
95
|
+
let(:logger) { instance_double(Logger) }
|
|
96
|
+
let(:listener) { instance_double(Listen::Listener) }
|
|
97
|
+
|
|
98
|
+
before do
|
|
99
|
+
allow(Logger).to receive(:new).and_return(logger)
|
|
100
|
+
allow(logger).to receive(:level=)
|
|
101
|
+
allow(logger).to receive(:formatter=)
|
|
102
|
+
allow(logger).to receive(:info)
|
|
103
|
+
|
|
104
|
+
allow(listener).to receive(:start)
|
|
105
|
+
allow(listener).to receive(:processing?).and_return false
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
it 'passes relative option to Listen' do
|
|
109
|
+
value = double('value')
|
|
110
|
+
expect(Listen).to receive(:to).
|
|
111
|
+
with(hash_including(relative: value)).
|
|
112
|
+
and_return(listener)
|
|
113
|
+
|
|
114
|
+
described_class.new(relative: value).start
|
|
115
|
+
end
|
|
116
|
+
end
|