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,424 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
RSpec.describe Listen::Record do
|
|
4
|
+
let(:dir) { instance_double(Pathname, to_s: '/dir') }
|
|
5
|
+
let(:silencer_options) { { ignore!: [/\A\.ignored/] } }
|
|
6
|
+
let(:silencer) { Listen::Silencer.new(**silencer_options) }
|
|
7
|
+
let(:record) { Listen::Record.new(dir, silencer) }
|
|
8
|
+
|
|
9
|
+
def dir_entries_for(hash)
|
|
10
|
+
hash.each do |dir, entries|
|
|
11
|
+
allow(::Dir).to receive(:entries).with(dir) { entries }
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def real_directory(hash)
|
|
16
|
+
dir_entries_for(hash)
|
|
17
|
+
hash.each_key do |dir|
|
|
18
|
+
realpath(dir)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def file(path)
|
|
23
|
+
allow(::Dir).to receive(:entries).with(path).and_raise(Errno::ENOTDIR)
|
|
24
|
+
path
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def lstat(path, stat = nil)
|
|
28
|
+
stat ||= instance_double(::File::Stat, mtime: 2.3, mode: 0755, size: 42)
|
|
29
|
+
allow(::File).to receive(:lstat).with(path).and_return(stat)
|
|
30
|
+
stat
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def realpath(path)
|
|
34
|
+
allow(::File).to receive(:realpath).with(path).and_return(path)
|
|
35
|
+
path
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def symlink(hash_or_dir)
|
|
39
|
+
if hash_or_dir.is_a?(String)
|
|
40
|
+
allow(::File).to receive(:realpath).with(hash_or_dir).
|
|
41
|
+
and_return(hash_or_dir)
|
|
42
|
+
else
|
|
43
|
+
hash_or_dir.each do |dir, real_path|
|
|
44
|
+
allow(::File).to receive(:realpath).with(dir).and_return(real_path)
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def record_tree(record)
|
|
50
|
+
record.instance_variable_get(:@tree)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
describe '#update_file' do
|
|
54
|
+
context 'with path in watched dir' do
|
|
55
|
+
it 'sets path by spliting dirname and basename' do
|
|
56
|
+
record.update_file('file.rb', mtime: 1.1)
|
|
57
|
+
expect(record_tree(record)).to eq('file.rb' => { mtime: 1.1 })
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
it 'sets path and keeps old data not overwritten' do
|
|
61
|
+
record.update_file('file.rb', foo: 1, bar: 2)
|
|
62
|
+
record.update_file('file.rb', foo: 3)
|
|
63
|
+
watched_dir = record_tree(record)
|
|
64
|
+
expect(watched_dir).to eq('file.rb' => { foo: 3, bar: 2 })
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
context 'with subdir path' do
|
|
69
|
+
it 'sets path by splitting dirname and basename' do
|
|
70
|
+
record.update_file('path/file.rb', mtime: 1.1)
|
|
71
|
+
expect(record_tree(record)['path']).to eq('file.rb' => { mtime: 1.1 })
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
it 'sets path and keeps old data not overwritten' do
|
|
75
|
+
record.update_file('path/file.rb', foo: 1, bar: 2)
|
|
76
|
+
record.update_file('path/file.rb', foo: 3)
|
|
77
|
+
file_data = record_tree(record)['path']['file.rb']
|
|
78
|
+
expect(file_data).to eq(foo: 3, bar: 2)
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
describe '#add_dir' do
|
|
84
|
+
it 'sets itself when .' do
|
|
85
|
+
record.add_dir('.')
|
|
86
|
+
expect(record_tree(record)).to eq({})
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
it 'sets itself when nil' do
|
|
90
|
+
record.add_dir(nil)
|
|
91
|
+
expect(record_tree(record)).to eq({})
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
it 'sets itself when empty' do
|
|
95
|
+
record.add_dir('')
|
|
96
|
+
expect(record_tree(record)).to eq({})
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
it 'correctly sets new directory data' do
|
|
100
|
+
record.add_dir('path/subdir')
|
|
101
|
+
expect(record_tree(record)).to eq('path/subdir' => {})
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
it 'sets path and keeps old data not overwritten' do
|
|
105
|
+
record.add_dir('path/subdir')
|
|
106
|
+
record.update_file('path/subdir/file.rb', mtime: 1.1)
|
|
107
|
+
record.add_dir('path/subdir')
|
|
108
|
+
record.update_file('path/subdir/file2.rb', mtime: 1.2)
|
|
109
|
+
record.add_dir('path/subdir')
|
|
110
|
+
|
|
111
|
+
watched = record_tree(record)
|
|
112
|
+
expect(watched.keys).to eq ['path/subdir']
|
|
113
|
+
expect(watched['path/subdir'].keys).to eq %w[file.rb file2.rb]
|
|
114
|
+
|
|
115
|
+
subdir = watched['path/subdir']
|
|
116
|
+
expect(subdir['file.rb']).to eq(mtime: 1.1)
|
|
117
|
+
expect(subdir['file2.rb']).to eq(mtime: 1.2)
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
describe '#unset_path' do
|
|
122
|
+
context 'within watched dir' do
|
|
123
|
+
context 'when path is present' do
|
|
124
|
+
before { record.update_file('file.rb', mtime: 1.1) }
|
|
125
|
+
|
|
126
|
+
it 'unsets path' do
|
|
127
|
+
record.unset_path('file.rb')
|
|
128
|
+
expect(record_tree(record)).to eq({})
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
context 'when path not present' do
|
|
133
|
+
it 'unsets path' do
|
|
134
|
+
record.unset_path('file.rb')
|
|
135
|
+
expect(record_tree(record)).to eq({})
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
context 'within subdir' do
|
|
141
|
+
context 'when path is present' do
|
|
142
|
+
before { record.update_file('path/file.rb', mtime: 1.1) }
|
|
143
|
+
|
|
144
|
+
it 'unsets path' do
|
|
145
|
+
record.unset_path('path/file.rb')
|
|
146
|
+
expect(record_tree(record)).to eq('path' => {})
|
|
147
|
+
end
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
context 'when path not present' do
|
|
151
|
+
it 'unsets path' do
|
|
152
|
+
record.unset_path('path/file.rb')
|
|
153
|
+
expect(record_tree(record)).to eq({})
|
|
154
|
+
end
|
|
155
|
+
end
|
|
156
|
+
end
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
describe '#file_data' do
|
|
160
|
+
context 'with path in watched dir' do
|
|
161
|
+
context 'when path is present' do
|
|
162
|
+
before { record.update_file('file.rb', mtime: 1.1) }
|
|
163
|
+
|
|
164
|
+
it 'returns file data' do
|
|
165
|
+
expect(record.file_data('file.rb')).to eq(mtime: 1.1)
|
|
166
|
+
end
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
context 'path not present' do
|
|
170
|
+
it 'return empty hash' do
|
|
171
|
+
expect(record.file_data('file.rb')).to be_empty
|
|
172
|
+
end
|
|
173
|
+
end
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
context 'with path in subdir' do
|
|
177
|
+
context 'when path is present' do
|
|
178
|
+
before { record.update_file('path/file.rb', mtime: 1.1) }
|
|
179
|
+
|
|
180
|
+
it 'returns file data' do
|
|
181
|
+
expected = { mtime: 1.1 }
|
|
182
|
+
expect(record.file_data('path/file.rb')).to eq expected
|
|
183
|
+
end
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
context 'path not present' do
|
|
187
|
+
it 'return empty hash' do
|
|
188
|
+
expect(record.file_data('path/file.rb')).to be_empty
|
|
189
|
+
end
|
|
190
|
+
end
|
|
191
|
+
end
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
describe '#dir_entries' do
|
|
195
|
+
context 'in watched dir' do
|
|
196
|
+
subject { record.dir_entries('.') }
|
|
197
|
+
|
|
198
|
+
context 'with no entries' do
|
|
199
|
+
it { should be_empty }
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
context 'with file.rb in record' do
|
|
203
|
+
before { record.update_file('file.rb', mtime: 1.1) }
|
|
204
|
+
it { should eq('file.rb' => { mtime: 1.1 }) }
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
context 'with subdir/file.rb in record' do
|
|
208
|
+
before { record.update_file('subdir/file.rb', mtime: 1.1) }
|
|
209
|
+
it { should eq('subdir' => {}) }
|
|
210
|
+
end
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
context 'when there is a file with the same name as a dir' do
|
|
214
|
+
subject { record.dir_entries('cypress') }
|
|
215
|
+
|
|
216
|
+
before do
|
|
217
|
+
record.update_file('cypress.json', mtime: 1.1)
|
|
218
|
+
record.update_file('cypress/README.md', mtime: 1.2)
|
|
219
|
+
record.update_file('a/b/cypress/d', mtime: 1.3)
|
|
220
|
+
record.update_file('a/b/c/cypress', mtime: 1.3)
|
|
221
|
+
end
|
|
222
|
+
it { should eq('README.md' => { mtime: 1.2 }) }
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
context 'when there is a file with a similar name to a dir' do
|
|
226
|
+
subject { record.dir_entries('app') }
|
|
227
|
+
|
|
228
|
+
before do
|
|
229
|
+
record.update_file('appspec.yml', mtime: 1.1)
|
|
230
|
+
record.update_file('app/README.md', mtime: 1.2)
|
|
231
|
+
record.update_file('spec/app/foo', mtime: 1.3)
|
|
232
|
+
end
|
|
233
|
+
it { should eq('README.md' => { mtime: 1.2 }) }
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
context 'in subdir /path' do
|
|
237
|
+
subject { record.dir_entries('path') }
|
|
238
|
+
|
|
239
|
+
context 'with no entries' do
|
|
240
|
+
it { should be_empty }
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
context 'with path/file.rb already in record' do
|
|
244
|
+
before { record.update_file('path/file.rb', mtime: 1.1) }
|
|
245
|
+
it { should eq('file.rb' => { mtime: 1.1 }) }
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
context 'with empty path/subdir' do
|
|
249
|
+
before { record.add_dir('path/subdir') }
|
|
250
|
+
it { should be_empty }
|
|
251
|
+
end
|
|
252
|
+
|
|
253
|
+
context 'with path/subdir with file' do
|
|
254
|
+
before do
|
|
255
|
+
record.add_dir('path/subdir')
|
|
256
|
+
record.update_file('path/subdir/file.rb', mtime: 1.1)
|
|
257
|
+
end
|
|
258
|
+
it { should be_empty }
|
|
259
|
+
end
|
|
260
|
+
|
|
261
|
+
context 'with path renamed to file' do
|
|
262
|
+
before do
|
|
263
|
+
record.add_dir('path/subdir')
|
|
264
|
+
record.update_file('path', mtime: 1.1)
|
|
265
|
+
end
|
|
266
|
+
it { should be_empty }
|
|
267
|
+
end
|
|
268
|
+
end
|
|
269
|
+
end
|
|
270
|
+
|
|
271
|
+
describe '#build' do
|
|
272
|
+
let(:dir1) { Pathname('/dir1') }
|
|
273
|
+
|
|
274
|
+
before do
|
|
275
|
+
stubs = {
|
|
276
|
+
::File => %w[lstat realpath],
|
|
277
|
+
::Dir => %w[entries exist?]
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
stubs.each do |klass, meths|
|
|
281
|
+
meths.each do |meth|
|
|
282
|
+
allow(klass).to receive(meth.to_sym) do |*args|
|
|
283
|
+
fail "stub called: #{klass}.#{meth}(#{args.map(&:inspect) * ', '})"
|
|
284
|
+
end
|
|
285
|
+
end
|
|
286
|
+
end
|
|
287
|
+
end
|
|
288
|
+
|
|
289
|
+
it 're-inits paths' do
|
|
290
|
+
real_directory('/dir1' => [])
|
|
291
|
+
real_directory('/dir' => [])
|
|
292
|
+
|
|
293
|
+
record.update_file('path/file.rb', mtime: 1.1)
|
|
294
|
+
record.build
|
|
295
|
+
expect(record_tree(record)).to eq({})
|
|
296
|
+
expect(record.file_data('path/file.rb')).to be_empty
|
|
297
|
+
end
|
|
298
|
+
|
|
299
|
+
let(:foo_stat) { instance_double(::File::Stat, mtime: 1.0, mode: 0644, size: 42) }
|
|
300
|
+
let(:bar_stat) { instance_double(::File::Stat, mtime: 2.3, mode: 0755, size: 42) }
|
|
301
|
+
|
|
302
|
+
context 'with no subdirs' do
|
|
303
|
+
before do
|
|
304
|
+
real_directory('/dir' => %w[foo bar])
|
|
305
|
+
lstat(file('/dir/foo'), foo_stat)
|
|
306
|
+
lstat(file('/dir/bar'), bar_stat)
|
|
307
|
+
real_directory('/dir2' => [])
|
|
308
|
+
end
|
|
309
|
+
|
|
310
|
+
it 'builds record' do
|
|
311
|
+
record.build
|
|
312
|
+
expect(record_tree(record)).
|
|
313
|
+
to eq(
|
|
314
|
+
'foo' => { mtime: 1.0, mode: 0644, size: 42 },
|
|
315
|
+
'bar' => { mtime: 2.3, mode: 0755, size: 42 })
|
|
316
|
+
end
|
|
317
|
+
end
|
|
318
|
+
|
|
319
|
+
context 'with subdir containing files' do
|
|
320
|
+
before do
|
|
321
|
+
real_directory('/dir' => %w[dir1 dir2 .ignored])
|
|
322
|
+
real_directory('/dir/dir1' => %w[foo])
|
|
323
|
+
real_directory('/dir/dir1/foo' => %w[bar])
|
|
324
|
+
lstat(file('/dir/.ignored/FETCH_HEAD'))
|
|
325
|
+
lstat(file('/dir/dir1/foo/bar'))
|
|
326
|
+
real_directory('/dir/dir2' => [])
|
|
327
|
+
end
|
|
328
|
+
|
|
329
|
+
it 'builds record, skipping silenced patterns' do
|
|
330
|
+
record.build
|
|
331
|
+
expect(record_tree(record)).
|
|
332
|
+
to eq(
|
|
333
|
+
'dir1' => {},
|
|
334
|
+
'dir1/foo' => { 'bar' => { mtime: 2.3, mode: 0755, size: 42 } },
|
|
335
|
+
'dir2' => {}
|
|
336
|
+
)
|
|
337
|
+
end
|
|
338
|
+
end
|
|
339
|
+
|
|
340
|
+
context 'with subdir containing dirs' do
|
|
341
|
+
before do
|
|
342
|
+
real_directory('/dir' => %w[dir1 dir2 .ignored])
|
|
343
|
+
real_directory('/dir/.ignored' => %w[ignored_file])
|
|
344
|
+
real_directory('/dir/dir1' => %w[foo])
|
|
345
|
+
real_directory('/dir/dir1/foo' => %w[bar baz])
|
|
346
|
+
real_directory('/dir/dir1/foo/bar' => [])
|
|
347
|
+
real_directory('/dir/dir1/foo/baz' => [])
|
|
348
|
+
real_directory('/dir/dir2' => [])
|
|
349
|
+
|
|
350
|
+
allow(::File).to receive(:realpath) { |path| path }
|
|
351
|
+
end
|
|
352
|
+
|
|
353
|
+
it 'builds record' do
|
|
354
|
+
record.build
|
|
355
|
+
expect(record_tree(record)).
|
|
356
|
+
to eq(
|
|
357
|
+
'dir1' => {},
|
|
358
|
+
'dir1/foo' => {},
|
|
359
|
+
'dir1/foo/bar' => {},
|
|
360
|
+
'dir1/foo/baz' => {},
|
|
361
|
+
'dir2' => {}
|
|
362
|
+
)
|
|
363
|
+
end
|
|
364
|
+
end
|
|
365
|
+
|
|
366
|
+
context 'with subdir containing symlink to parent' do
|
|
367
|
+
subject { record.paths }
|
|
368
|
+
before do
|
|
369
|
+
real_directory('/dir' => %w[dir1 dir2])
|
|
370
|
+
real_directory('/dir/dir1' => %w[foo])
|
|
371
|
+
dir_entries_for('/dir/dir1/foo' => %w[dir1])
|
|
372
|
+
symlink('/dir/dir1/foo' => '/dir/dir1')
|
|
373
|
+
|
|
374
|
+
real_directory('/dir/dir2' => [])
|
|
375
|
+
end
|
|
376
|
+
|
|
377
|
+
it 'shows a warning' do
|
|
378
|
+
expect_any_instance_of(Listen::Record::SymlinkDetector).to receive(:warn).
|
|
379
|
+
with(/directory is already being watched/)
|
|
380
|
+
|
|
381
|
+
record.build
|
|
382
|
+
# expect { record.build }.
|
|
383
|
+
# to raise_error(RuntimeError, /Failed due to looped symlinks/)
|
|
384
|
+
end
|
|
385
|
+
end
|
|
386
|
+
|
|
387
|
+
context 'with a normal symlinked directory to another' do
|
|
388
|
+
subject { record.paths }
|
|
389
|
+
|
|
390
|
+
before do
|
|
391
|
+
real_directory('/dir' => %w[dir1])
|
|
392
|
+
real_directory('/dir/dir1' => %w[foo])
|
|
393
|
+
|
|
394
|
+
symlink('/dir/dir1/foo' => '/dir/dir2')
|
|
395
|
+
dir_entries_for('/dir/dir1/foo' => %w[bar])
|
|
396
|
+
lstat(realpath(file('/dir/dir1/foo/bar')))
|
|
397
|
+
|
|
398
|
+
real_directory('/dir/dir2' => %w[bar])
|
|
399
|
+
lstat(file('/dir/dir2/bar'))
|
|
400
|
+
end
|
|
401
|
+
|
|
402
|
+
it 'shows message' do
|
|
403
|
+
expect(STDERR).to_not receive(:puts)
|
|
404
|
+
record.build
|
|
405
|
+
end
|
|
406
|
+
end
|
|
407
|
+
|
|
408
|
+
context 'with subdir containing symlinked file' do
|
|
409
|
+
subject { record.paths }
|
|
410
|
+
before do
|
|
411
|
+
real_directory('/dir' => %w[dir1 dir2])
|
|
412
|
+
real_directory('/dir/dir1' => %w[foo])
|
|
413
|
+
lstat(file('/dir/dir1/foo'))
|
|
414
|
+
real_directory('/dir/dir2' => [])
|
|
415
|
+
end
|
|
416
|
+
|
|
417
|
+
it 'shows a warning' do
|
|
418
|
+
expect(STDERR).to_not receive(:puts)
|
|
419
|
+
|
|
420
|
+
record.build
|
|
421
|
+
end
|
|
422
|
+
end
|
|
423
|
+
end
|
|
424
|
+
end
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'listen/silencer/controller'
|
|
4
|
+
|
|
5
|
+
RSpec.describe Listen::Silencer::Controller do
|
|
6
|
+
let(:silencer) { instance_double(Listen::Silencer) }
|
|
7
|
+
|
|
8
|
+
describe 'append_ignores' do
|
|
9
|
+
context 'with no previous :ignore rules' do
|
|
10
|
+
subject do
|
|
11
|
+
described_class.new(silencer, {})
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
before do
|
|
15
|
+
allow(silencer).to receive(:configure).with({})
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
context 'when providing a nil' do
|
|
19
|
+
it 'sets the given :ignore rules as empty array' do
|
|
20
|
+
subject
|
|
21
|
+
allow(silencer).to receive(:configure).with(ignore: [])
|
|
22
|
+
subject.append_ignores(nil)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
context 'when providing a single regexp as argument' do
|
|
27
|
+
it 'sets the given :ignore rules as array' do
|
|
28
|
+
subject
|
|
29
|
+
allow(silencer).to receive(:configure).with({ ignore: [/foo/] })
|
|
30
|
+
subject.append_ignores(/foo/)
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
context 'when providing multiple arguments' do
|
|
35
|
+
it 'sets the given :ignore rules as a flat array' do
|
|
36
|
+
subject
|
|
37
|
+
allow(silencer).to receive(:configure).with({ ignore: [/foo/, /bar/] })
|
|
38
|
+
subject.append_ignores(/foo/, /bar/)
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
context 'when providing as array' do
|
|
43
|
+
it 'sets the given :ignore rules' do
|
|
44
|
+
subject
|
|
45
|
+
allow(silencer).to receive(:configure).with({ ignore: [/foo/, /bar/] })
|
|
46
|
+
subject.append_ignores([/foo/, /bar/])
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
context 'with previous :ignore rules' do
|
|
52
|
+
subject do
|
|
53
|
+
described_class.new(silencer, { ignore: [/foo/, /bar/] })
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
before do
|
|
57
|
+
allow(silencer).to receive(:configure).with({ ignore: [/foo/, /bar/] })
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
context 'when providing a nil' do
|
|
61
|
+
# TODO: should this invocation maybe reset the rules?
|
|
62
|
+
it 'reconfigures with existing :ignore rules' do
|
|
63
|
+
subject
|
|
64
|
+
allow(silencer).to receive(:configure).with({ ignore: [/foo/, /bar/] })
|
|
65
|
+
subject.append_ignores(nil)
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
context 'when providing a single regexp as argument' do
|
|
70
|
+
it 'appends the given :ignore rules as array' do
|
|
71
|
+
subject
|
|
72
|
+
expected = { ignore: [/foo/, /bar/, /baz/] }
|
|
73
|
+
allow(silencer).to receive(:configure).with(expected)
|
|
74
|
+
subject.append_ignores(/baz/)
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
context 'when providing multiple arguments' do
|
|
79
|
+
it 'appends the given :ignore rules as a flat array' do
|
|
80
|
+
subject
|
|
81
|
+
expected = { ignore: [/foo/, /bar/, /baz/, /bak/] }
|
|
82
|
+
allow(silencer).to receive(:configure).with(expected)
|
|
83
|
+
subject.append_ignores(/baz/, /bak/)
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
context 'when providing as array' do
|
|
88
|
+
it 'appends the given :ignore rules' do
|
|
89
|
+
subject
|
|
90
|
+
expected = { ignore: [/foo/, /bar/, /baz/, /bak/] }
|
|
91
|
+
allow(silencer).to receive(:configure).with(expected)
|
|
92
|
+
subject.append_ignores([/baz/, /bak/])
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
end
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
RSpec::Matchers.define :accept do |type, path|
|
|
4
|
+
match { |actual| !actual.silenced?(Pathname(path), type) }
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
RSpec.describe Listen::Silencer do
|
|
8
|
+
let(:options) { {} }
|
|
9
|
+
subject { described_class.new(**options) }
|
|
10
|
+
|
|
11
|
+
describe '#silenced?' do
|
|
12
|
+
it { should accept(:file, Pathname('some_dir').join("some_file.rb")) }
|
|
13
|
+
|
|
14
|
+
context 'with default ignore' do
|
|
15
|
+
hidden_ignored = %w[.git .svn .hg .rbx .bundle]
|
|
16
|
+
other_ignored = %w[bundle vendor/bundle log tmp vendor/ruby]
|
|
17
|
+
(hidden_ignored + other_ignored).each do |dir|
|
|
18
|
+
it { should_not accept(:dir, dir) }
|
|
19
|
+
it { should accept(:dir, "#{dir}foo") }
|
|
20
|
+
it { should accept(:dir, "foo#{dir}") }
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
ignored = %w[.DS_Store foo.tmp foo~]
|
|
24
|
+
|
|
25
|
+
# Gedit swap files
|
|
26
|
+
ignored += %w[.goutputstream-S3FBGX]
|
|
27
|
+
|
|
28
|
+
# Kate editor swap files
|
|
29
|
+
ignored += %w[foo.rbo54321.new foo.rbB22583.new foo.rb.kate-swp]
|
|
30
|
+
|
|
31
|
+
# Intellij swap files
|
|
32
|
+
ignored += %w[foo.rb___jb_bak___ foo.rb___jb_old___]
|
|
33
|
+
|
|
34
|
+
# Vim swap files
|
|
35
|
+
ignored += %w[foo.swp foo.swx foo.swpx 4913]
|
|
36
|
+
|
|
37
|
+
# Emacs backup/swap files
|
|
38
|
+
ignored += %w[#hello.rb# .#hello.rb]
|
|
39
|
+
|
|
40
|
+
# sed temp files
|
|
41
|
+
ignored += %w[sedq7eVAR sed86w1kB]
|
|
42
|
+
|
|
43
|
+
# mutagen temp files
|
|
44
|
+
ignored += %w[
|
|
45
|
+
.mutagen-temporary-cross-device-rename0
|
|
46
|
+
.mutagen-temporary-unicode-test-éntry0
|
|
47
|
+
]
|
|
48
|
+
|
|
49
|
+
ignored.each do |path|
|
|
50
|
+
it { should_not accept(:file, path) }
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
%w[
|
|
54
|
+
foo.tmpl file.new file54321.new a.swf 14913 49131
|
|
55
|
+
|
|
56
|
+
sed_ABCDE
|
|
57
|
+
sedabcdefg
|
|
58
|
+
.sedq7eVAR
|
|
59
|
+
foo.sedq7eVAR
|
|
60
|
+
sedatives
|
|
61
|
+
sediments
|
|
62
|
+
sedan2014
|
|
63
|
+
|
|
64
|
+
].each do |path|
|
|
65
|
+
it { should accept(:file, path) }
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
context 'when ignoring *.pid' do
|
|
70
|
+
let(:options) { { ignore: /\.pid$/ } }
|
|
71
|
+
it { should_not accept(:file, 'foo.pid') }
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
context 'when ignoring foo/bar* and *.pid' do
|
|
75
|
+
let(:options) { { ignore: [%r{^foo/bar}, /\.pid$/] } }
|
|
76
|
+
it { should_not accept(:file, 'foo/bar/baz') }
|
|
77
|
+
it { should_not accept(:file, 'foo.pid') }
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
context 'when ignoring only *.pid' do
|
|
81
|
+
let(:options) { { ignore!: /\.pid$/ } }
|
|
82
|
+
it { should_not accept(:file, 'foo.pid') }
|
|
83
|
+
it { should accept(:file, '.git') }
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
context 'when accepting only *foo*' do
|
|
87
|
+
let(:options) { { only: /foo/ } }
|
|
88
|
+
it { should accept(:file, 'foo') }
|
|
89
|
+
it { should_not accept(:file, 'bar') }
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
context 'when accepting only foo/* and *.txt' do
|
|
93
|
+
let(:options) { { only: [%r{^foo/}, /\.txt$/] } }
|
|
94
|
+
it { should accept(:file, 'foo/bar.rb') }
|
|
95
|
+
it { should accept(:file, 'bar.txt') }
|
|
96
|
+
it { should_not accept(:file, 'bar/baz.rb') }
|
|
97
|
+
it { should_not accept(:file, 'bar.rb') }
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
context 'when accepting only *.pid' do
|
|
101
|
+
context 'when ignoring bar*' do
|
|
102
|
+
let(:options) { { only: /\.pid$/, ignore: /^bar/ } }
|
|
103
|
+
it { should_not accept(:file, 'foo.rb') }
|
|
104
|
+
it { should_not accept(:file, 'bar.pid') }
|
|
105
|
+
it { should accept(:file, 'foo.pid') }
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
end
|