shopify-cli 1.3.0 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (206) hide show
  1. checksums.yaml +4 -4
  2. data/.github/CODEOWNERS +2 -2
  3. data/.github/CONTRIBUTING.md +9 -1
  4. data/.github/PULL_REQUEST_TEMPLATE.md +10 -1
  5. data/.github/workflows/release.yml +61 -0
  6. data/.github/workflows/triage.yml +22 -0
  7. data/.gitignore +0 -1
  8. data/.rubocop.yml +61 -8
  9. data/.rubocop_todo.yml +11 -0
  10. data/.travis.yml +1 -0
  11. data/CHANGELOG.md +30 -0
  12. data/Gemfile +3 -2
  13. data/Gemfile.lock +39 -37
  14. data/README.md +39 -7
  15. data/RELEASING.md +19 -29
  16. data/Rakefile +2 -0
  17. data/dev.yml +2 -2
  18. data/docs/_config.yml +1 -18
  19. data/docs/app/node/commands/index.md +2 -80
  20. data/docs/app/node/index.md +2 -33
  21. data/docs/app/rails/commands/index.md +2 -78
  22. data/docs/app/rails/index.md +2 -34
  23. data/docs/core/index.md +2 -84
  24. data/docs/getting-started/index.md +2 -25
  25. data/docs/getting-started/install/index.md +1 -118
  26. data/docs/getting-started/migrate/index.md +2 -94
  27. data/docs/getting-started/uninstall/index.md +2 -35
  28. data/docs/getting-started/upgrade/index.md +2 -39
  29. data/docs/help/start-app/index.md +2 -4
  30. data/docs/index.md +2 -24
  31. data/install.sh +1 -1
  32. data/lib/project_types/extension/cli.rb +21 -11
  33. data/lib/project_types/extension/commands/extension_command.rb +2 -2
  34. data/lib/project_types/extension/features/argo.rb +117 -0
  35. data/lib/project_types/extension/forms/create.rb +2 -2
  36. data/lib/project_types/extension/models/specification.rb +35 -0
  37. data/lib/project_types/extension/models/specification_handlers/checkout_post_purchase.rb +19 -0
  38. data/lib/project_types/extension/models/specification_handlers/default.rb +67 -0
  39. data/lib/project_types/extension/models/specifications.rb +77 -0
  40. data/lib/project_types/extension/tasks/configure_features.rb +52 -0
  41. data/lib/project_types/extension/tasks/fetch_specifications.rb +38 -0
  42. data/lib/project_types/node/cli.rb +4 -1
  43. data/lib/project_types/node/commands/connect.rb +15 -0
  44. data/lib/project_types/node/commands/create.rb +10 -4
  45. data/lib/project_types/node/commands/generate.rb +2 -11
  46. data/lib/project_types/node/messages/messages.rb +16 -50
  47. data/lib/project_types/rails/cli.rb +4 -1
  48. data/lib/project_types/rails/commands/connect.rb +15 -0
  49. data/lib/project_types/rails/commands/create.rb +15 -12
  50. data/lib/project_types/rails/forms/create.rb +1 -1
  51. data/lib/project_types/rails/gem.rb +1 -1
  52. data/lib/project_types/rails/messages/messages.rb +8 -5
  53. data/lib/project_types/script/cli.rb +9 -5
  54. data/lib/project_types/script/commands/create.rb +6 -4
  55. data/lib/project_types/script/commands/enable.rb +12 -4
  56. data/lib/project_types/script/commands/push.rb +5 -13
  57. data/lib/project_types/script/config/extension_points.yml +17 -12
  58. data/lib/project_types/script/errors.rb +21 -0
  59. data/lib/project_types/script/forms/create.rb +26 -2
  60. data/lib/project_types/script/graphql/app_script_update_or_create.graphql +10 -1
  61. data/lib/project_types/script/layers/application/build_script.rb +18 -17
  62. data/lib/project_types/script/layers/application/create_script.rb +12 -10
  63. data/lib/project_types/script/layers/application/extension_points.rb +24 -0
  64. data/lib/project_types/script/layers/application/push_script.rb +18 -16
  65. data/lib/project_types/script/layers/domain/errors.rb +7 -0
  66. data/lib/project_types/script/layers/domain/extension_point.rb +62 -7
  67. data/lib/project_types/script/layers/domain/metadata.rb +55 -0
  68. data/lib/project_types/script/layers/domain/push_package.rb +25 -6
  69. data/lib/project_types/script/layers/infrastructure/assemblyscript_project_creator.rb +17 -52
  70. data/lib/project_types/script/layers/infrastructure/assemblyscript_task_runner.rb +42 -11
  71. data/lib/project_types/script/layers/infrastructure/errors.rb +16 -0
  72. data/lib/project_types/script/layers/infrastructure/extension_point_repository.rb +10 -4
  73. data/lib/project_types/script/layers/infrastructure/project_creator.rb +2 -1
  74. data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +25 -13
  75. data/lib/project_types/script/layers/infrastructure/rust_project_creator.rb +72 -0
  76. data/lib/project_types/script/layers/infrastructure/rust_task_runner.rb +59 -0
  77. data/lib/project_types/script/layers/infrastructure/script_service.rb +9 -1
  78. data/lib/project_types/script/layers/infrastructure/task_runner.rb +4 -3
  79. data/lib/project_types/script/messages/messages.rb +55 -4
  80. data/lib/project_types/script/script_project.rb +25 -16
  81. data/lib/project_types/script/ui/error_handler.rb +59 -1
  82. data/lib/project_types/theme/cli.rb +40 -0
  83. data/lib/project_types/theme/commands/connect.rb +54 -0
  84. data/lib/project_types/theme/commands/create.rb +48 -0
  85. data/lib/project_types/theme/commands/deploy.rb +38 -0
  86. data/lib/project_types/theme/commands/generate.rb +20 -0
  87. data/lib/project_types/theme/commands/generate/env.rb +79 -0
  88. data/lib/project_types/theme/commands/push.rb +55 -0
  89. data/lib/project_types/theme/commands/serve.rb +31 -0
  90. data/lib/project_types/theme/forms/connect.rb +34 -0
  91. data/lib/project_types/theme/forms/create.rb +22 -0
  92. data/lib/project_types/theme/messages/messages.rb +147 -0
  93. data/lib/project_types/theme/tasks/ensure_themekit_installed.rb +78 -0
  94. data/lib/project_types/theme/themekit.rb +113 -0
  95. data/lib/shopify-cli/admin_api.rb +42 -2
  96. data/lib/shopify-cli/api.rb +34 -33
  97. data/lib/shopify-cli/commands/config.rb +24 -0
  98. data/lib/shopify-cli/commands/connect.rb +32 -15
  99. data/lib/shopify-cli/commands/system.rb +10 -1
  100. data/lib/shopify-cli/context.rb +23 -2
  101. data/lib/shopify-cli/core/entry_point.rb +1 -1
  102. data/lib/shopify-cli/core/monorail.rb +6 -4
  103. data/lib/shopify-cli/feature.rb +0 -2
  104. data/lib/shopify-cli/http_request.rb +27 -0
  105. data/lib/shopify-cli/js_deps.rb +1 -1
  106. data/lib/shopify-cli/messages/messages.rb +31 -7
  107. data/lib/shopify-cli/method_object.rb +104 -0
  108. data/lib/shopify-cli/partners_api.rb +25 -3
  109. data/lib/shopify-cli/process_supervision.rb +1 -1
  110. data/lib/shopify-cli/project.rb +12 -8
  111. data/lib/shopify-cli/project_type.rb +18 -2
  112. data/lib/shopify-cli/resolve_constant.rb +25 -0
  113. data/lib/shopify-cli/result.rb +432 -0
  114. data/lib/shopify-cli/shopifolk.rb +87 -0
  115. data/lib/shopify-cli/task.rb +8 -0
  116. data/lib/shopify-cli/tasks/create_api_client.rb +13 -2
  117. data/lib/shopify-cli/tasks/ensure_env.rb +3 -0
  118. data/lib/shopify-cli/tasks/select_org_and_shop.rb +10 -5
  119. data/lib/shopify-cli/tunnel.rb +8 -2
  120. data/lib/shopify-cli/version.rb +1 -1
  121. data/lib/shopify_cli.rb +5 -1
  122. data/shopify.fish +1 -1
  123. data/shopify.sh +1 -1
  124. data/vendor/deps/cli-kit/REVISION +1 -1
  125. data/vendor/deps/cli-kit/lib/cli/kit/logger.rb +2 -2
  126. data/vendor/deps/cli-kit/lib/cli/kit/system.rb +3 -3
  127. data/vendor/deps/cli-ui/REVISION +1 -1
  128. data/vendor/deps/cli-ui/lib/cli/ui.rb +26 -22
  129. data/vendor/deps/cli-ui/lib/cli/ui/ansi.rb +4 -6
  130. data/vendor/deps/cli-ui/lib/cli/ui/frame.rb +3 -3
  131. data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_stack.rb +8 -9
  132. data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style.rb +1 -1
  133. data/vendor/deps/cli-ui/lib/cli/ui/glyph.rb +1 -0
  134. data/vendor/deps/cli-ui/lib/cli/ui/printer.rb +15 -3
  135. data/vendor/deps/cli-ui/lib/cli/ui/prompt/interactive_options.rb +4 -11
  136. data/vendor/deps/cli-ui/lib/cli/ui/spinner.rb +3 -5
  137. data/vendor/deps/cli-ui/lib/cli/ui/terminal.rb +10 -10
  138. data/vendor/deps/cli-ui/lib/cli/ui/version.rb +1 -1
  139. data/vendor/deps/cli-ui/lib/cli/ui/wrap.rb +56 -0
  140. data/vendor/deps/webrick/.gitignore +9 -0
  141. data/vendor/deps/webrick/Gemfile +3 -0
  142. data/vendor/deps/webrick/LICENSE.txt +22 -0
  143. data/vendor/deps/webrick/README.md +61 -0
  144. data/vendor/deps/webrick/Rakefile +10 -0
  145. data/vendor/deps/webrick/lib/webrick.rb +232 -0
  146. data/vendor/deps/webrick/lib/webrick/accesslog.rb +157 -0
  147. data/vendor/deps/webrick/lib/webrick/cgi.rb +313 -0
  148. data/vendor/deps/webrick/lib/webrick/compat.rb +36 -0
  149. data/vendor/deps/webrick/lib/webrick/config.rb +158 -0
  150. data/vendor/deps/webrick/lib/webrick/cookie.rb +172 -0
  151. data/vendor/deps/webrick/lib/webrick/htmlutils.rb +30 -0
  152. data/vendor/deps/webrick/lib/webrick/httpauth.rb +96 -0
  153. data/vendor/deps/webrick/lib/webrick/httpauth/authenticator.rb +117 -0
  154. data/vendor/deps/webrick/lib/webrick/httpauth/basicauth.rb +116 -0
  155. data/vendor/deps/webrick/lib/webrick/httpauth/digestauth.rb +395 -0
  156. data/vendor/deps/webrick/lib/webrick/httpauth/htdigest.rb +132 -0
  157. data/vendor/deps/webrick/lib/webrick/httpauth/htgroup.rb +97 -0
  158. data/vendor/deps/webrick/lib/webrick/httpauth/htpasswd.rb +158 -0
  159. data/vendor/deps/webrick/lib/webrick/httpauth/userdb.rb +53 -0
  160. data/vendor/deps/webrick/lib/webrick/httpproxy.rb +354 -0
  161. data/vendor/deps/webrick/lib/webrick/httprequest.rb +636 -0
  162. data/vendor/deps/webrick/lib/webrick/httpresponse.rb +564 -0
  163. data/vendor/deps/webrick/lib/webrick/https.rb +152 -0
  164. data/vendor/deps/webrick/lib/webrick/httpserver.rb +294 -0
  165. data/vendor/deps/webrick/lib/webrick/httpservlet.rb +23 -0
  166. data/vendor/deps/webrick/lib/webrick/httpservlet/abstract.rb +152 -0
  167. data/vendor/deps/webrick/lib/webrick/httpservlet/cgi_runner.rb +47 -0
  168. data/vendor/deps/webrick/lib/webrick/httpservlet/cgihandler.rb +126 -0
  169. data/vendor/deps/webrick/lib/webrick/httpservlet/erbhandler.rb +88 -0
  170. data/vendor/deps/webrick/lib/webrick/httpservlet/filehandler.rb +552 -0
  171. data/vendor/deps/webrick/lib/webrick/httpservlet/prochandler.rb +47 -0
  172. data/vendor/deps/webrick/lib/webrick/httpstatus.rb +194 -0
  173. data/vendor/deps/webrick/lib/webrick/httputils.rb +512 -0
  174. data/vendor/deps/webrick/lib/webrick/httpversion.rb +76 -0
  175. data/vendor/deps/webrick/lib/webrick/log.rb +156 -0
  176. data/vendor/deps/webrick/lib/webrick/server.rb +381 -0
  177. data/vendor/deps/webrick/lib/webrick/ssl.rb +215 -0
  178. data/vendor/deps/webrick/lib/webrick/utils.rb +265 -0
  179. data/vendor/deps/webrick/lib/webrick/version.rb +18 -0
  180. data/vendor/deps/webrick/webrick.gemspec +74 -0
  181. metadata +77 -27
  182. data/docs/Gemfile +0 -5
  183. data/docs/Gemfile.lock +0 -258
  184. data/docs/_data/nav.yml +0 -35
  185. data/docs/_includes/footer.html +0 -15
  186. data/docs/_includes/head.html +0 -19
  187. data/docs/_includes/sidebar_nav.html +0 -22
  188. data/docs/_includes/toc.html +0 -112
  189. data/docs/_layouts/default.html +0 -79
  190. data/docs/css/docs.css +0 -157
  191. data/docs/images/header.png +0 -0
  192. data/docs/installing-ruby.md +0 -28
  193. data/lib/project_types/extension/features/argo/admin.rb +0 -20
  194. data/lib/project_types/extension/features/argo/base.rb +0 -129
  195. data/lib/project_types/extension/features/argo/checkout.rb +0 -20
  196. data/lib/project_types/extension/models/type.rb +0 -81
  197. data/lib/project_types/extension/models/types/checkout_post_purchase.rb +0 -23
  198. data/lib/project_types/extension/models/types/product_subscription.rb +0 -24
  199. data/lib/project_types/node/commands/generate/billing.rb +0 -39
  200. data/lib/project_types/node/commands/generate/page.rb +0 -59
  201. data/lib/project_types/node/commands/generate/webhook.rb +0 -37
  202. data/lib/project_types/script/layers/domain/script.rb +0 -18
  203. data/lib/project_types/script/layers/infrastructure/assemblyscript_tsconfig.rb +0 -38
  204. data/lib/project_types/script/layers/infrastructure/script_repository.rb +0 -59
  205. data/lib/project_types/script/templates/ts/as-pect.config.js +0 -27
  206. data/lib/project_types/script/templates/ts/as-pect.d.ts +0 -1
@@ -0,0 +1,87 @@
1
+ module ShopifyCli
2
+ ##
3
+ # ShopifyCli::Shopifolk contains the logic to determine if the user appears to be a Shopify staff
4
+ #
5
+ # The Shopifolk Feature flag will persist between runs so if the flag is enabled or disabled,
6
+ # it will still be in that same state until the next class invocation.
7
+ class Shopifolk
8
+ GCLOUD_CONFIG_FILE = File.expand_path('~/.config/gcloud/configurations/config_default')
9
+ DEV_PATH = '/opt/dev'
10
+ SECTION = 'core'
11
+ FEATURE_NAME = 'shopifolk'
12
+
13
+ class << self
14
+ attr_writer :acting_as_shopify_organization
15
+
16
+ ##
17
+ # will return if the user appears to be a Shopify employee, based on several heuristics
18
+ #
19
+ # #### Returns
20
+ #
21
+ # * `is_shopifolk` - returns true if the user is a Shopify Employee
22
+ #
23
+ # #### Example
24
+ #
25
+ # ShopifyCli::Shopifolk.check
26
+ #
27
+ def check
28
+ return false unless ShopifyCli::Config.get_bool('shopifolk-beta', 'enabled')
29
+
30
+ ShopifyCli::Shopifolk.new.shopifolk?
31
+ end
32
+
33
+ def act_as_shopify_organization
34
+ @acting_as_shopify_organization = true
35
+ end
36
+
37
+ def acting_as_shopify_organization?
38
+ !!@acting_as_shopify_organization || (Project.has_current? && Project.current.config['shopify_organization'])
39
+ end
40
+
41
+ def reset
42
+ @acting_as_shopify_organization = nil
43
+ end
44
+ end
45
+
46
+ ##
47
+ # will return if the user is a Shopify employee
48
+ #
49
+ # #### Returns
50
+ #
51
+ # * `is_shopifolk` - returns true if the user has `dev` installed and
52
+ # a valid google cloud config file with email ending in "@shopify.com"
53
+ #
54
+ def shopifolk?
55
+ return false unless ShopifyCli::Config.get_bool('shopifolk-beta', 'enabled')
56
+ return true if Feature.enabled?(FEATURE_NAME)
57
+
58
+ if shopifolk_by_gcloud? && shopifolk_by_dev?
59
+ ShopifyCli::Feature.enable(FEATURE_NAME)
60
+ true
61
+ else
62
+ ShopifyCli::Feature.disable(FEATURE_NAME)
63
+ false
64
+ end
65
+ end
66
+
67
+ private
68
+
69
+ def shopifolk_by_gcloud?
70
+ ini&.dig("[#{SECTION}]", 'account')&.match?(/@shopify.com\z/)
71
+ end
72
+
73
+ def shopifolk_by_dev?
74
+ File.exist?("#{DEV_PATH}/bin/dev") && File.exist?("#{DEV_PATH}/.shopify-build")
75
+ end
76
+
77
+ def ini
78
+ @ini ||= begin
79
+ if File.exist?(GCLOUD_CONFIG_FILE)
80
+ CLI::Kit::Ini
81
+ .new(GCLOUD_CONFIG_FILE, default_section: "[#{SECTION}]", convert_types: false)
82
+ .tap(&:parse).ini
83
+ end
84
+ end
85
+ end
86
+ end
87
+ end
@@ -6,5 +6,13 @@ module ShopifyCli
6
6
  task = new
7
7
  task.call(*args, **kwargs)
8
8
  end
9
+
10
+ private
11
+
12
+ def wants_to_run_against_shopify_org?
13
+ @ctx.puts(@ctx.message('core.tasks.select_org_and_shop.identified_as_shopify'))
14
+ message = @ctx.message('core.tasks.select_org_and_shop.first_party')
15
+ CLI::UI::Prompt.confirm(message, default: false)
16
+ end
9
17
  end
10
18
  end
@@ -17,12 +17,23 @@ module ShopifyCli
17
17
  redir: [OAuth::REDIRECT_HOST]
18
18
  )
19
19
 
20
- user_errors = resp["data"]["appCreate"]["userErrors"]
20
+ unless resp
21
+ ctx.abort("Error - empty response")
22
+ end
23
+
24
+ errors = resp.dig("errors")
25
+ if !errors.nil? && errors.any?
26
+ ctx.abort(errors.map { |err| "#{err['field']} #{err['message']}" }.join(", "))
27
+ end
28
+
29
+ user_errors = resp.dig("data", "appCreate", "userErrors")
21
30
  if !user_errors.nil? && user_errors.any?
22
31
  ctx.abort(user_errors.map { |err| "#{err['field']} #{err['message']}" }.join(", "))
23
32
  end
24
33
 
25
- resp["data"]["appCreate"]["app"]
34
+ ShopifyCli::Core::Monorail.metadata[:api_key] = resp.dig("data", "appCreate", "app", "apiKey")
35
+
36
+ resp.dig("data", "appCreate", "app")
26
37
  end
27
38
  end
28
39
  end
@@ -22,6 +22,9 @@ module ShopifyCli
22
22
  private
23
23
 
24
24
  def fetch_org
25
+ if Shopifolk.check && wants_to_run_against_shopify_org?
26
+ Shopifolk.act_as_shopify_organization
27
+ end
25
28
  orgs = PartnersAPI::Organizations.fetch_with_app(@ctx)
26
29
  org_id = if orgs.count == 1
27
30
  orgs.first["id"]
@@ -8,18 +8,23 @@ module ShopifyCli
8
8
  def call(ctx, organization_id: nil, shop_domain: nil)
9
9
  @ctx = ctx
10
10
  return response(organization_id.to_i, shop_domain) unless organization_id.nil? || shop_domain.nil?
11
+ if Shopifolk.check && wants_to_run_against_shopify_org?
12
+ Shopifolk.act_as_shopify_organization
13
+ end
11
14
  org = get_organization(organization_id)
12
- shop_domain ||= get_shop_domain(org)
15
+ unless Shopifolk.acting_as_shopify_organization?
16
+ shop_domain ||= get_shop_domain(org)
17
+ end
18
+ ShopifyCli::Core::Monorail.metadata[:organization_id] = org["id"].to_i
13
19
  response(org["id"].to_i, shop_domain)
14
20
  end
15
21
 
16
22
  private
17
23
 
18
24
  def response(organization_id, shop_domain)
19
- {
20
- organization_id: organization_id,
21
- shop_domain: shop_domain,
22
- }
25
+ result = { organization_id: organization_id }
26
+ result[:shop_domain] = shop_domain if shop_domain
27
+ result
23
28
  end
24
29
 
25
30
  def organizations
@@ -123,7 +123,8 @@ module ShopifyCli
123
123
  private
124
124
 
125
125
  def install(ctx)
126
- return if File.exist?(File.join(ShopifyCli.cache_dir, ctx.windows? ? 'ngrok.exe' : 'ngrok'))
126
+ ngrok = "ngrok#{ctx.executable_file_extension}"
127
+ return if File.exist?(File.join(ShopifyCli.cache_dir, ngrok))
127
128
  check_prereq_command(ctx, 'curl')
128
129
  check_prereq_command(ctx, ctx.linux? ? 'unzip' : 'tar')
129
130
  spinner = CLI::UI::SpinGroup.new
@@ -141,6 +142,11 @@ module ShopifyCli
141
142
  ctx.rm(zip_dest)
142
143
  end
143
144
  spinner.wait
145
+
146
+ # final check to see if ngrok is accessible
147
+ unless File.exist?(File.join(ShopifyCli.cache_dir, ngrok))
148
+ ctx.abort(ctx.message('core.tunnel.error.ngrok', ngrok, ShopifyCli.cache_dir))
149
+ end
144
150
  end
145
151
 
146
152
  def fetch_url(ctx, log_path)
@@ -210,7 +216,7 @@ module ShopifyCli
210
216
  end
211
217
 
212
218
  def parse_account
213
- account, timeout, _ = @log.match(/AccountName:([\w\s\d@._\-]*) SessionDuration:([\d]+) PlanName/)&.captures
219
+ account, timeout, _ = @log.match(/AccountName:(.*)\s+SessionDuration:([\d]+) PlanName/)&.captures
214
220
  @account = account&.empty? ? nil : account
215
221
  @timeout = timeout&.empty? ? 0 : timeout.to_i
216
222
  end
@@ -1,3 +1,3 @@
1
1
  module ShopifyCli
2
- VERSION = '1.3.0'
2
+ VERSION = '1.6.0'
3
3
  end
data/lib/shopify_cli.rb CHANGED
@@ -15,7 +15,7 @@ ENV['PATH'] = ENV['PATH'].split(':').select { |p| p.start_with?('/', '~') }.join
15
15
  vendor_path = File.expand_path("../../vendor/lib", __FILE__)
16
16
  $LOAD_PATH.unshift(vendor_path) unless $LOAD_PATH.include?(vendor_path)
17
17
 
18
- deps = %w(cli-ui cli-kit smart_properties)
18
+ deps = %w(cli-ui cli-kit smart_properties webrick)
19
19
  deps.each do |dep|
20
20
  vendor_path = File.expand_path("../../vendor/deps/#{dep}/lib", __FILE__)
21
21
  $LOAD_PATH.unshift(vendor_path) unless $LOAD_PATH.include?(vendor_path)
@@ -108,6 +108,7 @@ module ShopifyCli
108
108
  autoload :Heroku, 'shopify-cli/heroku'
109
109
  autoload :JsDeps, 'shopify-cli/js_deps'
110
110
  autoload :JsSystem, 'shopify-cli/js_system'
111
+ autoload :MethodObject, 'shopify-cli/method_object'
111
112
  autoload :Log, 'shopify-cli/log'
112
113
  autoload :OAuth, 'shopify-cli/oauth'
113
114
  autoload :Options, 'shopify-cli/options'
@@ -115,7 +116,10 @@ module ShopifyCli
115
116
  autoload :ProcessSupervision, 'shopify-cli/process_supervision'
116
117
  autoload :Project, 'shopify-cli/project'
117
118
  autoload :ProjectType, 'shopify-cli/project_type'
119
+ autoload :ResolveConstant, 'shopify-cli/resolve_constant'
118
120
  autoload :Resources, 'shopify-cli/resources'
121
+ autoload :Result, 'shopify-cli/result'
122
+ autoload :Shopifolk, 'shopify-cli/shopifolk'
119
123
  autoload :SubCommand, 'shopify-cli/sub_command'
120
124
  autoload :Task, 'shopify-cli/task'
121
125
  autoload :Tasks, 'shopify-cli/tasks'
data/shopify.fish CHANGED
@@ -7,6 +7,6 @@ if [ $status != "0" ]
7
7
  echo "This version of Shopify App CLI is no longer supported. You’ll need to migrate to the new CLI version to continue.
8
8
 
9
9
  Please visit this page for complete instructions:
10
- https://shopify.github.io/shopify-app-cli/migrate/
10
+ https://shopify.dev/tools/cli/troubleshooting#migrate-from-a-legacy-version
11
11
  "
12
12
  end
data/shopify.sh CHANGED
@@ -6,6 +6,6 @@ if [ "$?" != "0" ]; then
6
6
  echo "This version of Shopify App CLI is no longer supported. You’ll need to migrate to the new CLI version to continue.
7
7
 
8
8
  Please visit this page for complete instructions:
9
- https://shopify.github.io/shopify-app-cli/migrate/
9
+ https://shopify.dev/tools/cli/troubleshooting#migrate-from-a-legacy-version
10
10
  "
11
11
  fi
@@ -1 +1 @@
1
- 1013aa5c5664e7034ca3f02fd2e0513361b07e95 (dirty)
1
+ 6eadd6c7f7fc9217008c2cfb0bc3101cb6cf3b41
@@ -61,7 +61,7 @@ module CLI
61
61
  #
62
62
  # @param msg [String] the message to log
63
63
  def debug(msg)
64
- $stdout.puts CLI::UI.fmt(msg) if is_debug?
64
+ $stdout.puts CLI::UI.fmt(msg) if debug?
65
65
  @debug_logger.debug(format_debug(msg))
66
66
  end
67
67
 
@@ -73,7 +73,7 @@ module CLI
73
73
  "[#{CLI::UI::StdoutRouter.current_id[:id]}] #{msg}"
74
74
  end
75
75
 
76
- def is_debug?
76
+ def debug?
77
77
  val = ENV[@env_debug_name]
78
78
  val && val != '0' && val != ''
79
79
  end
@@ -94,11 +94,11 @@ module CLI
94
94
  delegate_open3(*a, sudo: sudo, env: env, method: :popen2, **kwargs, &block)
95
95
  end
96
96
 
97
- def popen2e(*a, sudo: false, env: ENV, **kwargs)
97
+ def popen2e(*a, sudo: false, env: ENV, **kwargs, &block)
98
98
  delegate_open3(*a, sudo: sudo, env: env, method: :popen2e, **kwargs, &block)
99
99
  end
100
100
 
101
- def popen3(*a, sudo: false, env: ENV, **kwargs)
101
+ def popen3(*a, sudo: false, env: ENV, **kwargs, &block)
102
102
  delegate_open3(*a, sudo: sudo, env: env, method: :popen3, **kwargs, &block)
103
103
  end
104
104
 
@@ -112,7 +112,7 @@ module CLI
112
112
  # - `**kwargs`: additional keyword arguments to pass to Process.spawn
113
113
  #
114
114
  # #### Returns
115
- # - `status`: boolean success status of the command execution
115
+ # - `status`: The `Process:Status` result for the command execution
116
116
  #
117
117
  # #### Usage
118
118
  # `stat = CLI::Kit::System.system('ls', 'a_folder')`
@@ -1 +1 @@
1
- 5ea578d3110af35c73837a8008147ce53a4b56ed (dirty)
1
+ 168ce68b31d8436b2b222d6f063e5c7225785bd4
@@ -1,18 +1,19 @@
1
1
  module CLI
2
2
  module UI
3
- autoload :ANSI, 'cli/ui/ansi'
4
- autoload :Glyph, 'cli/ui/glyph'
5
- autoload :Color, 'cli/ui/color'
6
- autoload :Frame, 'cli/ui/frame'
7
- autoload :OS, 'cli/ui/os'
8
- autoload :Printer, 'cli/ui/printer'
9
- autoload :Progress, 'cli/ui/progress'
10
- autoload :Prompt, 'cli/ui/prompt'
11
- autoload :Terminal, 'cli/ui/terminal'
12
- autoload :Truncater, 'cli/ui/truncater'
13
- autoload :Formatter, 'cli/ui/formatter'
14
- autoload :Spinner, 'cli/ui/spinner'
15
- autoload :Widgets, 'cli/ui/widgets'
3
+ autoload :ANSI, 'cli/ui/ansi'
4
+ autoload :Glyph, 'cli/ui/glyph'
5
+ autoload :Color, 'cli/ui/color'
6
+ autoload :Frame, 'cli/ui/frame'
7
+ autoload :OS, 'cli/ui/os'
8
+ autoload :Printer, 'cli/ui/printer'
9
+ autoload :Progress, 'cli/ui/progress'
10
+ autoload :Prompt, 'cli/ui/prompt'
11
+ autoload :Terminal, 'cli/ui/terminal'
12
+ autoload :Truncater, 'cli/ui/truncater'
13
+ autoload :Formatter, 'cli/ui/formatter'
14
+ autoload :Spinner, 'cli/ui/spinner'
15
+ autoload :Widgets, 'cli/ui/widgets'
16
+ autoload :Wrap, 'cli/ui/wrap'
16
17
 
17
18
  # Convenience accessor to +CLI::UI::Spinner::SpinGroup+
18
19
  SpinGroup = Spinner::SpinGroup
@@ -29,7 +30,7 @@ module CLI
29
30
  end
30
31
 
31
32
  # Color resolution using +CLI::UI::Color.lookup+
32
- # Will lookup using +Color.lookup+ if a symbol, otherwise we assume it is a valid color and return it
33
+ # Will lookup using +Color.lookup+ unless it's already a CLI::UI::Color (or nil)
33
34
  #
34
35
  # ==== Attributes
35
36
  #
@@ -37,26 +38,25 @@ module CLI
37
38
  #
38
39
  def self.resolve_color(input)
39
40
  case input
40
- when Symbol
41
- CLI::UI::Color.lookup(input)
42
- else
41
+ when CLI::UI::Color, nil
43
42
  input
43
+ else
44
+ CLI::UI::Color.lookup(input)
44
45
  end
45
46
  end
46
47
 
47
48
  # Frame style resolution using +CLI::UI::Frame::FrameStyle.lookup+.
48
- # Will lookup using +FrameStyle.lookup+ if the input is a symbol. Otherwise,
49
- # we assume it's a valid FrameStyle
49
+ # Will lookup using +FrameStyle.lookup+ unless it's already a CLI::UI::Frame::FrameStyle(or nil)
50
50
  #
51
51
  # ==== Attributes
52
52
  #
53
53
  # * +input+ - frame style to resolve
54
54
  def self.resolve_style(input)
55
55
  case input
56
- when Symbol
57
- CLI::UI::Frame::FrameStyle.lookup(input)
58
- else
56
+ when CLI::UI::Frame::FrameStyle, nil
59
57
  input
58
+ else
59
+ CLI::UI::Frame::FrameStyle.lookup(input)
60
60
  end
61
61
  end
62
62
 
@@ -114,6 +114,10 @@ module CLI
114
114
  CLI::UI::Formatter.new(input).format(enable_color: enable_color)
115
115
  end
116
116
 
117
+ def self.wrap(input)
118
+ CLI::UI::Wrap.new(input).wrap
119
+ end
120
+
117
121
  # Convenience Method for +CLI::UI::Printer.puts+
118
122
  #
119
123
  # ==== Attributes
@@ -21,6 +21,8 @@ module CLI
21
21
  when 0x200d # zero-width joiner
22
22
  zwj = true
23
23
  acc
24
+ when "\n"
25
+ acc
24
26
  else
25
27
  acc + 1
26
28
  end
@@ -138,17 +140,13 @@ module CLI
138
140
  # Move to the next line
139
141
  #
140
142
  def self.next_line
141
- cmd = cursor_down + control('1', 'G')
142
- cmd += control('1', 'D') if CLI::UI::OS.current.shift_cursor_on_line_reset?
143
- cmd
143
+ cursor_down + cursor_horizontal_absolute
144
144
  end
145
145
 
146
146
  # Move to the previous line
147
147
  #
148
148
  def self.previous_line
149
- cmd = cursor_up + control('1', 'G')
150
- cmd += control('1', 'D') if CLI::UI::OS.current.shift_cursor_on_line_reset?
151
- cmd
149
+ cursor_up + cursor_horizontal_absolute
152
150
  end
153
151
 
154
152
  def self.clear_to_end_of_line
@@ -90,7 +90,7 @@ module CLI
90
90
 
91
91
  t_start = Time.now
92
92
  CLI::UI.raw do
93
- print prefix.chop
93
+ print(prefix.chop)
94
94
  puts frame_style.open(text, color: color)
95
95
  end
96
96
  FrameStack.push(color: color, style: frame_style)
@@ -153,7 +153,7 @@ module CLI
153
153
  frame_style = CLI::UI.resolve_style(frame_style) || fs_item.frame_style
154
154
 
155
155
  CLI::UI.raw do
156
- print prefix.chop
156
+ print(prefix.chop)
157
157
  puts frame_style.divider(text, color: color)
158
158
  end
159
159
 
@@ -197,7 +197,7 @@ module CLI
197
197
  end
198
198
 
199
199
  CLI::UI.raw do
200
- print prefix.chop
200
+ print(prefix.chop)
201
201
  puts frame_style.close(text, color: color, **kwargs)
202
202
  end
203
203
  end