shopify-cli 0.9.2 → 1.0.3
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/CHANGELOG.md +24 -3
- data/docs/_config.yml +3 -0
- data/docs/_data/nav.yml +9 -0
- data/docs/getting-started/index.md +5 -40
- data/docs/getting-started/install/index.md +75 -0
- data/docs/getting-started/migrate/index.md +96 -0
- data/docs/getting-started/uninstall/index.md +37 -0
- data/docs/getting-started/upgrade/index.md +37 -0
- data/docs/index.md +5 -6
- data/lib/project_types/extension/cli.rb +3 -2
- data/lib/project_types/extension/commands/build.rb +1 -1
- data/lib/project_types/extension/commands/tunnel.rb +1 -1
- data/lib/project_types/extension/forms/register.rb +2 -3
- data/lib/project_types/extension/graphql/get_app_by_api_key.graphql +9 -0
- data/lib/project_types/extension/tasks/converters/app_converter.rb +27 -0
- data/lib/project_types/extension/tasks/get_app.rb +22 -0
- data/lib/project_types/extension/tasks/get_apps.rb +1 -6
- data/lib/project_types/node/forms/create.rb +3 -54
- data/lib/project_types/node/messages/messages.rb +3 -14
- data/lib/project_types/rails/cli.rb +0 -1
- data/lib/project_types/rails/forms/create.rb +3 -52
- data/lib/project_types/rails/messages/messages.rb +2 -13
- data/lib/project_types/script/cli.rb +5 -5
- data/lib/project_types/script/commands/create.rb +5 -4
- data/lib/project_types/script/commands/disable.rb +4 -14
- data/lib/project_types/script/commands/enable.rb +35 -11
- data/lib/project_types/script/commands/push.rb +9 -9
- data/lib/project_types/script/config/extension_points.yml +9 -3
- data/lib/project_types/script/errors.rb +1 -0
- data/lib/project_types/script/forms/create.rb +8 -4
- data/lib/project_types/script/forms/script_form.rb +5 -2
- data/lib/project_types/script/layers/application/create_script.rb +14 -20
- data/lib/project_types/script/layers/application/disable_script.rb +9 -7
- data/lib/project_types/script/layers/application/enable_script.rb +11 -9
- data/lib/project_types/script/layers/application/project_dependencies.rb +0 -5
- data/lib/project_types/script/layers/application/push_script.rb +6 -4
- data/lib/project_types/script/layers/infrastructure/assemblyscript_project_creator.rb +106 -0
- data/lib/project_types/script/layers/infrastructure/assemblyscript_task_runner.rb +2 -2
- data/lib/project_types/script/layers/infrastructure/errors.rb +2 -1
- data/lib/project_types/script/layers/infrastructure/project_creator.rb +23 -0
- data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +1 -1
- data/lib/project_types/script/layers/infrastructure/script_repository.rb +1 -34
- data/lib/project_types/script/layers/infrastructure/script_service.rb +2 -0
- data/lib/project_types/script/messages/messages.rb +21 -25
- data/lib/project_types/script/script_project.rb +8 -4
- data/lib/project_types/script/templates/ts/as-pect.config.js +6 -0
- data/lib/project_types/script/templates/ts/as-pect.d.ts +1 -0
- data/lib/project_types/script/ui/error_handler.rb +9 -0
- data/lib/project_types/script/ui/printing_spinner.rb +75 -0
- data/lib/shopify-cli/admin_api.rb +1 -2
- data/lib/shopify-cli/admin_api/populate_resource_command.rb +10 -1
- data/lib/shopify-cli/admin_api/schema.rb +20 -8
- data/lib/shopify-cli/command.rb +2 -5
- data/lib/shopify-cli/commands.rb +1 -0
- data/lib/shopify-cli/commands/config.rb +44 -0
- data/lib/shopify-cli/commands/connect.rb +17 -10
- data/lib/shopify-cli/commands/create.rb +1 -1
- data/lib/shopify-cli/commands/help.rb +1 -1
- data/lib/shopify-cli/commands/system.rb +1 -1
- data/lib/shopify-cli/context.rb +10 -1
- data/lib/shopify-cli/core.rb +0 -1
- data/lib/shopify-cli/core/entry_point.rb +6 -0
- data/lib/shopify-cli/core/finalize.rb +13 -0
- data/lib/shopify-cli/feature.rb +97 -0
- data/lib/shopify-cli/messages/messages.rb +45 -2
- data/lib/shopify-cli/partners_api/organizations.rb +7 -7
- data/lib/shopify-cli/project_type.rb +2 -5
- data/lib/shopify-cli/tasks.rb +1 -0
- data/lib/shopify-cli/tasks/ensure_env.rb +0 -1
- data/lib/shopify-cli/tasks/select_org_and_shop.rb +77 -0
- data/lib/shopify-cli/tasks/update_dashboard_urls.rb +4 -3
- data/lib/shopify-cli/tunnel.rb +66 -10
- data/lib/shopify-cli/version.rb +1 -1
- data/lib/shopify_cli.rb +1 -0
- data/vendor/deps/cli-ui/REVISION +1 -1
- data/vendor/deps/cli-ui/lib/cli/ui.rb +52 -11
- data/vendor/deps/cli-ui/lib/cli/ui/color.rb +11 -7
- data/vendor/deps/cli-ui/lib/cli/ui/formatter.rb +34 -21
- data/vendor/deps/cli-ui/lib/cli/ui/frame.rb +107 -149
- data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_stack.rb +99 -0
- data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style.rb +119 -0
- data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style/box.rb +158 -0
- data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style/bracket.rb +112 -0
- data/vendor/deps/cli-ui/lib/cli/ui/glyph.rb +9 -15
- data/vendor/deps/cli-ui/lib/cli/ui/printer.rb +47 -0
- data/vendor/deps/cli-ui/lib/cli/ui/progress.rb +9 -7
- data/vendor/deps/cli-ui/lib/cli/ui/prompt.rb +39 -14
- data/vendor/deps/cli-ui/lib/cli/ui/prompt/interactive_options.rb +62 -44
- data/vendor/deps/cli-ui/lib/cli/ui/prompt/options_handler.rb +7 -2
- data/vendor/deps/cli-ui/lib/cli/ui/spinner.rb +23 -3
- data/vendor/deps/cli-ui/lib/cli/ui/spinner/spin_group.rb +34 -10
- data/vendor/deps/cli-ui/lib/cli/ui/stdout_router.rb +12 -7
- data/vendor/deps/cli-ui/lib/cli/ui/terminal.rb +26 -16
- data/vendor/deps/cli-ui/lib/cli/ui/truncater.rb +3 -3
- data/vendor/deps/cli-ui/lib/cli/ui/widgets.rb +75 -0
- data/vendor/deps/cli-ui/lib/cli/ui/widgets/base.rb +27 -0
- data/vendor/deps/cli-ui/lib/cli/ui/widgets/status.rb +61 -0
- metadata +25 -9
- data/lib/project_types/extension/features/tunnel_url.rb +0 -20
- data/lib/project_types/script/forms/enable.rb +0 -24
- data/lib/project_types/script/forms/push.rb +0 -19
- data/lib/project_types/script/layers/infrastructure/assemblyscript_dependency_manager.rb +0 -51
- data/lib/project_types/script/layers/infrastructure/dependency_manager.rb +0 -36
- data/lib/project_types/script/layers/infrastructure/test_suite_repository.rb +0 -62
- data/vendor/deps/cli-ui/lib/cli/ui/box.rb +0 -15
|
@@ -15,8 +15,13 @@ module CLI
|
|
|
15
15
|
@options[option] = handler
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
-
def call(
|
|
19
|
-
|
|
18
|
+
def call(options)
|
|
19
|
+
case options
|
|
20
|
+
when Array
|
|
21
|
+
options.map { |option| @options[option].call(options) }
|
|
22
|
+
else
|
|
23
|
+
@options[options].call(options)
|
|
24
|
+
end
|
|
20
25
|
end
|
|
21
26
|
end
|
|
22
27
|
end
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# frozen-string-literal: true
|
|
1
2
|
require 'cli/ui'
|
|
2
3
|
|
|
3
4
|
module CLI
|
|
@@ -9,11 +10,30 @@ module CLI
|
|
|
9
10
|
PERIOD = 0.1 # seconds
|
|
10
11
|
TASK_FAILED = :task_failed
|
|
11
12
|
|
|
13
|
+
RUNES = %w(⠋ ⠙ ⠹ ⠸ ⠼ ⠴ ⠦ ⠧ ⠇ ⠏).freeze
|
|
14
|
+
|
|
12
15
|
begin
|
|
13
|
-
runes = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏']
|
|
14
16
|
colors = [CLI::UI::Color::CYAN.code] * 5 + [CLI::UI::Color::MAGENTA.code] * 5
|
|
15
|
-
raise unless
|
|
16
|
-
GLYPHS = colors.zip(
|
|
17
|
+
raise unless RUNES.size == colors.size
|
|
18
|
+
GLYPHS = colors.zip(RUNES).map(&:join)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
class << self
|
|
22
|
+
attr_accessor(:index)
|
|
23
|
+
|
|
24
|
+
# We use this from CLI::UI::Widgets::Status to render an additional
|
|
25
|
+
# spinner next to the "working" element. While this global state looks
|
|
26
|
+
# a bit repulsive at first, it's worth realizing that:
|
|
27
|
+
#
|
|
28
|
+
# * It's managed by the SpinGroup#wait method, not individual tasks; and
|
|
29
|
+
# * It would be complete insanity to run two separate but concurrent SpinGroups.
|
|
30
|
+
#
|
|
31
|
+
# While it would be possible to stitch through some connection between
|
|
32
|
+
# the SpinGroup and the Widgets included in its title, this is simpler
|
|
33
|
+
# in practice and seems unlikely to cause issues in practice.
|
|
34
|
+
def current_rune
|
|
35
|
+
RUNES[index || 0]
|
|
36
|
+
end
|
|
17
37
|
end
|
|
18
38
|
|
|
19
39
|
# Adds a single spinner
|
|
@@ -25,6 +25,7 @@ module CLI
|
|
|
25
25
|
@consumed_lines = 0
|
|
26
26
|
@tasks = []
|
|
27
27
|
@auto_debrief = auto_debrief
|
|
28
|
+
@start = Time.new
|
|
28
29
|
end
|
|
29
30
|
|
|
30
31
|
class Task
|
|
@@ -40,6 +41,7 @@ module CLI
|
|
|
40
41
|
#
|
|
41
42
|
def initialize(title, &block)
|
|
42
43
|
@title = title
|
|
44
|
+
@always_full_render = title =~ Formatter::SCAN_WIDGET
|
|
43
45
|
@thread = Thread.new do
|
|
44
46
|
cap = CLI::UI::StdoutRouter::Capture.new(self, with_frame_inset: false, &block)
|
|
45
47
|
begin
|
|
@@ -50,8 +52,9 @@ module CLI
|
|
|
50
52
|
end
|
|
51
53
|
end
|
|
52
54
|
|
|
55
|
+
@m = Mutex.new
|
|
53
56
|
@force_full_render = false
|
|
54
|
-
@done
|
|
57
|
+
@done = false
|
|
55
58
|
@exception = nil
|
|
56
59
|
@success = false
|
|
57
60
|
end
|
|
@@ -75,7 +78,17 @@ module CLI
|
|
|
75
78
|
@done
|
|
76
79
|
end
|
|
77
80
|
|
|
78
|
-
# Re-renders the task if required
|
|
81
|
+
# Re-renders the task if required:
|
|
82
|
+
#
|
|
83
|
+
# We try to be as lazy as possible in re-rendering the full line. The
|
|
84
|
+
# spinner rune will change on each render for the most part, but the
|
|
85
|
+
# body text will rarely have changed. If the body text *has* changed,
|
|
86
|
+
# we set @force_full_render.
|
|
87
|
+
#
|
|
88
|
+
# Further, if the title string includes any CLI::UI::Widgets, we
|
|
89
|
+
# assume that it may change from render to render, since those
|
|
90
|
+
# evaluate more dynamically than the rest of our format codes, which
|
|
91
|
+
# are just text formatters. This is controlled by @always_full_render.
|
|
79
92
|
#
|
|
80
93
|
# ==== Attributes
|
|
81
94
|
#
|
|
@@ -84,10 +97,17 @@ module CLI
|
|
|
84
97
|
# * +width+ - current terminal width to format for
|
|
85
98
|
#
|
|
86
99
|
def render(index, force = true, width: CLI::UI::Terminal.width)
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
100
|
+
@m.synchronize do
|
|
101
|
+
begin
|
|
102
|
+
if force || @always_full_render || @force_full_render
|
|
103
|
+
full_render(index, width)
|
|
104
|
+
else
|
|
105
|
+
partial_render(index)
|
|
106
|
+
end
|
|
107
|
+
ensure
|
|
108
|
+
@force_full_render = false
|
|
109
|
+
end
|
|
110
|
+
end
|
|
91
111
|
end
|
|
92
112
|
|
|
93
113
|
# Update the spinner title
|
|
@@ -97,8 +117,11 @@ module CLI
|
|
|
97
117
|
# * +title+ - title to change the spinner to
|
|
98
118
|
#
|
|
99
119
|
def update_title(new_title)
|
|
100
|
-
@
|
|
101
|
-
|
|
120
|
+
@m.synchronize do
|
|
121
|
+
@always_full_render = new_title =~ Formatter::SCAN_WIDGET
|
|
122
|
+
@title = new_title
|
|
123
|
+
@force_full_render = true
|
|
124
|
+
end
|
|
102
125
|
end
|
|
103
126
|
|
|
104
127
|
private
|
|
@@ -182,7 +205,7 @@ module CLI
|
|
|
182
205
|
@consumed_lines += 1
|
|
183
206
|
else
|
|
184
207
|
offset = @consumed_lines - int_index
|
|
185
|
-
move_to
|
|
208
|
+
move_to = CLI::UI::ANSI.cursor_up(offset) + "\r"
|
|
186
209
|
move_from = "\r" + CLI::UI::ANSI.cursor_down(offset)
|
|
187
210
|
|
|
188
211
|
print(move_to + task.render(idx, idx.zero?, width: width) + move_from)
|
|
@@ -194,6 +217,7 @@ module CLI
|
|
|
194
217
|
break if all_done
|
|
195
218
|
|
|
196
219
|
idx = (idx + 1) % GLYPHS.size
|
|
220
|
+
Spinner.index = idx
|
|
197
221
|
sleep(PERIOD)
|
|
198
222
|
end
|
|
199
223
|
|
|
@@ -217,7 +241,7 @@ module CLI
|
|
|
217
241
|
out = task.stdout
|
|
218
242
|
err = task.stderr
|
|
219
243
|
|
|
220
|
-
CLI::UI::Frame.open('Task Failed: ' + task.title, color: :red) do
|
|
244
|
+
CLI::UI::Frame.open('Task Failed: ' + task.title, color: :red, timing: Time.new - @start) do
|
|
221
245
|
if e
|
|
222
246
|
puts "#{e.class}: #{e.message}"
|
|
223
247
|
puts "\tfrom #{e.backtrace.join("\n\tfrom ")}"
|
|
@@ -26,13 +26,14 @@ module CLI
|
|
|
26
26
|
end
|
|
27
27
|
end
|
|
28
28
|
|
|
29
|
-
hook = Thread.current[:cliui_output_hook]
|
|
30
29
|
# hook return of false suppresses output.
|
|
31
|
-
if
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
if (hook = Thread.current[:cliui_output_hook])
|
|
31
|
+
return if hook.call(args.map(&:to_s).join, @name) == false
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
@stream.write_without_cli_ui(*prepend_id(@stream, args))
|
|
35
|
+
if (dup = StdoutRouter.duplicate_output_to)
|
|
36
|
+
dup.write(*prepend_id(dup, args))
|
|
36
37
|
end
|
|
37
38
|
end
|
|
38
39
|
|
|
@@ -117,6 +118,10 @@ module CLI
|
|
|
117
118
|
prev_frame_inset = Thread.current[:no_cliui_frame_inset]
|
|
118
119
|
prev_hook = Thread.current[:cliui_output_hook]
|
|
119
120
|
|
|
121
|
+
if Thread.current.respond_to?(:report_on_exception)
|
|
122
|
+
Thread.current.report_on_exception = false
|
|
123
|
+
end
|
|
124
|
+
|
|
120
125
|
self.class.with_stdin_masked do
|
|
121
126
|
Thread.current[:no_cliui_frame_inset] = !@with_frame_inset
|
|
122
127
|
Thread.current[:cliui_output_hook] = ->(data, stream) do
|
|
@@ -159,7 +164,7 @@ module CLI
|
|
|
159
164
|
id = format("%05d", rand(10**5))
|
|
160
165
|
Thread.current[:cliui_output_id] = {
|
|
161
166
|
id: id,
|
|
162
|
-
streams: on_streams
|
|
167
|
+
streams: on_streams,
|
|
163
168
|
}
|
|
164
169
|
yield(id)
|
|
165
170
|
ensure
|
|
@@ -8,28 +8,38 @@ module CLI
|
|
|
8
8
|
DEFAULT_HEIGHT = 24
|
|
9
9
|
|
|
10
10
|
# Returns the width of the terminal, if possible
|
|
11
|
-
# Otherwise will return
|
|
11
|
+
# Otherwise will return DEFAULT_WIDTH
|
|
12
12
|
#
|
|
13
13
|
def self.width
|
|
14
|
-
|
|
15
|
-
width = console.winsize[1]
|
|
16
|
-
width.zero? ? DEFAULT_WIDTH : width
|
|
17
|
-
else
|
|
18
|
-
DEFAULT_WIDTH
|
|
19
|
-
end
|
|
20
|
-
rescue Errno::EIO
|
|
21
|
-
DEFAULT_WIDTH
|
|
14
|
+
winsize[1]
|
|
22
15
|
end
|
|
23
16
|
|
|
17
|
+
# Returns the width of the terminal, if possible
|
|
18
|
+
# Otherwise, will return DEFAULT_HEIGHT
|
|
19
|
+
#
|
|
24
20
|
def self.height
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
21
|
+
winsize[0]
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def self.winsize
|
|
25
|
+
@winsize ||= begin
|
|
26
|
+
winsize = IO.console.winsize
|
|
27
|
+
setup_winsize_trap
|
|
28
|
+
|
|
29
|
+
if winsize.any?(&:zero?)
|
|
30
|
+
[DEFAULT_HEIGHT, DEFAULT_WIDTH]
|
|
31
|
+
else
|
|
32
|
+
winsize
|
|
33
|
+
end
|
|
34
|
+
rescue
|
|
35
|
+
[DEFAULT_HEIGHT, DEFAULT_WIDTH]
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def self.setup_winsize_trap
|
|
40
|
+
@winsize_trap ||= Signal.trap('WINCH') do
|
|
41
|
+
@winsize = nil
|
|
30
42
|
end
|
|
31
|
-
rescue Errno::EIO
|
|
32
|
-
DEFAULT_HEIGHT
|
|
33
43
|
end
|
|
34
44
|
end
|
|
35
45
|
end
|
|
@@ -52,11 +52,11 @@ module CLI
|
|
|
52
52
|
end
|
|
53
53
|
end
|
|
54
54
|
when PARSE_ESC
|
|
55
|
-
case cp
|
|
55
|
+
mode = case cp
|
|
56
56
|
when LEFT_SQUARE_BRACKET
|
|
57
|
-
|
|
57
|
+
PARSE_ANSI
|
|
58
58
|
else
|
|
59
|
-
|
|
59
|
+
PARSE_ROOT
|
|
60
60
|
end
|
|
61
61
|
when PARSE_ANSI
|
|
62
62
|
# ANSI escape codes preeeetty much have the format of:
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
require('cli/ui')
|
|
2
|
+
|
|
3
|
+
module CLI
|
|
4
|
+
module UI
|
|
5
|
+
# Widgets are formatter objects with more custom implementations than the
|
|
6
|
+
# other features, which all center around formatting text with colours,
|
|
7
|
+
# etc.
|
|
8
|
+
#
|
|
9
|
+
# If you want to extend CLI::UI with your own widgets, you may want to do
|
|
10
|
+
# something like this:
|
|
11
|
+
#
|
|
12
|
+
# require('cli/ui')
|
|
13
|
+
# class MyWidget < CLI::UI::Widgets::Base
|
|
14
|
+
# # ...
|
|
15
|
+
# end
|
|
16
|
+
# CLI::UI::Widgets.register('my-widget') { MyWidget }
|
|
17
|
+
# puts(CLI::UI.fmt("{{@widget/my-widget:args}}"))
|
|
18
|
+
module Widgets
|
|
19
|
+
MAP = {}
|
|
20
|
+
|
|
21
|
+
autoload(:Base, 'cli/ui/widgets/base')
|
|
22
|
+
|
|
23
|
+
def self.register(name, &cb)
|
|
24
|
+
MAP[name] = cb
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
autoload(:Status, 'cli/ui/widgets/status')
|
|
28
|
+
register('status') { Widgets::Status }
|
|
29
|
+
|
|
30
|
+
# Looks up a widget by handle
|
|
31
|
+
#
|
|
32
|
+
# ==== Raises
|
|
33
|
+
# Raises InvalidWidgetHandle if the widget is not available.
|
|
34
|
+
#
|
|
35
|
+
# ==== Returns
|
|
36
|
+
# A callable widget, to be invoked like `.call(argstring)`
|
|
37
|
+
#
|
|
38
|
+
def self.lookup(handle)
|
|
39
|
+
MAP.fetch(handle.to_s).call
|
|
40
|
+
rescue KeyError, NameError
|
|
41
|
+
raise(InvalidWidgetHandle, handle)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# All available widgets by name
|
|
45
|
+
#
|
|
46
|
+
def self.available
|
|
47
|
+
MAP.keys
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
class InvalidWidgetHandle < ArgumentError
|
|
51
|
+
def initialize(handle)
|
|
52
|
+
@handle = handle
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def message
|
|
56
|
+
keys = Widget.available.join(',')
|
|
57
|
+
"invalid widget handle: #{@handle} " \
|
|
58
|
+
"-- must be one of CLI::UI::Widgets.available (#{keys})"
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
class InvalidWidgetArguments < ArgumentError
|
|
63
|
+
def initialize(argstring, pattern)
|
|
64
|
+
@argstring = argstring
|
|
65
|
+
@pattern = pattern
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def message
|
|
69
|
+
"invalid widget arguments: #{@argstring} " \
|
|
70
|
+
"-- must match pattern: #{@pattern.inspect}"
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
require('cli/ui')
|
|
2
|
+
|
|
3
|
+
module CLI
|
|
4
|
+
module UI
|
|
5
|
+
module Widgets
|
|
6
|
+
class Base
|
|
7
|
+
def self.call(argstring)
|
|
8
|
+
new(argstring).render
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def initialize(argstring)
|
|
12
|
+
pat = self.class.argparse_pattern
|
|
13
|
+
unless (@match_data = pat.match(argstring))
|
|
14
|
+
raise(Widgets::InvalidWidgetArguments.new(argstring, pat))
|
|
15
|
+
end
|
|
16
|
+
@match_data.names.each do |name|
|
|
17
|
+
instance_variable_set(:"@#{name}", @match_data[name])
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def self.argparse_pattern
|
|
22
|
+
const_get(:ARGPARSE_PATTERN)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# frozen-string-literal: true
|
|
2
|
+
require('cli/ui')
|
|
3
|
+
|
|
4
|
+
module CLI
|
|
5
|
+
module UI
|
|
6
|
+
module Widgets
|
|
7
|
+
class Status < Widgets::Base
|
|
8
|
+
ARGPARSE_PATTERN = %r{
|
|
9
|
+
\A (?<succeeded> \d+)
|
|
10
|
+
: (?<failed> \d+)
|
|
11
|
+
: (?<working> \d+)
|
|
12
|
+
: (?<pending> \d+) \z
|
|
13
|
+
}x # e.g. "1:23:3:404"
|
|
14
|
+
OPEN = Color::RESET.code + Color::BOLD.code + '[' + Color::RESET.code
|
|
15
|
+
CLOSE = Color::RESET.code + Color::BOLD.code + ']' + Color::RESET.code
|
|
16
|
+
ARROW = Color::RESET.code + Color::GRAY.code + '◂' + Color::RESET.code
|
|
17
|
+
COMMA = Color::RESET.code + Color::GRAY.code + ',' + Color::RESET.code
|
|
18
|
+
|
|
19
|
+
SPINNER_STOPPED = '⠿'
|
|
20
|
+
EMPTY_SET = '∅'
|
|
21
|
+
|
|
22
|
+
def render
|
|
23
|
+
if zero?(@succeeded) && zero?(@failed) && zero?(@working) && zero?(@pending)
|
|
24
|
+
Color::RESET.code + Color::BOLD.code + EMPTY_SET + Color::RESET.code
|
|
25
|
+
else
|
|
26
|
+
# [ 0✓ , 2✗ ◂ 3⠼ ◂ 4⌛︎ ]
|
|
27
|
+
"#{OPEN}#{succeeded_part}#{COMMA}#{failed_part}#{ARROW}#{working_part}#{ARROW}#{pending_part}#{CLOSE}"
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
private
|
|
32
|
+
|
|
33
|
+
def zero?(num_str)
|
|
34
|
+
num_str == '0'
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def colorize_if_nonzero(num_str, rune, color)
|
|
38
|
+
color = Color::GRAY if zero?(num_str)
|
|
39
|
+
color.code + num_str + rune
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def succeeded_part
|
|
43
|
+
colorize_if_nonzero(@succeeded, Glyph::CHECK.char, Color::GREEN)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def failed_part
|
|
47
|
+
colorize_if_nonzero(@failed, Glyph::X.char, Color::RED)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def working_part
|
|
51
|
+
rune = zero?(@working) ? SPINNER_STOPPED : Spinner.current_rune
|
|
52
|
+
colorize_if_nonzero(@working, rune, Color::BLUE)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def pending_part
|
|
56
|
+
colorize_if_nonzero(@pending, Glyph::HOURGLASS.char, Color::WHITE)
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: shopify-cli
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 1.0.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Shopify
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2020-
|
|
11
|
+
date: 2020-08-04 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -111,6 +111,10 @@ files:
|
|
|
111
111
|
- docs/core/index.md
|
|
112
112
|
- docs/css/docs.css
|
|
113
113
|
- docs/getting-started/index.md
|
|
114
|
+
- docs/getting-started/install/index.md
|
|
115
|
+
- docs/getting-started/migrate/index.md
|
|
116
|
+
- docs/getting-started/uninstall/index.md
|
|
117
|
+
- docs/getting-started/upgrade/index.md
|
|
114
118
|
- docs/help/start-app/index.md
|
|
115
119
|
- docs/images/header.png
|
|
116
120
|
- docs/index.md
|
|
@@ -149,9 +153,9 @@ files:
|
|
|
149
153
|
- lib/project_types/extension/features/argo_setup.rb
|
|
150
154
|
- lib/project_types/extension/features/argo_setup_step.rb
|
|
151
155
|
- lib/project_types/extension/features/argo_setup_steps.rb
|
|
152
|
-
- lib/project_types/extension/features/tunnel_url.rb
|
|
153
156
|
- lib/project_types/extension/forms/create.rb
|
|
154
157
|
- lib/project_types/extension/forms/register.rb
|
|
158
|
+
- lib/project_types/extension/graphql/get_app_by_api_key.graphql
|
|
155
159
|
- lib/project_types/extension/messages/message_loading.rb
|
|
156
160
|
- lib/project_types/extension/messages/messages.rb
|
|
157
161
|
- lib/project_types/extension/models/app.rb
|
|
@@ -161,10 +165,12 @@ files:
|
|
|
161
165
|
- lib/project_types/extension/models/types/subscription_management.rb
|
|
162
166
|
- lib/project_types/extension/models/validation_error.rb
|
|
163
167
|
- lib/project_types/extension/models/version.rb
|
|
168
|
+
- lib/project_types/extension/tasks/converters/app_converter.rb
|
|
164
169
|
- lib/project_types/extension/tasks/converters/registration_converter.rb
|
|
165
170
|
- lib/project_types/extension/tasks/converters/validation_error_converter.rb
|
|
166
171
|
- lib/project_types/extension/tasks/converters/version_converter.rb
|
|
167
172
|
- lib/project_types/extension/tasks/create_extension.rb
|
|
173
|
+
- lib/project_types/extension/tasks/get_app.rb
|
|
168
174
|
- lib/project_types/extension/tasks/get_apps.rb
|
|
169
175
|
- lib/project_types/extension/tasks/update_draft.rb
|
|
170
176
|
- lib/project_types/extension/tasks/user_errors.rb
|
|
@@ -210,8 +216,6 @@ files:
|
|
|
210
216
|
- lib/project_types/script/config/extension_points.yml
|
|
211
217
|
- lib/project_types/script/errors.rb
|
|
212
218
|
- lib/project_types/script/forms/create.rb
|
|
213
|
-
- lib/project_types/script/forms/enable.rb
|
|
214
|
-
- lib/project_types/script/forms/push.rb
|
|
215
219
|
- lib/project_types/script/forms/script_form.rb
|
|
216
220
|
- lib/project_types/script/graphql/app_script_update_or_create.graphql
|
|
217
221
|
- lib/project_types/script/graphql/script_service_proxy.graphql
|
|
@@ -228,21 +232,22 @@ files:
|
|
|
228
232
|
- lib/project_types/script/layers/domain/extension_point.rb
|
|
229
233
|
- lib/project_types/script/layers/domain/push_package.rb
|
|
230
234
|
- lib/project_types/script/layers/domain/script.rb
|
|
231
|
-
- lib/project_types/script/layers/infrastructure/
|
|
235
|
+
- lib/project_types/script/layers/infrastructure/assemblyscript_project_creator.rb
|
|
232
236
|
- lib/project_types/script/layers/infrastructure/assemblyscript_task_runner.rb
|
|
233
237
|
- lib/project_types/script/layers/infrastructure/assemblyscript_tsconfig.rb
|
|
234
|
-
- lib/project_types/script/layers/infrastructure/dependency_manager.rb
|
|
235
238
|
- lib/project_types/script/layers/infrastructure/errors.rb
|
|
236
239
|
- lib/project_types/script/layers/infrastructure/extension_point_repository.rb
|
|
240
|
+
- lib/project_types/script/layers/infrastructure/project_creator.rb
|
|
237
241
|
- lib/project_types/script/layers/infrastructure/push_package_repository.rb
|
|
238
242
|
- lib/project_types/script/layers/infrastructure/script_repository.rb
|
|
239
243
|
- lib/project_types/script/layers/infrastructure/script_service.rb
|
|
240
244
|
- lib/project_types/script/layers/infrastructure/task_runner.rb
|
|
241
|
-
- lib/project_types/script/layers/infrastructure/test_suite_repository.rb
|
|
242
245
|
- lib/project_types/script/messages/messages.rb
|
|
243
246
|
- lib/project_types/script/script_project.rb
|
|
244
247
|
- lib/project_types/script/templates/ts/as-pect.config.js
|
|
248
|
+
- lib/project_types/script/templates/ts/as-pect.d.ts
|
|
245
249
|
- lib/project_types/script/ui/error_handler.rb
|
|
250
|
+
- lib/project_types/script/ui/printing_spinner.rb
|
|
246
251
|
- lib/project_types/script/ui/strict_spinner.rb
|
|
247
252
|
- lib/rubygems_plugin.rb
|
|
248
253
|
- lib/shopify-cli/admin_api.rb
|
|
@@ -251,6 +256,7 @@ files:
|
|
|
251
256
|
- lib/shopify-cli/api.rb
|
|
252
257
|
- lib/shopify-cli/command.rb
|
|
253
258
|
- lib/shopify-cli/commands.rb
|
|
259
|
+
- lib/shopify-cli/commands/config.rb
|
|
254
260
|
- lib/shopify-cli/commands/connect.rb
|
|
255
261
|
- lib/shopify-cli/commands/create.rb
|
|
256
262
|
- lib/shopify-cli/commands/help.rb
|
|
@@ -261,9 +267,11 @@ files:
|
|
|
261
267
|
- lib/shopify-cli/core.rb
|
|
262
268
|
- lib/shopify-cli/core/entry_point.rb
|
|
263
269
|
- lib/shopify-cli/core/executor.rb
|
|
270
|
+
- lib/shopify-cli/core/finalize.rb
|
|
264
271
|
- lib/shopify-cli/core/help_resolver.rb
|
|
265
272
|
- lib/shopify-cli/core/monorail.rb
|
|
266
273
|
- lib/shopify-cli/db.rb
|
|
274
|
+
- lib/shopify-cli/feature.rb
|
|
267
275
|
- lib/shopify-cli/form.rb
|
|
268
276
|
- lib/shopify-cli/git.rb
|
|
269
277
|
- lib/shopify-cli/helpers.rb
|
|
@@ -290,6 +298,7 @@ files:
|
|
|
290
298
|
- lib/shopify-cli/tasks/ensure_dev_store.rb
|
|
291
299
|
- lib/shopify-cli/tasks/ensure_env.rb
|
|
292
300
|
- lib/shopify-cli/tasks/ensure_loopback_url.rb
|
|
301
|
+
- lib/shopify-cli/tasks/select_org_and_shop.rb
|
|
293
302
|
- lib/shopify-cli/tasks/update_dashboard_urls.rb
|
|
294
303
|
- lib/shopify-cli/tunnel.rb
|
|
295
304
|
- lib/shopify-cli/version.rb
|
|
@@ -318,11 +327,15 @@ files:
|
|
|
318
327
|
- vendor/deps/cli-ui/REVISION
|
|
319
328
|
- vendor/deps/cli-ui/lib/cli/ui.rb
|
|
320
329
|
- vendor/deps/cli-ui/lib/cli/ui/ansi.rb
|
|
321
|
-
- vendor/deps/cli-ui/lib/cli/ui/box.rb
|
|
322
330
|
- vendor/deps/cli-ui/lib/cli/ui/color.rb
|
|
323
331
|
- vendor/deps/cli-ui/lib/cli/ui/formatter.rb
|
|
324
332
|
- vendor/deps/cli-ui/lib/cli/ui/frame.rb
|
|
333
|
+
- vendor/deps/cli-ui/lib/cli/ui/frame/frame_stack.rb
|
|
334
|
+
- vendor/deps/cli-ui/lib/cli/ui/frame/frame_style.rb
|
|
335
|
+
- vendor/deps/cli-ui/lib/cli/ui/frame/frame_style/box.rb
|
|
336
|
+
- vendor/deps/cli-ui/lib/cli/ui/frame/frame_style/bracket.rb
|
|
325
337
|
- vendor/deps/cli-ui/lib/cli/ui/glyph.rb
|
|
338
|
+
- vendor/deps/cli-ui/lib/cli/ui/printer.rb
|
|
326
339
|
- vendor/deps/cli-ui/lib/cli/ui/progress.rb
|
|
327
340
|
- vendor/deps/cli-ui/lib/cli/ui/prompt.rb
|
|
328
341
|
- vendor/deps/cli-ui/lib/cli/ui/prompt/interactive_options.rb
|
|
@@ -334,6 +347,9 @@ files:
|
|
|
334
347
|
- vendor/deps/cli-ui/lib/cli/ui/terminal.rb
|
|
335
348
|
- vendor/deps/cli-ui/lib/cli/ui/truncater.rb
|
|
336
349
|
- vendor/deps/cli-ui/lib/cli/ui/version.rb
|
|
350
|
+
- vendor/deps/cli-ui/lib/cli/ui/widgets.rb
|
|
351
|
+
- vendor/deps/cli-ui/lib/cli/ui/widgets/base.rb
|
|
352
|
+
- vendor/deps/cli-ui/lib/cli/ui/widgets/status.rb
|
|
337
353
|
- vendor/deps/smart_properties/REVISION
|
|
338
354
|
- vendor/deps/smart_properties/lib/smart_properties.rb
|
|
339
355
|
- vendor/deps/smart_properties/lib/smart_properties/errors.rb
|