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,320 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
RSpec.describe 'Listen', acceptance: true do
|
|
4
|
+
let(:base_options) { { latency: 0.1 } }
|
|
5
|
+
let(:polling_options) { {} }
|
|
6
|
+
let(:options) { {} }
|
|
7
|
+
let(:all_options) { base_options.merge(polling_options).merge(options) }
|
|
8
|
+
|
|
9
|
+
let(:wrapper) { setup_listener(all_options, :track_changes) }
|
|
10
|
+
|
|
11
|
+
context 'with normal start/stop' do
|
|
12
|
+
before { wrapper.listener.start }
|
|
13
|
+
after { wrapper.listener.stop }
|
|
14
|
+
|
|
15
|
+
subject { wrapper }
|
|
16
|
+
|
|
17
|
+
context 'with one listen dir' do
|
|
18
|
+
let(:paths) { Pathname.new(Dir.pwd) }
|
|
19
|
+
around { |example| fixtures { example.run } }
|
|
20
|
+
|
|
21
|
+
modes =
|
|
22
|
+
case ENV['TEST_LISTEN_ADAPTER_MODES']
|
|
23
|
+
when 'polling'
|
|
24
|
+
[true]
|
|
25
|
+
when 'native'
|
|
26
|
+
[false]
|
|
27
|
+
else
|
|
28
|
+
[false, true]
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# TODO: make it configurable
|
|
32
|
+
# TODO: restore
|
|
33
|
+
modes.each do |polling|
|
|
34
|
+
context "force_polling option to #{polling}" do
|
|
35
|
+
let(:polling_options) { { force_polling: polling } }
|
|
36
|
+
|
|
37
|
+
if polling
|
|
38
|
+
context 'when polling' do
|
|
39
|
+
context 'with a large latency' do
|
|
40
|
+
let(:options) { { latency: 10 } }
|
|
41
|
+
it 'passes the latency option correctly' do
|
|
42
|
+
expect(subject).to_not process_addition_of('file.rb')
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
else
|
|
47
|
+
unless darwin?
|
|
48
|
+
context 'when driver does not support option' do
|
|
49
|
+
let(:options) { { latency: 10 } }
|
|
50
|
+
it 'does not pass the latency option' do
|
|
51
|
+
expect(subject).to process_addition_of('file.rb')
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
context 'with default ignore options' do
|
|
58
|
+
context 'with nothing in listen dir' do
|
|
59
|
+
it { is_expected.to process_addition_of('file.rb') }
|
|
60
|
+
it { is_expected.to process_addition_of('.hidden') }
|
|
61
|
+
|
|
62
|
+
it 'listens to multiple files addition' do
|
|
63
|
+
result = wrapper.listen do
|
|
64
|
+
change_fs(:added, 'file1.rb')
|
|
65
|
+
change_fs(:added, 'file2.rb')
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
expect(result).to eq(modified: [],
|
|
69
|
+
added: %w[file1.rb file2.rb],
|
|
70
|
+
removed: [])
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
it 'listens to file moved inside' do
|
|
74
|
+
touch '../file.rb'
|
|
75
|
+
expect(wrapper.listen do
|
|
76
|
+
mv '../file.rb', 'file.rb'
|
|
77
|
+
end).to eq(modified: [], added: ['file.rb'], removed: [])
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
context 'existing file.rb in listen dir' do
|
|
82
|
+
around do |example|
|
|
83
|
+
change_fs(:added, 'file.rb')
|
|
84
|
+
example.run
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
it { is_expected.to process_modification_of('file.rb') }
|
|
88
|
+
it { is_expected.to process_removal_of('file.rb') }
|
|
89
|
+
|
|
90
|
+
it 'listens to file.rb moved out' do
|
|
91
|
+
expect(wrapper.listen do
|
|
92
|
+
mv 'file.rb', '../file.rb'
|
|
93
|
+
end).to eq(modified: [], added: [], removed: ['file.rb'])
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
it 'listens to file mode change' do
|
|
97
|
+
prev_mode = File.stat('file.rb').mode
|
|
98
|
+
|
|
99
|
+
result = wrapper.listen do
|
|
100
|
+
windows? ? `attrib +r file.rb` : chmod(0444, 'file.rb')
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
new_mode = File.stat('file.rb').mode
|
|
104
|
+
no_event = result[:modified].empty? && prev_mode == new_mode
|
|
105
|
+
|
|
106
|
+
# Check if chmod actually works or an attrib event happens,
|
|
107
|
+
# or expect nothing otherwise
|
|
108
|
+
#
|
|
109
|
+
# (e.g. fails for polling+vfat on Linux, but works with
|
|
110
|
+
# INotify+vfat because you get an event regardless if mode
|
|
111
|
+
# actually changes)
|
|
112
|
+
#
|
|
113
|
+
files = no_event ? [] : ['file.rb']
|
|
114
|
+
|
|
115
|
+
expect(result).to eq(modified: files, added: [], removed: [])
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
context 'hidden file in listen dir' do
|
|
120
|
+
around do |example|
|
|
121
|
+
change_fs(:added, '.hidden')
|
|
122
|
+
example.run
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
it { is_expected.to process_modification_of('.hidden') }
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
context 'dir in listen dir' do
|
|
129
|
+
around do |example|
|
|
130
|
+
mkdir_p 'dir'
|
|
131
|
+
example.run
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
it { is_expected.to process_addition_of('dir/file.rb') }
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
context 'dir with file in listen dir' do
|
|
138
|
+
around do |example|
|
|
139
|
+
mkdir_p 'dir'
|
|
140
|
+
touch 'dir/file.rb'
|
|
141
|
+
example.run
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
it 'listens to file move' do
|
|
145
|
+
expected = { modified: [],
|
|
146
|
+
added: %w[file.rb],
|
|
147
|
+
removed: %w[dir/file.rb] }
|
|
148
|
+
|
|
149
|
+
expect(wrapper.listen do
|
|
150
|
+
mv 'dir/file.rb', 'file.rb'
|
|
151
|
+
end).to eq expected
|
|
152
|
+
end
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
context 'two dirs with files in listen dir' do
|
|
156
|
+
around do |example|
|
|
157
|
+
mkdir_p 'dir1'
|
|
158
|
+
touch 'dir1/file1.rb'
|
|
159
|
+
mkdir_p 'dir2'
|
|
160
|
+
touch 'dir2/file2.rb'
|
|
161
|
+
example.run
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
it 'listens to multiple file moves' do
|
|
165
|
+
expected = {
|
|
166
|
+
modified: [],
|
|
167
|
+
added: ['dir1/file2.rb', 'dir2/file1.rb'],
|
|
168
|
+
removed: ['dir1/file1.rb', 'dir2/file2.rb']
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
expect(wrapper.listen do
|
|
172
|
+
mv 'dir1/file1.rb', 'dir2/file1.rb'
|
|
173
|
+
mv 'dir2/file2.rb', 'dir1/file2.rb'
|
|
174
|
+
end).to eq expected
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
it 'listens to dir move' do
|
|
178
|
+
expected = { modified: [],
|
|
179
|
+
added: ['dir2/dir1/file1.rb'],
|
|
180
|
+
removed: ['dir1/file1.rb'] }
|
|
181
|
+
|
|
182
|
+
expect(wrapper.listen do
|
|
183
|
+
mv 'dir1', 'dir2/'
|
|
184
|
+
end).to eq expected
|
|
185
|
+
end
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
context 'listens to subdirectory removed' do
|
|
189
|
+
around do |example|
|
|
190
|
+
mkdir_p 'dir1'
|
|
191
|
+
mkdir_p 'dir1/subdir1'
|
|
192
|
+
mkdir_p 'dir1/subdir1/subdir2'
|
|
193
|
+
touch 'dir1/subdir1/file.rb'
|
|
194
|
+
touch 'dir1/subdir1/subdir2/file.rb'
|
|
195
|
+
example.run
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
it 'listen to the files of a removed directory' do
|
|
199
|
+
expected = {
|
|
200
|
+
modified: [],
|
|
201
|
+
added: [],
|
|
202
|
+
removed: %w[dir1/subdir1/file.rb dir1/subdir1/subdir2/file.rb]
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
expect(wrapper.listen do
|
|
206
|
+
rm_rf 'dir1'
|
|
207
|
+
end).to eq expected
|
|
208
|
+
end
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
context 'listens to sub-subdirectory removed' do
|
|
212
|
+
around do |example|
|
|
213
|
+
mkdir_p 'dir1'
|
|
214
|
+
mkdir_p 'dir1/subdir1'
|
|
215
|
+
mkdir_p 'dir1/subdir1/subdir2'
|
|
216
|
+
touch 'dir1/subdir1/file.rb'
|
|
217
|
+
touch 'dir1/subdir1/subdir2/file.rb'
|
|
218
|
+
example.run
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
it 'listen to the files of a removed directory' do
|
|
222
|
+
expected = {
|
|
223
|
+
modified: [],
|
|
224
|
+
added: [],
|
|
225
|
+
removed: %w[dir1/subdir1/file.rb dir1/subdir1/subdir2/file.rb]
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
expect(wrapper.listen do
|
|
229
|
+
rm_rf 'dir1/subdir1'
|
|
230
|
+
end).to eq expected
|
|
231
|
+
end
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
context 'with .bundle dir ignored by default' do
|
|
235
|
+
around do |example|
|
|
236
|
+
mkdir_p '.bundle'
|
|
237
|
+
example.run
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
it { is_expected.not_to process_addition_of('.bundle/file.rb') }
|
|
241
|
+
end
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
context 'when :ignore is *ignored_dir*' do
|
|
245
|
+
context 'ignored dir with file in listen dir' do
|
|
246
|
+
let(:options) { { ignore: /ignored_dir/ } }
|
|
247
|
+
|
|
248
|
+
around do |example|
|
|
249
|
+
mkdir_p 'ignored_dir'
|
|
250
|
+
example.run
|
|
251
|
+
end
|
|
252
|
+
|
|
253
|
+
it { is_expected.not_to process_addition_of('ignored_dir/file.rb') }
|
|
254
|
+
end
|
|
255
|
+
|
|
256
|
+
context 'when :only is *.rb' do
|
|
257
|
+
let(:options) { { only: /\.rb$/ } }
|
|
258
|
+
|
|
259
|
+
it { is_expected.to process_addition_of('file.rb') }
|
|
260
|
+
it { is_expected.not_to process_addition_of('file.txt') }
|
|
261
|
+
end
|
|
262
|
+
|
|
263
|
+
context 'when :ignore is bar.rb' do
|
|
264
|
+
context 'when :only is *.rb' do
|
|
265
|
+
let(:options) { { ignore: /bar\.rb$/, only: /\.rb$/ } }
|
|
266
|
+
|
|
267
|
+
it { is_expected.to process_addition_of('file.rb') }
|
|
268
|
+
it { is_expected.not_to process_addition_of('file.txt') }
|
|
269
|
+
it { is_expected.not_to process_addition_of('bar.rb') }
|
|
270
|
+
end
|
|
271
|
+
end
|
|
272
|
+
|
|
273
|
+
context 'when default ignore is *.rb' do
|
|
274
|
+
let(:options) { { ignore: /\.rb$/ } }
|
|
275
|
+
|
|
276
|
+
it { is_expected.not_to process_addition_of('file.rb') }
|
|
277
|
+
|
|
278
|
+
context 'with #ignore on *.txt mask' do
|
|
279
|
+
before { wrapper.listener.ignore(/\.txt/) }
|
|
280
|
+
|
|
281
|
+
it { is_expected.not_to process_addition_of('file.rb') }
|
|
282
|
+
it { is_expected.not_to process_addition_of('file.txt') }
|
|
283
|
+
end
|
|
284
|
+
|
|
285
|
+
context 'with #ignore! on *.txt mask' do
|
|
286
|
+
before { wrapper.listener.ignore!(/\.txt/) }
|
|
287
|
+
|
|
288
|
+
it { is_expected.to process_addition_of('file.rb') }
|
|
289
|
+
it { is_expected.not_to process_addition_of('file.txt') }
|
|
290
|
+
end
|
|
291
|
+
end
|
|
292
|
+
end
|
|
293
|
+
end
|
|
294
|
+
end
|
|
295
|
+
end
|
|
296
|
+
|
|
297
|
+
context 'with paths set' do
|
|
298
|
+
let(:paths) { Pathname.new(Dir.pwd) }
|
|
299
|
+
|
|
300
|
+
it 'allows extra calls to stop' do
|
|
301
|
+
wrapper.listener.stop
|
|
302
|
+
wrapper.listener.stop
|
|
303
|
+
end
|
|
304
|
+
end
|
|
305
|
+
end
|
|
306
|
+
|
|
307
|
+
context 'when never started' do
|
|
308
|
+
let(:paths) { Pathname.new(Dir.pwd) }
|
|
309
|
+
|
|
310
|
+
it 'allows stop' do
|
|
311
|
+
wrapper.listener.stop
|
|
312
|
+
end
|
|
313
|
+
|
|
314
|
+
it 'extra calls to stop' do
|
|
315
|
+
wrapper.listener.stop
|
|
316
|
+
wrapper.listener.stop
|
|
317
|
+
wrapper.listener.stop
|
|
318
|
+
end
|
|
319
|
+
end
|
|
320
|
+
end
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
RSpec.describe Listen::Adapter::Base do
|
|
4
|
+
class FakeAdapter < described_class
|
|
5
|
+
def initialize(config)
|
|
6
|
+
@my_callbacks = {}
|
|
7
|
+
super
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def _run
|
|
11
|
+
fail NotImplementedError
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def _configure(dir, &callback)
|
|
15
|
+
@my_callbacks[dir.to_s] = callback
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def fake_event(event)
|
|
19
|
+
dir = event[:dir]
|
|
20
|
+
@my_callbacks[dir].call(event)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def _process_event(dir, event)
|
|
24
|
+
_queue_change(:file, dir, event[:file], cookie: event[:cookie])
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
let(:thread) { instance_double(Thread, "thread") }
|
|
29
|
+
let(:dir1) { instance_double(Pathname, 'dir1', to_s: '/foo/dir1') }
|
|
30
|
+
|
|
31
|
+
let(:config) { instance_double(Listen::Adapter::Config) }
|
|
32
|
+
let(:queue) { instance_double(Queue) }
|
|
33
|
+
let(:silencer) { instance_double(Listen::Silencer) }
|
|
34
|
+
let(:adapter_options) { {} }
|
|
35
|
+
|
|
36
|
+
let(:snapshot) { instance_double(Listen::Change) }
|
|
37
|
+
let(:record) { instance_double(Listen::Record) }
|
|
38
|
+
|
|
39
|
+
subject { FakeAdapter.new(config) }
|
|
40
|
+
|
|
41
|
+
before do
|
|
42
|
+
allow(config).to receive(:directories).and_return([dir1])
|
|
43
|
+
allow(config).to receive(:queue).and_return(queue)
|
|
44
|
+
allow(config).to receive(:silencer).and_return(silencer)
|
|
45
|
+
allow(config).to receive(:adapter_options).and_return(adapter_options)
|
|
46
|
+
|
|
47
|
+
allow(Thread).to receive(:new) do |&block|
|
|
48
|
+
block.call
|
|
49
|
+
allow(thread).to receive(:name=)
|
|
50
|
+
thread
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# Stuff that happens in configure()
|
|
54
|
+
allow(Listen::Record).to receive(:new).with(dir1, silencer).and_return(record)
|
|
55
|
+
|
|
56
|
+
allow(Listen::Change::Config).to receive(:new).with(queue, silencer).
|
|
57
|
+
and_return(config)
|
|
58
|
+
|
|
59
|
+
allow(Listen::Change).to receive(:new).with(config, record).
|
|
60
|
+
and_return(snapshot)
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
describe '#start' do
|
|
64
|
+
before do
|
|
65
|
+
allow(subject).to receive(:_run)
|
|
66
|
+
|
|
67
|
+
allow(snapshot).to receive(:record).and_return(record)
|
|
68
|
+
allow(record).to receive(:build)
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
it 'builds record' do
|
|
72
|
+
expect(record).to receive(:build)
|
|
73
|
+
subject.start
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
it 'runs the adapter' do
|
|
77
|
+
expect(subject).to receive(:_run)
|
|
78
|
+
subject.start
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
describe 'handling events' do
|
|
83
|
+
before do
|
|
84
|
+
allow(subject).to receive(:_run)
|
|
85
|
+
|
|
86
|
+
allow(snapshot).to receive(:record).and_return(record)
|
|
87
|
+
allow(record).to receive(:build)
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
context 'when an event occurs' do
|
|
91
|
+
it 'passes invalidates the snapshot based on the event' do
|
|
92
|
+
subject.start
|
|
93
|
+
|
|
94
|
+
expect(snapshot).to receive(:invalidate).with(:file, 'bar', { cookie: 3 })
|
|
95
|
+
|
|
96
|
+
event = { dir: '/foo/dir1', file: 'bar', type: :moved, cookie: 3 }
|
|
97
|
+
subject.fake_event(event)
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
end
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'listen/adapter/config'
|
|
4
|
+
|
|
5
|
+
RSpec.describe Listen::Adapter::Config do
|
|
6
|
+
let(:directories) { [path1, path2] }
|
|
7
|
+
let(:queue) { instance_double(Queue) }
|
|
8
|
+
let(:silencer) { instance_double(Listen::Silencer) }
|
|
9
|
+
|
|
10
|
+
# NOTE: defaults are handled later in Listen::Options
|
|
11
|
+
let(:adapter_options) { { latency: 1.234 } }
|
|
12
|
+
|
|
13
|
+
subject do
|
|
14
|
+
described_class.new(directories, queue, silencer, adapter_options)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# Here's what may be passed to initializer
|
|
18
|
+
let(:path1) { fake_path('/real/path1', realpath: real_path1) }
|
|
19
|
+
let(:path2) { fake_path('/real/path2', realpath: real_path2) }
|
|
20
|
+
let(:path3) { fake_path('/real/path3', realpath: real_path3) }
|
|
21
|
+
|
|
22
|
+
let(:current_path) do
|
|
23
|
+
fake_path('/real/current_path', realpath: real_current_path)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
let(:symlinked_dir1) { fake_path('symlinked_dir1', realpath: real_path1) }
|
|
27
|
+
let(:symlinked_dir2) { fake_path('symlinked_dir1', realpath: real_path2) }
|
|
28
|
+
|
|
29
|
+
# Here's what expected to be returned (just so that realpath() calls return
|
|
30
|
+
# something useful)
|
|
31
|
+
let(:real_path1) { fake_path('/real/path1') }
|
|
32
|
+
let(:real_path2) { fake_path('/real/path2') }
|
|
33
|
+
let(:real_path3) { fake_path('/real/path3', directory?: false) }
|
|
34
|
+
let(:real_current_path) { fake_path('/real/current_path') }
|
|
35
|
+
|
|
36
|
+
before do
|
|
37
|
+
allow(Pathname).to receive(:new) do |*args|
|
|
38
|
+
fail "unstubbed Pathname.new(#{args.map(&:inspect) * ','})"
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
allow(Pathname).to receive(:new).with('/real/path1').and_return(path1)
|
|
42
|
+
allow(Pathname).to receive(:new).with('/real/path2').and_return(path2)
|
|
43
|
+
allow(Pathname).to receive(:new).with('/real/path3').and_return(path3)
|
|
44
|
+
|
|
45
|
+
allow(Pathname).to receive(:new).with(path1).and_return(path1)
|
|
46
|
+
allow(Pathname).to receive(:new).with(path2).and_return(path2)
|
|
47
|
+
|
|
48
|
+
allow(Pathname).to receive(:new).with('symlinked_dir1').
|
|
49
|
+
and_return(symlinked_dir1)
|
|
50
|
+
|
|
51
|
+
allow(Pathname).to receive(:new).with('symlinked_dir2').
|
|
52
|
+
and_return(symlinked_dir2)
|
|
53
|
+
|
|
54
|
+
allow(Dir).to receive(:pwd).and_return('/real/current_path')
|
|
55
|
+
|
|
56
|
+
allow(Pathname).to receive(:new).
|
|
57
|
+
with('/real/current_path').and_return(current_path)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
describe '#initialize' do
|
|
61
|
+
context 'with directories as array' do
|
|
62
|
+
context 'with strings for directories' do
|
|
63
|
+
context 'when already resolved' do
|
|
64
|
+
let(:directories) { ['/real/path1', '/real/path2'] }
|
|
65
|
+
it 'returns array of pathnames' do
|
|
66
|
+
expect(subject.directories).to eq([real_path1, real_path2])
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
context 'when not resolved' do
|
|
71
|
+
let(:directories) { %w[symlinked_dir1 symlinked_dir2] }
|
|
72
|
+
it 'returns array of resolved pathnames' do
|
|
73
|
+
expect(subject.directories).to eq([real_path1, real_path2])
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
context 'with Pathnames for directories' do
|
|
79
|
+
let(:directories) { [path1, path2] }
|
|
80
|
+
it 'returns array of pathnames' do
|
|
81
|
+
expect(subject.directories).to eq([real_path1, real_path2])
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
context 'with directories as messy array' do
|
|
87
|
+
pending 'implement me'
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
context 'with no directories' do
|
|
91
|
+
let(:directories) { }
|
|
92
|
+
it 'returns the current path in array' do
|
|
93
|
+
expect(subject.directories).to eq([real_current_path])
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
context 'with file path' do
|
|
98
|
+
let(:directories) { ['/real/path3'] }
|
|
99
|
+
it 'raises argument error requesting a directory' do
|
|
100
|
+
expect { subject }.to raise_error(ArgumentError, /must be a directory/)
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
describe '#adapter_options' do
|
|
106
|
+
it 'provides a set of adapter_specific options' do
|
|
107
|
+
expect(subject.adapter_options).to eq(latency: 1.234)
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
describe '#queue' do
|
|
112
|
+
it 'provides a direct queue for filesystem events' do
|
|
113
|
+
expect(subject.queue).to eq(queue)
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
describe '#silencer' do
|
|
118
|
+
it 'provides a silencer object' do
|
|
119
|
+
expect(subject.silencer).to eq(silencer)
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
end
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# This is just so stubs work
|
|
4
|
+
require 'rb-fsevent'
|
|
5
|
+
|
|
6
|
+
require 'listen/adapter/darwin'
|
|
7
|
+
|
|
8
|
+
include Listen
|
|
9
|
+
|
|
10
|
+
RSpec.describe Adapter::Darwin do
|
|
11
|
+
describe 'class' do
|
|
12
|
+
subject { described_class }
|
|
13
|
+
|
|
14
|
+
context 'on darwin 13.0 (OS X Mavericks)' do
|
|
15
|
+
before do
|
|
16
|
+
allow(RbConfig::CONFIG).to receive(:[]).and_return('darwin13.0')
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
it { should be_usable }
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
context 'on darwin20 (macOS Big Sur)' do
|
|
23
|
+
before do
|
|
24
|
+
allow(RbConfig::CONFIG).to receive(:[]).and_return('darwin20')
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
it { should be_usable }
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
context 'on darwin10.0 (OS X Snow Leopard)' do
|
|
31
|
+
before do
|
|
32
|
+
allow(RbConfig::CONFIG).to receive(:[]).and_return('darwin10.0')
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
context 'with rb-fsevent > 0.9.4' do
|
|
36
|
+
before { stub_const('FSEvent::VERSION', '0.9.6') }
|
|
37
|
+
it 'shows a warning and should not be usable' do
|
|
38
|
+
expect(Listen).to receive(:adapter_warn)
|
|
39
|
+
expect(subject).to_not be_usable
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
context 'with rb-fsevent <= 0.9.4' do
|
|
44
|
+
before { stub_const('FSEvent::VERSION', '0.9.4') }
|
|
45
|
+
it { should be_usable }
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
context 'on another platform (linux)' do
|
|
50
|
+
before { allow(RbConfig::CONFIG).to receive(:[]).and_return('linux') }
|
|
51
|
+
it { should_not be_usable }
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
let(:options) { {} }
|
|
56
|
+
let(:config) { instance_double(Listen::Adapter::Config) }
|
|
57
|
+
let(:queue) { instance_double(::Queue) }
|
|
58
|
+
let(:silencer) { instance_double(Listen::Silencer) }
|
|
59
|
+
|
|
60
|
+
let(:dir1) { fake_path('/foo/dir1', cleanpath: fake_path('/foo/dir1')) }
|
|
61
|
+
let(:directories) { [dir1] }
|
|
62
|
+
|
|
63
|
+
subject { described_class.new(config) }
|
|
64
|
+
|
|
65
|
+
before do
|
|
66
|
+
allow(config).to receive(:directories).and_return(directories)
|
|
67
|
+
allow(config).to receive(:adapter_options).and_return(options)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
describe '#_latency' do
|
|
71
|
+
subject { described_class.new(config).options.latency }
|
|
72
|
+
|
|
73
|
+
context 'with no overriding option' do
|
|
74
|
+
it { should eq 0.1 }
|
|
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
|