shopify-cli 1.13.1 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (200) hide show
  1. checksums.yaml +4 -4
  2. data/.github/CODEOWNERS +1 -1
  3. data/.github/CONTRIBUTING.md +7 -7
  4. data/.github/DESIGN.md +3 -3
  5. data/.github/workflows/build.yml +1 -1
  6. data/.gitignore +3 -0
  7. data/.rubocop.yml +3 -1
  8. data/.ruby-version +1 -1
  9. data/CHANGELOG.md +60 -26
  10. data/Gemfile +4 -0
  11. data/Gemfile.lock +32 -0
  12. data/LICENSE +4 -1
  13. data/README.md +94 -26
  14. data/RELEASING.md +31 -7
  15. data/Rakefile +2 -2
  16. data/SECURITY.md +1 -1
  17. data/THEMEKIT_MIGRATION.md +18 -0
  18. data/bin/load_shopify.rb +1 -1
  19. data/bin/shopify +3 -3
  20. data/dev.yml +1 -1
  21. data/docs/app/node/index.md +1 -1
  22. data/docs/app/rails/index.md +1 -1
  23. data/docs/core/index.md +1 -1
  24. data/docs/getting-started/index.md +1 -1
  25. data/docs/getting-started/install/index.md +1 -1
  26. data/docs/getting-started/migrate/index.md +1 -1
  27. data/docs/getting-started/uninstall/index.md +1 -1
  28. data/docs/getting-started/upgrade/index.md +1 -1
  29. data/docs/help/start-app/index.md +1 -1
  30. data/docs/index.md +1 -1
  31. data/ext/shopify-cli/extconf.rb +17 -5
  32. data/install.sh +1 -1
  33. data/lib/docgen/index_template.md.erb +2 -2
  34. data/lib/graphql/all_orgs_with_extensions.graphql +37 -0
  35. data/lib/graphql/api_versions.graphql +1 -1
  36. data/lib/graphql/find_organization.graphql +2 -1
  37. data/lib/project_types/extension/cli.rb +19 -15
  38. data/lib/project_types/extension/commands/build.rb +4 -5
  39. data/lib/project_types/extension/commands/check.rb +44 -0
  40. data/lib/project_types/extension/commands/connect.rb +35 -0
  41. data/lib/project_types/extension/commands/create.rb +12 -16
  42. data/lib/project_types/extension/commands/extension_command.rb +2 -2
  43. data/lib/project_types/extension/commands/info.rb +86 -0
  44. data/lib/project_types/extension/commands/push.rb +8 -7
  45. data/lib/project_types/extension/commands/register.rb +4 -5
  46. data/lib/project_types/extension/commands/serve.rb +5 -8
  47. data/lib/project_types/extension/commands/tunnel.rb +3 -1
  48. data/lib/project_types/extension/errors.rb +9 -0
  49. data/lib/project_types/extension/extension_project.rb +24 -1
  50. data/lib/project_types/extension/extension_project_keys.rb +1 -0
  51. data/lib/project_types/extension/features/argo.rb +6 -6
  52. data/lib/project_types/extension/features/argo_runtime.rb +22 -66
  53. data/lib/project_types/extension/features/argo_serve.rb +25 -18
  54. data/lib/project_types/extension/forms/connect.rb +42 -0
  55. data/lib/project_types/extension/forms/questions/ask_name.rb +14 -6
  56. data/lib/project_types/extension/forms/questions/ask_registration.rb +51 -0
  57. data/lib/project_types/extension/messages/messages.rb +84 -16
  58. data/lib/project_types/extension/models/specification.rb +1 -0
  59. data/lib/project_types/extension/models/specification_handlers/{checkout_argo_extension.rb → checkout_ui_extension.rb} +3 -1
  60. data/lib/project_types/extension/models/specification_handlers/default.rb +13 -3
  61. data/lib/project_types/extension/models/specification_handlers/theme_app_extension.rb +89 -0
  62. data/lib/project_types/extension/models/specifications.rb +1 -0
  63. data/lib/project_types/extension/tasks/configure_features.rb +6 -7
  64. data/lib/project_types/extension/tasks/configure_options.rb +20 -0
  65. data/lib/project_types/extension/tasks/get_extensions.rb +32 -0
  66. data/lib/project_types/node/cli.rb +9 -21
  67. data/lib/project_types/node/commands/connect.rb +8 -2
  68. data/lib/project_types/node/commands/create.rb +9 -5
  69. data/lib/project_types/node/commands/deploy.rb +15 -5
  70. data/lib/project_types/node/commands/deploy/heroku.rb +29 -29
  71. data/lib/project_types/node/commands/generate.rb +4 -2
  72. data/lib/project_types/node/commands/open.rb +4 -2
  73. data/lib/project_types/node/commands/serve.rb +3 -2
  74. data/lib/project_types/node/commands/tunnel.rb +4 -2
  75. data/lib/project_types/node/messages/messages.rb +47 -90
  76. data/lib/project_types/rails/cli.rb +9 -21
  77. data/lib/project_types/rails/commands/connect.rb +8 -2
  78. data/lib/project_types/rails/commands/create.rb +10 -6
  79. data/lib/project_types/rails/commands/deploy.rb +15 -5
  80. data/lib/project_types/rails/commands/deploy/heroku.rb +84 -82
  81. data/lib/project_types/rails/commands/generate.rb +15 -5
  82. data/lib/project_types/rails/commands/generate/webhook.rb +28 -26
  83. data/lib/project_types/rails/commands/open.rb +4 -2
  84. data/lib/project_types/rails/commands/serve.rb +3 -2
  85. data/lib/project_types/rails/commands/tunnel.rb +4 -2
  86. data/lib/project_types/rails/messages/messages.rb +72 -119
  87. data/lib/project_types/script/cli.rb +6 -8
  88. data/lib/project_types/script/commands/create.rb +3 -1
  89. data/lib/project_types/script/commands/push.rb +7 -4
  90. data/lib/project_types/script/graphql/app_script_update_or_create.graphql +9 -3
  91. data/lib/project_types/script/layers/application/create_script.rb +4 -3
  92. data/lib/project_types/script/layers/domain/errors.rb +6 -11
  93. data/lib/project_types/script/layers/domain/push_package.rb +4 -8
  94. data/lib/project_types/script/layers/domain/script_json.rb +32 -0
  95. data/lib/project_types/script/layers/domain/script_project.rb +1 -1
  96. data/lib/project_types/script/layers/infrastructure/errors.rb +13 -17
  97. data/lib/project_types/script/layers/infrastructure/languages/assemblyscript_project_creator.rb +29 -21
  98. data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +2 -4
  99. data/lib/project_types/script/layers/infrastructure/script_project_repository.rb +45 -34
  100. data/lib/project_types/script/layers/infrastructure/script_service.rb +37 -16
  101. data/lib/project_types/script/messages/messages.rb +64 -54
  102. data/lib/project_types/script/tasks/ensure_env.rb +3 -1
  103. data/lib/project_types/script/ui/error_handler.rb +32 -32
  104. data/lib/project_types/theme/cli.rb +16 -27
  105. data/lib/project_types/theme/commands/check.rb +33 -0
  106. data/lib/project_types/theme/commands/delete.rb +64 -0
  107. data/lib/project_types/theme/commands/init.rb +42 -0
  108. data/lib/project_types/theme/commands/language_server.rb +16 -0
  109. data/lib/project_types/theme/commands/package.rb +55 -0
  110. data/lib/project_types/theme/commands/publish.rb +43 -0
  111. data/lib/project_types/theme/commands/pull.rb +51 -0
  112. data/lib/project_types/theme/commands/push.rb +58 -32
  113. data/lib/project_types/theme/commands/serve.rb +8 -16
  114. data/lib/project_types/theme/forms/confirm_store.rb +15 -0
  115. data/lib/project_types/theme/forms/select.rb +59 -0
  116. data/lib/project_types/theme/messages/messages.rb +118 -103
  117. data/lib/project_types/theme/ui/sync_progress_bar.rb +20 -0
  118. data/lib/shopify-cli/admin_api.rb +57 -38
  119. data/lib/shopify-cli/admin_api/populate_resource_command.rb +6 -14
  120. data/lib/shopify-cli/admin_api/schema.rb +1 -10
  121. data/lib/shopify-cli/api.rb +29 -14
  122. data/lib/shopify-cli/command.rb +15 -3
  123. data/lib/shopify-cli/commands.rb +7 -2
  124. data/lib/shopify-cli/commands/help.rb +2 -29
  125. data/lib/shopify-cli/commands/login.rb +95 -0
  126. data/lib/shopify-cli/commands/logout.rb +24 -8
  127. data/lib/shopify-cli/commands/populate.rb +23 -0
  128. data/lib/{project_types/node → shopify-cli}/commands/populate/customer.rb +2 -8
  129. data/lib/{project_types/node → shopify-cli}/commands/populate/draft_order.rb +2 -2
  130. data/lib/{project_types/node → shopify-cli}/commands/populate/product.rb +2 -8
  131. data/lib/shopify-cli/commands/store.rb +15 -0
  132. data/lib/shopify-cli/commands/switch.rb +39 -0
  133. data/lib/shopify-cli/commands/system.rb +12 -0
  134. data/lib/shopify-cli/commands/whoami.rb +28 -0
  135. data/lib/shopify-cli/connect.rb +32 -0
  136. data/lib/shopify-cli/context.rb +65 -4
  137. data/lib/shopify-cli/core/entry_point.rb +3 -22
  138. data/lib/shopify-cli/core/monorail.rb +6 -2
  139. data/lib/shopify-cli/db.rb +4 -4
  140. data/lib/shopify-cli/http_request.rb +16 -0
  141. data/lib/shopify-cli/identity_auth.rb +282 -0
  142. data/lib/shopify-cli/{oauth → identity_auth}/servlet.rb +11 -12
  143. data/lib/shopify-cli/messages/messages.rb +140 -46
  144. data/lib/shopify-cli/packager.rb +5 -5
  145. data/lib/shopify-cli/partners_api.rb +21 -44
  146. data/lib/shopify-cli/partners_api/organizations.rb +8 -0
  147. data/lib/shopify-cli/project_commands.rb +16 -0
  148. data/lib/shopify-cli/project_type.rb +0 -31
  149. data/lib/shopify-cli/shopifolk.rb +8 -11
  150. data/lib/shopify-cli/sub_command.rb +1 -0
  151. data/lib/shopify-cli/tasks.rb +3 -0
  152. data/lib/shopify-cli/tasks/confirm_store.rb +18 -0
  153. data/lib/shopify-cli/tasks/create_api_client.rb +2 -2
  154. data/lib/shopify-cli/tasks/ensure_authenticated.rb +13 -0
  155. data/lib/shopify-cli/tasks/ensure_loopback_url.rb +1 -1
  156. data/lib/shopify-cli/tasks/ensure_project_type.rb +12 -0
  157. data/lib/shopify-cli/tasks/select_org_and_shop.rb +0 -3
  158. data/lib/shopify-cli/theme/dev_server.rb +98 -0
  159. data/lib/shopify-cli/theme/dev_server/certificate_manager.rb +79 -0
  160. data/lib/shopify-cli/theme/dev_server/header_hash.rb +94 -0
  161. data/lib/shopify-cli/theme/dev_server/hot-reload.js +93 -0
  162. data/lib/shopify-cli/theme/dev_server/hot_reload.rb +76 -0
  163. data/lib/shopify-cli/theme/dev_server/local_assets.rb +87 -0
  164. data/lib/shopify-cli/theme/dev_server/proxy.rb +205 -0
  165. data/lib/shopify-cli/theme/dev_server/sse.rb +75 -0
  166. data/lib/shopify-cli/theme/dev_server/watcher.rb +59 -0
  167. data/lib/shopify-cli/theme/dev_server/web_server.rb +140 -0
  168. data/lib/shopify-cli/theme/development_theme.rb +69 -0
  169. data/lib/shopify-cli/theme/file.rb +112 -0
  170. data/lib/shopify-cli/theme/ignore_filter.rb +109 -0
  171. data/lib/shopify-cli/theme/mime_type.rb +34 -0
  172. data/lib/shopify-cli/theme/syncer.rb +332 -0
  173. data/lib/shopify-cli/theme/theme.rb +204 -0
  174. data/lib/shopify-cli/tunnel.rb +1 -1
  175. data/lib/shopify-cli/version.rb +1 -1
  176. data/lib/shopify_cli.rb +18 -11
  177. data/shopify-cli.gemspec +12 -5
  178. data/shopify.fish +1 -1
  179. data/shopify.sh +1 -1
  180. metadata +92 -35
  181. data/.github/workflows/release.yml +0 -59
  182. data/lib/project_types/extension/features/argo_serve_options.rb +0 -42
  183. data/lib/project_types/node/commands/populate.rb +0 -23
  184. data/lib/project_types/rails/commands/populate.rb +0 -23
  185. data/lib/project_types/rails/commands/populate/customer.rb +0 -31
  186. data/lib/project_types/rails/commands/populate/draft_order.rb +0 -28
  187. data/lib/project_types/rails/commands/populate/product.rb +0 -30
  188. data/lib/project_types/script/layers/domain/config_ui.rb +0 -16
  189. data/lib/project_types/theme/commands/connect.rb +0 -54
  190. data/lib/project_types/theme/commands/create.rb +0 -48
  191. data/lib/project_types/theme/commands/deploy.rb +0 -38
  192. data/lib/project_types/theme/commands/generate.rb +0 -20
  193. data/lib/project_types/theme/commands/generate/env.rb +0 -79
  194. data/lib/project_types/theme/forms/connect.rb +0 -34
  195. data/lib/project_types/theme/forms/create.rb +0 -22
  196. data/lib/project_types/theme/tasks/ensure_themekit_installed.rb +0 -78
  197. data/lib/project_types/theme/themekit.rb +0 -113
  198. data/lib/shopify-cli/commands/connect.rb +0 -64
  199. data/lib/shopify-cli/commands/create.rb +0 -50
  200. data/lib/shopify-cli/oauth.rb +0 -198
@@ -2,12 +2,22 @@
2
2
  require "shopify_cli"
3
3
 
4
4
  module Rails
5
- module Commands
6
- class Generate < ShopifyCli::Command
7
- subcommand :Webhook, "webhook", Project.project_filepath("commands/generate/webhook")
5
+ class Command
6
+ class Generate < ShopifyCli::SubCommand
7
+ prerequisite_task ensure_project_type: :rails
8
8
 
9
- def call(*)
10
- @ctx.puts(self.class.help)
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
11
21
  end
12
22
 
13
23
  def self.help
@@ -1,38 +1,40 @@
1
1
  require "shopify_cli"
2
2
  require "json"
3
3
  module Rails
4
- module Commands
4
+ class Command
5
5
  class Generate
6
- class Webhook < ShopifyCli::SubCommand
7
- def call(args, _name)
8
- selected_type = args.first
9
- schema = ShopifyCli::AdminAPI::Schema.get(@ctx)
10
- webhooks = schema.get_names_from_type("WebhookSubscriptionTopic")
11
- unless selected_type && webhooks.include?(selected_type)
12
- selected_type = CLI::UI::Prompt.ask(@ctx.message("rails.generate.webhook.select")) do |handler|
13
- webhooks.each do |type|
14
- handler.option(type) { type }
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
15
17
  end
16
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
17
25
  end
18
- spin_group = CLI::UI::SpinGroup.new
19
- spin_group.add(@ctx.message("rails.generate.webhook.selected", selected_type)) do |spinner|
20
- Rails::Commands::Generate.run_generate(generate_command(selected_type), selected_type, @ctx)
21
- spinner.update_title("{{green:#{selected_type}}} config/initializers/shopify_app.rb")
22
- end
23
- spin_group.wait
24
- end
25
26
 
26
- def self.help
27
- ShopifyCli::Context.message("rails.generate.webhook.help", ShopifyCli::TOOL_NAME)
28
- end
27
+ def help
28
+ ShopifyCli::Context.message("rails.generate.webhook.help", ShopifyCli::TOOL_NAME)
29
+ end
29
30
 
30
- def generate_command(selected_type)
31
- parts = selected_type.downcase.split("_")
32
- host = ShopifyCli::Project.current.env.host
33
- selected_type = parts[0..-2].join("_") + "/" + parts[-1]
34
- command = @ctx.windows? ? "ruby bin\\rails" : "bin/rails"
35
- "#{command} g shopify_app:add_webhook -t #{selected_type} -a #{host}/webhooks/#{selected_type.downcase}"
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
36
38
  end
37
39
  end
38
40
  end
@@ -1,8 +1,10 @@
1
1
  require "shopify_cli"
2
2
 
3
3
  module Rails
4
- module Commands
5
- class Open < ShopifyCli::Command
4
+ class Command
5
+ class Open < ShopifyCli::SubCommand
6
+ prerequisite_task ensure_project_type: :rails
7
+
6
8
  def call(*)
7
9
  project = ShopifyCli::Project.current
8
10
  @ctx.open_url!("#{project.env.host}/login?shop=#{project.env.shop}")
@@ -1,7 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
  module Rails
3
- module Commands
4
- class Serve < ShopifyCli::Command
3
+ class Command
4
+ class Serve < ShopifyCli::SubCommand
5
+ prerequisite_task ensure_project_type: :rails
5
6
  prerequisite_task :ensure_env, :ensure_dev_store
6
7
 
7
8
  options do |parser, flags|
@@ -3,10 +3,12 @@
3
3
  require "shopify_cli"
4
4
 
5
5
  module Rails
6
- module Commands
7
- class Tunnel < ShopifyCli::Command
6
+ class Command
7
+ class Tunnel < ShopifyCli::SubCommand
8
8
  # subcommands :auth, :start, :stop
9
9
 
10
+ prerequisite_task ensure_project_type: :rails
11
+
10
12
  def call(args, _name)
11
13
  subcommand = args.shift
12
14
  case subcommand
@@ -4,6 +4,11 @@ module Rails
4
4
  module Messages
5
5
  MESSAGES = {
6
6
  rails: {
7
+ help: <<~HELP,
8
+ Suite of commands for developing Ruby on Rails apps. See {{command:%1$s rails <command> --help}} for usage of each command.
9
+ Usage: {{command:%1$s rails [ %2$s ]}}
10
+ HELP
11
+
7
12
  error: {
8
13
  generic: "Error",
9
14
  },
@@ -12,37 +17,36 @@ module Rails
12
17
  checking_installation_path: "Checking path %s for gem %s",
13
18
  installed: "Installed %s gem",
14
19
  installed_debug: "%s installed: %s",
15
- installing: "Installing %s gem...",
20
+ installing: "Installing %s gem",
16
21
  setting_gem_home: "GEM_HOME being set to %s",
17
22
  setting_gem_path: "GEM_PATH being set to %s",
18
23
  },
19
24
 
20
25
  connect: {
21
26
  connected: "Project now connected to {{green:%s}}",
27
+ help: <<~HELP,
28
+ {{command:%s rails connect}}: Connects an existing Ruby on Rails app to Shopify CLI. Creates a config file.
29
+ Usage: {{command:%s rails connect}}
30
+ HELP
22
31
  production_warning: <<~MESSAGE,
23
- {{yellow:! Warning: if you have connected to an {{bold:app in production}}, running {{command:serve}} may update the app URL and cause an outage.
32
+ {{yellow:! Warning: if you have connected to an {{bold:app in production}}, running {{command:serve}} may update the app URL and cause an outage.
24
33
  MESSAGE
25
34
  },
26
35
 
27
36
  create: {
28
37
  help: <<~HELP,
29
- {{command:%s create rails}}: Creates a ruby on rails app.
30
- Usage: {{command:%s create rails}}
31
- Options:
32
- {{command:--name=NAME}} App name. Any string.
33
- {{command:--app-url=APPURL}} App URL. Must be a valid URL.
34
- {{command:--organization-id=ID}} Partner organization ID. Must be an existing organization.
35
- {{command:--shop-domain=MYSHOPIFYDOMAIN }} Development store URL. Must be an existing development store.
36
- {{command:--db=DB}} Database type. Must be one of: mysql, postgresql, sqlite3, oracle, frontbase, ibm_db, sqlserver, jdbcmysql, jdbcsqlite3, jdbcpostgresql, jdbc.
37
- {{command:--rails-opts=RAILSOPTS}} Additional options. Must be string containing one or more valid Rails options, separated by spaces.
38
+ {{command:%s rails create}}: Creates a ruby on rails app.
39
+ Usage: {{command:%s rails create}}
40
+ Options:
41
+ {{command:--name=NAME}} App name. Any string.
42
+ {{command:--organization-id=ID}} Partner organization ID. Must be an existing organization.
43
+ {{command:--store=MYSHOPIFYDOMAIN }} Development store URL. Must be an existing development store.
44
+ {{command:--db=DB}} Database type. Must be one of: mysql, postgresql, sqlite3, oracle, frontbase, ibm_db, sqlserver, jdbcmysql, jdbcsqlite3, jdbcpostgresql, jdbc.
45
+ {{command:--rails-opts=RAILSOPTS}} Additional options. Must be string containing one or more valid Rails options, separated by spaces.
38
46
  HELP
39
47
 
40
48
  error: {
41
- invalid_ruby_version: <<~MSG,
42
- This project requires a Ruby version ~> 2.5 or Ruby 3.0
43
- See {{underline:https://github.com/Shopify/shopify-app-cli/blob/master/docs/installing-ruby.md}}
44
- for our recommended method of installing ruby.
45
- MSG
49
+ invalid_ruby_version: "This project requires a Ruby version ~> 2.5 or Ruby 3.0.",
46
50
  dir_exists: "Project directory %s already exists. Please use a different name.",
47
51
  install_failure: "Error installing %s gem",
48
52
  node_required: "node is required to create a rails project. Download at https://nodejs.org/en/download.",
@@ -58,55 +62,55 @@ module Rails
58
62
  open_new_shell: "{{*}} {{yellow:After installing %s, please open a new Command Prompt or PowerShell " \
59
63
  "window to continue.}}",
60
64
  },
61
- installing_bundler: "Installing bundler...",
62
- generating_app: "Generating new rails app project in %s...",
63
- adding_shopify_gem: "{{v}} Adding shopify_app gem...",
65
+ installing_bundler: "Installing bundler",
66
+ generating_app: "Generating new rails app project in %s",
67
+ adding_shopify_gem: "{{v}} Adding shopify_app gem",
64
68
  node_version: "node %s",
65
69
  yarn_version: "yarn %s",
66
- running_bundle_install: "Running bundle install...",
67
- running_generator: "Running shopify_app generator...",
68
- running_migrations: "Running migrations...",
69
- running_webpacker_install: "Running webpacker:install...",
70
+ running_bundle_install: "Running bundle install",
71
+ running_generator: "Running shopify_app generator",
72
+ running_migrations: "Running migrations",
73
+ running_webpacker_install: "Running webpacker:install",
70
74
  },
71
75
 
72
76
  deploy: {
73
77
  help: <<~HELP,
74
- Deploy the current Rails project to a hosting service. Heroku ({{underline:https://www.heroku.com}}) is currently the only option, but more will be added in the future.
75
- Usage: {{command:%s deploy [ heroku ]}}
78
+ Deploy the current Rails project to a hosting service. Heroku ({{underline:https://www.heroku.com}}) is currently the only option, but more will be added in the future.
79
+ Usage: {{command:%s rails deploy [ heroku ]}}
76
80
  HELP
77
81
  extended_help: <<~HELP,
78
- {{bold:Subcommands:}}
79
- {{cyan:heroku}}: Deploys the current Rails project to Heroku.
80
- Usage: {{command:%s deploy heroku}}
82
+ {{bold:Subcommands:}}
83
+ {{cyan:heroku}}: Deploys the current Rails project to Heroku.
84
+ Usage: {{command:%s rails deploy heroku}}
81
85
  HELP
82
86
 
83
87
  heroku: {
84
88
  help: <<~HELP,
85
- Deploy the current Rails project to Heroku
86
- Usage: {{command:%s deploy heroku}}
89
+ Deploy the current Rails project to Heroku
90
+ Usage: {{command:%s rails deploy heroku}}
87
91
  HELP
88
- downloading: "Downloading Heroku CLI...",
92
+ downloading: "Downloading Heroku CLI",
89
93
  downloaded: "Downloaded Heroku CLI",
90
- installing: "Installing Heroku CLI...",
94
+ installing: "Installing Heroku CLI",
91
95
  installed: "Installed Heroku CLI",
92
96
  authenticated_with_account: "{{v}} Authenticated with Heroku as {{green:%s}}",
93
- authenticating: "Authenticating with Heroku...",
97
+ authenticating: "Authenticating with Heroku",
94
98
  authenticated: "{{v}} Authenticated with Heroku",
95
- deploying: "Deploying to Heroku...",
99
+ deploying: "Deploying to Heroku",
96
100
  deployed: "{{v}} Deployed to Heroku",
97
101
  db_check: {
98
- validating: "Validating application...",
99
- checking: "Checking database type...",
102
+ validating: "Validating application",
103
+ checking: "Checking database type",
100
104
  validated: "Database type \"%s\" validated for platform \"Heroku\"",
101
105
  problem: "A problem was encountered while checking your database type.",
102
106
  sqlite: <<~SQLITE,
103
- Heroku does not support deployment using the SQLite database system.
104
- Change the database type using {{command:rails db:system:change --to=[new_db_type]}}. For more info:
105
- {{underline:https://gorails.com/episodes/rails-6-db-system-change-command}}
107
+ Heroku does not support deployment using the SQLite database system.
108
+ Change the database type using {{command:rails db:system:change --to=[new_db_type]}}. For more info:
109
+ {{underline:https://gorails.com/episodes/rails-6-db-system-change-command}}
106
110
  SQLITE
107
111
  },
108
112
  git: {
109
- checking: "Checking git repo...",
113
+ checking: "Checking git repo",
110
114
  initialized: "Git repo initialized",
111
115
  what_branch: "What branch would you like to deploy?",
112
116
  branch_selected: "{{v}} Git branch {{green:%s}} selected for deploy",
@@ -115,10 +119,10 @@ module Rails
115
119
  no_apps_found: "No existing Heroku app found. What would you like to do?",
116
120
  name: "What is your Heroku app’s name?",
117
121
  select: "Specify an existing Heroku app",
118
- selecting: "Selecting Heroku app %s...",
122
+ selecting: "Selecting Heroku app %s",
119
123
  selected: "{{v}} Heroku app {{green:%s}} selected",
120
124
  create: "Create a new Heroku app",
121
- creating: "Creating new Heroku app...",
125
+ creating: "Creating new Heroku app",
122
126
  created: "{{v}} New Heroku app created",
123
127
  },
124
128
  },
@@ -126,13 +130,13 @@ module Rails
126
130
 
127
131
  generate: {
128
132
  help: <<~HELP,
129
- Generate code in your Rails project. Currently supports generating new webhooks.
130
- Usage: {{command:%s generate [ webhook ]}}
133
+ Generate code in your Rails project. Currently supports generating new webhooks.
134
+ Usage: {{command:%s rails generate [ webhook ]}}
131
135
  HELP
132
136
  extended_help: <<~EXAMPLES,
133
- {{bold:Examples:}}
134
- {{cyan:%s generate webhook PRODUCTS_CREATE}}
135
- Generate and register a new webhook that will be called every time a new product is created on your store.
137
+ {{bold:Examples:}}
138
+ {{cyan:%s generate webhook PRODUCTS_CREATE}}
139
+ Generate and register a new webhook that will be called every time a new product is created on your store.
136
140
  EXAMPLES
137
141
 
138
142
  error: {
@@ -142,8 +146,8 @@ module Rails
142
146
 
143
147
  webhook: {
144
148
  help: <<~HELP,
145
- Generate and register a new webhook that listens for the specified Shopify store event.
146
- Usage: {{command:%s generate webhook <type>}}
149
+ Generate and register a new webhook that listens for the specified Shopify store event.
150
+ Usage: {{command:%s rails generate webhook <type>}}
147
151
  HELP
148
152
 
149
153
  select: "What type of webhook would you like to create?",
@@ -153,70 +157,19 @@ module Rails
153
157
 
154
158
  open: {
155
159
  help: <<~HELP,
156
- Open your local development app in the default browser.
157
- Usage: {{command:%s open}}
158
- HELP
159
- },
160
-
161
- populate: {
162
- help: <<~HELP,
163
- Populate your Shopify development store with example customers, orders, or products.
164
- Usage: {{command:%s populate [ customers | draftorders | products ]}}
160
+ Open your local development app in the default browser.
161
+ Usage: {{command:%s rails open}}
165
162
  HELP
166
- extended_help: <<~HELP,
167
- {{bold:Subcommands:}}
168
-
169
- {{cyan:customers [options]}}: Add dummy customers to the specified development store.
170
- Usage: {{command:%1$s populate customers}}
171
-
172
- {{cyan:draftorders [options]}}: Add dummy orders to the specified development store.
173
- Usage: {{command:%1$s populate draftorders}}
174
-
175
- {{cyan:products [options]}}: Add dummy products to the specified development store.
176
- Usage: {{command:%1$s populate products}}
177
-
178
- {{bold:Options:}}
179
-
180
- {{cyan:--count [integer]}}: The number of dummy items to populate. Defaults to 5.
181
- {{cyan:--silent}}: Silence the populate output.
182
- {{cyan:--help}}: Display more options specific to each subcommand.
183
-
184
- {{bold:Examples:}}
185
-
186
- {{command:%1$s populate products}}
187
- Populate your development store with 5 additional products.
188
-
189
- {{command:%1$s populate customers --count 30}}
190
- Populate your development store with 30 additional customers.
191
-
192
- {{command:%1$s populate draftorders}}
193
- Populate your development store with 5 additional orders.
194
-
195
- {{command:%1$s populate products --help}}
196
- Display the list of options available to customize the {{command:%1$s populate products}} command.
197
- HELP
198
-
199
- customer: {
200
- added: "%s added to {{green:%s}} at {{underline:%scustomers/%d}}",
201
- },
202
-
203
- draft_order: {
204
- added: "DraftOrder added to {{green:%s}} at {{underline:%sdraft_orders/%d}}",
205
- },
206
-
207
- product: {
208
- added: "%s added to {{green:%s}} at {{underline:%sproducts/%d}}",
209
- },
210
163
  },
211
164
 
212
165
  serve: {
213
166
  help: <<~HELP,
214
- Start a local development rails server for your project, as well as a public ngrok tunnel to your localhost.
215
- Usage: {{command:%s serve}}
167
+ Start a local development rails server for your project, as well as a public ngrok tunnel to your localhost.
168
+ Usage: {{command:%s rails serve}}
216
169
  HELP
217
170
  extended_help: <<~HELP,
218
- {{bold:Options:}}
219
- {{cyan:--host=HOST}}: Bypass running tunnel and use custom host. HOST must be HTTPS url.
171
+ {{bold:Options:}}
172
+ {{cyan:--host=HOST}}: Bypass running tunnel and use custom host. HOST must be HTTPS url.
220
173
  HELP
221
174
 
222
175
  error: {
@@ -227,25 +180,25 @@ module Rails
227
180
  {{*}} To install and start using your app, open this URL in your browser:
228
181
  {{green:%s}}
229
182
  MESSAGE
230
- running_server: "Running server...",
183
+ running_server: "Running server",
231
184
  },
232
185
 
233
186
  tunnel: {
234
187
  help: <<~HELP,
235
- Start or stop an http tunnel to your local development app using ngrok.
236
- Usage: {{command:%s tunnel [ auth | start | stop ]}}
188
+ Start or stop an http tunnel to your local development app using ngrok.
189
+ Usage: {{command:%s rails tunnel [ auth | start | stop ]}}
237
190
  HELP
238
191
  extended_help: <<~HELP,
239
- {{bold:Subcommands:}}
192
+ {{bold:Subcommands:}}
240
193
 
241
- {{cyan:auth}}: Writes an ngrok auth token to ~/.ngrok2/ngrok.yml to connect with an ngrok account. Visit https://dashboard.ngrok.com/signup to sign up.
242
- Usage: {{command:%1$s tunnel auth <token>}}
194
+ {{cyan:auth}}: Writes an ngrok auth token to ~/.ngrok2/ngrok.yml to connect with an ngrok account. Visit https://dashboard.ngrok.com/signup to sign up.
195
+ Usage: {{command:%1$s rails tunnel auth <token>}}
243
196
 
244
- {{cyan:start}}: Starts an ngrok tunnel, will print the URL for an existing tunnel if already running.
245
- Usage: {{command:%1$s tunnel start}}
197
+ {{cyan:start}}: Starts an ngrok tunnel, will print the URL for an existing tunnel if already running.
198
+ Usage: {{command:%1$s rails tunnel start}}
246
199
 
247
- {{cyan:stop}}: Stops the ngrok tunnel.
248
- Usage: {{command:%1$s tunnel stop}}
200
+ {{cyan:stop}}: Stops the ngrok tunnel.
201
+ Usage: {{command:%1$s rails tunnel stop}}
249
202
 
250
203
  HELP
251
204
 
@@ -270,9 +223,9 @@ module Rails
270
223
  },
271
224
  db: {
272
225
  want_select: <<~WANT_SELECT,
273
- Would you like to select what database type to use now? (SQLite is the default)
274
- If you want to change this in the future, run {{command:rails db:system:change --to=[new_db_type]}}. For more info:
275
- {{underline:https://gorails.com/episodes/rails-6-db-system-change-command}}
226
+ Would you like to select what database type to use now? (SQLite is the default)
227
+ If you want to change this in the future, run {{command:rails db:system:change --to=[new_db_type]}}. For more info:
228
+ {{underline:https://gorails.com/episodes/rails-6-db-system-change-command}}
276
229
  WANT_SELECT
277
230
  select: "What database type would you like to use? Please ensure the database is installed.",
278
231
  select_sqlite3: "SQLite (default)",
@@ -3,20 +3,18 @@
3
3
  module Script
4
4
  class Project < ShopifyCli::ProjectType
5
5
  hidden_feature(feature_set: :script_project)
6
- title("Script")
7
- creator("Script::Commands::Create")
8
-
9
- register_command("Script::Commands::Push", "push")
10
6
 
11
7
  require Project.project_filepath("messages/messages")
12
8
  register_messages(Script::Messages::MESSAGES)
13
9
  end
14
10
 
15
11
  # define/autoload project specific Commands
16
- module Commands
17
- autoload :Create, Project.project_filepath("commands/create")
18
- autoload :Push, Project.project_filepath("commands/push")
12
+ class Command < ShopifyCli::ProjectCommands
13
+ hidden_feature(feature_set: :script_project)
14
+ subcommand :Create, "create", Project.project_filepath("commands/create")
15
+ subcommand :Push, "push", Project.project_filepath("commands/push")
19
16
  end
17
+ ShopifyCli::Commands.register("Script::Command", "script")
20
18
 
21
19
  # define/autoload project specific Forms
22
20
  module Forms
@@ -39,10 +37,10 @@ module Script
39
37
 
40
38
  module Domain
41
39
  autoload :Errors, Project.project_filepath("layers/domain/errors")
42
- autoload :ConfigUi, Project.project_filepath("layers/domain/config_ui")
43
40
  autoload :PushPackage, Project.project_filepath("layers/domain/push_package")
44
41
  autoload :Metadata, Project.project_filepath("layers/domain/metadata")
45
42
  autoload :ExtensionPoint, Project.project_filepath("layers/domain/extension_point")
43
+ autoload :ScriptJson, Project.project_filepath("layers/domain/script_json")
46
44
  autoload :ScriptProject, Project.project_filepath("layers/domain/script_project")
47
45
  end
48
46