fluid_cli 0.1.8 → 0.2.1
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 +4 -4
- data/README.md +200 -1
- data/exe/fluid +12 -17
- data/lib/fluid_cli/version.rb +1 -1
- data/lib/fluid_cli.rb +4 -57
- metadata +14 -274
- data/Rakefile +0 -26
- data/dev.yml +0 -5
- data/lib/fluid_cli/api.rb +0 -141
- data/lib/fluid_cli/assets/post_auth_page/index.html.erb +0 -34
- data/lib/fluid_cli/assets/post_auth_page/style.css +0 -58
- data/lib/fluid_cli/command.rb +0 -55
- data/lib/fluid_cli/commands/help.rb +0 -21
- data/lib/fluid_cli/commands/login.rb +0 -30
- data/lib/fluid_cli/commands/logout.rb +0 -38
- data/lib/fluid_cli/commands/switch.rb +0 -23
- data/lib/fluid_cli/commands/theme/common/company_helper.rb +0 -15
- data/lib/fluid_cli/commands/theme/common/root_helper.rb +0 -95
- data/lib/fluid_cli/commands/theme/dev.rb +0 -61
- data/lib/fluid_cli/commands/theme/help.rb +0 -21
- data/lib/fluid_cli/commands/theme/init.rb +0 -46
- data/lib/fluid_cli/commands/theme/pull.rb +0 -68
- data/lib/fluid_cli/commands/theme/push.rb +0 -132
- data/lib/fluid_cli/commands/theme.rb +0 -23
- data/lib/fluid_cli/commands/whoami.rb +0 -23
- data/lib/fluid_cli/commands.rb +0 -19
- data/lib/fluid_cli/company_switcher.rb +0 -69
- data/lib/fluid_cli/context.rb +0 -691
- data/lib/fluid_cli/db.rb +0 -114
- data/lib/fluid_cli/entry_point.rb +0 -10
- data/lib/fluid_cli/environment.rb +0 -32
- data/lib/fluid_cli/file_system_listener.rb +0 -29
- data/lib/fluid_cli/form.rb +0 -42
- data/lib/fluid_cli/git.rb +0 -319
- data/lib/fluid_cli/http_request.rb +0 -60
- data/lib/fluid_cli/identity_auth/servlet.rb +0 -39
- data/lib/fluid_cli/identity_auth.rb +0 -126
- data/lib/fluid_cli/options.rb +0 -38
- data/lib/fluid_cli/packager.rb +0 -36
- data/lib/fluid_cli/theme/dev_server/certificate_manager.rb +0 -79
- data/lib/fluid_cli/theme/dev_server/errors.rb +0 -9
- data/lib/fluid_cli/theme/dev_server/header_hash.rb +0 -98
- data/lib/fluid_cli/theme/dev_server/hooks/file_change_hook.rb +0 -39
- data/lib/fluid_cli/theme/dev_server/hot_reload/resources/hot-reload-no-script.html +0 -27
- data/lib/fluid_cli/theme/dev_server/hot_reload/resources/hot_reload.js +0 -28
- data/lib/fluid_cli/theme/dev_server/hot_reload/resources/sse_client.js +0 -43
- data/lib/fluid_cli/theme/dev_server/hot_reload/resources/theme.js +0 -16
- data/lib/fluid_cli/theme/dev_server/hot_reload/script_injector.rb +0 -54
- data/lib/fluid_cli/theme/dev_server/hot_reload.rb +0 -75
- data/lib/fluid_cli/theme/dev_server/local_assets.rb +0 -92
- data/lib/fluid_cli/theme/dev_server/proxy.rb +0 -235
- data/lib/fluid_cli/theme/dev_server/proxy_param_builder.rb +0 -82
- data/lib/fluid_cli/theme/dev_server/reload_mode.rb +0 -34
- data/lib/fluid_cli/theme/dev_server/sse.rb +0 -75
- data/lib/fluid_cli/theme/dev_server/watcher.rb +0 -57
- data/lib/fluid_cli/theme/dev_server/web_server.rb +0 -140
- data/lib/fluid_cli/theme/dev_server.rb +0 -293
- data/lib/fluid_cli/theme/development_theme.rb +0 -101
- data/lib/fluid_cli/theme/file.rb +0 -105
- data/lib/fluid_cli/theme/forms/select.rb +0 -33
- data/lib/fluid_cli/theme/mime_type.rb +0 -34
- data/lib/fluid_cli/theme/presenters/theme_presenter.rb +0 -49
- data/lib/fluid_cli/theme/presenters/themes_presenter.rb +0 -31
- data/lib/fluid_cli/theme/root.rb +0 -62
- data/lib/fluid_cli/theme/syncer/checksums.rb +0 -66
- data/lib/fluid_cli/theme/syncer/downloader.rb +0 -54
- data/lib/fluid_cli/theme/syncer/error_reporter.rb +0 -45
- data/lib/fluid_cli/theme/syncer/merger.rb +0 -53
- data/lib/fluid_cli/theme/syncer/operation.rb +0 -58
- data/lib/fluid_cli/theme/syncer/standard_reporter.rb +0 -32
- data/lib/fluid_cli/theme/syncer/unsupported_script_warning.rb +0 -90
- data/lib/fluid_cli/theme/syncer/uploader/forms/apply_to_all.rb +0 -41
- data/lib/fluid_cli/theme/syncer/uploader/forms/apply_to_all_form.rb +0 -37
- data/lib/fluid_cli/theme/syncer/uploader/forms/base_strategy_form.rb +0 -64
- data/lib/fluid_cli/theme/syncer/uploader/forms/select_delete_strategy.rb +0 -29
- data/lib/fluid_cli/theme/syncer/uploader/forms/select_update_strategy.rb +0 -30
- data/lib/fluid_cli/theme/syncer/uploader/json_delete_handler.rb +0 -49
- data/lib/fluid_cli/theme/syncer/uploader/json_update_handler.rb +0 -71
- data/lib/fluid_cli/theme/syncer/uploader.rb +0 -105
- data/lib/fluid_cli/theme/syncer.rb +0 -492
- data/lib/fluid_cli/theme/theme.rb +0 -186
- data/lib/fluid_cli/theme/ui/sync_progress_bar.rb +0 -22
- data/lib/fluid_cli/thread_pool/job.rb +0 -35
- data/lib/fluid_cli/thread_pool.rb +0 -49
- data/packaging/homebrew/fluid_cli.base.rb +0 -103
- data/vendor/deps/base64/.document +0 -5
- data/vendor/deps/base64/.gitignore +0 -9
- data/vendor/deps/base64/BSDL +0 -22
- data/vendor/deps/base64/COPYING +0 -56
- data/vendor/deps/base64/Gemfile +0 -9
- data/vendor/deps/base64/LEGAL +0 -60
- data/vendor/deps/base64/README.md +0 -48
- data/vendor/deps/base64/Rakefile +0 -31
- data/vendor/deps/base64/base64.gemspec +0 -28
- data/vendor/deps/base64/bin/console +0 -14
- data/vendor/deps/base64/bin/setup +0 -8
- data/vendor/deps/base64/lib/base64.rb +0 -382
- data/vendor/deps/base64/sig/base64.rbs +0 -358
- data/vendor/deps/base64/test/base64/test_base64.rb +0 -115
- data/vendor/deps/base64/test_sig/test_base64.rb +0 -44
- data/vendor/deps/cli-kit/REVISION +0 -1
- data/vendor/deps/cli-kit/lib/cli/kit/args/definition.rb +0 -286
- data/vendor/deps/cli-kit/lib/cli/kit/args/evaluation.rb +0 -215
- data/vendor/deps/cli-kit/lib/cli/kit/args/parser/node.rb +0 -128
- data/vendor/deps/cli-kit/lib/cli/kit/args/parser.rb +0 -125
- data/vendor/deps/cli-kit/lib/cli/kit/args/tokenizer.rb +0 -130
- data/vendor/deps/cli-kit/lib/cli/kit/args.rb +0 -16
- data/vendor/deps/cli-kit/lib/cli/kit/base_command.rb +0 -30
- data/vendor/deps/cli-kit/lib/cli/kit/command_help.rb +0 -268
- data/vendor/deps/cli-kit/lib/cli/kit/command_registry.rb +0 -150
- data/vendor/deps/cli-kit/lib/cli/kit/config.rb +0 -137
- data/vendor/deps/cli-kit/lib/cli/kit/core_ext.rb +0 -28
- data/vendor/deps/cli-kit/lib/cli/kit/error_handler.rb +0 -166
- data/vendor/deps/cli-kit/lib/cli/kit/executor.rb +0 -92
- data/vendor/deps/cli-kit/lib/cli/kit/ini.rb +0 -91
- data/vendor/deps/cli-kit/lib/cli/kit/levenshtein.rb +0 -92
- data/vendor/deps/cli-kit/lib/cli/kit/logger.rb +0 -94
- data/vendor/deps/cli-kit/lib/cli/kit/opts.rb +0 -248
- data/vendor/deps/cli-kit/lib/cli/kit/parse_args.rb +0 -55
- data/vendor/deps/cli-kit/lib/cli/kit/resolver.rb +0 -66
- data/vendor/deps/cli-kit/lib/cli/kit/support/test_helper.rb +0 -260
- data/vendor/deps/cli-kit/lib/cli/kit/support.rb +0 -11
- data/vendor/deps/cli-kit/lib/cli/kit/system.rb +0 -290
- data/vendor/deps/cli-kit/lib/cli/kit/util.rb +0 -118
- data/vendor/deps/cli-kit/lib/cli/kit/version.rb +0 -7
- data/vendor/deps/cli-kit/lib/cli/kit.rb +0 -139
- data/vendor/deps/cli-ui/REVISION +0 -1
- data/vendor/deps/cli-ui/lib/cli/ui/ansi.rb +0 -218
- data/vendor/deps/cli-ui/lib/cli/ui/color.rb +0 -101
- data/vendor/deps/cli-ui/lib/cli/ui/formatter.rb +0 -219
- data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_stack.rb +0 -67
- data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style/box.rb +0 -179
- data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style/bracket.rb +0 -152
- data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style.rb +0 -127
- data/vendor/deps/cli-ui/lib/cli/ui/frame.rb +0 -286
- data/vendor/deps/cli-ui/lib/cli/ui/glyph.rb +0 -92
- data/vendor/deps/cli-ui/lib/cli/ui/os.rb +0 -63
- data/vendor/deps/cli-ui/lib/cli/ui/printer.rb +0 -64
- data/vendor/deps/cli-ui/lib/cli/ui/progress.rb +0 -132
- data/vendor/deps/cli-ui/lib/cli/ui/progress_reporter.rb +0 -209
- data/vendor/deps/cli-ui/lib/cli/ui/prompt/interactive_options.rb +0 -583
- data/vendor/deps/cli-ui/lib/cli/ui/prompt/options_handler.rb +0 -36
- data/vendor/deps/cli-ui/lib/cli/ui/prompt.rb +0 -381
- data/vendor/deps/cli-ui/lib/cli/ui/spinner/async.rb +0 -48
- data/vendor/deps/cli-ui/lib/cli/ui/spinner/spin_group.rb +0 -602
- data/vendor/deps/cli-ui/lib/cli/ui/spinner.rb +0 -79
- data/vendor/deps/cli-ui/lib/cli/ui/stdout_router.rb +0 -399
- data/vendor/deps/cli-ui/lib/cli/ui/table.rb +0 -83
- data/vendor/deps/cli-ui/lib/cli/ui/terminal.rb +0 -55
- data/vendor/deps/cli-ui/lib/cli/ui/truncater.rb +0 -106
- data/vendor/deps/cli-ui/lib/cli/ui/version.rb +0 -8
- data/vendor/deps/cli-ui/lib/cli/ui/widgets/base.rb +0 -46
- data/vendor/deps/cli-ui/lib/cli/ui/widgets/status.rb +0 -79
- data/vendor/deps/cli-ui/lib/cli/ui/widgets.rb +0 -89
- data/vendor/deps/cli-ui/lib/cli/ui/work_queue.rb +0 -142
- data/vendor/deps/cli-ui/lib/cli/ui/wrap.rb +0 -61
- data/vendor/deps/cli-ui/lib/cli/ui.rb +0 -359
- data/vendor/deps/cli-ui/vendor/reentrant_mutex.rb +0 -78
- data/vendor/deps/webrick/.gitignore +0 -9
- data/vendor/deps/webrick/Gemfile +0 -3
- data/vendor/deps/webrick/LICENSE.txt +0 -22
- data/vendor/deps/webrick/README.md +0 -61
- data/vendor/deps/webrick/Rakefile +0 -10
- data/vendor/deps/webrick/lib/webrick/accesslog.rb +0 -157
- data/vendor/deps/webrick/lib/webrick/cgi.rb +0 -313
- data/vendor/deps/webrick/lib/webrick/compat.rb +0 -36
- data/vendor/deps/webrick/lib/webrick/config.rb +0 -158
- data/vendor/deps/webrick/lib/webrick/cookie.rb +0 -172
- data/vendor/deps/webrick/lib/webrick/htmlutils.rb +0 -30
- data/vendor/deps/webrick/lib/webrick/httpauth/authenticator.rb +0 -117
- data/vendor/deps/webrick/lib/webrick/httpauth/basicauth.rb +0 -116
- data/vendor/deps/webrick/lib/webrick/httpauth/digestauth.rb +0 -395
- data/vendor/deps/webrick/lib/webrick/httpauth/htdigest.rb +0 -132
- data/vendor/deps/webrick/lib/webrick/httpauth/htgroup.rb +0 -97
- data/vendor/deps/webrick/lib/webrick/httpauth/htpasswd.rb +0 -158
- data/vendor/deps/webrick/lib/webrick/httpauth/userdb.rb +0 -53
- data/vendor/deps/webrick/lib/webrick/httpauth.rb +0 -96
- data/vendor/deps/webrick/lib/webrick/httpproxy.rb +0 -354
- data/vendor/deps/webrick/lib/webrick/httprequest.rb +0 -636
- data/vendor/deps/webrick/lib/webrick/httpresponse.rb +0 -564
- data/vendor/deps/webrick/lib/webrick/https.rb +0 -152
- data/vendor/deps/webrick/lib/webrick/httpserver.rb +0 -294
- data/vendor/deps/webrick/lib/webrick/httpservlet/abstract.rb +0 -152
- data/vendor/deps/webrick/lib/webrick/httpservlet/cgi_runner.rb +0 -47
- data/vendor/deps/webrick/lib/webrick/httpservlet/cgihandler.rb +0 -126
- data/vendor/deps/webrick/lib/webrick/httpservlet/erbhandler.rb +0 -88
- data/vendor/deps/webrick/lib/webrick/httpservlet/filehandler.rb +0 -552
- data/vendor/deps/webrick/lib/webrick/httpservlet/prochandler.rb +0 -47
- data/vendor/deps/webrick/lib/webrick/httpservlet.rb +0 -23
- data/vendor/deps/webrick/lib/webrick/httpstatus.rb +0 -194
- data/vendor/deps/webrick/lib/webrick/httputils.rb +0 -512
- data/vendor/deps/webrick/lib/webrick/httpversion.rb +0 -76
- data/vendor/deps/webrick/lib/webrick/log.rb +0 -156
- data/vendor/deps/webrick/lib/webrick/server.rb +0 -381
- data/vendor/deps/webrick/lib/webrick/ssl.rb +0 -215
- data/vendor/deps/webrick/lib/webrick/utils.rb +0 -265
- data/vendor/deps/webrick/lib/webrick/version.rb +0 -18
- data/vendor/deps/webrick/lib/webrick.rb +0 -232
- data/vendor/deps/webrick/webrick.gemspec +0 -74
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
require "forwardable"
|
|
3
|
-
|
|
4
|
-
module FluidCLI
|
|
5
|
-
module Theme
|
|
6
|
-
module Presenters
|
|
7
|
-
class ThemePresenter
|
|
8
|
-
extend Forwardable
|
|
9
|
-
|
|
10
|
-
COLOR_BY_STATUS = {
|
|
11
|
-
"active" => "green",
|
|
12
|
-
"draft" => "yellow",
|
|
13
|
-
"development" => "blue",
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
attr_reader :theme
|
|
17
|
-
|
|
18
|
-
def_delegators :theme, :id, :name, :status
|
|
19
|
-
|
|
20
|
-
def initialize(theme)
|
|
21
|
-
@theme = theme
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def to_s(mode = :long)
|
|
25
|
-
case mode
|
|
26
|
-
when :short
|
|
27
|
-
"{{bold:#{name}}}"
|
|
28
|
-
when :long
|
|
29
|
-
"{{green:##{id}}} {{bold:#{name}}}"
|
|
30
|
-
else
|
|
31
|
-
inspect
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
private
|
|
36
|
-
|
|
37
|
-
def theme_tags
|
|
38
|
-
tags = ["{{#{tag_color}:[#{status}]}}"]
|
|
39
|
-
tags << "{{cyan:[yours]}}}}" if theme.current_development?
|
|
40
|
-
tags.join(" ")
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
def tag_color
|
|
44
|
-
COLOR_BY_STATUS[status] || "italic"
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
|
-
end
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require_relative "theme_presenter"
|
|
4
|
-
|
|
5
|
-
module FluidCLI
|
|
6
|
-
module Theme
|
|
7
|
-
module Presenters
|
|
8
|
-
class ThemesPresenter
|
|
9
|
-
SUPPORTED_STATUSES = %w(active draft development)
|
|
10
|
-
|
|
11
|
-
def initialize(ctx, root)
|
|
12
|
-
@ctx = ctx
|
|
13
|
-
@root = root
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def all
|
|
17
|
-
all_themes
|
|
18
|
-
.select { |theme| SUPPORTED_STATUSES.include?(theme.status) }
|
|
19
|
-
.sort_by { |theme| SUPPORTED_STATUSES.index(theme.status) }
|
|
20
|
-
.map { |theme| ThemePresenter.new(theme) }
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
private
|
|
24
|
-
|
|
25
|
-
def all_themes
|
|
26
|
-
FluidCLI::Theme::Theme.all(@ctx, root: @root)
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
end
|
data/lib/fluid_cli/theme/root.rb
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
require_relative "file"
|
|
3
|
-
require "pathname"
|
|
4
|
-
|
|
5
|
-
module FluidCLI
|
|
6
|
-
module Theme
|
|
7
|
-
class Root
|
|
8
|
-
attr_reader :root, :ctx
|
|
9
|
-
|
|
10
|
-
def initialize(ctx, root:)
|
|
11
|
-
@ctx = ctx
|
|
12
|
-
@root = Pathname.new(root) if root
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
def static_asset_files
|
|
16
|
-
glob("assets/*", raise_on_dir: true)
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def liquid_files
|
|
20
|
-
glob("**/*.liquid")
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def json_files
|
|
24
|
-
glob("**/*.json")
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
def glob(pattern, raise_on_dir: false)
|
|
28
|
-
root
|
|
29
|
-
.glob(pattern)
|
|
30
|
-
.select { |path| file?(path, raise_on_dir) }
|
|
31
|
-
.map { |path| File.new(path, root) }
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
def static_asset_file?(file)
|
|
35
|
-
static_asset_files.include?(self[file])
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
def static_asset_paths
|
|
39
|
-
static_asset_files.map(&:relative_path)
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
def [](file)
|
|
43
|
-
case file
|
|
44
|
-
when File
|
|
45
|
-
file
|
|
46
|
-
when Pathname
|
|
47
|
-
File.new(file, root)
|
|
48
|
-
when String
|
|
49
|
-
File.new(root.join(file), root)
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
def file?(path, raise_on_dir = false)
|
|
54
|
-
if raise_on_dir && ::File.directory?(path)
|
|
55
|
-
@ctx.abort(@ctx.message("theme.serve.error.invalid_subdirectory", path.to_s))
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
::File.file?(path)
|
|
59
|
-
end
|
|
60
|
-
end
|
|
61
|
-
end
|
|
62
|
-
end
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module FluidCLI
|
|
4
|
-
module Theme
|
|
5
|
-
class Syncer
|
|
6
|
-
class Checksums
|
|
7
|
-
def initialize(theme)
|
|
8
|
-
@theme = theme
|
|
9
|
-
@checksum_by_key = {}
|
|
10
|
-
|
|
11
|
-
# Mutex used to coordinate changes in the checksums (shared accross `Syncer` threads)
|
|
12
|
-
@checksums_mutex = Mutex.new
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
def has?(file)
|
|
16
|
-
checksum_by_key.key?(to_key(file))
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def file_has_changed?(file)
|
|
20
|
-
file.checksum != checksum_by_key[file.relative_path]
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def delete(file)
|
|
24
|
-
checksums_mutex.synchronize do
|
|
25
|
-
checksum_by_key.delete(to_key(file))
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
def keys
|
|
30
|
-
checksum_by_key.keys
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
def [](key)
|
|
34
|
-
checksum_by_key[key]
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
def []=(key, value)
|
|
38
|
-
checksums_mutex.synchronize do
|
|
39
|
-
checksum_by_key[key] = value
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
# Generate .liquid asset files are reported twice in checksum:
|
|
44
|
-
# once of generated, once for .liquid. We only keep the .liquid, that's the one we have
|
|
45
|
-
# on disk.
|
|
46
|
-
def reject_duplicated_checksums!
|
|
47
|
-
checksums_mutex.synchronize do
|
|
48
|
-
checksum_by_key.reject! { |key, _| checksum_by_key.key?("#{key}.liquid") }
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
private
|
|
53
|
-
|
|
54
|
-
def to_key(file)
|
|
55
|
-
theme[file].relative_path
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
# Private getters only used in unit tests
|
|
59
|
-
|
|
60
|
-
attr_reader :checksum_by_key
|
|
61
|
-
attr_reader :theme
|
|
62
|
-
attr_reader :checksums_mutex
|
|
63
|
-
end
|
|
64
|
-
end
|
|
65
|
-
end
|
|
66
|
-
end
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "forwardable"
|
|
4
|
-
|
|
5
|
-
module FluidCLI
|
|
6
|
-
module Theme
|
|
7
|
-
class Syncer
|
|
8
|
-
class Downloader
|
|
9
|
-
extend Forwardable
|
|
10
|
-
|
|
11
|
-
attr_reader :syncer, :ctx
|
|
12
|
-
|
|
13
|
-
def_delegators :syncer,
|
|
14
|
-
:ctx,
|
|
15
|
-
:checksums,
|
|
16
|
-
:get_theme_resources!,
|
|
17
|
-
:wait!
|
|
18
|
-
|
|
19
|
-
def initialize(syncer, delete, &update_progress_bar_block)
|
|
20
|
-
@syncer = syncer
|
|
21
|
-
@delete = delete
|
|
22
|
-
@update_progress_bar_block = update_progress_bar_block
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
def download!
|
|
26
|
-
get_theme_resources!
|
|
27
|
-
|
|
28
|
-
if delete_local_files?
|
|
29
|
-
to_be_deleted.each { |file| delete(file) }
|
|
30
|
-
end
|
|
31
|
-
wait!(&@update_progress_bar_block)
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
private
|
|
35
|
-
|
|
36
|
-
def delete(file)
|
|
37
|
-
ctx.debug("[#{self.class}] rm #{file.relative_path}")
|
|
38
|
-
file.delete
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
def delete_local_files?
|
|
42
|
-
@delete
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
def to_be_deleted
|
|
46
|
-
@to_be_deleted ||= syncer
|
|
47
|
-
.theme
|
|
48
|
-
.theme_files
|
|
49
|
-
.reject { |file| checksums.has?(file) }.uniq
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
end
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module FluidCLI
|
|
4
|
-
module Theme
|
|
5
|
-
class Syncer
|
|
6
|
-
##
|
|
7
|
-
# FluidCLI::Theme::Syncer::ErrorReporter allows delaying log of errors,
|
|
8
|
-
# mainly to not break the progress bar.
|
|
9
|
-
#
|
|
10
|
-
class ErrorReporter
|
|
11
|
-
attr_reader :ctx, :delayed_errors
|
|
12
|
-
|
|
13
|
-
def initialize(ctx)
|
|
14
|
-
@ctx = ctx
|
|
15
|
-
@has_any_error = false
|
|
16
|
-
@delay_errors = false
|
|
17
|
-
@delayed_errors = []
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
def disable!
|
|
21
|
-
@delay_errors = true
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def enable!
|
|
25
|
-
@delay_errors = false
|
|
26
|
-
@delayed_errors.each { |error| report(error) }
|
|
27
|
-
@delayed_errors.clear
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def report(error_message)
|
|
31
|
-
if @delay_errors
|
|
32
|
-
@delayed_errors << error_message
|
|
33
|
-
else
|
|
34
|
-
@has_any_error = true
|
|
35
|
-
@ctx.error(error_message)
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
def has_any_error?
|
|
40
|
-
@has_any_error
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
end
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "tempfile"
|
|
4
|
-
|
|
5
|
-
module FluidCLI
|
|
6
|
-
module Theme
|
|
7
|
-
class Syncer
|
|
8
|
-
class Merger
|
|
9
|
-
class << self
|
|
10
|
-
##
|
|
11
|
-
# Merge `theme_file` with the `new_content` by relying on the union merge
|
|
12
|
-
#
|
|
13
|
-
def union_merge(theme_file, new_content)
|
|
14
|
-
git_merge(theme_file, new_content, ["--union", "-p"])
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
private
|
|
18
|
-
|
|
19
|
-
##
|
|
20
|
-
# Merge theme file (`FluidCLI::Theme::File`) with a new content (String),
|
|
21
|
-
# by creating a temporary file based on the `new_content`.
|
|
22
|
-
#
|
|
23
|
-
def git_merge(theme_file, new_content, opts)
|
|
24
|
-
remote_file = create_tmp_file(tmp_file_name(theme_file), new_content)
|
|
25
|
-
empty_file = create_tmp_file("empty")
|
|
26
|
-
|
|
27
|
-
FluidCLI::Git.merge_file(
|
|
28
|
-
theme_file.absolute_path,
|
|
29
|
-
empty_file.path,
|
|
30
|
-
remote_file.path,
|
|
31
|
-
opts
|
|
32
|
-
)
|
|
33
|
-
ensure
|
|
34
|
-
# Remove temporary files on Windows as well
|
|
35
|
-
remote_file.close!
|
|
36
|
-
empty_file.close!
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
def create_tmp_file(basename, content = "")
|
|
40
|
-
tmp_file = Tempfile.new(basename)
|
|
41
|
-
tmp_file.write(content)
|
|
42
|
-
tmp_file.close # Make it ready to merge
|
|
43
|
-
tmp_file
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
def tmp_file_name(ref_file)
|
|
47
|
-
"fluid-cli-merge-#{ref_file.name(".*")}"
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
end
|
|
53
|
-
end
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module FluidCLI
|
|
4
|
-
module Theme
|
|
5
|
-
class Syncer
|
|
6
|
-
class Operation
|
|
7
|
-
attr_accessor :method, :file, :options
|
|
8
|
-
|
|
9
|
-
COLOR_BY_STATUS = {
|
|
10
|
-
error: :red,
|
|
11
|
-
synced: :green,
|
|
12
|
-
warning: :yellow,
|
|
13
|
-
fixed: :cyan,
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
def initialize(ctx, method, file, options = {})
|
|
17
|
-
@ctx = ctx
|
|
18
|
-
@method = method
|
|
19
|
-
@file = file
|
|
20
|
-
@options = options
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def to_s
|
|
24
|
-
"#{method} #{file_path}"
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
def as_error_message
|
|
28
|
-
as_message_with(status: :error)
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def as_synced_message(color: :green)
|
|
32
|
-
as_message_with(status: :synced, color: color)
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
def as_fix_message
|
|
36
|
-
as_message_with(status: :fixed)
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
def file_path
|
|
40
|
-
file&.relative_path
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
private
|
|
44
|
-
|
|
45
|
-
def as_message_with(status:, color: nil)
|
|
46
|
-
color ||= COLOR_BY_STATUS[status]
|
|
47
|
-
text = "#{status.to_s.capitalize}"
|
|
48
|
-
|
|
49
|
-
"#{timestamp} {{#{color}:#{text}}} {{>}} {{blue:#{self}}}"
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
def timestamp
|
|
53
|
-
Time.now.strftime("%T")
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
end
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module FluidCLI
|
|
4
|
-
module Theme
|
|
5
|
-
class Syncer
|
|
6
|
-
##
|
|
7
|
-
# FluidCLI::Theme::Syncer::StdReporter allows disabling/enabling
|
|
8
|
-
# messages reported in the standard error output (FluidCLI::Context#puts).
|
|
9
|
-
#
|
|
10
|
-
class StandardReporter
|
|
11
|
-
attr_reader :ctx
|
|
12
|
-
|
|
13
|
-
def initialize(ctx)
|
|
14
|
-
@enabled = true
|
|
15
|
-
@ctx = ctx
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def disable!
|
|
19
|
-
@enabled = false
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def enable!
|
|
23
|
-
@enabled = true
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def report(message)
|
|
27
|
-
ctx.error(message) if @enabled
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
end
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module FluidCLI
|
|
4
|
-
module Theme
|
|
5
|
-
class Syncer
|
|
6
|
-
class UnsupportedScriptWarning
|
|
7
|
-
attr_reader :ctx
|
|
8
|
-
|
|
9
|
-
def initialize(ctx, file)
|
|
10
|
-
@ctx = ctx
|
|
11
|
-
@file = file
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def to_s
|
|
15
|
-
"\n\n#{occurrences} #{long_text}"
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
private
|
|
19
|
-
|
|
20
|
-
def occurrences
|
|
21
|
-
warnings.map { |w| occurrence(w) }.join("\n")
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def occurrence(warning)
|
|
25
|
-
line_number = "{{blue: #{warning.line} |}}"
|
|
26
|
-
pointer = pointer_message(warning)
|
|
27
|
-
|
|
28
|
-
<<~OCCURRENCE
|
|
29
|
-
#{line_number} #{warning.line_content}
|
|
30
|
-
#{pointer}
|
|
31
|
-
OCCURRENCE
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
def long_text
|
|
35
|
-
lines_and_columns = warnings.map do |warning|
|
|
36
|
-
message("line_and_column", warning.line, warning.column)
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
message("unsupported_script_text", lines_and_columns.join)
|
|
40
|
-
.split("\n")
|
|
41
|
-
.reduce("") do |text, line|
|
|
42
|
-
# Add indentation in the long text to improve readability
|
|
43
|
-
line = " #{line}"
|
|
44
|
-
|
|
45
|
-
# Inline yellow (otherwise `CLI::UI::Frame` breaks multiline formatting)
|
|
46
|
-
line = "{{yellow:#{line}}}"
|
|
47
|
-
|
|
48
|
-
"#{text}#{line}\n"
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
def pointer_message(warning)
|
|
53
|
-
padding = warning.column + warning.line.to_s.size + 2
|
|
54
|
-
text = message("unsupported_script")
|
|
55
|
-
|
|
56
|
-
"{{yellow:#{" " * padding} ^ {{bold:#{text}}}}}"
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
def message(*args)
|
|
60
|
-
key = args.shift
|
|
61
|
-
@ctx.message("theme.serve.syncer.warnings.#{key}", *args)
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
def warnings
|
|
65
|
-
@warnings ||= @file.warnings.map { |w| Warning.new(@file, w) }
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
class Warning
|
|
69
|
-
attr_reader :line, :column
|
|
70
|
-
|
|
71
|
-
def initialize(file, warning_hash)
|
|
72
|
-
@file = file
|
|
73
|
-
@line = warning_hash["line"].to_i
|
|
74
|
-
@column = warning_hash["column"].to_i
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
def line_content
|
|
78
|
-
file_lines[line - 1]
|
|
79
|
-
end
|
|
80
|
-
|
|
81
|
-
private
|
|
82
|
-
|
|
83
|
-
def file_lines
|
|
84
|
-
@file_lines ||= @file.read.split("\n")
|
|
85
|
-
end
|
|
86
|
-
end
|
|
87
|
-
end
|
|
88
|
-
end
|
|
89
|
-
end
|
|
90
|
-
end
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require_relative "apply_to_all_form"
|
|
4
|
-
|
|
5
|
-
module FluidCLI
|
|
6
|
-
module Theme
|
|
7
|
-
class Syncer
|
|
8
|
-
class Uploader
|
|
9
|
-
module Forms
|
|
10
|
-
class ApplyToAll
|
|
11
|
-
attr_reader :value
|
|
12
|
-
|
|
13
|
-
def initialize(ctx, number_of_files)
|
|
14
|
-
@ctx = ctx
|
|
15
|
-
@number_of_files = number_of_files
|
|
16
|
-
@value = nil
|
|
17
|
-
@apply = nil
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
def apply?(value)
|
|
21
|
-
return unless @number_of_files > 1
|
|
22
|
-
|
|
23
|
-
if @apply.nil?
|
|
24
|
-
@apply = ask.apply?
|
|
25
|
-
@value = value if @apply
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
@apply
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
private
|
|
32
|
-
|
|
33
|
-
def ask
|
|
34
|
-
ApplyToAllForm.ask(@ctx, [], number_of_files: @number_of_files)
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
end
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module FluidCLI
|
|
4
|
-
module Theme
|
|
5
|
-
class Syncer
|
|
6
|
-
class Uploader
|
|
7
|
-
module Forms
|
|
8
|
-
class ApplyToAllForm < FluidCLI::Form
|
|
9
|
-
attr_accessor :apply
|
|
10
|
-
flag_arguments :number_of_files
|
|
11
|
-
|
|
12
|
-
def ask
|
|
13
|
-
title = message("title", number_of_files - 1)
|
|
14
|
-
|
|
15
|
-
self.apply = CLI::UI::Prompt.ask(title, allow_empty: false) do |handler|
|
|
16
|
-
handler.option(message("yes")) { true }
|
|
17
|
-
handler.option(message("no")) { false }
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
self
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def apply?
|
|
24
|
-
apply
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
private
|
|
28
|
-
|
|
29
|
-
def message(key, *params)
|
|
30
|
-
ctx.message("theme.serve.syncer.forms.apply_to_all.#{key}", *params)
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
end
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module FluidCLI
|
|
4
|
-
module Theme
|
|
5
|
-
class Syncer
|
|
6
|
-
class Uploader
|
|
7
|
-
module Forms
|
|
8
|
-
class BaseStrategyForm < FluidCLI::Form
|
|
9
|
-
attr_accessor :strategy
|
|
10
|
-
|
|
11
|
-
def ask
|
|
12
|
-
ctx.puts(title_context(file))
|
|
13
|
-
|
|
14
|
-
self.strategy = CLI::UI::Prompt.ask(title_question, allow_empty: false) do |handler|
|
|
15
|
-
strategies.each do |strategy|
|
|
16
|
-
handler.option(as_text(strategy)) { strategy }
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
exit_cli if self.strategy == :exit
|
|
21
|
-
|
|
22
|
-
self
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
protected
|
|
26
|
-
|
|
27
|
-
##
|
|
28
|
-
# List of strategies that populate the form options
|
|
29
|
-
#
|
|
30
|
-
def strategies
|
|
31
|
-
raise "`#{self.class.name}#strategies' must be defined"
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
##
|
|
35
|
-
# Message prefix for the form title and options (strategies).
|
|
36
|
-
# See the methods `title` and `as_text`
|
|
37
|
-
#
|
|
38
|
-
def prefix
|
|
39
|
-
raise "`#{self.class.name}#prefix' must be defined"
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
private
|
|
43
|
-
|
|
44
|
-
def exit_cli
|
|
45
|
-
exit(0)
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
def title_context(file)
|
|
49
|
-
ctx.message("#{prefix}.title_context", file.relative_path)
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
def title_question
|
|
53
|
-
ctx.message("#{prefix}.title_question")
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
def as_text(strategy)
|
|
57
|
-
ctx.message("#{prefix}.#{strategy}")
|
|
58
|
-
end
|
|
59
|
-
end
|
|
60
|
-
end
|
|
61
|
-
end
|
|
62
|
-
end
|
|
63
|
-
end
|
|
64
|
-
end
|