shopify-cli 2.6.6 → 2.7.3

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/.devcontainer.json +5 -0
  3. data/.github/CODEOWNERS +2 -2
  4. data/.github/DESIGN.md +1 -1
  5. data/.github/ISSUE_TEMPLATE.md +7 -0
  6. data/.github/workflows/shopify.yml +1 -1
  7. data/.gitignore +1 -0
  8. data/.ruby-version +1 -1
  9. data/.vscode/extensions.json +5 -0
  10. data/.vscode/settings.json +9 -0
  11. data/CHANGELOG.md +44 -4
  12. data/CONTRIBUTING.md +1 -29
  13. data/{Dockerfile → Codespace.dockerfile} +2 -2
  14. data/Gemfile.lock +5 -5
  15. data/README.md +20 -99
  16. data/Rakefile +27 -0
  17. data/Tests.dockerfile +35 -0
  18. data/assets/logo.png +0 -0
  19. data/dev.yml +1 -4
  20. data/docs/README.md +13 -0
  21. data/docs/contributors/testing.md +27 -0
  22. data/docs/users/installation.md +46 -0
  23. data/{THEMEKIT_MIGRATION.md → docs/users/migrate-from-themekit.md} +1 -1
  24. data/ext/javy/hashes/javy-arm-macos-v0.1.0.gz.sha256 +1 -0
  25. data/ext/javy/hashes/javy-x86_64-linux-v0.1.0.gz.sha256 +1 -0
  26. data/ext/javy/hashes/javy-x86_64-macos-v0.1.0.gz.sha256 +1 -0
  27. data/ext/javy/hashes/javy-x86_64-windows-v0.1.0.gz.sha256 +1 -0
  28. data/ext/javy/javy.rb +205 -0
  29. data/ext/javy/version +1 -0
  30. data/lib/project_types/extension/cli.rb +6 -3
  31. data/lib/project_types/extension/commands/build.rb +4 -8
  32. data/lib/project_types/extension/commands/create.rb +2 -5
  33. data/lib/project_types/extension/commands/extension_command.rb +1 -1
  34. data/lib/project_types/extension/features/argo_serve.rb +9 -23
  35. data/lib/project_types/extension/forms/questions/ask_template.rb +1 -5
  36. data/lib/project_types/extension/messages/messages.rb +0 -2
  37. data/lib/project_types/extension/models/development_server.rb +2 -2
  38. data/lib/project_types/extension/models/development_server_requirements.rb +2 -3
  39. data/lib/project_types/extension/models/server_config/app.rb +13 -0
  40. data/lib/project_types/extension/models/server_config/development.rb +5 -4
  41. data/lib/project_types/extension/models/server_config/development_renderer.rb +1 -1
  42. data/lib/project_types/extension/models/server_config/development_resource.rb +13 -0
  43. data/lib/project_types/extension/models/server_config/extension.rb +3 -1
  44. data/lib/project_types/extension/models/server_config/root.rb +4 -1
  45. data/lib/project_types/extension/tasks/convert_server_config.rb +65 -0
  46. data/lib/project_types/extension/tasks/ensure_resource_url.rb +39 -0
  47. data/lib/project_types/extension/tasks/merge_server_config.rb +32 -0
  48. data/lib/project_types/extension/tasks/run_extension_command.rb +11 -10
  49. data/lib/project_types/node/cli.rb +0 -16
  50. data/lib/project_types/node/forms/create.rb +5 -5
  51. data/lib/project_types/node/messages/messages.rb +2 -144
  52. data/lib/project_types/php/cli.rb +0 -11
  53. data/lib/project_types/php/forms/create.rb +5 -6
  54. data/lib/project_types/php/messages/messages.rb +2 -161
  55. data/lib/project_types/rails/cli.rb +0 -16
  56. data/lib/project_types/rails/commands/create.rb +3 -5
  57. data/lib/project_types/rails/forms/create.rb +5 -6
  58. data/lib/project_types/rails/messages/messages.rb +6 -151
  59. data/lib/project_types/script/cli.rb +8 -2
  60. data/lib/project_types/script/commands/create.rb +2 -4
  61. data/lib/project_types/script/commands/javy.rb +29 -0
  62. data/lib/project_types/script/commands/push.rb +3 -2
  63. data/lib/project_types/script/config/extension_points.yml +12 -30
  64. data/lib/project_types/script/forms/ask_app.rb +32 -0
  65. data/lib/project_types/script/forms/ask_org.rb +30 -0
  66. data/lib/project_types/script/forms/ask_script_uuid.rb +22 -0
  67. data/lib/project_types/script/forms/run_against_shopify_org.rb +14 -0
  68. data/lib/project_types/script/graphql/app_script_set.graphql +2 -2
  69. data/lib/project_types/script/layers/application/build_script.rb +0 -1
  70. data/lib/project_types/script/layers/application/connect_app.rb +73 -0
  71. data/lib/project_types/script/layers/application/create_script.rb +1 -1
  72. data/lib/project_types/script/layers/application/push_script.rb +1 -1
  73. data/lib/project_types/script/layers/domain/errors.rb +1 -4
  74. data/lib/project_types/script/layers/domain/push_package.rb +3 -3
  75. data/lib/project_types/script/layers/domain/{script_json.rb → script_config.rb} +2 -2
  76. data/lib/project_types/script/layers/domain/script_project.rb +5 -1
  77. data/lib/project_types/script/layers/infrastructure/errors.rb +36 -7
  78. data/lib/project_types/script/layers/infrastructure/languages/assemblyscript_task_runner.rb +0 -4
  79. data/lib/project_types/script/layers/infrastructure/languages/typescript_task_runner.rb +0 -4
  80. data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +2 -2
  81. data/lib/project_types/script/layers/infrastructure/script_project_repository.rb +104 -27
  82. data/lib/project_types/script/layers/infrastructure/script_service.rb +11 -11
  83. data/lib/project_types/script/messages/messages.rb +21 -4
  84. data/lib/project_types/script/ui/error_handler.rb +31 -21
  85. data/lib/project_types/theme/cli.rb +1 -1
  86. data/lib/project_types/theme/commands/check.rb +1 -1
  87. data/lib/project_types/theme/commands/delete.rb +1 -1
  88. data/lib/project_types/theme/commands/init.rb +1 -1
  89. data/lib/project_types/theme/commands/language_server.rb +1 -1
  90. data/lib/project_types/theme/commands/package.rb +1 -1
  91. data/lib/project_types/theme/commands/publish.rb +1 -1
  92. data/lib/project_types/theme/commands/pull.rb +4 -1
  93. data/lib/project_types/theme/commands/push.rb +5 -1
  94. data/lib/project_types/theme/commands/serve.rb +9 -3
  95. data/lib/project_types/theme/messages/messages.rb +39 -2
  96. data/lib/project_types/theme/ui/sync_progress_bar.rb +2 -2
  97. data/lib/shopify_cli/admin_api/populate_resource_command.rb +1 -1
  98. data/lib/shopify_cli/api.rb +7 -2
  99. data/lib/shopify_cli/app_type_detector.rb +24 -20
  100. data/lib/shopify_cli/command/app_sub_command.rb +10 -0
  101. data/lib/shopify_cli/command/project_command.rb +31 -0
  102. data/lib/shopify_cli/command/sub_command.rb +19 -0
  103. data/lib/shopify_cli/command.rb +7 -2
  104. data/lib/shopify_cli/commands/app/connect.rb +22 -0
  105. data/lib/shopify_cli/commands/app/create/node.rb +36 -0
  106. data/lib/shopify_cli/commands/app/create/php.rb +36 -0
  107. data/lib/shopify_cli/commands/app/create/rails.rb +38 -0
  108. data/lib/shopify_cli/commands/app/create.rb +28 -0
  109. data/lib/shopify_cli/commands/app/deploy.rb +49 -0
  110. data/lib/shopify_cli/commands/app/open.rb +19 -0
  111. data/lib/shopify_cli/commands/app/serve.rb +49 -0
  112. data/lib/shopify_cli/commands/app/tunnel.rb +43 -0
  113. data/lib/shopify_cli/commands/app.rb +29 -0
  114. data/lib/shopify_cli/commands/config.rb +2 -2
  115. data/lib/shopify_cli/commands.rb +1 -0
  116. data/lib/shopify_cli/constants.rb +7 -0
  117. data/lib/shopify_cli/context.rb +10 -0
  118. data/lib/shopify_cli/environment.rb +4 -0
  119. data/lib/shopify_cli/exception_reporter.rb +3 -4
  120. data/lib/shopify_cli/git.rb +14 -1
  121. data/lib/shopify_cli/github/issue_url_generator.rb +19 -0
  122. data/lib/shopify_cli/github.rb +5 -0
  123. data/lib/shopify_cli/identity_auth.rb +18 -0
  124. data/lib/shopify_cli/messages/messages.rb +254 -9
  125. data/lib/shopify_cli/partners_api.rb +1 -8
  126. data/lib/shopify_cli/project.rb +5 -1
  127. data/lib/shopify_cli/project_commands.rb +1 -1
  128. data/lib/shopify_cli/services/app/connect_service.rb +25 -0
  129. data/lib/shopify_cli/services/app/create/node_service.rb +155 -0
  130. data/lib/shopify_cli/services/app/create/php_service.rb +152 -0
  131. data/lib/shopify_cli/services/app/create/rails_service.rb +215 -0
  132. data/lib/shopify_cli/services/app/deploy/heroku/node_service.rb +101 -0
  133. data/lib/shopify_cli/services/app/deploy/heroku/php_service.rb +135 -0
  134. data/lib/shopify_cli/services/app/deploy/heroku/rails_service.rb +120 -0
  135. data/lib/shopify_cli/services/app/open_service.rb +19 -0
  136. data/lib/shopify_cli/services/app/serve/node_service.rb +42 -0
  137. data/lib/shopify_cli/services/app/serve/php_service.rb +46 -0
  138. data/lib/shopify_cli/services/app/serve/rails_service.rb +48 -0
  139. data/lib/shopify_cli/services/app/tunnel/auth_service.rb +21 -0
  140. data/lib/shopify_cli/services/app/tunnel/start_service.rb +20 -0
  141. data/lib/shopify_cli/services/app/tunnel/stop_service.rb +20 -0
  142. data/lib/shopify_cli/services.rb +31 -0
  143. data/lib/shopify_cli/tasks/ensure_authenticated.rb +9 -3
  144. data/lib/shopify_cli/theme/dev_server/cdn_fonts.rb +73 -0
  145. data/lib/shopify_cli/theme/dev_server/hot-reload.js +25 -9
  146. data/lib/shopify_cli/theme/dev_server/local_assets.rb +1 -1
  147. data/lib/shopify_cli/theme/dev_server.rb +37 -18
  148. data/lib/shopify_cli/theme/syncer/error_reporter.rb +45 -0
  149. data/lib/shopify_cli/theme/syncer/operation.rb +56 -0
  150. data/lib/shopify_cli/theme/syncer/standard_reporter.rb +32 -0
  151. data/lib/shopify_cli/theme/syncer.rb +40 -39
  152. data/lib/shopify_cli/theme/theme.rb +31 -19
  153. data/lib/shopify_cli/tunnel.rb +26 -22
  154. data/lib/shopify_cli/version.rb +1 -1
  155. data/lib/shopify_cli.rb +1 -2
  156. data/shopify-cli.gemspec +1 -1
  157. data/shopify-dev +18 -0
  158. data/utilities/constants.rb +7 -0
  159. data/utilities/docker/container.rb +10 -3
  160. data/utilities/docker.rb +2 -2
  161. data/utilities/utilities.rb +1 -0
  162. data/vendor/deps/cli-kit/lib/cli/kit/system.rb +1 -1
  163. metadata +66 -50
  164. data/docs/_config.yml +0 -2
  165. data/docs/app/node/commands/index.md +0 -4
  166. data/docs/app/node/index.md +0 -4
  167. data/docs/app/rails/commands/index.md +0 -4
  168. data/docs/app/rails/index.md +0 -4
  169. data/docs/core/index.md +0 -4
  170. data/docs/getting-started/index.md +0 -4
  171. data/docs/getting-started/install/index.md +0 -4
  172. data/docs/getting-started/migrate/index.md +0 -4
  173. data/docs/getting-started/uninstall/index.md +0 -4
  174. data/docs/getting-started/upgrade/index.md +0 -4
  175. data/docs/help/start-app/index.md +0 -4
  176. data/docs/index.md +0 -4
  177. data/install.sh +0 -7
  178. data/lib/project_types/extension/tasks/converters/server_config_converter.rb +0 -30
  179. data/lib/project_types/extension/tasks/load_server_config.rb +0 -28
  180. data/lib/project_types/node/commands/connect.rb +0 -21
  181. data/lib/project_types/node/commands/create.rb +0 -125
  182. data/lib/project_types/node/commands/deploy/heroku.rb +0 -96
  183. data/lib/project_types/node/commands/deploy.rb +0 -32
  184. data/lib/project_types/node/commands/generate.rb +0 -22
  185. data/lib/project_types/node/commands/open.rb +0 -18
  186. data/lib/project_types/node/commands/serve.rb +0 -45
  187. data/lib/project_types/node/commands/tunnel.rb +0 -41
  188. data/lib/project_types/php/commands/connect.rb +0 -19
  189. data/lib/project_types/php/commands/create.rb +0 -143
  190. data/lib/project_types/php/commands/deploy/heroku.rb +0 -129
  191. data/lib/project_types/php/commands/deploy.rb +0 -32
  192. data/lib/project_types/php/commands/open.rb +0 -16
  193. data/lib/project_types/php/commands/serve.rb +0 -48
  194. data/lib/project_types/php/commands/tunnel.rb +0 -37
  195. data/lib/project_types/rails/commands/connect.rb +0 -21
  196. data/lib/project_types/rails/commands/deploy/heroku.rb +0 -115
  197. data/lib/project_types/rails/commands/deploy.rb +0 -32
  198. data/lib/project_types/rails/commands/generate/webhook.rb +0 -42
  199. data/lib/project_types/rails/commands/generate.rb +0 -60
  200. data/lib/project_types/rails/commands/open.rb +0 -18
  201. data/lib/project_types/rails/commands/serve.rb +0 -51
  202. data/lib/project_types/rails/commands/tunnel.rb +0 -41
  203. data/lib/project_types/script/tasks/ensure_env.rb +0 -106
  204. data/lib/shopify_cli/sub_command.rb +0 -17
  205. data/shopify.fish +0 -12
  206. data/shopify.sh +0 -11
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
- module Rails
3
- class Command
4
- class Connect < ShopifyCLI::SubCommand
5
- prerequisite_task ensure_project_type: :rails
6
-
7
- def call(*)
8
- if ShopifyCLI::Project.has_current? && ShopifyCLI::Project.current.env
9
- @ctx.puts(@ctx.message("rails.connect.production_warning"))
10
- end
11
-
12
- app = ShopifyCLI::Connect.new(@ctx).default_connect("rails")
13
- @ctx.done(@ctx.message("rails.connect.connected", app))
14
- end
15
-
16
- def self.help
17
- ShopifyCLI::Context.message("rails.connect.help", ShopifyCLI::TOOL_NAME, ShopifyCLI::TOOL_NAME)
18
- end
19
- end
20
- end
21
- end
@@ -1,115 +0,0 @@
1
- # frozen_string_literal: true
2
- require "shopify_cli"
3
-
4
- module Rails
5
- class Command
6
- class Deploy
7
- class Heroku
8
- class << self
9
- DB_CHECK_CMD = 'bundle exec rails runner "puts ActiveRecord::Base.connection.adapter_name.downcase"'
10
-
11
- def help
12
- ShopifyCLI::Context.message("rails.deploy.heroku.help", ShopifyCLI::TOOL_NAME)
13
- end
14
-
15
- def start(ctx)
16
- CLI::UI::Frame.open(ctx.message("rails.deploy.heroku.db_check.validating")) do
17
- CLI::UI::Spinner.spin(ctx.message("rails.deploy.heroku.db_check.checking")) do |spinner|
18
- db_type, err = check_db(ctx)
19
- ctx.abort(ctx.message(err)) unless err.nil?
20
- spinner.update_title(ctx.message("rails.deploy.heroku.db_check.validated", db_type))
21
- end
22
- true
23
- end
24
-
25
- spin_group = CLI::UI::SpinGroup.new
26
- heroku_service = ShopifyCLI::Heroku.new(ctx)
27
-
28
- spin_group.add(ctx.message("rails.deploy.heroku.downloading")) do |spinner|
29
- heroku_service.download
30
- spinner.update_title(ctx.message("rails.deploy.heroku.downloaded"))
31
- end
32
- spin_group.wait
33
-
34
- spin_group.add(ctx.message("rails.deploy.heroku.installing")) do |spinner|
35
- heroku_service.install
36
- spinner.update_title(ctx.message("rails.deploy.heroku.installed"))
37
- end
38
- spin_group.add(ctx.message("rails.deploy.heroku.git.checking")) do |spinner|
39
- ShopifyCLI::Git.init(ctx)
40
- spinner.update_title(ctx.message("rails.deploy.heroku.git.initialized"))
41
- end
42
- spin_group.wait
43
-
44
- if (account = heroku_service.whoami)
45
- ctx.puts(ctx.message("rails.deploy.heroku.authenticated_with_account", account))
46
- else
47
- CLI::UI::Frame.open(
48
- ctx.message("rails.deploy.heroku.authenticating"),
49
- success_text: ctx.message("rails.deploy.heroku.authenticated")
50
- ) do
51
- heroku_service.authenticate
52
- end
53
- end
54
-
55
- if (app_name = heroku_service.app)
56
- ctx.puts(ctx.message("rails.deploy.heroku.app.selected", app_name))
57
- else
58
- app_type = CLI::UI::Prompt.ask(ctx.message("rails.deploy.heroku.app.no_apps_found")) do |handler|
59
- handler.option(ctx.message("rails.deploy.heroku.app.create")) { :new }
60
- handler.option(ctx.message("rails.deploy.heroku.app.select")) { :existing }
61
- end
62
-
63
- if app_type == :existing
64
- app_name = CLI::UI::Prompt.ask(ctx.message("rails.deploy.heroku.app.name"))
65
- CLI::UI::Frame.open(
66
- ctx.message("rails.deploy.heroku.app.selecting", app_name),
67
- success_text: ctx.message("rails.deploy.heroku.app.selected", app_name)
68
- ) do
69
- heroku_service.select_existing_app(app_name)
70
- end
71
- elsif app_type == :new
72
- CLI::UI::Frame.open(
73
- ctx.message("rails.deploy.heroku.app.creating"),
74
- success_text: ctx.message("rails.deploy.heroku.app.created")
75
- ) do
76
- heroku_service.create_new_app
77
- end
78
- end
79
- end
80
-
81
- branches = ShopifyCLI::Git.branches(ctx)
82
- if branches.length == 1
83
- branch_to_deploy = branches[0]
84
- ctx.puts(ctx.message("rails.deploy.heroku.git.branch_selected", branch_to_deploy))
85
- else
86
- branch_to_deploy = CLI::UI::Prompt.ask(ctx.message("rails.deploy.heroku.git.what_branch")) do |handler|
87
- branches.each do |branch|
88
- handler.option(branch) { branch }
89
- end
90
- end
91
- end
92
-
93
- CLI::UI::Frame.open(
94
- ctx.message("rails.deploy.heroku.deploying"),
95
- success_text: ctx.message("rails.deploy.heroku.deployed")
96
- ) do
97
- heroku_service.deploy(branch_to_deploy)
98
- end
99
- end
100
-
101
- def check_db(ctx)
102
- out, stat = ctx.capture2e(DB_CHECK_CMD)
103
- if stat.success? && out.strip == "sqlite"
104
- ["sqlite", "rails.deploy.heroku.db_check.sqlite"]
105
- elsif !stat.success?
106
- [nil, "rails.deploy.heroku.db_check.problem"]
107
- else
108
- [out.strip, nil]
109
- end
110
- end
111
- end
112
- end
113
- end
114
- end
115
- end
@@ -1,32 +0,0 @@
1
- # frozen_string_literal: true
2
- require "shopify_cli"
3
-
4
- module Rails
5
- class Command
6
- class Deploy < ShopifyCLI::SubCommand
7
- prerequisite_task ensure_project_type: :rails
8
-
9
- autoload :Heroku, Project.project_filepath("commands/deploy/heroku")
10
-
11
- HEROKU = "heroku"
12
-
13
- def call(args, _name)
14
- subcommand = args.shift
15
- case subcommand
16
- when HEROKU
17
- Rails::Command::Deploy::Heroku.start(@ctx)
18
- else
19
- @ctx.puts(self.class.help)
20
- end
21
- end
22
-
23
- def self.help
24
- ShopifyCLI::Context.message("rails.deploy.help", ShopifyCLI::TOOL_NAME)
25
- end
26
-
27
- def self.extended_help
28
- ShopifyCLI::Context.message("rails.deploy.extended_help", ShopifyCLI::TOOL_NAME)
29
- end
30
- end
31
- end
32
- end
@@ -1,42 +0,0 @@
1
- require "shopify_cli"
2
- require "json"
3
- module Rails
4
- class Command
5
- class Generate
6
- class Webhook
7
- class << self
8
- def start(ctx, args)
9
- selected_type = args.first
10
- schema = ShopifyCLI::AdminAPI::Schema.get(ctx)
11
- webhooks = schema.get_names_from_type("WebhookSubscriptionTopic")
12
- unless selected_type && webhooks.include?(selected_type)
13
- selected_type = CLI::UI::Prompt.ask(ctx.message("rails.generate.webhook.select")) do |handler|
14
- webhooks.each do |type|
15
- handler.option(type) { type }
16
- end
17
- end
18
- end
19
- spin_group = CLI::UI::SpinGroup.new
20
- spin_group.add(ctx.message("rails.generate.webhook.selected", selected_type)) do |spinner|
21
- Rails::Command::Generate.run_generate(generate_command(selected_type, ctx), selected_type, ctx)
22
- spinner.update_title("{{green:#{selected_type}}} config/initializers/shopify_app.rb")
23
- end
24
- spin_group.wait
25
- end
26
-
27
- def help
28
- ShopifyCLI::Context.message("rails.generate.webhook.help", ShopifyCLI::TOOL_NAME)
29
- end
30
-
31
- def generate_command(selected_type, ctx)
32
- parts = selected_type.downcase.split("_")
33
- host = ShopifyCLI::Project.current.env.host
34
- selected_type = parts[0..-2].join("_") + "/" + parts[-1]
35
- command = ctx.windows? ? "ruby bin\\rails" : "bin/rails"
36
- "#{command} g shopify_app:add_webhook -t #{selected_type} -a #{host}/webhooks/#{selected_type.downcase}"
37
- end
38
- end
39
- end
40
- end
41
- end
42
- end
@@ -1,60 +0,0 @@
1
- # frozen_string_literal: true
2
- require "shopify_cli"
3
-
4
- module Rails
5
- class Command
6
- class Generate < ShopifyCLI::SubCommand
7
- prerequisite_task ensure_project_type: :rails
8
-
9
- autoload :Webhook, Project.project_filepath("commands/generate/webhook")
10
-
11
- WEBHOOK = "webhook"
12
-
13
- def call(args, _name)
14
- subcommand = args.shift
15
- case subcommand
16
- when WEBHOOK
17
- Rails::Command::Generate::Webhook.start(@ctx, args)
18
- else
19
- @ctx.puts(self.class.help)
20
- end
21
- end
22
-
23
- def self.help
24
- ShopifyCLI::Context.message("rails.generate.help", ShopifyCLI::TOOL_NAME)
25
- end
26
-
27
- def self.extended_help
28
- extended_help = "{{bold:Subcommands:}}\n"
29
- subcommand_registry.resolved_commands.sort.each do |name, klass|
30
- extended_help += " {{cyan:#{name}}}: "
31
-
32
- if (subcmd_help = klass.help)
33
- extended_help += subcmd_help.gsub("\n ", "\n ")
34
- end
35
- extended_help += "\n"
36
- end
37
- extended_help += ShopifyCLI::Context.message("rails.generate.extended_help", ShopifyCLI::TOOL_NAME)
38
- end
39
-
40
- def self.run_generate(script, name, ctx)
41
- Gem.gem_path(ctx)
42
- stat = ctx.system(script)
43
- unless stat.success?
44
- ctx.abort(response(stat.exitstatus, name, ctx))
45
- end
46
- end
47
-
48
- def self.response(code, name, ctx)
49
- case code
50
- when 1
51
- ctx.message("rails.generate.error.generic", name)
52
- when 2
53
- ctx.message("rails.generate.error.name_exists", name)
54
- else
55
- ctx.message("rails.error.generic")
56
- end
57
- end
58
- end
59
- end
60
- end
@@ -1,18 +0,0 @@
1
- require "shopify_cli"
2
-
3
- module Rails
4
- class Command
5
- class Open < ShopifyCLI::SubCommand
6
- prerequisite_task ensure_project_type: :rails
7
-
8
- def call(*)
9
- project = ShopifyCLI::Project.current
10
- @ctx.open_url!("#{project.env.host}/login?shop=#{project.env.shop}")
11
- end
12
-
13
- def self.help
14
- ShopifyCLI::Context.message("rails.open.help", ShopifyCLI::TOOL_NAME)
15
- end
16
- end
17
- end
18
- end
@@ -1,51 +0,0 @@
1
- # frozen_string_literal: true
2
- module Rails
3
- class Command
4
- class Serve < ShopifyCLI::SubCommand
5
- include ShopifyCLI::CommandOptions::CommandServeOptions
6
-
7
- prerequisite_task ensure_project_type: :rails
8
- prerequisite_task :ensure_env, :ensure_dev_store
9
-
10
- parse_host_option
11
- parse_port_option
12
-
13
- def call(*)
14
- project = ShopifyCLI::Project.current
15
- tunnel_port = port.to_s
16
- url = host || ShopifyCLI::Tunnel.start(@ctx, port: tunnel_port)
17
- project.env.update(@ctx, :host, url)
18
- ShopifyCLI::Tasks::UpdateDashboardURLS.call(
19
- @ctx,
20
- url: url,
21
- callback_url: "/auth/shopify/callback",
22
- )
23
-
24
- if project.env.shop
25
- project_url = "#{project.env.host}/login?shop=#{project.env.shop}"
26
- @ctx.puts("\n" + @ctx.message("rails.serve.open_info", project_url) + "\n")
27
- end
28
-
29
- CLI::UI::Frame.open(@ctx.message("rails.serve.running_server")) do
30
- env = ShopifyCLI::Project.current.env.to_h
31
- env.delete("HOST")
32
- env["PORT"] = tunnel_port
33
- env["GEM_PATH"] = Gem.gem_path(@ctx)
34
- if @ctx.windows?
35
- @ctx.system("ruby bin\\rails server", env: env)
36
- else
37
- @ctx.system("bin/rails server", env: env)
38
- end
39
- end
40
- end
41
-
42
- def self.help
43
- ShopifyCLI::Context.message("rails.serve.help", ShopifyCLI::TOOL_NAME)
44
- end
45
-
46
- def self.extended_help
47
- ShopifyCLI::Context.message("rails.serve.extended_help", ShopifyCLI::TOOL_NAME)
48
- end
49
- end
50
- end
51
- end
@@ -1,41 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "shopify_cli"
4
-
5
- module Rails
6
- class Command
7
- class Tunnel < ShopifyCLI::SubCommand
8
- # subcommands :auth, :start, :stop
9
-
10
- prerequisite_task ensure_project_type: :rails
11
-
12
- def call(args, _name)
13
- subcommand = args.shift
14
- case subcommand
15
- when "auth"
16
- token = args.shift
17
- if token.nil?
18
- @ctx.puts(@ctx.message("rails.tunnel.error.token_argument_missing"))
19
- @ctx.puts("#{self.class.help}\n#{self.class.extended_help}")
20
- else
21
- ShopifyCLI::Tunnel.auth(@ctx, token)
22
- end
23
- when "start"
24
- ShopifyCLI::Tunnel.start(@ctx)
25
- when "stop"
26
- ShopifyCLI::Tunnel.stop(@ctx)
27
- else
28
- @ctx.puts(self.class.help)
29
- end
30
- end
31
-
32
- def self.help
33
- ShopifyCLI::Context.message("rails.tunnel.help", ShopifyCLI::TOOL_NAME)
34
- end
35
-
36
- def self.extended_help
37
- ShopifyCLI::Context.message("rails.tunnel.extended_help", ShopifyCLI::TOOL_NAME)
38
- end
39
- end
40
- end
41
- end
@@ -1,106 +0,0 @@
1
- require "shopify_cli"
2
-
3
- module Script
4
- module Tasks
5
- class EnsureEnv < ShopifyCLI::Task
6
- attr_accessor :ctx
7
-
8
- def call(ctx)
9
- self.ctx = ctx
10
-
11
- script_project_repo = Layers::Infrastructure::ScriptProjectRepository.new(ctx: ctx)
12
- script_project = script_project_repo.get
13
-
14
- return false if script_project.api_key && script_project.api_secret && script_project.uuid_defined?
15
-
16
- org = ask_org
17
- app = ask_app(org["apps"])
18
- uuid = ask_script_uuid(app, script_project.extension_point_type)
19
-
20
- script_project_repo.create_env(
21
- api_key: app["apiKey"],
22
- secret: app["apiSecretKeys"].first["secret"],
23
- uuid: uuid
24
- )
25
-
26
- true
27
- end
28
-
29
- private
30
-
31
- def ask_org
32
- return stubbed_org if partner_proxy_bypass
33
-
34
- if ShopifyCLI::Shopifolk.check && wants_to_run_against_shopify_org?
35
- ShopifyCLI::Shopifolk.act_as_shopify_organization
36
- end
37
-
38
- orgs = ShopifyCLI::PartnersAPI::Organizations.fetch_with_app(ctx)
39
- if orgs.count == 1
40
- default = orgs.first
41
- ctx.puts(ctx.message("script.application.ensure_env.organization", default["businessName"], default["id"]))
42
- default
43
- elsif orgs.count > 0
44
- CLI::UI::Prompt.ask(ctx.message("script.application.ensure_env.organization_select")) do |handler|
45
- orgs.each do |org|
46
- handler.option("#{org["businessName"]} (#{org["id"]})") { org }
47
- end
48
- end
49
- else
50
- raise Errors::NoExistingOrganizationsError
51
- end
52
- end
53
-
54
- def stubbed_org
55
- {
56
- "apps" => [
57
- {
58
- "appType" => "custom",
59
- "apiKey" => "stubbed-api-key",
60
- "apiSecretKeys" => [{ "secret" => "stubbed-api-secret" }],
61
- "title" => "Fake App (Not connected to Partners)",
62
- },
63
- ],
64
- }
65
- end
66
-
67
- def partner_proxy_bypass
68
- !ENV["BYPASS_PARTNERS_PROXY"].nil?
69
- end
70
-
71
- def ask_app(apps)
72
- unless ShopifyCLI::Shopifolk.acting_as_shopify_organization?
73
- apps = apps.select { |app| app["appType"] == "custom" }
74
- end
75
-
76
- if apps.count == 1
77
- default = apps.first
78
- ctx.puts(ctx.message("script.application.ensure_env.app", default["title"]))
79
- default
80
- elsif apps.count > 0
81
- CLI::UI::Prompt.ask(ctx.message("script.application.ensure_env.app_select")) do |handler|
82
- apps.each do |app|
83
- handler.option(app["title"]) { app }
84
- end
85
- end
86
- else
87
- raise Errors::NoExistingAppsError
88
- end
89
- end
90
-
91
- def ask_script_uuid(app, extension_point_type)
92
- script_service = Layers::Infrastructure::ServiceLocator.script_service(ctx: ctx, api_key: app["apiKey"])
93
- scripts = script_service.get_app_scripts(extension_point_type: extension_point_type)
94
-
95
- return nil unless scripts.count > 0 &&
96
- CLI::UI::Prompt.confirm(ctx.message("script.application.ensure_env.ask_connect_to_existing_script"))
97
-
98
- CLI::UI::Prompt.ask(ctx.message("script.application.ensure_env.ask_which_script_to_connect_to")) do |handler|
99
- scripts.each do |script|
100
- handler.option("#{script["title"]} (#{script["uuid"]})") { script["uuid"] }
101
- end
102
- end
103
- end
104
- end
105
- end
106
- end
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
- require "shopify_cli"
3
-
4
- module ShopifyCLI
5
- class SubCommand < Command
6
- class << self
7
- def call(args, command_name, parent_command)
8
- cmd = new(@ctx)
9
- args = cmd.options.parse(@_options, args[1..-1] || [])
10
- return call_help(parent_command, command_name) if cmd.options.help
11
- run_prerequisites
12
-
13
- cmd.call(args, command_name)
14
- end
15
- end
16
- end
17
- end
data/shopify.fish DELETED
@@ -1,12 +0,0 @@
1
- #!/usr/bin/env fish
2
- # vi: ft=fish
3
-
4
- # If we're not already in a shim environment but still tried to set up a shim, print out the re-installation warning
5
- type -t shopify > /dev/null 2>&1
6
- if [ $status != "0" ]
7
- echo "This version of Shopify CLI is no longer supported. You’ll need to migrate to the new CLI version to continue.
8
-
9
- Please visit this page for complete instructions:
10
- https://shopify.dev/tools/cli/troubleshooting#migrate-from-a-legacy-version
11
- "
12
- end
data/shopify.sh DELETED
@@ -1,11 +0,0 @@
1
- #!/bin/sh
2
-
3
- # If we're not already in a shim environment but still tried to set up a shim, print out the re-installation warning
4
- typeset -f shopify > /dev/null 2>&1
5
- if [ "$?" != "0" ]; then
6
- echo "This version of Shopify CLI is no longer supported. You’ll need to migrate to the new CLI version to continue.
7
-
8
- Please visit this page for complete instructions:
9
- https://shopify.dev/tools/cli/troubleshooting#migrate-from-a-legacy-version
10
- "
11
- fi