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,186 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
require_relative "file"
|
|
3
|
+
require_relative "root"
|
|
4
|
+
|
|
5
|
+
require "pathname"
|
|
6
|
+
require "time"
|
|
7
|
+
|
|
8
|
+
module FluidCLI
|
|
9
|
+
module Theme
|
|
10
|
+
class InvalidThemeStatus < StandardError; end
|
|
11
|
+
|
|
12
|
+
class Theme < Root
|
|
13
|
+
attr_reader :root, :id
|
|
14
|
+
|
|
15
|
+
def initialize(ctx, root: nil, id: nil, name: nil, status: "development")
|
|
16
|
+
super(ctx, root: root)
|
|
17
|
+
@id = id
|
|
18
|
+
@name = name
|
|
19
|
+
@status = status
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def theme_files
|
|
23
|
+
(glob(["*.css", "*.json", "**/*.liquid", "**/*.json", "**/*.css"]) - glob(["styleguide/*.liquid", "styleguide/*.css"]) + static_asset_files).uniq
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def theme_file?(file)
|
|
27
|
+
theme_files.include?(self[file])
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def company
|
|
31
|
+
api_client.get_company_or_abort
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def editor_url
|
|
35
|
+
"https://admin.fluid.app/admin/themes/#{id}/editor"
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def name
|
|
39
|
+
@name
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def status
|
|
43
|
+
@status
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def live?
|
|
47
|
+
status == "active"
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def development?
|
|
51
|
+
status == "development"
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def preview_url
|
|
55
|
+
"https://#{company}.fluid.app?preview_theme_id=#{id}"
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def create
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
raise InvalidThemeStatus, "Can't create live theme. Use publish." if live?
|
|
62
|
+
|
|
63
|
+
_status, body = api_client.post(
|
|
64
|
+
path: "application_themes",
|
|
65
|
+
body: JSON.generate({
|
|
66
|
+
application_theme: {
|
|
67
|
+
name: name,
|
|
68
|
+
status: status,
|
|
69
|
+
},
|
|
70
|
+
}),
|
|
71
|
+
)
|
|
72
|
+
@id = body["application_theme"]["id"]
|
|
73
|
+
@created_at_runtime = true
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def delete
|
|
77
|
+
delete_theme
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def publish
|
|
81
|
+
return if live?
|
|
82
|
+
api_client.put(
|
|
83
|
+
path: "themes/#{id}.json",
|
|
84
|
+
body: JSON.generate(theme: {
|
|
85
|
+
status: "active",
|
|
86
|
+
})
|
|
87
|
+
)
|
|
88
|
+
@status = "live"
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def current_development?
|
|
92
|
+
development? && id == FluidCLI::DB.get(:development_theme_id)
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def foreign_development?
|
|
96
|
+
development? && id != FluidCLI::DB.get(:development_theme_id)
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def created_at_runtime?
|
|
100
|
+
@created_at_runtime ||= false
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def to_h
|
|
104
|
+
{
|
|
105
|
+
id: id,
|
|
106
|
+
name: name,
|
|
107
|
+
status: status,
|
|
108
|
+
editor_url: editor_url,
|
|
109
|
+
preview_url: preview_url,
|
|
110
|
+
}
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
class << self
|
|
114
|
+
def create_unpublished(ctx, root: nil, name: nil)
|
|
115
|
+
name ||= random_name
|
|
116
|
+
theme = new(ctx, root: root, name: name, status: "draft")
|
|
117
|
+
theme.create
|
|
118
|
+
theme
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
def all(ctx, root: nil)
|
|
122
|
+
_status, body = fetch_themes(ctx)
|
|
123
|
+
body['application_themes']
|
|
124
|
+
.sort_by { |theme_attrs| Time.parse(theme_attrs["updated_at"]) }
|
|
125
|
+
.reverse
|
|
126
|
+
.map { |theme_attrs| new(ctx, root: root, **allowed_attrs(theme_attrs)) }
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
def live(ctx, root: nil)
|
|
130
|
+
find(ctx, root) { |attrs| attrs["status"] == "active" }
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
# Finds a Theme by its identifier
|
|
134
|
+
#
|
|
135
|
+
# #### Parameters
|
|
136
|
+
# * `ctx` - current running context of your command
|
|
137
|
+
# * `root` - theme root
|
|
138
|
+
# * `identifier` - theme ID or theme name
|
|
139
|
+
def find_by_identifier(ctx, root: nil, identifier:)
|
|
140
|
+
find(ctx, root) do |attrs|
|
|
141
|
+
attrs.slice("name", "id").values.map(&:to_s).include?(identifier)
|
|
142
|
+
end
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
private
|
|
146
|
+
|
|
147
|
+
def random_name
|
|
148
|
+
FluidCLI::Helpers::Haikunator.haikunate(9999)
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
def find(ctx, root, &block)
|
|
152
|
+
_status, body = fetch_themes(ctx)
|
|
153
|
+
|
|
154
|
+
body["application_themes"]
|
|
155
|
+
.find(&block)
|
|
156
|
+
.tap do |attrs|
|
|
157
|
+
break new(ctx, root: root, **allowed_attrs(attrs)) if attrs
|
|
158
|
+
end
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
def allowed_attrs(attrs)
|
|
162
|
+
attrs.slice("id", "name", "status").transform_keys(&:to_sym)
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
def fetch_themes(ctx)
|
|
166
|
+
FluidCLI::API.new(ctx).get(
|
|
167
|
+
path: "application_themes",
|
|
168
|
+
query: URI.encode_www_form({ include_development: true, per_page: 50 })
|
|
169
|
+
)
|
|
170
|
+
end
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
private
|
|
174
|
+
|
|
175
|
+
def api_client
|
|
176
|
+
@api_client ||= FluidCLI::API.new(@ctx)
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
def delete_theme
|
|
180
|
+
api_client.delete(
|
|
181
|
+
path: "application_themes/#{id}"
|
|
182
|
+
)
|
|
183
|
+
end
|
|
184
|
+
end
|
|
185
|
+
end
|
|
186
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
module FluidCLI
|
|
2
|
+
module Theme
|
|
3
|
+
module UI
|
|
4
|
+
class SyncProgressBar
|
|
5
|
+
def initialize(syncer)
|
|
6
|
+
@syncer = syncer
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def progress(method, **args)
|
|
10
|
+
@syncer.lock_io!
|
|
11
|
+
CLI::UI::Progress.progress do |bar|
|
|
12
|
+
@syncer.public_send(method, **args) do |left, total|
|
|
13
|
+
bar.tick(set_percent: 1 - left.to_f / total)
|
|
14
|
+
end
|
|
15
|
+
bar.tick(set_percent: 1)
|
|
16
|
+
end
|
|
17
|
+
@syncer.unlock_io!
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module FluidCLI
|
|
4
|
+
class ThreadPool
|
|
5
|
+
class Job
|
|
6
|
+
attr_reader :error, :interval
|
|
7
|
+
|
|
8
|
+
def initialize(interval = 0)
|
|
9
|
+
@interval = interval
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def perform!
|
|
13
|
+
raise "`#{self.class.name}#perform!' must be defined"
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def call
|
|
17
|
+
perform!
|
|
18
|
+
rescue StandardError => error
|
|
19
|
+
@error = error
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def success?
|
|
23
|
+
!@error
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def error?
|
|
27
|
+
!!@error
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def recurring?
|
|
31
|
+
!interval.zero?
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module FluidCLI
|
|
4
|
+
class ThreadPool
|
|
5
|
+
attr_reader :errors
|
|
6
|
+
|
|
7
|
+
def initialize(pool_size: 10)
|
|
8
|
+
@jobs = Queue.new
|
|
9
|
+
@pool = Array.new(pool_size) { spawn_thread }
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def schedule(job)
|
|
13
|
+
@jobs << job
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def shutdown
|
|
17
|
+
@pool.size.times do
|
|
18
|
+
schedule(-> { throw(:stop_thread) })
|
|
19
|
+
end
|
|
20
|
+
@pool.map(&:join)
|
|
21
|
+
ensure
|
|
22
|
+
@jobs.close
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
private
|
|
26
|
+
|
|
27
|
+
def spawn_thread
|
|
28
|
+
Thread.new do
|
|
29
|
+
catch(:stop_thread) do
|
|
30
|
+
loop { perform(@jobs.pop) }
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def perform(job)
|
|
36
|
+
job.call
|
|
37
|
+
reschedule(job) if job.recurring?
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def reschedule(job)
|
|
41
|
+
wait(job.interval)
|
|
42
|
+
schedule(job)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def wait(seconds)
|
|
46
|
+
sleep(seconds)
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
data/lib/fluid_cli.rb
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
require 'cli/ui'
|
|
2
|
+
require 'cli/kit'
|
|
3
|
+
# require 'debug'
|
|
4
|
+
require "webrick"
|
|
5
|
+
|
|
6
|
+
CLI::UI::StdoutRouter.enable
|
|
7
|
+
|
|
8
|
+
module FluidCLI
|
|
9
|
+
TOOL_NAME = 'fluid'
|
|
10
|
+
ROOT = File.expand_path('../..', __FILE__)
|
|
11
|
+
LOG_FILE = '/tmp/fluid_cli.log'
|
|
12
|
+
API_HOST = 'api.fluid.app'
|
|
13
|
+
|
|
14
|
+
autoload(:EntryPoint, 'fluid_cli/entry_point')
|
|
15
|
+
autoload(:API, 'fluid_cli/api')
|
|
16
|
+
autoload(:Commands, 'fluid_cli/commands')
|
|
17
|
+
autoload(:Command, 'fluid_cli/command')
|
|
18
|
+
autoload(:Context, 'fluid_cli/context')
|
|
19
|
+
autoload(:DB, 'fluid_cli/db')
|
|
20
|
+
autoload(:Environment, 'fluid_cli/environment')
|
|
21
|
+
autoload(:Form, 'fluid_cli/form')
|
|
22
|
+
autoload(:Git, 'fluid_cli/git')
|
|
23
|
+
autoload(:IdentityAuth, 'fluid_cli/identity_auth')
|
|
24
|
+
autoload(:CompanySwitcher, 'fluid_cli/company_switcher')
|
|
25
|
+
autoload(:Options, 'fluid_cli/options')
|
|
26
|
+
|
|
27
|
+
module Theme
|
|
28
|
+
module Forms
|
|
29
|
+
autoload(:Select, 'fluid_cli/theme/forms/select')
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
module UI
|
|
33
|
+
autoload(:SyncProgressBar, 'fluid_cli/theme/ui/sync_progress_bar')
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def self.cache_dir
|
|
38
|
+
cache_dir = if ENV["LOCALAPPDATA"].nil?
|
|
39
|
+
File.join(File.expand_path(ENV.fetch("XDG_CACHE_HOME", "~/.cache")), TOOL_NAME)
|
|
40
|
+
else
|
|
41
|
+
File.join(File.expand_path(ENV["LOCALAPPDATA"]), TOOL_NAME)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Make sure the cache dir always exists
|
|
45
|
+
@cache_dir_exists ||= FileUtils.mkdir_p(cache_dir)
|
|
46
|
+
|
|
47
|
+
cache_dir
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
Config = CLI::Kit::Config.new(tool_name: TOOL_NAME)
|
|
51
|
+
|
|
52
|
+
Executor = CLI::Kit::Executor.new(log_file: LOG_FILE)
|
|
53
|
+
Resolver = CLI::Kit::Resolver.new(
|
|
54
|
+
tool_name: TOOL_NAME,
|
|
55
|
+
command_registry: FluidCLI::Commands::Registry
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
ErrorHandler = CLI::Kit::ErrorHandler.new(log_file: LOG_FILE)
|
|
59
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (C) 1993-2013 Yukihiro Matsumoto. All rights reserved.
|
|
2
|
+
|
|
3
|
+
Redistribution and use in source and binary forms, with or without
|
|
4
|
+
modification, are permitted provided that the following conditions
|
|
5
|
+
are met:
|
|
6
|
+
1. Redistributions of source code must retain the above copyright
|
|
7
|
+
notice, this list of conditions and the following disclaimer.
|
|
8
|
+
2. Redistributions in binary form must reproduce the above copyright
|
|
9
|
+
notice, this list of conditions and the following disclaimer in the
|
|
10
|
+
documentation and/or other materials provided with the distribution.
|
|
11
|
+
|
|
12
|
+
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
13
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
14
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
15
|
+
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
16
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
17
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
18
|
+
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
19
|
+
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
20
|
+
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
21
|
+
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
22
|
+
SUCH DAMAGE.
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
Ruby is copyrighted free software by Yukihiro Matsumoto <matz@netlab.jp>.
|
|
2
|
+
You can redistribute it and/or modify it under either the terms of the
|
|
3
|
+
2-clause BSDL (see the file BSDL), or the conditions below:
|
|
4
|
+
|
|
5
|
+
1. You may make and give away verbatim copies of the source form of the
|
|
6
|
+
software without restriction, provided that you duplicate all of the
|
|
7
|
+
original copyright notices and associated disclaimers.
|
|
8
|
+
|
|
9
|
+
2. You may modify your copy of the software in any way, provided that
|
|
10
|
+
you do at least ONE of the following:
|
|
11
|
+
|
|
12
|
+
a. place your modifications in the Public Domain or otherwise
|
|
13
|
+
make them Freely Available, such as by posting said
|
|
14
|
+
modifications to Usenet or an equivalent medium, or by allowing
|
|
15
|
+
the author to include your modifications in the software.
|
|
16
|
+
|
|
17
|
+
b. use the modified software only within your corporation or
|
|
18
|
+
organization.
|
|
19
|
+
|
|
20
|
+
c. give non-standard binaries non-standard names, with
|
|
21
|
+
instructions on where to get the original software distribution.
|
|
22
|
+
|
|
23
|
+
d. make other distribution arrangements with the author.
|
|
24
|
+
|
|
25
|
+
3. You may distribute the software in object code or binary form,
|
|
26
|
+
provided that you do at least ONE of the following:
|
|
27
|
+
|
|
28
|
+
a. distribute the binaries and library files of the software,
|
|
29
|
+
together with instructions (in the manual page or equivalent)
|
|
30
|
+
on where to get the original distribution.
|
|
31
|
+
|
|
32
|
+
b. accompany the distribution with the machine-readable source of
|
|
33
|
+
the software.
|
|
34
|
+
|
|
35
|
+
c. give non-standard binaries non-standard names, with
|
|
36
|
+
instructions on where to get the original software distribution.
|
|
37
|
+
|
|
38
|
+
d. make other distribution arrangements with the author.
|
|
39
|
+
|
|
40
|
+
4. You may modify and include the part of the software into any other
|
|
41
|
+
software (possibly commercial). But some files in the distribution
|
|
42
|
+
are not written by the author, so that they are not under these terms.
|
|
43
|
+
|
|
44
|
+
For the list of those files and their copying conditions, see the
|
|
45
|
+
file LEGAL.
|
|
46
|
+
|
|
47
|
+
5. The scripts and library files supplied as input to or produced as
|
|
48
|
+
output from the software do not automatically fall under the
|
|
49
|
+
copyright of the software, but belong to whomever generated them,
|
|
50
|
+
and may be sold commercially, and may be aggregated with this
|
|
51
|
+
software.
|
|
52
|
+
|
|
53
|
+
6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
|
54
|
+
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
|
55
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
56
|
+
PURPOSE.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# -*- rdoc -*-
|
|
2
|
+
|
|
3
|
+
= LEGAL NOTICE INFORMATION
|
|
4
|
+
--------------------------
|
|
5
|
+
|
|
6
|
+
All the files in this distribution are covered under either the Ruby's
|
|
7
|
+
license (see the file COPYING) or public-domain except some files
|
|
8
|
+
mentioned below.
|
|
9
|
+
|
|
10
|
+
== MIT License
|
|
11
|
+
>>>
|
|
12
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
13
|
+
a copy of this software and associated documentation files (the
|
|
14
|
+
"Software"), to deal in the Software without restriction, including
|
|
15
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
16
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
17
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
18
|
+
the following conditions:
|
|
19
|
+
|
|
20
|
+
The above copyright notice and this permission notice shall be
|
|
21
|
+
included in all copies or substantial portions of the Software.
|
|
22
|
+
|
|
23
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
24
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
25
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
26
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
27
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
28
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
29
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
30
|
+
|
|
31
|
+
== Old-style BSD license
|
|
32
|
+
>>>
|
|
33
|
+
Redistribution and use in source and binary forms, with or without
|
|
34
|
+
modification, are permitted provided that the following conditions
|
|
35
|
+
are met:
|
|
36
|
+
1. Redistributions of source code must retain the above copyright
|
|
37
|
+
notice, this list of conditions and the following disclaimer.
|
|
38
|
+
2. Redistributions in binary form must reproduce the above copyright
|
|
39
|
+
notice, this list of conditions and the following disclaimer in the
|
|
40
|
+
documentation and/or other materials provided with the distribution.
|
|
41
|
+
3. Neither the name of the University nor the names of its contributors
|
|
42
|
+
may be used to endorse or promote products derived from this software
|
|
43
|
+
without specific prior written permission.
|
|
44
|
+
|
|
45
|
+
THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
46
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
47
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
48
|
+
ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
49
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
50
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
51
|
+
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
52
|
+
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
53
|
+
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
54
|
+
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
55
|
+
SUCH DAMAGE.
|
|
56
|
+
|
|
57
|
+
IMPORTANT NOTE::
|
|
58
|
+
|
|
59
|
+
From ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change
|
|
60
|
+
paragraph 3 above is now null and void.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Base64
|
|
2
|
+
|
|
3
|
+
The Base64 module provides for the encoding (`#encode64`, `#strict_encode64`,
|
|
4
|
+
`#urlsafe_encode64`) and decoding (`#decode64`, `#strict_decode64`,
|
|
5
|
+
`#urlsafe_decode64`) of binary data using a Base64 representation.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
Add this line to your application's Gemfile:
|
|
10
|
+
|
|
11
|
+
```ruby
|
|
12
|
+
gem 'base64'
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
And then execute:
|
|
16
|
+
|
|
17
|
+
$ bundle install
|
|
18
|
+
|
|
19
|
+
Or install it yourself as:
|
|
20
|
+
|
|
21
|
+
$ gem install base64
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
A simple encoding and decoding.
|
|
26
|
+
|
|
27
|
+
```ruby
|
|
28
|
+
require "base64"
|
|
29
|
+
|
|
30
|
+
enc = Base64.encode64('Send reinforcements')
|
|
31
|
+
# -> "U2VuZCByZWluZm9yY2VtZW50cw==\n"
|
|
32
|
+
plain = Base64.decode64(enc)
|
|
33
|
+
# -> "Send reinforcements"
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
The purpose of using base64 to encode data is that it translates any
|
|
37
|
+
binary data into purely printable characters.
|
|
38
|
+
|
|
39
|
+
## Development
|
|
40
|
+
|
|
41
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
42
|
+
|
|
43
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
44
|
+
|
|
45
|
+
## Contributing
|
|
46
|
+
|
|
47
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/ruby/base64.
|
|
48
|
+
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
require "bundler/gem_tasks"
|
|
2
|
+
require "rake/testtask"
|
|
3
|
+
|
|
4
|
+
Rake::TestTask.new(:test) do |t|
|
|
5
|
+
t.libs << "test"
|
|
6
|
+
t.libs << "lib"
|
|
7
|
+
t.test_files = FileList["test/**/test_*.rb"]
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
namespace :rbs do
|
|
11
|
+
task :test do
|
|
12
|
+
sh "ruby -I lib test_sig/test_base64.rb"
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
task :annotate do
|
|
16
|
+
require "tmpdir"
|
|
17
|
+
require "pathname"
|
|
18
|
+
|
|
19
|
+
Dir.mktmpdir do |tmpdir|
|
|
20
|
+
system("rdoc --ri --output #{tmpdir}/doc --root=. lib")
|
|
21
|
+
system("rbs annotate --no-system --no-gems --no-site --no-home -d #{tmpdir}/doc sig")
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
task :confirm do
|
|
26
|
+
puts "Testing if RBS docs are updated with respect to RDoc"
|
|
27
|
+
sh "git diff --exit-code sig/"
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
task :default => :test
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
name = File.basename(__FILE__, ".gemspec")
|
|
2
|
+
version = ["lib", Array.new(name.count("-")+1).join("/")].find do |dir|
|
|
3
|
+
break File.foreach(File.join(__dir__, dir, "#{name.tr('-', '/')}.rb")) do |line|
|
|
4
|
+
/^\s*VERSION\s*=\s*"(.*)"/ =~ line and break $1
|
|
5
|
+
end rescue nil
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
Gem::Specification.new do |spec|
|
|
9
|
+
spec.name = name
|
|
10
|
+
spec.version = version
|
|
11
|
+
spec.authors = ["Yusuke Endoh"]
|
|
12
|
+
spec.email = ["mame@ruby-lang.org"]
|
|
13
|
+
|
|
14
|
+
spec.summary = %q{Support for encoding and decoding binary data using a Base64 representation.}
|
|
15
|
+
spec.description = %q{Support for encoding and decoding binary data using a Base64 representation.}
|
|
16
|
+
spec.homepage = "https://github.com/ruby/base64"
|
|
17
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.4")
|
|
18
|
+
spec.licenses = ["Ruby", "BSD-2-Clause"]
|
|
19
|
+
|
|
20
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
|
21
|
+
spec.metadata["source_code_uri"] = spec.homepage
|
|
22
|
+
spec.metadata["changelog_uri"] = spec.homepage + "/releases"
|
|
23
|
+
|
|
24
|
+
spec.files = ["README.md", "BSDL", "COPYING", "LEGAL", "lib/base64.rb", "sig/base64.rbs"]
|
|
25
|
+
spec.bindir = "exe"
|
|
26
|
+
spec.executables = []
|
|
27
|
+
spec.require_paths = ["lib"]
|
|
28
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
require "base64"
|
|
5
|
+
|
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
|
8
|
+
|
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
10
|
+
# require "pry"
|
|
11
|
+
# Pry.start
|
|
12
|
+
|
|
13
|
+
require "irb"
|
|
14
|
+
IRB.start(__FILE__)
|