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,490 @@
|
|
|
1
|
+
# Listen
|
|
2
|
+
|
|
3
|
+
The `listen` gem listens to file modifications and notifies you about the changes.
|
|
4
|
+
|
|
5
|
+
[](https://github.com/guard/listen/actions?workflow=Development)
|
|
6
|
+
[](http://badge.fury.io/rb/listen)
|
|
7
|
+
[](https://codeclimate.com/github/guard/listen)
|
|
8
|
+
[](https://coveralls.io/r/guard/listen)
|
|
9
|
+
|
|
10
|
+
## Features
|
|
11
|
+
|
|
12
|
+
* OS-optimized adapters on MRI for Mac OS X 10.6+, Linux, \*BSD and Windows, [more info](#listen-adapters) below.
|
|
13
|
+
* Detects file modification, addition and removal.
|
|
14
|
+
* You can watch multiple directories.
|
|
15
|
+
* Regexp-patterns for ignoring paths for more accuracy and speed
|
|
16
|
+
* Increased change detection accuracy on OS X HFS and VFAT volumes.
|
|
17
|
+
* Continuous Integration: tested on selected Ruby environments via [Github Workflows](https://github.com/guard/listen/tree/master/.github/workflows).
|
|
18
|
+
|
|
19
|
+
## Issues / limitations
|
|
20
|
+
|
|
21
|
+
* Limited support for symlinked directories ([#279](https://github.com/guard/listen/issues/279)):
|
|
22
|
+
* Symlinks are always followed ([#25](https://github.com/guard/listen/issues/25)).
|
|
23
|
+
* Symlinked directories pointing within a watched directory are not supported ([#273](https://github.com/guard/listen/pull/273).
|
|
24
|
+
* No directory/adapter-specific configuration options.
|
|
25
|
+
* Support for plugins planned for future.
|
|
26
|
+
* TCP functionality was removed in `listen` [3.0.0](https://github.com/guard/listen/releases/tag/v3.0.0) ([#319](https://github.com/guard/listen/issues/319), [#218](https://github.com/guard/listen/issues/218)). There are plans to extract this feature to separate gems ([#258](https://github.com/guard/listen/issues/258)), until this is finished, you can use by locking the `listen` gem to version `'~> 2.10'`.
|
|
27
|
+
* Some filesystems won't work without polling (VM/Vagrant Shared folders, NFS, Samba, sshfs, etc.).
|
|
28
|
+
* Windows and \*BSD adapter aren't continuously and automatically tested.
|
|
29
|
+
* OSX adapter has some performance limitations ([#342](https://github.com/guard/listen/issues/342)).
|
|
30
|
+
* Listeners do not notify across forked processes, if you wish for multiple processes to receive change notifications you must [listen inside of each process](https://github.com/guard/listen/issues/398#issuecomment-223957952).
|
|
31
|
+
|
|
32
|
+
Pull requests or help is very welcome for these.
|
|
33
|
+
|
|
34
|
+
## Install
|
|
35
|
+
|
|
36
|
+
The simplest way to install `listen` is to use [Bundler](http://bundler.io).
|
|
37
|
+
|
|
38
|
+
```ruby
|
|
39
|
+
gem 'listen'
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Complete Example
|
|
43
|
+
Here is a complete example of using the `listen` gem:
|
|
44
|
+
```ruby
|
|
45
|
+
require 'listen'
|
|
46
|
+
|
|
47
|
+
listener = Listen.to('/srv/app') do |modified, added, removed|
|
|
48
|
+
puts(modified: modified, added: added, removed: removed)
|
|
49
|
+
end
|
|
50
|
+
listener.start
|
|
51
|
+
sleep
|
|
52
|
+
```
|
|
53
|
+
Running the above in the background, you can see the callback block being called in response to each command:
|
|
54
|
+
```
|
|
55
|
+
$ cd /srv/app
|
|
56
|
+
$ touch a.txt
|
|
57
|
+
{:modified=>[], :added=>["/srv/app/a.txt"], :removed=>[]}
|
|
58
|
+
|
|
59
|
+
$ echo more >> a.txt
|
|
60
|
+
{:modified=>["/srv/app/a.txt"], :added=>[], :removed=>[]}
|
|
61
|
+
|
|
62
|
+
$ mv a.txt b.txt
|
|
63
|
+
{:modified=>[], :added=>["/srv/app/b.txt"], :removed=>["/srv/app/a.txt"]}
|
|
64
|
+
|
|
65
|
+
$ vi b.txt
|
|
66
|
+
# add a line to this new file and press ZZ to save and exit
|
|
67
|
+
{:modified=>["/srv/app/b.txt"], :added=>[], :removed=>[]}
|
|
68
|
+
|
|
69
|
+
$ vi c.txt
|
|
70
|
+
# add a line and press ZZ to save and exit
|
|
71
|
+
{:modified=>[], :added=>["/srv/app/c.txt"], :removed=>[]}
|
|
72
|
+
|
|
73
|
+
$ rm b.txt c.txt
|
|
74
|
+
{:modified=>[], :added=>[], :removed=>["/srv/app/b.txt", "/srv/app/c.txt"]}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Usage
|
|
78
|
+
|
|
79
|
+
Call `Listen.to` with one or more directories and the "changes" callback passed as a block.
|
|
80
|
+
|
|
81
|
+
``` ruby
|
|
82
|
+
listener = Listen.to('dir/to/listen', 'dir/to/listen2') do |modified, added, removed|
|
|
83
|
+
puts "modified absolute path array: #{modified}"
|
|
84
|
+
puts "added absolute path array: #{added}"
|
|
85
|
+
puts "removed absolute path array: #{removed}"
|
|
86
|
+
end
|
|
87
|
+
listener.start # starts a listener thread--does not block
|
|
88
|
+
|
|
89
|
+
# do whatever you want here...just don't exit the process :)
|
|
90
|
+
|
|
91
|
+
sleep
|
|
92
|
+
```
|
|
93
|
+
## Changes Callback
|
|
94
|
+
|
|
95
|
+
Changes to the listened-to directories are reported by the listener thread in a callback.
|
|
96
|
+
The callback receives **three** array parameters: `modified`, `added` and `removed`, in that order.
|
|
97
|
+
Each of these three is always an array with 0 or more entries.
|
|
98
|
+
Each array entry is an absolute path.
|
|
99
|
+
|
|
100
|
+
### Pause / start / stop
|
|
101
|
+
|
|
102
|
+
Listeners can also be easily paused and later un-paused with start:
|
|
103
|
+
|
|
104
|
+
``` ruby
|
|
105
|
+
listener = Listen.to('dir/path/to/listen') { |modified, added, removed| puts 'handle changes here...' }
|
|
106
|
+
|
|
107
|
+
listener.start
|
|
108
|
+
listener.paused? # => false
|
|
109
|
+
listener.processing? # => true
|
|
110
|
+
|
|
111
|
+
listener.pause # stops processing changes (but keeps on collecting them)
|
|
112
|
+
listener.paused? # => true
|
|
113
|
+
listener.processing? # => false
|
|
114
|
+
|
|
115
|
+
listener.start # resumes processing changes
|
|
116
|
+
listener.stop # stop both listening to changes and processing them
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Note: While paused, `listen` keeps on collecting changes in the background - to clear them, call `stop`.
|
|
120
|
+
|
|
121
|
+
Note: You should keep track of all started listeners and `stop` them properly on finish.
|
|
122
|
+
|
|
123
|
+
### Ignore / ignore!
|
|
124
|
+
|
|
125
|
+
`Listen` ignores some directories and extensions by default (See DEFAULT_IGNORED_FILES and DEFAULT_IGNORED_EXTENSIONS in Listen::Silencer).
|
|
126
|
+
You can add ignoring patterns with the `ignore` option/method or overwrite default with `ignore!` option/method.
|
|
127
|
+
|
|
128
|
+
``` ruby
|
|
129
|
+
listener = Listen.to('dir/path/to/listen', ignore: /\.txt/) { |modified, added, removed| # ... }
|
|
130
|
+
listener.start
|
|
131
|
+
listener.ignore! /\.pkg/ # overwrite all patterns and only ignore pkg extension.
|
|
132
|
+
listener.ignore /\.rb/ # ignore rb extension in addition of pkg.
|
|
133
|
+
sleep
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Note: `:ignore` regexp patterns are evaluated against relative paths.
|
|
137
|
+
|
|
138
|
+
Note: Ignoring paths does not improve performance, except when Polling ([#274](https://github.com/guard/listen/issues/274)).
|
|
139
|
+
|
|
140
|
+
### Only
|
|
141
|
+
|
|
142
|
+
`Listen` watches all files (less the ignored ones) by default. If you want to only listen to a specific type of file (i.e., just `.rb` extension), you should use the `only` option/method.
|
|
143
|
+
|
|
144
|
+
``` ruby
|
|
145
|
+
listener = Listen.to('dir/path/to/listen', only: /\.rb$/) { |modified, added, removed| # ... }
|
|
146
|
+
listener.start
|
|
147
|
+
listener.only /_spec\.rb$/ # overwrite all existing only patterns.
|
|
148
|
+
sleep
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Note: `:only` regexp patterns are evaluated only against relative **file** paths.
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
## Options
|
|
155
|
+
|
|
156
|
+
All the following options can be set through the `Listen.to` after the directory path(s) params.
|
|
157
|
+
|
|
158
|
+
``` ruby
|
|
159
|
+
ignore: [%r{/foo/bar}, /\.pid$/, /\.coffee$/] # Ignore a list of paths
|
|
160
|
+
# default: See DEFAULT_IGNORED_FILES and DEFAULT_IGNORED_EXTENSIONS in Listen::Silencer
|
|
161
|
+
|
|
162
|
+
ignore!: %r{/foo/bar} # Same as ignore options, but overwrite default ignored paths.
|
|
163
|
+
|
|
164
|
+
only: %r{.rb$} # Only listen to specific files
|
|
165
|
+
# default: none
|
|
166
|
+
|
|
167
|
+
latency: 0.5 # Set the delay (**in seconds**) between checking for changes
|
|
168
|
+
# default: 0.25 sec (1.0 sec for polling)
|
|
169
|
+
|
|
170
|
+
wait_for_delay: 4 # Set the delay (**in seconds**) between calls to the callback when changes exist
|
|
171
|
+
# default: 0.10 sec
|
|
172
|
+
|
|
173
|
+
force_polling: true # Force the use of the polling adapter
|
|
174
|
+
# default: none
|
|
175
|
+
|
|
176
|
+
relative: false # Whether changes should be relative to current dir or not
|
|
177
|
+
# default: false
|
|
178
|
+
|
|
179
|
+
polling_fallback_message: 'custom message' # Set a custom polling fallback message (or disable it with false)
|
|
180
|
+
# default: "Listen will be polling for changes. Learn more at https://github.com/guard/listen#listen-adapters."
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## Logging and Debugging
|
|
184
|
+
|
|
185
|
+
`Listen` logs its activity to `Listen.logger`.
|
|
186
|
+
This is the primary method of debugging.
|
|
187
|
+
|
|
188
|
+
### Custom Logger
|
|
189
|
+
You can call `Listen.logger =` to set a custom `listen` logger for the process. For example:
|
|
190
|
+
``` ruby
|
|
191
|
+
Listen.logger = Rails.logger
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### Default Logger
|
|
195
|
+
If no custom logger is set, a default `listen` logger which logs to to `STDERR` will be created and assigned to `Listen.logger`.
|
|
196
|
+
|
|
197
|
+
The default logger defaults to the `error` logging level (severity).
|
|
198
|
+
You can override the logging level by setting the environment variable `LISTEN_GEM_DEBUGGING=<level>`.
|
|
199
|
+
For `<level>`, all standard `::Logger` levels are supported, with any mix of upper-/lower-case:
|
|
200
|
+
``` ruby
|
|
201
|
+
export LISTEN_GEM_DEBUGGING=debug # or 2 [deprecated]
|
|
202
|
+
export LISTEN_GEM_DEBUGGING=info # or 1 or true or yes [deprecated]
|
|
203
|
+
export LISTEN_GEM_DEBUGGING=warn
|
|
204
|
+
export LISTEN_GEM_DEBUGGING=fatal
|
|
205
|
+
export LISTEN_GEM_DEBUGGING=error
|
|
206
|
+
```
|
|
207
|
+
The default of `error` will be used if an unsupported value is set.
|
|
208
|
+
|
|
209
|
+
Note: The alternate values `1`, `2`, `true` and `yes` shown above are deprecated and will be removed from `listen` v4.0.
|
|
210
|
+
|
|
211
|
+
### Disabling Logging
|
|
212
|
+
If you want to disable `listen` logging, set
|
|
213
|
+
``` ruby
|
|
214
|
+
Listen.logger = ::Logger.new('/dev/null')
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### Adapter Warnings
|
|
218
|
+
If listen is having trouble with the underlying adapter, it will display warnings with `Kernel#warn` by default,
|
|
219
|
+
which in turn writes to STDERR.
|
|
220
|
+
Sometimes this is not desirable, for example in an environment where STDERR is ignored.
|
|
221
|
+
For these reasons, the behavior can be configured using `Listen.adapter_warn_behavior =`:
|
|
222
|
+
``` ruby
|
|
223
|
+
Listen.adapter_warn_behavior = :warn # default (true means the same)
|
|
224
|
+
Listen.adapter_warn_behavior = :log # send to logger.warn
|
|
225
|
+
Listen.adapter_warn_behavior = :silent # suppress all adapter warnings (nil or false mean the same)
|
|
226
|
+
```
|
|
227
|
+
Also there are some cases where specific warnings are not helpful.
|
|
228
|
+
For example, if you are using the polling adapter--and expect to--you can suppress the warning about it
|
|
229
|
+
by providing a callable object like a lambda or proc that determines the behavior based on the `message`:
|
|
230
|
+
``` ruby
|
|
231
|
+
Listen.adapter_warn_behavior = ->(message) do
|
|
232
|
+
case message
|
|
233
|
+
when /Listen will be polling for changes/
|
|
234
|
+
:silent
|
|
235
|
+
when /directory is already being watched/
|
|
236
|
+
:log
|
|
237
|
+
else
|
|
238
|
+
:warn
|
|
239
|
+
end
|
|
240
|
+
end
|
|
241
|
+
```
|
|
242
|
+
In cases where the `Listen` gem is embedded inside another service--such as `guard`--the above configuration
|
|
243
|
+
can be set in the environment variable `LISTEN_GEM_ADAPTER_WARN_BEHAVIOR=warn|log|silent`.
|
|
244
|
+
|
|
245
|
+
## Listen Adapters
|
|
246
|
+
|
|
247
|
+
The `Listen` gem has a set of adapters to notify it when there are changes.
|
|
248
|
+
|
|
249
|
+
There are 4 OS-specific adapters to support Darwin, Linux, \*BSD and Windows.
|
|
250
|
+
These adapters are fast as they use some system-calls to implement the notifying function.
|
|
251
|
+
|
|
252
|
+
There is also a polling adapter - although it's much slower than other adapters,
|
|
253
|
+
it works on every platform/system and scenario (including network filesystems such as VM shared folders).
|
|
254
|
+
|
|
255
|
+
The Darwin and Linux adapters are dependencies of the `listen` gem so they work out of the box. For other adapters a specific gem will have to be added to your Gemfile, please read below.
|
|
256
|
+
|
|
257
|
+
The `listen` gem will choose the best adapter automatically, if present. If you
|
|
258
|
+
want to force the use of the polling adapter, use the `:force_polling` option
|
|
259
|
+
while initializing the listener.
|
|
260
|
+
|
|
261
|
+
### On Windows
|
|
262
|
+
|
|
263
|
+
If you are on Windows, it's recommended to use the [`wdm`](https://github.com/Maher4Ever/wdm) adapter instead of polling.
|
|
264
|
+
|
|
265
|
+
Please add the following to your Gemfile:
|
|
266
|
+
|
|
267
|
+
```ruby
|
|
268
|
+
gem 'wdm', '>= 0.1.0'
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
### On \*BSD
|
|
272
|
+
|
|
273
|
+
If you are on \*BSD you can try to use the [`rb-kqueue`](https://github.com/mat813/rb-kqueue) adapter instead of polling.
|
|
274
|
+
|
|
275
|
+
Please add the following to your Gemfile:
|
|
276
|
+
|
|
277
|
+
```ruby
|
|
278
|
+
gem 'rb-kqueue', '>= 0.2'
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
### Getting the [polling fallback message](#options)?
|
|
282
|
+
|
|
283
|
+
If you see:
|
|
284
|
+
```
|
|
285
|
+
Listen will be polling for changes.
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
This means the Listen gem can’t find an optimized adapter. Typically this is caused by:
|
|
289
|
+
|
|
290
|
+
- You’re on Windows and WDM gem isn’t installed.
|
|
291
|
+
- You’re running the app without Bundler or RubyGems.
|
|
292
|
+
- Using Sass which includes an ancient (the “dinosaur” type of ancient) version of the Listen gem.
|
|
293
|
+
|
|
294
|
+
Possible solutions:
|
|
295
|
+
|
|
296
|
+
1. Suppress the message by using the :force_polling option. Or, you could just ignore the message since it’s harmless.
|
|
297
|
+
2. Windows users: Install the WDM gem.
|
|
298
|
+
3. Upgrade Ruby (use RubyInstaller for Windows or RVM/rbenv for Mac) and RubyGems.
|
|
299
|
+
3. Run your apps using Bundler.
|
|
300
|
+
4. Sass users: Install the latest version of Listen and try again.
|
|
301
|
+
|
|
302
|
+
#### Simplified Bundler and Sass example
|
|
303
|
+
Create a Gemfile with these lines:
|
|
304
|
+
```
|
|
305
|
+
source 'https://rubygems.org'
|
|
306
|
+
gem 'listen'
|
|
307
|
+
gem 'sass'
|
|
308
|
+
```
|
|
309
|
+
Next, use Bundler to update gems:
|
|
310
|
+
```
|
|
311
|
+
$ bundle update
|
|
312
|
+
$ bundle exec sass --watch # ... or whatever app is using Listen.
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
### Increasing the amount of inotify watchers
|
|
316
|
+
|
|
317
|
+
If you are running Debian, RedHat, or another similar Linux distribution, run the following in a terminal:
|
|
318
|
+
```
|
|
319
|
+
$ sudo sh -c "echo fs.inotify.max_user_watches=524288 >> /etc/sysctl.conf"
|
|
320
|
+
$ sudo sysctl -p
|
|
321
|
+
```
|
|
322
|
+
If you are running ArchLinux, search the `/etc/sysctl.d/` directory for config files with the setting:
|
|
323
|
+
```
|
|
324
|
+
$ grep -H -s "fs.inotify.max_user_watches" /etc/sysctl.d/*
|
|
325
|
+
/etc/sysctl.d/40-max_user_watches.conf:fs.inotify.max_user_watches=100000
|
|
326
|
+
```
|
|
327
|
+
Then change the setting in the file you found above to a higher value (see [here](https://www.archlinux.org/news/deprecation-of-etcsysctlconf/) for why):
|
|
328
|
+
```
|
|
329
|
+
$ sudo sh -c "echo fs.inotify.max_user_watches=524288 > /etc/sysctl.d/40-max-user-watches.conf"
|
|
330
|
+
$ sudo sysctl --system
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
#### The technical details
|
|
334
|
+
Listen uses `inotify` by default on Linux to monitor directories for changes.
|
|
335
|
+
It's not uncommon to encounter a system limit on the number of files you can monitor.
|
|
336
|
+
For example, Ubuntu Lucid's (64bit) `inotify` limit is set to 8192.
|
|
337
|
+
|
|
338
|
+
You can get your current inotify file watch limit by executing:
|
|
339
|
+
```
|
|
340
|
+
$ cat /proc/sys/fs/inotify/max_user_watches
|
|
341
|
+
```
|
|
342
|
+
When this limit is not enough to monitor all files inside a directory, the limit must be increased for Listen to work properly.
|
|
343
|
+
|
|
344
|
+
You can set a new limit temporarily with:
|
|
345
|
+
```
|
|
346
|
+
$ sudo sysctl fs.inotify.max_user_watches=524288
|
|
347
|
+
$ sudo sysctl -p
|
|
348
|
+
```
|
|
349
|
+
If you like to make your limit permanent, use:
|
|
350
|
+
```
|
|
351
|
+
$ sudo sh -c "echo fs.inotify.max_user_watches=524288 >> /etc/sysctl.conf"
|
|
352
|
+
$ sudo sysctl -p
|
|
353
|
+
```
|
|
354
|
+
You may also need to pay attention to the values of `max_queued_events` and `max_user_instances` if Listen keeps on complaining.
|
|
355
|
+
|
|
356
|
+
While 524,288 is the maximum number of files that can be watched. Each file watch [takes up 1,080 bytes](https://stackoverflow.com/a/7091897/1156119) on a 64-bit system, so assuming that all 524,288 watches are consumed, that allocates around 540 MiB.
|
|
357
|
+
If you're in an environment that is particularly memory-constrained, consider to specify a lower number.
|
|
358
|
+
|
|
359
|
+
#### More info
|
|
360
|
+
Man page for [inotify(7)](https://linux.die.net/man/7/inotify).
|
|
361
|
+
Blog post: [limit of inotify](https://blog.sorah.jp/2012/01/24/inotify-limitation).
|
|
362
|
+
|
|
363
|
+
### Issues and Troubleshooting
|
|
364
|
+
|
|
365
|
+
If the gem doesn't work as expected, start by setting `LISTEN_GEM_DEBUGGING=debug` or `LISTEN_GEM_DEBUGGING=info` as described above in [Logging and Debugging](#logging-and-debugging).
|
|
366
|
+
|
|
367
|
+
*NOTE: without providing the output after setting the `LISTEN_GEM_DEBUGGING=debug` environment variable, it is usually impossible to guess why `listen` is not working as expected.*
|
|
368
|
+
|
|
369
|
+
#### 3 steps before you start diagnosing problems
|
|
370
|
+
These 3 steps will:
|
|
371
|
+
|
|
372
|
+
- help quickly troubleshoot obscure problems (trust me, most of them are obscure)
|
|
373
|
+
- help quickly identify the area of the problem (a full list is below)
|
|
374
|
+
- help you get familiar with listen's diagnostic mode (it really comes in handy, trust me)
|
|
375
|
+
- help you create relevant output before you submit an issue (so we can respond with answers instead of tons of questions)
|
|
376
|
+
|
|
377
|
+
Step 1 - The most important option in Listen
|
|
378
|
+
For effective troubleshooting set the `LISTEN_GEM_DEBUGGING=info` variable before starting `listen`.
|
|
379
|
+
|
|
380
|
+
Step 2 - Verify polling works
|
|
381
|
+
Polling has to work ... or something is really wrong (and we need to know that before anything else).
|
|
382
|
+
|
|
383
|
+
(see force_polling option).
|
|
384
|
+
|
|
385
|
+
After starting `listen`, you should see something like:
|
|
386
|
+
```
|
|
387
|
+
INFO -- : Record.build(): 0.06773114204406738 seconds
|
|
388
|
+
```
|
|
389
|
+
Step 3 - Trigger some changes directly without using editors or apps
|
|
390
|
+
Make changes e.g. touch foo or echo "a" >> foo (for troubleshooting, avoid using an editor which could generate too many misleading events).
|
|
391
|
+
|
|
392
|
+
You should see something like:
|
|
393
|
+
```
|
|
394
|
+
INFO -- : listen: raw changes: [[:added, "/home/me/foo"]]
|
|
395
|
+
INFO -- : listen: final changes: {:modified=>[], :added=>["/home/me/foo"], :removed=>[]}
|
|
396
|
+
```
|
|
397
|
+
"raw changes" contains changes collected during the :wait_for_delay and :latency intervals, while "final changes" is what listen decided are relevant changes (for better editor support).
|
|
398
|
+
|
|
399
|
+
## Performance
|
|
400
|
+
|
|
401
|
+
If `listen` seems slow or unresponsive, make sure you're not using the Polling adapter (you should see a warning upon startup if you are).
|
|
402
|
+
|
|
403
|
+
Also, if the directories you're watching contain many files, make sure you're:
|
|
404
|
+
|
|
405
|
+
* not using Polling (ideally)
|
|
406
|
+
* using `:ignore` and `:only` options to avoid tracking directories you don't care about (important with Polling and on MacOS)
|
|
407
|
+
* running `listen` with the `:latency` and `:wait_for_delay` options not too small or too big (depends on needs)
|
|
408
|
+
* not watching directories with log files, database files or other frequently changing files
|
|
409
|
+
* not using a version of `listen` prior to 2.7.7
|
|
410
|
+
* not getting silent crashes within `listen` (see `LISTEN_GEM_DEBUGGING=debug`)
|
|
411
|
+
* not running multiple instances of `listen` in the background
|
|
412
|
+
* using a file system with atime modification disabled (ideally)
|
|
413
|
+
* not using a filesystem with inaccurate file modification times (ideally), e.g. HFS, VFAT
|
|
414
|
+
* not buffering to a slow terminal (e.g. transparency + fancy font + slow gfx card + lots of output)
|
|
415
|
+
* ideally not running a slow encryption stack, e.g. btrfs + ecryptfs
|
|
416
|
+
|
|
417
|
+
When in doubt, `LISTEN_GEM_DEBUGGING=debug` can help discover the actual events and time they happened.
|
|
418
|
+
|
|
419
|
+
## Tips and Techniques
|
|
420
|
+
- Watch only directories you're interested in.
|
|
421
|
+
- Set your editor to save quickly (e.g. without backup files, without atomic-save)
|
|
422
|
+
- Tweak the `:latency` and `:wait_for_delay` options until you get good results (see [options](#options)).
|
|
423
|
+
- Add `:ignore` rules to silence all events you don't care about (reduces a lot of noise, especially if you use it on directories)
|
|
424
|
+
|
|
425
|
+
## Development
|
|
426
|
+
|
|
427
|
+
* Documentation hosted at [RubyDoc](http://rubydoc.info/github/guard/listen/master/frames).
|
|
428
|
+
* Source hosted at [GitHub](https://github.com/guard/listen).
|
|
429
|
+
|
|
430
|
+
Pull requests are very welcome! Please try to follow these simple rules if applicable:
|
|
431
|
+
|
|
432
|
+
* Please create a topic branch for every separate change you make.
|
|
433
|
+
* Make sure your patches are well tested. All specs must pass on [CI](https://github.com/guard/listen/actions?workflow=Development).
|
|
434
|
+
* Update the [Yard](http://yardoc.org/) documentation.
|
|
435
|
+
* Update the [README](https://github.com/guard/listen/blob/master/README.md).
|
|
436
|
+
* Please **do not change** the version number.
|
|
437
|
+
|
|
438
|
+
For questions please join us in our [Google group](http://groups.google.com/group/guard-dev) or on
|
|
439
|
+
`#guard` (irc.freenode.net).
|
|
440
|
+
|
|
441
|
+
## Releasing
|
|
442
|
+
|
|
443
|
+
### Prerequisites
|
|
444
|
+
|
|
445
|
+
* You must have commit rights to the GitHub repository.
|
|
446
|
+
* You must have push rights for rubygems.org.
|
|
447
|
+
|
|
448
|
+
### How to release
|
|
449
|
+
|
|
450
|
+
1. Run `bundle install` to make sure that you have all the gems necessary for testing and releasing.
|
|
451
|
+
2. **Ensure all tests are passing by running `bundle exec rake`.**
|
|
452
|
+
3. Determine which would be the correct next version number according to [semver](http://semver.org/).
|
|
453
|
+
4. Update the version in `./lib/listen/version.rb`.
|
|
454
|
+
5. Update the version in the Install section of `./README.md` (`gem 'listen', '~> X.Y'`).
|
|
455
|
+
6. Commit the version in a single commit, the message should be "Preparing vX.Y.Z"
|
|
456
|
+
7. Run `bundle exec rake release:full`; this will tag, push to GitHub, and publish to rubygems.org.
|
|
457
|
+
8. Update and publish the release notes on the [GitHub releases page](https://github.com/guard/listen/releases) if necessary
|
|
458
|
+
|
|
459
|
+
## Acknowledgments
|
|
460
|
+
|
|
461
|
+
* [Michael Kessler (netzpirat)][] for having written the [initial specs](https://github.com/guard/listen/commit/1e457b13b1bb8a25d2240428ce5ed488bafbed1f).
|
|
462
|
+
* [Travis Tilley (ttilley)][] for this awesome work on [fssm][] & [rb-fsevent][].
|
|
463
|
+
* [Natalie Weizenbaum (nex3)][] for [rb-inotify][], a thorough inotify wrapper.
|
|
464
|
+
* [Mathieu Arnold (mat813)][] for [rb-kqueue][], a simple kqueue wrapper.
|
|
465
|
+
* [Maher Sallam][] for [wdm][], windows support wouldn't exist without him.
|
|
466
|
+
* [Yehuda Katz (wycats)][] for [vigilo][], that has been a great source of inspiration.
|
|
467
|
+
|
|
468
|
+
## Author
|
|
469
|
+
|
|
470
|
+
[Thibaud Guillaume-Gentil](https://github.com/thibaudgg) ([@thibaudgg](https://twitter.com/thibaudgg))
|
|
471
|
+
|
|
472
|
+
## Contributors
|
|
473
|
+
|
|
474
|
+
[https://github.com/guard/listen/graphs/contributors](https://github.com/guard/listen/graphs/contributors)
|
|
475
|
+
|
|
476
|
+
[Thibaud Guillaume-Gentil (thibaudgg)]: https://github.com/thibaudgg
|
|
477
|
+
[Maher Sallam]: https://github.com/Maher4Ever
|
|
478
|
+
[Michael Kessler (netzpirat)]: https://github.com/netzpirat
|
|
479
|
+
[Travis Tilley (ttilley)]: https://github.com/ttilley
|
|
480
|
+
[fssm]: https://github.com/ttilley/fssm
|
|
481
|
+
[rb-fsevent]: https://github.com/thibaudgg/rb-fsevent
|
|
482
|
+
[Mathieu Arnold (mat813)]: https://github.com/mat813
|
|
483
|
+
[Natalie Weizenbaum (nex3)]: https://github.com/nex3
|
|
484
|
+
[rb-inotify]: https://github.com/nex3/rb-inotify
|
|
485
|
+
[stereobooster]: https://github.com/stereobooster
|
|
486
|
+
[rb-fchange]: https://github.com/stereobooster/rb-fchange
|
|
487
|
+
[rb-kqueue]: https://github.com/mat813/rb-kqueue
|
|
488
|
+
[Yehuda Katz (wycats)]: https://github.com/wycats
|
|
489
|
+
[vigilo]: https://github.com/wycats/vigilo
|
|
490
|
+
[wdm]: https://github.com/Maher4Ever/wdm
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'bundler/gem_tasks'
|
|
4
|
+
require 'rspec/core/rake_task'
|
|
5
|
+
|
|
6
|
+
RSpec::Core::RakeTask.new(:spec)
|
|
7
|
+
|
|
8
|
+
require "rubocop/rake_task"
|
|
9
|
+
RuboCop::RakeTask.new(:rubocop)
|
|
10
|
+
task default: [:spec, :rubocop]
|
|
11
|
+
|
|
12
|
+
class Releaser
|
|
13
|
+
def initialize(options = {})
|
|
14
|
+
@project_name = options.delete(:project_name) do
|
|
15
|
+
fail "project_name is needed!"
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
@gem_name = options.delete(:gem_name) do
|
|
19
|
+
fail "gem_name is needed!"
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
@github_repo = options.delete(:github_repo) do
|
|
23
|
+
fail "github_repo is needed!"
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
@version = options.delete(:version) do
|
|
27
|
+
fail "version is needed!"
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def full
|
|
32
|
+
rubygems
|
|
33
|
+
github
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def rubygems
|
|
37
|
+
begin
|
|
38
|
+
STDOUT.puts "Release #{@project_name} #{@version} to RubyGems? (y/n)"
|
|
39
|
+
input = STDIN.gets.chomp.downcase
|
|
40
|
+
end while !%w(y n).include?(input)
|
|
41
|
+
|
|
42
|
+
exit if input == "n"
|
|
43
|
+
|
|
44
|
+
Rake::Task["release"].invoke
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def github
|
|
48
|
+
tag_name = "v#{@version}"
|
|
49
|
+
|
|
50
|
+
require "gems"
|
|
51
|
+
|
|
52
|
+
_verify_released
|
|
53
|
+
_verify_tag_pushed
|
|
54
|
+
|
|
55
|
+
require "octokit"
|
|
56
|
+
gh_client = Octokit::Client.new(netrc: true)
|
|
57
|
+
|
|
58
|
+
gh_release = _detect_gh_release(gh_client, tag_name, true)
|
|
59
|
+
return unless gh_release
|
|
60
|
+
|
|
61
|
+
STDOUT.puts "Draft release for #{tag_name}:\n"
|
|
62
|
+
STDOUT.puts gh_release.body
|
|
63
|
+
STDOUT.puts "\n-------------------------\n\n"
|
|
64
|
+
|
|
65
|
+
_confirm_publish
|
|
66
|
+
|
|
67
|
+
return unless _update_release(gh_client, gh_release, tag_name)
|
|
68
|
+
|
|
69
|
+
gh_release = _detect_gh_release(gh_client, tag_name, false)
|
|
70
|
+
|
|
71
|
+
_success_summary(gh_release, tag_name)
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
private
|
|
75
|
+
|
|
76
|
+
def _verify_released
|
|
77
|
+
latest = Gems.info(@gem_name)["version"]
|
|
78
|
+
return if @version == latest
|
|
79
|
+
STDOUT.puts format(
|
|
80
|
+
"%s %s is not yet released (latest: %s)",
|
|
81
|
+
@project_name,
|
|
82
|
+
@version,
|
|
83
|
+
latest.inspect
|
|
84
|
+
)
|
|
85
|
+
STDOUT.puts "Please release it first with: rake release:gem"
|
|
86
|
+
exit
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def _verify_tag_pushed
|
|
90
|
+
tags = `git ls-remote --tags origin`.split("\n")
|
|
91
|
+
return if tags.detect { |tag| tag =~ /v#{@version}$/ }
|
|
92
|
+
|
|
93
|
+
STDOUT.puts "The tag v#{@version} has not yet been pushed."
|
|
94
|
+
STDOUT.puts "Please push it first with: rake release:gem"
|
|
95
|
+
exit
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def _success_summary(gh_release, tag_name)
|
|
99
|
+
href = gh_release.rels[:html].href
|
|
100
|
+
STDOUT.puts "GitHub release #{tag_name} has been published!"
|
|
101
|
+
STDOUT.puts "\nPlease enjoy and spread the word!"
|
|
102
|
+
STDOUT.puts "Lack of inspiration? Here's a tweet you could improve:\n\n"
|
|
103
|
+
STDOUT.puts "Just released #{@project_name} #{@version}! #{href}"
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
def _detect_gh_release(gh_client, tag_name, draft)
|
|
107
|
+
gh_releases = gh_client.releases(@github_repo)
|
|
108
|
+
gh_releases.detect { |r| r.tag_name == tag_name && r.draft == draft }
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
def _confirm_publish
|
|
112
|
+
begin
|
|
113
|
+
STDOUT.puts "Would you like to publish this GitHub release now? (y/n)"
|
|
114
|
+
input = STDIN.gets.chomp.downcase
|
|
115
|
+
end while !%w(y n).include?(input)
|
|
116
|
+
|
|
117
|
+
exit if input == "n"
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
def _update_release(gh_client, gh_release, tag_name)
|
|
121
|
+
result = gh_client.update_release(gh_release.rels[:self].href, draft: false)
|
|
122
|
+
return true if result
|
|
123
|
+
STDOUT.puts "GitHub release #{tag_name} couldn't be published!"
|
|
124
|
+
false
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
PROJECT_NAME = "Listen"
|
|
129
|
+
CURRENT_VERSION = Listen::VERSION
|
|
130
|
+
|
|
131
|
+
def releaser
|
|
132
|
+
$releaser ||= Releaser.new(
|
|
133
|
+
project_name: PROJECT_NAME,
|
|
134
|
+
gem_name: "listen",
|
|
135
|
+
github_repo: "guard/listen",
|
|
136
|
+
version: CURRENT_VERSION)
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
namespace :release do
|
|
140
|
+
desc "Push #{PROJECT_NAME} #{CURRENT_VERSION} to RubyGems and publish"\
|
|
141
|
+
" its GitHub release"
|
|
142
|
+
|
|
143
|
+
task full: ["release:gem", "release:github"]
|
|
144
|
+
|
|
145
|
+
desc "Push #{PROJECT_NAME} #{CURRENT_VERSION} to RubyGems"
|
|
146
|
+
task :gem do
|
|
147
|
+
releaser.rubygems
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
desc "Publish #{PROJECT_NAME} #{CURRENT_VERSION} GitHub release"
|
|
151
|
+
task :github do
|
|
152
|
+
releaser.github
|
|
153
|
+
end
|
|
154
|
+
end
|