shopify-cli 1.0.5 → 1.3.0

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.
Files changed (109) hide show
  1. checksums.yaml +4 -4
  2. data/.github/CONTRIBUTING.md +1 -1
  3. data/CHANGELOG.md +20 -0
  4. data/bin/load_shopify.rb +3 -1
  5. data/bin/shopify +2 -0
  6. data/docs/core/index.md +16 -0
  7. data/docs/getting-started/index.md +3 -2
  8. data/docs/getting-started/install/index.md +55 -9
  9. data/docs/getting-started/uninstall/index.md +1 -1
  10. data/docs/getting-started/upgrade/index.md +8 -4
  11. data/ext/shopify-cli/extconf.rb +40 -20
  12. data/lib/project_types/extension/cli.rb +6 -1
  13. data/lib/project_types/extension/commands/register.rb +1 -1
  14. data/lib/project_types/extension/features/argo/admin.rb +20 -0
  15. data/lib/project_types/extension/features/argo/base.rb +129 -0
  16. data/lib/project_types/extension/features/argo/checkout.rb +20 -0
  17. data/lib/project_types/extension/features/argo_config.rb +60 -0
  18. data/lib/project_types/extension/messages/messages.rb +11 -2
  19. data/lib/project_types/extension/models/type.rb +4 -0
  20. data/lib/project_types/extension/models/types/checkout_post_purchase.rb +6 -3
  21. data/lib/project_types/extension/models/types/product_subscription.rb +24 -0
  22. data/lib/project_types/node/commands/create.rb +4 -4
  23. data/lib/project_types/node/commands/deploy/heroku.rb +6 -1
  24. data/lib/project_types/node/commands/generate/billing.rb +7 -5
  25. data/lib/project_types/node/commands/generate/page.rb +9 -5
  26. data/lib/project_types/node/commands/generate/webhook.rb +5 -1
  27. data/lib/project_types/node/commands/serve.rb +5 -5
  28. data/lib/project_types/node/messages/messages.rb +5 -1
  29. data/lib/project_types/rails/commands/create.rb +56 -5
  30. data/lib/project_types/rails/commands/generate.rb +1 -0
  31. data/lib/project_types/rails/commands/generate/webhook.rb +3 -2
  32. data/lib/project_types/rails/commands/serve.rb +11 -7
  33. data/lib/project_types/rails/gem.rb +61 -6
  34. data/lib/project_types/rails/messages/messages.rb +32 -12
  35. data/lib/project_types/script/config/extension_points.yml +4 -4
  36. data/lib/project_types/script/forms/create.rb +1 -1
  37. data/lib/project_types/script/layers/infrastructure/assemblyscript_task_runner.rb +36 -1
  38. data/lib/project_types/script/layers/infrastructure/errors.rb +7 -0
  39. data/lib/project_types/script/layers/infrastructure/script_service.rb +6 -2
  40. data/lib/project_types/script/messages/messages.rb +12 -37
  41. data/lib/project_types/script/ui/error_handler.rb +13 -5
  42. data/lib/rubygems_plugin.rb +18 -10
  43. data/lib/shopify-cli/admin_api/populate_resource_command.rb +1 -1
  44. data/lib/shopify-cli/commands/config.rb +33 -1
  45. data/lib/shopify-cli/commands/connect.rb +1 -1
  46. data/lib/shopify-cli/commands/system.rb +9 -8
  47. data/lib/shopify-cli/context.rb +68 -0
  48. data/lib/shopify-cli/core/entry_point.rb +3 -0
  49. data/lib/shopify-cli/git.rb +1 -1
  50. data/lib/shopify-cli/heroku.rb +18 -2
  51. data/lib/shopify-cli/js_deps.rb +2 -2
  52. data/lib/shopify-cli/js_system.rb +24 -7
  53. data/lib/shopify-cli/messages/messages.rb +39 -11
  54. data/lib/shopify-cli/process_supervision.rb +52 -15
  55. data/lib/shopify-cli/project.rb +17 -9
  56. data/lib/shopify-cli/tunnel.rb +19 -4
  57. data/lib/shopify-cli/version.rb +1 -1
  58. data/lib/shopify_cli.rb +6 -2
  59. data/shopify-cli.gemspec +4 -1
  60. data/vendor/deps/cli-kit/REVISION +1 -1
  61. data/vendor/deps/cli-kit/lib/cli/kit.rb +1 -1
  62. data/vendor/deps/cli-kit/lib/cli/kit/autocall.rb +2 -2
  63. data/vendor/deps/cli-kit/lib/cli/kit/error_handler.rb +12 -6
  64. data/vendor/deps/cli-kit/lib/cli/kit/executor.rb +9 -11
  65. data/vendor/deps/cli-kit/lib/cli/kit/logger.rb +8 -2
  66. data/vendor/deps/cli-kit/lib/cli/kit/support/test_helper.rb +7 -7
  67. data/vendor/deps/cli-kit/lib/cli/kit/system.rb +48 -17
  68. data/vendor/deps/cli-ui/REVISION +1 -1
  69. data/vendor/deps/cli-ui/lib/cli/ui.rb +5 -4
  70. data/vendor/deps/cli-ui/lib/cli/ui/ansi.rb +9 -3
  71. data/vendor/deps/cli-ui/lib/cli/ui/color.rb +1 -0
  72. data/vendor/deps/cli-ui/lib/cli/ui/frame.rb +3 -2
  73. data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style.rb +1 -0
  74. data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style/box.rb +13 -5
  75. data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style/bracket.rb +29 -2
  76. data/vendor/deps/cli-ui/lib/cli/ui/glyph.rb +21 -10
  77. data/vendor/deps/cli-ui/lib/cli/ui/os.rb +63 -0
  78. data/vendor/deps/cli-ui/lib/cli/ui/prompt.rb +11 -2
  79. data/vendor/deps/cli-ui/lib/cli/ui/prompt/interactive_options.rb +1 -0
  80. data/vendor/deps/cli-ui/lib/cli/ui/spinner.rb +3 -3
  81. data/vendor/deps/cli-ui/lib/cli/ui/spinner/spin_group.rb +6 -8
  82. data/vendor/deps/cli-ui/lib/cli/ui/widgets.rb +2 -0
  83. data/vendor/gen/lib/gen.rb +39 -0
  84. data/vendor/gen/lib/gen/commands.rb +18 -0
  85. data/vendor/gen/lib/gen/commands/help.rb +20 -0
  86. data/vendor/gen/lib/gen/commands/new.rb +21 -0
  87. data/vendor/gen/lib/gen/entry_point.rb +10 -0
  88. data/vendor/gen/lib/gen/generator.rb +165 -0
  89. data/vendor/gen/template/.gitignore +2 -0
  90. data/vendor/gen/template/Gemfile +10 -0
  91. data/vendor/gen/template/README.md +1 -0
  92. data/vendor/gen/template/bin/testunit +23 -0
  93. data/vendor/gen/template/bin/update-deps +97 -0
  94. data/vendor/gen/template/dev-gems.yml +3 -0
  95. data/vendor/gen/template/dev-vendor.yml +4 -0
  96. data/vendor/gen/template/exe/__app__-gems +17 -0
  97. data/vendor/gen/template/exe/__app__-vendor +18 -0
  98. data/vendor/gen/template/lib/__app__.rb +33 -0
  99. data/vendor/gen/template/lib/__app__/commands.rb +18 -0
  100. data/vendor/gen/template/lib/__app__/commands/example.rb +19 -0
  101. data/vendor/gen/template/lib/__app__/commands/help.rb +21 -0
  102. data/vendor/gen/template/lib/__app__/entry_point.rb +10 -0
  103. data/vendor/gen/template/test/example_test.rb +17 -0
  104. data/vendor/gen/template/test/test_helper.rb +22 -0
  105. metadata +30 -6
  106. data/Vagrantfile +0 -17
  107. data/lib/project_types/extension/features/argo.rb +0 -48
  108. data/lib/project_types/extension/models/types/subscription_management.rb +0 -20
  109. data/lib/project_types/script/forms/script_form.rb +0 -69
@@ -0,0 +1,3 @@
1
+ up:
2
+ - ruby: 2.5.0
3
+ - bundler
@@ -0,0 +1,4 @@
1
+ up:
2
+ - ruby: 2.5.0
3
+
4
+ build: bin/update-deps
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ Encoding.default_external = Encoding::UTF_8
4
+ Encoding.default_internal = Encoding::UTF_8
5
+
6
+ unshift_path = ->(path) {
7
+ p = File.expand_path("../../#{path}", __FILE__)
8
+ $LOAD_PATH.unshift(p) unless $LOAD_PATH.include?(p)
9
+ }
10
+ unshift_path.call('lib')
11
+
12
+ require 'bundler/setup'
13
+ require '__app__'
14
+
15
+ exit(__App__::ErrorHandler.call do
16
+ __App__::EntryPoint.call(ARGV.dup)
17
+ end)
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby --disable-gems
2
+
3
+ Encoding.default_external = Encoding::UTF_8
4
+ Encoding.default_internal = Encoding::UTF_8
5
+
6
+ unshift_path = ->(path) {
7
+ p = File.expand_path("../../#{path}", __FILE__)
8
+ $LOAD_PATH.unshift(p) unless $LOAD_PATH.include?(p)
9
+ }
10
+ unshift_path.call('vendor/deps/cli-ui/lib')
11
+ unshift_path.call('vendor/deps/cli-kit/lib')
12
+ unshift_path.call('lib')
13
+
14
+ require '__app__'
15
+
16
+ exit(__App__::ErrorHandler.call do
17
+ __App__::EntryPoint.call(ARGV.dup)
18
+ end)
@@ -0,0 +1,33 @@
1
+ require 'cli/ui'
2
+ require 'cli/kit'
3
+
4
+ CLI::UI::StdoutRouter.enable
5
+
6
+ module __App__
7
+ extend CLI::Kit::Autocall
8
+
9
+ TOOL_NAME = '__app__'
10
+ ROOT = File.expand_path('../..', __FILE__)
11
+ LOG_FILE = '/tmp/__app__.log'
12
+
13
+ autoload(:EntryPoint, '__app__/entry_point')
14
+ autoload(:Commands, '__app__/commands')
15
+
16
+ autocall(:Config) { CLI::Kit::Config.new(tool_name: TOOL_NAME) }
17
+ autocall(:Command) { CLI::Kit::BaseCommand }
18
+
19
+ autocall(:Executor) { CLI::Kit::Executor.new(log_file: LOG_FILE) }
20
+ autocall(:Resolver) do
21
+ CLI::Kit::Resolver.new(
22
+ tool_name: TOOL_NAME,
23
+ command_registry: __App__::Commands::Registry
24
+ )
25
+ end
26
+
27
+ autocall(:ErrorHandler) do
28
+ CLI::Kit::ErrorHandler.new(
29
+ log_file: LOG_FILE,
30
+ exception_reporter: nil
31
+ )
32
+ end
33
+ end
@@ -0,0 +1,18 @@
1
+ require '__app__'
2
+
3
+ module __App__
4
+ module Commands
5
+ Registry = CLI::Kit::CommandRegistry.new(
6
+ default: 'help',
7
+ contextual_resolver: nil
8
+ )
9
+
10
+ def self.register(const, cmd, path)
11
+ autoload(const, path)
12
+ Registry.add(->() { const_get(const) }, cmd)
13
+ end
14
+
15
+ register :Example, 'example', '__app__/commands/example'
16
+ register :Help, 'help', '__app__/commands/help'
17
+ end
18
+ end
@@ -0,0 +1,19 @@
1
+ require '__app__'
2
+
3
+ module __App__
4
+ module Commands
5
+ class Example < __App__::Command
6
+ def call(_args, _name)
7
+ puts 'neato'
8
+
9
+ if rand < 0.05
10
+ raise(CLI::Kit::Abort, "you got unlucky!")
11
+ end
12
+ end
13
+
14
+ def self.help
15
+ "A dummy command.\nUsage: {{command:#{__App__::TOOL_NAME} example}}"
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,21 @@
1
+ require '__app__'
2
+
3
+ module __App__
4
+ module Commands
5
+ class Help < __App__::Command
6
+ def call(args, _name)
7
+ puts CLI::UI.fmt("{{bold:Available commands}}")
8
+ puts ""
9
+
10
+ __App__::Commands::Registry.resolved_commands.each do |name, klass|
11
+ next if name == 'help'
12
+ puts CLI::UI.fmt("{{command:#{__App__::TOOL_NAME} #{name}}}")
13
+ if help = klass.help
14
+ puts CLI::UI.fmt(help)
15
+ end
16
+ puts ""
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,10 @@
1
+ require '__app__'
2
+
3
+ module __App__
4
+ module EntryPoint
5
+ def self.call(args)
6
+ cmd, command_name, args = __App__::Resolver.call(args)
7
+ __App__::Executor.call(cmd, command_name, args)
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,17 @@
1
+ require 'test_helper'
2
+
3
+ module __App__
4
+ class ExampleTest < MiniTest::Test
5
+ include CLI::Kit::Support::TestHelper
6
+
7
+ def test_example
8
+ CLI::Kit::System.fake("ls -al", stdout: "a\nb", success: true)
9
+
10
+ out, = CLI::Kit::System.capture2('ls', '-al')
11
+ assert_equal %w(a b), out.split("\n")
12
+
13
+ errors = assert_all_commands_run(should_raise: false)
14
+ assert_nil errors, "expected command to run successfully"
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,22 @@
1
+ begin
2
+ addpath = lambda do |p|
3
+ path = File.expand_path("../../#{p}", __FILE__)
4
+ $LOAD_PATH.unshift(path) unless $LOAD_PATH.include?(path)
5
+ end
6
+ addpath.call("lib")
7
+ end
8
+
9
+ require 'cli/kit'
10
+
11
+ require 'fileutils'
12
+ require 'tmpdir'
13
+ require 'tempfile'
14
+
15
+ require 'rubygems'
16
+ require 'bundler/setup'
17
+
18
+ CLI::UI::StdoutRouter.enable
19
+
20
+ require 'minitest/autorun'
21
+ require "minitest/unit"
22
+ require 'mocha/minitest'
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: 1.0.5
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-13 00:00:00.000000000 Z
11
+ date: 2020-10-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -91,7 +91,6 @@ files:
91
91
  - RELEASING.md
92
92
  - Rakefile
93
93
  - SECURITY.md
94
- - Vagrantfile
95
94
  - bin/load_shopify.rb
96
95
  - bin/shopify
97
96
  - dev.yml
@@ -148,7 +147,10 @@ files:
148
147
  - lib/project_types/extension/commands/tunnel.rb
149
148
  - lib/project_types/extension/extension_project.rb
150
149
  - lib/project_types/extension/extension_project_keys.rb
151
- - lib/project_types/extension/features/argo.rb
150
+ - lib/project_types/extension/features/argo/admin.rb
151
+ - lib/project_types/extension/features/argo/base.rb
152
+ - lib/project_types/extension/features/argo/checkout.rb
153
+ - lib/project_types/extension/features/argo_config.rb
152
154
  - lib/project_types/extension/features/argo_dependencies.rb
153
155
  - lib/project_types/extension/features/argo_setup.rb
154
156
  - lib/project_types/extension/features/argo_setup_step.rb
@@ -162,7 +164,7 @@ files:
162
164
  - lib/project_types/extension/models/registration.rb
163
165
  - lib/project_types/extension/models/type.rb
164
166
  - lib/project_types/extension/models/types/checkout_post_purchase.rb
165
- - lib/project_types/extension/models/types/subscription_management.rb
167
+ - lib/project_types/extension/models/types/product_subscription.rb
166
168
  - lib/project_types/extension/models/validation_error.rb
167
169
  - lib/project_types/extension/models/version.rb
168
170
  - lib/project_types/extension/tasks/converters/app_converter.rb
@@ -216,7 +218,6 @@ files:
216
218
  - lib/project_types/script/config/extension_points.yml
217
219
  - lib/project_types/script/errors.rb
218
220
  - lib/project_types/script/forms/create.rb
219
- - lib/project_types/script/forms/script_form.rb
220
221
  - lib/project_types/script/graphql/app_script_update_or_create.graphql
221
222
  - lib/project_types/script/graphql/script_service_proxy.graphql
222
223
  - lib/project_types/script/graphql/shop_script_delete.graphql
@@ -335,6 +336,7 @@ files:
335
336
  - vendor/deps/cli-ui/lib/cli/ui/frame/frame_style/box.rb
336
337
  - vendor/deps/cli-ui/lib/cli/ui/frame/frame_style/bracket.rb
337
338
  - vendor/deps/cli-ui/lib/cli/ui/glyph.rb
339
+ - vendor/deps/cli-ui/lib/cli/ui/os.rb
338
340
  - vendor/deps/cli-ui/lib/cli/ui/printer.rb
339
341
  - vendor/deps/cli-ui/lib/cli/ui/progress.rb
340
342
  - vendor/deps/cli-ui/lib/cli/ui/prompt.rb
@@ -358,6 +360,28 @@ files:
358
360
  - vendor/deps/smart_properties/lib/smart_properties/validations.rb
359
361
  - vendor/deps/smart_properties/lib/smart_properties/validations/ancestor.rb
360
362
  - vendor/deps/smart_properties/lib/smart_properties/version.rb
363
+ - vendor/gen/lib/gen.rb
364
+ - vendor/gen/lib/gen/commands.rb
365
+ - vendor/gen/lib/gen/commands/help.rb
366
+ - vendor/gen/lib/gen/commands/new.rb
367
+ - vendor/gen/lib/gen/entry_point.rb
368
+ - vendor/gen/lib/gen/generator.rb
369
+ - vendor/gen/template/.gitignore
370
+ - vendor/gen/template/Gemfile
371
+ - vendor/gen/template/README.md
372
+ - vendor/gen/template/bin/testunit
373
+ - vendor/gen/template/bin/update-deps
374
+ - vendor/gen/template/dev-gems.yml
375
+ - vendor/gen/template/dev-vendor.yml
376
+ - vendor/gen/template/exe/__app__-gems
377
+ - vendor/gen/template/exe/__app__-vendor
378
+ - vendor/gen/template/lib/__app__.rb
379
+ - vendor/gen/template/lib/__app__/commands.rb
380
+ - vendor/gen/template/lib/__app__/commands/example.rb
381
+ - vendor/gen/template/lib/__app__/commands/help.rb
382
+ - vendor/gen/template/lib/__app__/entry_point.rb
383
+ - vendor/gen/template/test/example_test.rb
384
+ - vendor/gen/template/test/test_helper.rb
361
385
  - vendor/lib/semantic/LICENSE
362
386
  - vendor/lib/semantic/semantic.rb
363
387
  - vendor/lib/semantic/version.rb
@@ -1,17 +0,0 @@
1
- # -*- mode: ruby -*-
2
- # vi: set ft=ruby :
3
-
4
- Vagrant.configure('2') do |config|
5
- # config.vm.define "centos" do |centos|
6
- # centos.vm.box = "centos/7"
7
- # end
8
-
9
- # config.vm.define "windows" do |windows|
10
- # windows.vm.box = "Microsoft/EdgeOnWindows10"
11
- # windows.vm.box_version = "1.0"
12
- # end
13
-
14
- config.vm.define('ubuntu') do |ubuntu|
15
- ubuntu.vm.box = 'ubuntu/xenial64'
16
- end
17
- end
@@ -1,48 +0,0 @@
1
- # frozen_string_literal: true
2
- require 'base64'
3
-
4
- module Extension
5
- module Features
6
- class Argo
7
- include SmartProperties
8
-
9
- GIT_ADMIN_TEMPLATE = 'https://github.com/Shopify/argo-admin-template.git'
10
- GIT_CHECKOUT_TEMPLATE = 'https://github.com/Shopify/argo-checkout-template.git'
11
- SCRIPT_PATH = %w(build main.js).freeze
12
-
13
- class << self
14
- def admin
15
- @admin ||= Argo.new(setup: ArgoSetup.new(git_template: GIT_ADMIN_TEMPLATE))
16
- end
17
-
18
- def checkout
19
- @checkout ||= Argo.new(
20
- setup: ArgoSetup.new(
21
- git_template: GIT_CHECKOUT_TEMPLATE,
22
- dependency_checks: [ArgoDependencies.node_installed(min_major: 10, min_minor: 16)]
23
- )
24
- )
25
- end
26
- end
27
-
28
- property! :setup, accepts: Features::ArgoSetup
29
-
30
- def create(directory_name, identifier, context)
31
- setup.call(directory_name, identifier, context)
32
- end
33
-
34
- def config(context)
35
- filepath = File.join(context.root, SCRIPT_PATH)
36
- context.abort(context.message('features.argo.missing_file_error')) unless File.exist?(filepath)
37
-
38
- begin
39
- {
40
- serialized_script: Base64.strict_encode64(File.open(filepath).read.chomp),
41
- }
42
- rescue StandardError
43
- context.abort(context.message('features.argo.script_prepare_error'))
44
- end
45
- end
46
- end
47
- end
48
- end
@@ -1,20 +0,0 @@
1
- # frozen_string_literal: true
2
- require 'base64'
3
-
4
- module Extension
5
- module Models
6
- module Types
7
- class SubscriptionManagement < Models::Type
8
- IDENTIFIER = 'SUBSCRIPTION_MANAGEMENT'
9
-
10
- def create(directory_name, context)
11
- Features::Argo.admin.create(directory_name, IDENTIFIER, context)
12
- end
13
-
14
- def config(context)
15
- Features::Argo.admin.config(context)
16
- end
17
- end
18
- end
19
- end
20
- end
@@ -1,69 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Script
4
- module Forms
5
- class ScriptForm < ShopifyCli::Form
6
- protected
7
-
8
- def organization
9
- @organization ||= ask_organization
10
- end
11
-
12
- def organizations
13
- return @organizations if defined?(@organizations)
14
- UI::PrintingSpinner.spin(ctx, ctx.message('script.forms.script_form.fetching_organizations')) do |ctx, spinner|
15
- @organizations = ShopifyCli::PartnersAPI::Organizations.fetch_with_app(ctx)
16
- spinner.update_title(ctx.message('script.forms.script_form.fetched_organizations'))
17
- end
18
- @organizations
19
- end
20
-
21
- def ask_app_api_key(apps, message: ctx.message('script.forms.script_form.ask_app_api_key_default'))
22
- if apps.count == 0
23
- raise Errors::NoExistingAppsError
24
- elsif apps.count == 1
25
- ctx.puts(ctx.message(
26
- 'script.forms.script_form.using_app',
27
- title: apps.first['title'],
28
- api_key: apps.first['apiKey']
29
- ))
30
- apps.first["apiKey"]
31
- else
32
- CLI::UI::Prompt.ask(message) do |handler|
33
- apps.each { |app| handler.option(app["title"]) { app["apiKey"] } }
34
- end
35
- end
36
- end
37
-
38
- def ask_organization
39
- if organizations.count == 0
40
- raise Errors::NoExistingOrganizationsError
41
- elsif organizations.count == 1
42
- org = organizations.first
43
- ctx.puts(ctx.message('script.forms.script_form.using_organization',
44
- ctx.message('core.partners_api.org_name_and_id', org['businessName'], org['id'])))
45
- org
46
- else
47
- org_id = CLI::UI::Prompt.ask(ctx.message('script.forms.script_form.select_organization')) do |handler|
48
- organizations.each do |o|
49
- handler.option(ctx.message('core.partners_api.org_name_and_id', o['businessName'], o['id'])) { o['id'] }
50
- end
51
- end
52
- organizations.find { |o| o['id'] == org_id }
53
- end
54
- end
55
-
56
- def ask_shop_domain(organization, message: ctx.message('script.forms.script_form.ask_shop_domain_default'))
57
- if organization['stores'].count == 0
58
- raise Errors::NoExistingStoresError, organization['id']
59
- elsif organization['stores'].count == 1
60
- domain = organization['stores'].first['shopDomain']
61
- ctx.puts(ctx.message('script.forms.script_form.using_development_store', domain: domain))
62
- domain
63
- else
64
- CLI::UI::Prompt.ask(message, options: organization["stores"].map { |s| s["shopDomain"] })
65
- end
66
- end
67
- end
68
- end
69
- end