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,381 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
# typed: true
|
|
3
|
+
# frozen_string_literal: true
|
|
4
|
+
|
|
5
|
+
require 'cli/ui'
|
|
6
|
+
begin
|
|
7
|
+
require 'reline' # For 2.7+
|
|
8
|
+
rescue LoadError
|
|
9
|
+
require 'readline' # For 2.6
|
|
10
|
+
Object.const_set(:Reline, Readline)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
module CLI
|
|
14
|
+
module UI
|
|
15
|
+
module Prompt
|
|
16
|
+
autoload :InteractiveOptions, 'cli/ui/prompt/interactive_options'
|
|
17
|
+
autoload :OptionsHandler, 'cli/ui/prompt/options_handler'
|
|
18
|
+
|
|
19
|
+
class << self
|
|
20
|
+
#: -> Color
|
|
21
|
+
def instructions_color
|
|
22
|
+
@instructions_color ||= Color::YELLOW
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# Set the instructions color.
|
|
26
|
+
#
|
|
27
|
+
# ==== Attributes
|
|
28
|
+
#
|
|
29
|
+
# * +color+ - the color to use for prompt instructions
|
|
30
|
+
#
|
|
31
|
+
#: (colorable color) -> void
|
|
32
|
+
def instructions_color=(color)
|
|
33
|
+
@instructions_color = CLI::UI.resolve_color(color)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# Ask a user a question with either free form answer or a set of answers (multiple choice)
|
|
37
|
+
# Can use arrows, y/n, numbers (1/2), and vim bindings to control multiple choice selection
|
|
38
|
+
# Do not use this method for yes/no questions. Use +confirm+
|
|
39
|
+
#
|
|
40
|
+
# * Handles free form answers (options are nil)
|
|
41
|
+
# * Handles default answers for free form text
|
|
42
|
+
# * Handles file auto completion for file input
|
|
43
|
+
# * Handles interactively choosing answers using +InteractiveOptions+
|
|
44
|
+
#
|
|
45
|
+
# https://user-images.githubusercontent.com/3074765/33799822-47f23302-dd01-11e7-82f3-9072a5a5f611.png
|
|
46
|
+
#
|
|
47
|
+
# ==== Attributes
|
|
48
|
+
#
|
|
49
|
+
# * +question+ - (required) The question to ask the user
|
|
50
|
+
#
|
|
51
|
+
# ==== Options
|
|
52
|
+
#
|
|
53
|
+
# * +:options+ - Options that the user may select from. Will use +InteractiveOptions+ to do so.
|
|
54
|
+
# * +:default+ - The default answer to the question (e.g. they just press enter and don't input anything)
|
|
55
|
+
# * +:is_file+ - Tells the input to use file auto-completion (tab completion)
|
|
56
|
+
# * +:allow_empty+ - Allows the answer to be empty
|
|
57
|
+
# * +:multiple+ - Allow multiple options to be selected
|
|
58
|
+
# * +:filter_ui+ - Enable option filtering (default: true)
|
|
59
|
+
# * +:select_ui+ - Enable long-form option selection (default: true)
|
|
60
|
+
#
|
|
61
|
+
# Note:
|
|
62
|
+
# * +:options+ or providing a +Block+ conflicts with +:default+ and +:is_file+,
|
|
63
|
+
# you cannot set options with either of these keywords
|
|
64
|
+
# * +:default+ conflicts with +:allow_empty:, you cannot set these together
|
|
65
|
+
# * +:options+ conflicts with providing a +Block+ , you may only set one
|
|
66
|
+
# * +:multiple+ can only be used with +:options+ or a +Block+; it is ignored, otherwise.
|
|
67
|
+
#
|
|
68
|
+
# ==== Block (optional)
|
|
69
|
+
#
|
|
70
|
+
# * A Proc that provides a +OptionsHandler+ and uses the public +:option+ method to add options and their
|
|
71
|
+
# respective handlers
|
|
72
|
+
#
|
|
73
|
+
# ==== Return Value
|
|
74
|
+
#
|
|
75
|
+
# * If a +Block+ was not provided, the selected option or response to the free form question will be returned
|
|
76
|
+
# * If a +Block+ was provided, the evaluated value of the +Block+ will be returned
|
|
77
|
+
#
|
|
78
|
+
# ==== Example Usage:
|
|
79
|
+
#
|
|
80
|
+
# Free form question
|
|
81
|
+
# CLI::UI::Prompt.ask('What color is the sky?')
|
|
82
|
+
#
|
|
83
|
+
# Free form question with a file answer
|
|
84
|
+
# CLI::UI::Prompt.ask('Where is your Gemfile located?', is_file: true)
|
|
85
|
+
#
|
|
86
|
+
# Free form question with a default answer
|
|
87
|
+
# CLI::UI::Prompt.ask('What color is the sky?', default: 'blue')
|
|
88
|
+
#
|
|
89
|
+
# Free form question when the answer can be empty
|
|
90
|
+
# CLI::UI::Prompt.ask('What is your opinion on this question?', allow_empty: true)
|
|
91
|
+
#
|
|
92
|
+
# Interactive (multiple choice) question
|
|
93
|
+
# CLI::UI::Prompt.ask('What kind of project is this?', options: %w(rails go ruby python))
|
|
94
|
+
#
|
|
95
|
+
# Interactive (multiple choice) question with defined handlers
|
|
96
|
+
# CLI::UI::Prompt.ask('What kind of project is this?') do |handler|
|
|
97
|
+
# handler.option('rails') { |selection| selection }
|
|
98
|
+
# handler.option('go') { |selection| selection }
|
|
99
|
+
# handler.option('ruby') { |selection| selection }
|
|
100
|
+
# handler.option('python') { |selection| selection }
|
|
101
|
+
# end
|
|
102
|
+
#
|
|
103
|
+
#: (String question, ?options: Array[String]?, ?default: (String | Array[String])?, ?is_file: bool, ?allow_empty: bool, ?multiple: bool, ?filter_ui: bool, ?select_ui: bool) ?{ (OptionsHandler handler) -> void } -> (String | Array[String])
|
|
104
|
+
def ask(
|
|
105
|
+
question,
|
|
106
|
+
options: nil,
|
|
107
|
+
default: nil,
|
|
108
|
+
is_file: false,
|
|
109
|
+
allow_empty: true,
|
|
110
|
+
multiple: false,
|
|
111
|
+
filter_ui: true,
|
|
112
|
+
select_ui: true,
|
|
113
|
+
&options_proc
|
|
114
|
+
)
|
|
115
|
+
has_options = !!(options || block_given?)
|
|
116
|
+
if has_options && is_file
|
|
117
|
+
raise(ArgumentError, 'conflicting arguments: is_file is only useful when options are not provided')
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
if options && multiple && default && !(Array(default) - options).empty?
|
|
121
|
+
raise(ArgumentError, 'conflicting arguments: default should only include elements present in options')
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
if multiple && !has_options
|
|
125
|
+
raise(ArgumentError, 'conflicting arguments: options must be provided when multiple is true')
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
if !multiple && default.is_a?(Array)
|
|
129
|
+
raise(ArgumentError, 'conflicting arguments: multiple defaults may only be provided when multiple is true')
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
if has_options
|
|
133
|
+
ask_interactive(
|
|
134
|
+
question,
|
|
135
|
+
options,
|
|
136
|
+
multiple: multiple,
|
|
137
|
+
default: default,
|
|
138
|
+
filter_ui: filter_ui,
|
|
139
|
+
select_ui: select_ui,
|
|
140
|
+
&options_proc
|
|
141
|
+
)
|
|
142
|
+
else
|
|
143
|
+
ask_free_form(
|
|
144
|
+
question,
|
|
145
|
+
default, #: as String?
|
|
146
|
+
is_file,
|
|
147
|
+
allow_empty,
|
|
148
|
+
)
|
|
149
|
+
end
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
# Asks the user for a single-line answer, without displaying the characters while typing.
|
|
153
|
+
# Typically used for password prompts
|
|
154
|
+
#
|
|
155
|
+
# ==== Return Value
|
|
156
|
+
#
|
|
157
|
+
# The password, without a trailing newline.
|
|
158
|
+
# If the user simply presses "Enter" without typing any password, this will return an empty string.
|
|
159
|
+
#: (String question) -> String
|
|
160
|
+
def ask_password(question)
|
|
161
|
+
require 'io/console'
|
|
162
|
+
|
|
163
|
+
CLI::UI::StdoutRouter::Capture.in_alternate_screen do
|
|
164
|
+
$stdout.print(CLI::UI.fmt('{{?}} ' + question)) # Do not use puts_question to avoid the new line.
|
|
165
|
+
|
|
166
|
+
# noecho interacts poorly with Readline under system Ruby, so do a manual `gets` here.
|
|
167
|
+
# No fancy Readline integration (like echoing back) is required for a password prompt anyway.
|
|
168
|
+
password = $stdin.noecho do
|
|
169
|
+
# Chomp will remove the one new line character added by `gets`, without touching potential extra spaces:
|
|
170
|
+
# " 123 \n".chomp => " 123 "
|
|
171
|
+
$stdin.gets.to_s.chomp
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
$stdout.puts # Complete the line
|
|
175
|
+
|
|
176
|
+
password
|
|
177
|
+
end
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
# Asks the user a yes/no question.
|
|
181
|
+
# Can use arrows, y/n, numbers (1/2), and vim bindings to control
|
|
182
|
+
#
|
|
183
|
+
# ==== Example Usage:
|
|
184
|
+
#
|
|
185
|
+
# Confirmation question
|
|
186
|
+
# CLI::UI::Prompt.confirm('Is the sky blue?')
|
|
187
|
+
#
|
|
188
|
+
# CLI::UI::Prompt.confirm('Do a dangerous thing?', default: false)
|
|
189
|
+
#
|
|
190
|
+
#: (String question, ?default: bool) -> bool
|
|
191
|
+
def confirm(question, default: true)
|
|
192
|
+
ask_interactive(question, default ? ['yes', 'no'] : ['no', 'yes'], filter_ui: false) == 'yes'
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
# Present the user with a message and wait for any key to be pressed, returning the pressed key.
|
|
196
|
+
#
|
|
197
|
+
# ==== Example Usage:
|
|
198
|
+
#
|
|
199
|
+
# CLI::UI::Prompt.any_key # Press any key to continue...
|
|
200
|
+
#
|
|
201
|
+
# CLI::UI::Prompt.any_key('Press RETURN to continue...') # Then check if that's what they pressed
|
|
202
|
+
#: (?String prompt) -> String?
|
|
203
|
+
def any_key(prompt = 'Press any key to continue...')
|
|
204
|
+
CLI::UI::StdoutRouter::Capture.in_alternate_screen do
|
|
205
|
+
puts_question(prompt)
|
|
206
|
+
read_char
|
|
207
|
+
end
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
# Wait for any key to be pressed, returning the pressed key.
|
|
211
|
+
#: -> String?
|
|
212
|
+
def read_char
|
|
213
|
+
CLI::UI::StdoutRouter::Capture.in_alternate_screen do
|
|
214
|
+
if $stdin.tty? && !ENV['TEST']
|
|
215
|
+
require 'io/console'
|
|
216
|
+
$stdin.getch # raw mode for tty
|
|
217
|
+
else
|
|
218
|
+
$stdin.getc # returns nil at end of input
|
|
219
|
+
end
|
|
220
|
+
end
|
|
221
|
+
rescue Errno::EIO, Errno::EPIPE, IOError
|
|
222
|
+
"\e"
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
private
|
|
226
|
+
|
|
227
|
+
#: (String question, String? default, bool is_file, bool allow_empty) -> String
|
|
228
|
+
def ask_free_form(question, default, is_file, allow_empty)
|
|
229
|
+
if default && !allow_empty
|
|
230
|
+
raise(ArgumentError, 'conflicting arguments: default enabled but allow_empty is false')
|
|
231
|
+
end
|
|
232
|
+
|
|
233
|
+
CLI::UI::StdoutRouter::Capture.in_alternate_screen do
|
|
234
|
+
if default
|
|
235
|
+
puts_question("#{question} (empty = #{default})")
|
|
236
|
+
else
|
|
237
|
+
puts_question(question)
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
# Ask a free form question
|
|
241
|
+
loop do
|
|
242
|
+
line = readline(is_file: is_file)
|
|
243
|
+
|
|
244
|
+
if line.empty? && default
|
|
245
|
+
write_default_over_empty_input(default)
|
|
246
|
+
return default
|
|
247
|
+
end
|
|
248
|
+
|
|
249
|
+
if !line.empty? || allow_empty
|
|
250
|
+
return line
|
|
251
|
+
end
|
|
252
|
+
end
|
|
253
|
+
end
|
|
254
|
+
end
|
|
255
|
+
|
|
256
|
+
#: (String question, ?Array[String]? options, ?multiple: bool, ?default: (String | Array[String])?, ?filter_ui: bool, ?select_ui: bool) -> (String | Array[String])
|
|
257
|
+
def ask_interactive(question, options = nil, multiple: false, default: nil, filter_ui: true, select_ui: true)
|
|
258
|
+
raise(ArgumentError, 'conflicting arguments: options and block given') if options && block_given?
|
|
259
|
+
|
|
260
|
+
options ||= if block_given?
|
|
261
|
+
handler = OptionsHandler.new
|
|
262
|
+
yield handler
|
|
263
|
+
handler.options
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
raise(ArgumentError, 'insufficient options') if options.nil? || options.empty?
|
|
267
|
+
|
|
268
|
+
navigate_text = if CLI::UI::OS.current.suggest_arrow_keys?
|
|
269
|
+
'Choose with ↑ ↓ ⏎'
|
|
270
|
+
else
|
|
271
|
+
"Navigate up with 'k' and down with 'j', press Enter to select"
|
|
272
|
+
end
|
|
273
|
+
|
|
274
|
+
instructions = (multiple ? 'Toggle options. ' : '') + navigate_text
|
|
275
|
+
instructions += ", filter with 'f'" if filter_ui
|
|
276
|
+
instructions += ", enter option with 'e'" if select_ui && (options.size > 9)
|
|
277
|
+
|
|
278
|
+
resp = [] #: (String | Array[String])
|
|
279
|
+
|
|
280
|
+
CLI::UI::StdoutRouter::Capture.in_alternate_screen do
|
|
281
|
+
puts_question("#{question} " + instructions_color.code + "(#{instructions})" + Color::RESET.code)
|
|
282
|
+
resp = interactive_prompt(options, multiple: multiple, default: default)
|
|
283
|
+
|
|
284
|
+
# Clear the line
|
|
285
|
+
print(ANSI.previous_line + ANSI.clear_to_end_of_line)
|
|
286
|
+
# Force StdoutRouter to prefix
|
|
287
|
+
print(ANSI.previous_line + "\n")
|
|
288
|
+
|
|
289
|
+
# reset the question to include the answer
|
|
290
|
+
resp_text = case resp
|
|
291
|
+
when Array
|
|
292
|
+
case resp.size
|
|
293
|
+
when 0
|
|
294
|
+
'<nothing>'
|
|
295
|
+
when 1..2
|
|
296
|
+
resp.join(' and ')
|
|
297
|
+
else
|
|
298
|
+
"#{resp.size} items"
|
|
299
|
+
end
|
|
300
|
+
else
|
|
301
|
+
resp
|
|
302
|
+
end
|
|
303
|
+
puts_question("#{question} (You chose: {{italic:#{resp_text}}})")
|
|
304
|
+
end
|
|
305
|
+
|
|
306
|
+
if block_given?
|
|
307
|
+
h = handler #: as !nil
|
|
308
|
+
h.call(resp)
|
|
309
|
+
else
|
|
310
|
+
resp
|
|
311
|
+
end
|
|
312
|
+
end
|
|
313
|
+
|
|
314
|
+
# Useful for stubbing in tests
|
|
315
|
+
#: (Array[String] options, ?multiple: bool, ?default: (Array[String] | String)?) -> (Array[String] | String)
|
|
316
|
+
def interactive_prompt(options, multiple: false, default: nil)
|
|
317
|
+
CLI::UI::StdoutRouter::Capture.in_alternate_screen do
|
|
318
|
+
InteractiveOptions.call(options, multiple: multiple, default: default)
|
|
319
|
+
end
|
|
320
|
+
end
|
|
321
|
+
|
|
322
|
+
#: (String default) -> void
|
|
323
|
+
def write_default_over_empty_input(default)
|
|
324
|
+
CLI::UI.raw do
|
|
325
|
+
$stderr.puts(
|
|
326
|
+
CLI::UI::ANSI.cursor_up(1) +
|
|
327
|
+
"\r" +
|
|
328
|
+
CLI::UI::ANSI.cursor_forward(4) + # TODO: width
|
|
329
|
+
default +
|
|
330
|
+
CLI::UI::Color::RESET.code,
|
|
331
|
+
)
|
|
332
|
+
end
|
|
333
|
+
end
|
|
334
|
+
|
|
335
|
+
#: (String str) -> void
|
|
336
|
+
def puts_question(str)
|
|
337
|
+
$stdout.puts(CLI::UI.fmt('{{?}} ' + str))
|
|
338
|
+
end
|
|
339
|
+
|
|
340
|
+
#: (?is_file: bool) -> String
|
|
341
|
+
def readline(is_file: false)
|
|
342
|
+
if is_file
|
|
343
|
+
Reline.completion_proc = proc do |input|
|
|
344
|
+
directory = input[-1] == '/' ? input : File.dirname(input)
|
|
345
|
+
filename = input[-1] == '/' ? '' : File.basename(input)
|
|
346
|
+
|
|
347
|
+
(Dir.entries(directory).select do |fp|
|
|
348
|
+
fp.start_with?(filename)
|
|
349
|
+
end - (input[-1] == '.' ? [] : ['.', '..'])).map do |fp|
|
|
350
|
+
File.join(directory, fp).gsub(/\A\.\//, '')
|
|
351
|
+
end
|
|
352
|
+
end
|
|
353
|
+
Reline.completion_append_character = ''
|
|
354
|
+
else
|
|
355
|
+
Reline.completion_proc = proc {}
|
|
356
|
+
Reline.completion_append_character = ' '
|
|
357
|
+
end
|
|
358
|
+
|
|
359
|
+
# because Readline is a C library, CLI::UI's hooks into $stdout don't
|
|
360
|
+
# work. We could work around this by having CLI::UI use a pipe and a
|
|
361
|
+
# thread to manage output, but the current strategy feels like a
|
|
362
|
+
# better tradeoff.
|
|
363
|
+
prefix = CLI::UI::Frame.prefix
|
|
364
|
+
# If a prompt is interrupted on Windows it locks the colour of the terminal from that point on, so we should
|
|
365
|
+
# not change the colour here.
|
|
366
|
+
prompt = prefix + CLI::UI.fmt('{{blue:> }}')
|
|
367
|
+
prompt += CLI::UI::Color::YELLOW.code if CLI::UI::OS.current.use_color_prompt?
|
|
368
|
+
|
|
369
|
+
begin
|
|
370
|
+
line = Reline.readline(prompt, true)
|
|
371
|
+
print(CLI::UI::Color::RESET.code)
|
|
372
|
+
line.to_s.chomp
|
|
373
|
+
rescue Interrupt
|
|
374
|
+
CLI::UI.raw { $stderr.puts('^C' + CLI::UI::Color::RESET.code) }
|
|
375
|
+
raise
|
|
376
|
+
end
|
|
377
|
+
end
|
|
378
|
+
end
|
|
379
|
+
end
|
|
380
|
+
end
|
|
381
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# typed: true
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
module CLI
|
|
5
|
+
module UI
|
|
6
|
+
module Spinner
|
|
7
|
+
class Async
|
|
8
|
+
class << self
|
|
9
|
+
# Convenience method for +initialize+
|
|
10
|
+
#
|
|
11
|
+
#: (String title) -> Async
|
|
12
|
+
def start(title)
|
|
13
|
+
new(title)
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# Initializes a new asynchronous spinner with no specific end.
|
|
18
|
+
# Must call +.stop+ to end the spinner
|
|
19
|
+
#
|
|
20
|
+
# ==== Attributes
|
|
21
|
+
#
|
|
22
|
+
# * +title+ - Title of the spinner to use
|
|
23
|
+
#
|
|
24
|
+
# ==== Example Usage:
|
|
25
|
+
#
|
|
26
|
+
# CLI::UI::Spinner::Async.new('Title')
|
|
27
|
+
#
|
|
28
|
+
#: (String title) -> void
|
|
29
|
+
def initialize(title)
|
|
30
|
+
require 'thread'
|
|
31
|
+
sg = CLI::UI::Spinner::SpinGroup.new
|
|
32
|
+
@m = Mutex.new
|
|
33
|
+
@cv = ConditionVariable.new
|
|
34
|
+
sg.add(title) { @m.synchronize { @cv.wait(@m) } }
|
|
35
|
+
@t = Thread.new { sg.wait }
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Stops an asynchronous spinner
|
|
39
|
+
#
|
|
40
|
+
#: -> bool
|
|
41
|
+
def stop
|
|
42
|
+
@m.synchronize { @cv.signal }
|
|
43
|
+
@t.value
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|