shopify-cli 1.0.0 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +3 -2
  3. data/CHANGELOG.md +20 -0
  4. data/Gemfile +1 -1
  5. data/Gemfile.lock +13 -13
  6. data/docs/Gemfile.lock +23 -13
  7. data/docs/getting-started/install/index.md +37 -1
  8. data/docs/getting-started/migrate/index.md +34 -1
  9. data/lib/project_types/extension/cli.rb +1 -1
  10. data/lib/project_types/extension/commands/build.rb +1 -1
  11. data/lib/project_types/extension/models/type.rb +1 -0
  12. data/lib/project_types/extension/tasks/create_extension.rb +1 -1
  13. data/lib/project_types/extension/tasks/get_app.rb +1 -1
  14. data/lib/project_types/extension/tasks/update_draft.rb +1 -1
  15. data/lib/project_types/node/forms/create.rb +3 -54
  16. data/lib/project_types/node/messages/messages.rb +3 -14
  17. data/lib/project_types/rails/cli.rb +0 -1
  18. data/lib/project_types/rails/forms/create.rb +3 -52
  19. data/lib/project_types/rails/messages/messages.rb +2 -13
  20. data/lib/project_types/script/cli.rb +2 -3
  21. data/lib/project_types/script/commands/create.rb +5 -9
  22. data/lib/project_types/script/commands/disable.rb +4 -15
  23. data/lib/project_types/script/commands/enable.rb +37 -13
  24. data/lib/project_types/script/commands/push.rb +8 -13
  25. data/lib/project_types/script/config/extension_points.yml +9 -3
  26. data/lib/project_types/script/errors.rb +8 -0
  27. data/lib/project_types/script/forms/script_form.rb +5 -2
  28. data/lib/project_types/script/layers/application/create_script.rb +7 -6
  29. data/lib/project_types/script/layers/application/disable_script.rb +9 -7
  30. data/lib/project_types/script/layers/application/enable_script.rb +11 -9
  31. data/lib/project_types/script/layers/application/push_script.rb +6 -4
  32. data/lib/project_types/script/layers/domain/errors.rb +2 -0
  33. data/lib/project_types/script/layers/infrastructure/assemblyscript_project_creator.rb +2 -2
  34. data/lib/project_types/script/layers/infrastructure/assemblyscript_task_runner.rb +2 -2
  35. data/lib/project_types/script/layers/infrastructure/errors.rb +2 -0
  36. data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +1 -1
  37. data/lib/project_types/script/layers/infrastructure/script_repository.rb +1 -1
  38. data/lib/project_types/script/layers/infrastructure/script_service.rb +2 -0
  39. data/lib/project_types/script/messages/messages.rb +25 -31
  40. data/lib/project_types/script/script_project.rb +8 -4
  41. data/lib/project_types/script/templates/ts/as-pect.config.js +6 -0
  42. data/lib/project_types/script/ui/error_handler.rb +8 -0
  43. data/lib/project_types/script/ui/printing_spinner.rb +75 -0
  44. data/lib/shopify-cli/admin_api.rb +1 -2
  45. data/lib/shopify-cli/admin_api/populate_resource_command.rb +10 -1
  46. data/lib/shopify-cli/admin_api/schema.rb +20 -8
  47. data/lib/shopify-cli/command.rb +14 -11
  48. data/lib/shopify-cli/commands.rb +1 -0
  49. data/lib/shopify-cli/commands/config.rb +44 -0
  50. data/lib/shopify-cli/commands/connect.rb +8 -69
  51. data/lib/shopify-cli/commands/create.rb +2 -2
  52. data/lib/shopify-cli/commands/help.rb +1 -1
  53. data/lib/shopify-cli/commands/system.rb +14 -6
  54. data/lib/shopify-cli/context.rb +10 -1
  55. data/lib/shopify-cli/core.rb +0 -1
  56. data/lib/shopify-cli/core/entry_point.rb +7 -1
  57. data/lib/shopify-cli/core/executor.rb +3 -5
  58. data/lib/shopify-cli/core/finalize.rb +13 -0
  59. data/lib/shopify-cli/core/monorail.rb +1 -1
  60. data/lib/shopify-cli/db.rb +1 -1
  61. data/lib/shopify-cli/feature.rb +97 -0
  62. data/lib/shopify-cli/heroku.rb +4 -4
  63. data/lib/shopify-cli/messages/messages.rb +51 -12
  64. data/lib/shopify-cli/partners_api/organizations.rb +7 -7
  65. data/lib/shopify-cli/process_supervision.rb +8 -6
  66. data/lib/shopify-cli/project_type.rb +5 -7
  67. data/lib/shopify-cli/sub_command.rb +1 -0
  68. data/lib/shopify-cli/task.rb +2 -2
  69. data/lib/shopify-cli/tasks.rb +12 -4
  70. data/lib/shopify-cli/tasks/ensure_env.rb +72 -16
  71. data/lib/shopify-cli/tasks/select_org_and_shop.rb +77 -0
  72. data/lib/shopify-cli/tasks/update_dashboard_urls.rb +4 -3
  73. data/lib/shopify-cli/tunnel.rb +38 -14
  74. data/lib/shopify-cli/version.rb +1 -1
  75. data/lib/shopify_cli.rb +32 -9
  76. metadata +7 -4
  77. data/lib/project_types/script/forms/enable.rb +0 -24
  78. data/lib/project_types/script/forms/push.rb +0 -19
@@ -28,8 +28,8 @@ module Node
28
28
  },
29
29
  info: {
30
30
  created: "{{v}} {{green:%s}} was created in your Partner Dashboard {{underline:%s}}",
31
- serve: "{{*}} Change into your new project folder {{green:%s}} and run {{command:%s serve}} to start a " \
32
- "local server",
31
+ serve: "{{*}} Change directories to your new project folder {{green:%s}} and run {{command:%s serve}} " \
32
+ "to start a local server",
33
33
  install: "{{*}} Then, visit {{underline:%s/test}} to install {{green:%s}} on your Dev Store",
34
34
  },
35
35
  node_version: "node %s",
@@ -233,25 +233,14 @@ module Node
233
233
  create: {
234
234
  error: {
235
235
  invalid_app_type: "Invalid app type %s",
236
- organization_not_found: "Cannot find a partner organization with that ID",
237
- no_organizations: "No partner organizations available.",
238
236
  },
239
-
240
- authentication_issue: "For authentication issues, run {{command:%s logout}} to clear invalid credentials",
241
- partners_notice: "Please visit https://partners.shopify.com/ to create a partners account",
242
- no_development_stores: "{{x}} No Development Stores available.",
243
- create_store: "Visit {{underline:https://partners.shopify.com/%s/stores}} to create one",
244
- app_name: "App Name",
237
+ app_name: "App name",
245
238
  app_type: {
246
239
  select: "What type of app are you building?",
247
240
  select_public: "Public: An app built for a wide merchant audience.",
248
241
  select_custom: "Custom: An app custom built for a single client.",
249
242
  selected: "App type {{green:%s}}",
250
243
  },
251
- organization_select: "Select partner organization",
252
- organization: "Partner organization {{green:%s}}",
253
- development_store_select: "Select a development store",
254
- development_store: "Using development store {{green:%s}}",
255
244
  },
256
245
  },
257
246
  },
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  module Rails
3
3
  class Project < ShopifyCli::ProjectType
4
- # hidden_project_type
5
4
  creator 'Ruby on Rails App', 'Rails::Commands::Create'
6
5
 
7
6
  register_command('Rails::Commands::Deploy', "deploy")
@@ -22,8 +22,9 @@ module Rails
22
22
  self.title ||= CLI::UI::Prompt.ask(ctx.message('rails.forms.create.app_name'))
23
23
  self.type = ask_type
24
24
  self.name = self.title.downcase.split(" ").join("_")
25
- self.organization_id ||= organization["id"].to_i
26
- self.shop_domain ||= ask_shop_domain
25
+ res = ShopifyCli::Tasks::SelectOrgAndShop.call(ctx, organization_id: organization_id, shop_domain: shop_domain)
26
+ self.organization_id = res[:organization_id]
27
+ self.shop_domain = res[:shop_domain]
27
28
  self.db = ask_db
28
29
  end
29
30
 
@@ -44,56 +45,6 @@ module Rails
44
45
  type
45
46
  end
46
47
 
47
- def organizations
48
- @organizations ||= ShopifyCli::PartnersAPI::Organizations.fetch_all(ctx)
49
- end
50
-
51
- def organization
52
- @organization ||= if !organization_id.nil?
53
- org = ShopifyCli::PartnersAPI::Organizations.fetch(ctx, id: organization_id)
54
- if org.nil?
55
- ctx.puts(ctx.message('rails.forms.create.authentication_issue', ShopifyCli::TOOL_NAME))
56
- ctx.abort(ctx.message('rails.forms.create.error.organization_not_found'))
57
- end
58
- org
59
- elsif organizations.count == 0
60
- ctx.puts(ctx.message('rails.forms.create.partners_notice'))
61
- ctx.puts(ctx.message('rails.forms.create.authentication_issue', ShopifyCli::TOOL_NAME))
62
- ctx.abort(ctx.message('rails.forms.create.error.no_organizations'))
63
- elsif organizations.count == 1
64
- org = organizations.first
65
- ctx.puts(ctx.message('rails.forms.create.organization',
66
- ctx.message('core.partners_api.org_name_and_id', org['businessName'], org['id'])))
67
- org
68
- else
69
- org_id = CLI::UI::Prompt.ask(ctx.message('rails.forms.create.organization_select')) do |handler|
70
- organizations.each { |o| handler.option(o['businessName']) { o['id'] } }
71
- end
72
- organizations.find { |o| o['id'] == org_id }
73
- end
74
- end
75
-
76
- def ask_shop_domain
77
- valid_stores = organization['stores'].select do |store|
78
- store['transferDisabled'] == true || store['convertableToPartnerTest'] == true
79
- end
80
-
81
- if valid_stores.count == 0
82
- ctx.puts(ctx.message('rails.forms.create.no_development_stores'))
83
- ctx.puts(ctx.message('rails.forms.create.create_store', organization['id']))
84
- ctx.puts(ctx.message('rails.forms.create.authentication_issue', ShopifyCli::TOOL_NAME))
85
- elsif valid_stores.count == 1
86
- domain = valid_stores.first['shopDomain']
87
- ctx.puts(ctx.message('rails.forms.create.development_store', domain))
88
- domain
89
- else
90
- CLI::UI::Prompt.ask(
91
- ctx.message('rails.forms.create.development_store_select'),
92
- options: valid_stores.map { |s| s['shopDomain'] }
93
- )
94
- end
95
- end
96
-
97
48
  def ask_db
98
49
  if db.nil?
99
50
  return 'sqlite3' unless CLI::UI::Prompt.confirm(ctx.message('rails.forms.create.db.want_select'),
@@ -37,8 +37,8 @@ module Rails
37
37
 
38
38
  info: {
39
39
  created: "{{v}} {{green:%s}} was created in your Partner Dashboard {{underline:%s}}",
40
- serve: "{{*}} Change into your new project folder {{green:%s}} and run {{command:%s serve}} to start a " \
41
- "local server",
40
+ serve: "{{*}} Change directories to your new project folder {{green:%s}} and run {{command:%s serve}} " \
41
+ "to start a local server",
42
42
  install: "{{*}} Then, visit {{underline:%s/test}} to install {{green:%s}} on your Dev Store",
43
43
  },
44
44
  installing_bundler: "Installing bundler…",
@@ -236,14 +236,7 @@ module Rails
236
236
  error: {
237
237
  invalid_app_type: "Invalid app type %s",
238
238
  invalid_db_type: "Invalid database type %s",
239
- organization_not_found: "Cannot find a partner organization with that ID",
240
- no_organizations: "No partner organizations available.",
241
239
  },
242
-
243
- authentication_issue: "For authentication issues, run {{command:%s logout}} to clear invalid credentials",
244
- partners_notice: "Please visit https://partners.shopify.com/ to create a partners account",
245
- no_development_stores: "{{x}} No development stores available.",
246
- create_store: "Visit {{underline:https://partners.shopify.com/%s/stores}} to create one",
247
240
  app_name: "App name",
248
241
  app_type: {
249
242
  select: "What type of app are you building?",
@@ -271,10 +264,6 @@ module Rails
271
264
  select_jdbc: "JDBC",
272
265
  selected: "Database Type {{green:%s}}",
273
266
  },
274
- organization_select: "Select partner organization",
275
- organization: "Partner organization {{green:%s}}",
276
- development_store_select: "Select a development store",
277
- development_store: "Using development store {{green:%s}}",
278
267
  },
279
268
  },
280
269
  },
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Script
4
4
  class Project < ShopifyCli::ProjectType
5
- hidden_project_type
5
+ hidden_feature(feature_set: :script_project)
6
6
  creator 'Script', 'Script::Commands::Create'
7
7
 
8
8
  register_command('Script::Commands::Push', 'push')
@@ -24,8 +24,6 @@ module Script
24
24
  # define/autoload project specific Forms
25
25
  module Forms
26
26
  autoload :Create, Project.project_filepath('forms/create')
27
- autoload :Push, Project.project_filepath('forms/push')
28
- autoload :Enable, Project.project_filepath('forms/enable')
29
27
  autoload :ScriptForm, Project.project_filepath('forms/script_form')
30
28
  end
31
29
 
@@ -66,6 +64,7 @@ module Script
66
64
 
67
65
  module UI
68
66
  autoload :ErrorHandler, Project.project_filepath('ui/error_handler')
67
+ autoload :PrintingSpinner, Project.project_filepath('ui/printing_spinner')
69
68
  autoload :StrictSpinner, Project.project_filepath('ui/strict_spinner')
70
69
  end
71
70
 
@@ -19,27 +19,23 @@ module Script
19
19
  return @ctx.puts(self.class.help)
20
20
  end
21
21
 
22
- Layers::Application::CreateScript.call(
22
+ project = Layers::Application::CreateScript.call(
23
23
  ctx: @ctx,
24
24
  language: language,
25
25
  script_name: form.name,
26
26
  extension_point_type: form.extension_point
27
27
  )
28
- project = ScriptProject.current
29
- @ctx.puts(@ctx.message('script.create.script_path', folder: project.script_name))
30
- @ctx.puts(@ctx.message('script.create.script_created', script_id: project.source_file))
28
+ @ctx.puts(@ctx.message('script.create.change_directory_notice', project.script_name))
29
+ rescue Script::Errors::ScriptProjectAlreadyExistsError => e
30
+ UI::ErrorHandler.pretty_print_and_raise(e, failed_op: @ctx.message('script.create.error.operation_failed'))
31
31
  rescue StandardError => e
32
32
  ScriptProject.cleanup(ctx: @ctx, script_name: form.name, root_dir: cur_dir) if form
33
33
  UI::ErrorHandler.pretty_print_and_raise(e, failed_op: @ctx.message('script.create.error.operation_failed'))
34
34
  end
35
35
 
36
36
  def self.help
37
- ShopifyCli::Context.message('script.create.help', ShopifyCli::TOOL_NAME)
38
- end
39
-
40
- def self.extended_help
41
37
  allowed_values = Script::Layers::Application::ExtensionPoints.types.map { |type| "{{cyan:#{type}}}" }
42
- ShopifyCli::Context.message('script.create.extended_help', ShopifyCli::TOOL_NAME, allowed_values.join(', '))
38
+ ShopifyCli::Context.message('script.create.help', ShopifyCli::TOOL_NAME, allowed_values.join(', '))
43
39
  end
44
40
  end
45
41
  end
@@ -3,20 +3,13 @@
3
3
  module Script
4
4
  module Commands
5
5
  class Disable < ShopifyCli::Command
6
- options do |parser, flags|
7
- parser.on('--api_key=APIKEY') { |t| flags[:api_key] = t }
8
- parser.on('--shop_domain=MYSHOPIFYDOMAIN') { |t| flags[:shop_domain] = t }
9
- end
10
-
11
- def call(args, _name)
12
- form = Forms::Enable.ask(@ctx, args, options.flags)
13
- return @ctx.puts(self.class.help) unless form
14
-
6
+ def call(_args, _name)
7
+ ShopifyCli::Tasks::EnsureEnv.call(@ctx, required: [:api_key, :secret, :shop])
15
8
  project = ScriptProject.current
16
9
  Layers::Application::DisableScript.call(
17
10
  ctx: @ctx,
18
- api_key: form.api_key,
19
- shop_domain: form.shop_domain,
11
+ api_key: project.env[:api_key],
12
+ shop_domain: project.env[:shop],
20
13
  extension_point_type: project.extension_point_type
21
14
  )
22
15
  @ctx.puts(@ctx.message('script.disable.script_disabled'))
@@ -27,10 +20,6 @@ module Script
27
20
  def self.help
28
21
  ShopifyCli::Context.message('script.disable.help', ShopifyCli::TOOL_NAME)
29
22
  end
30
-
31
- def self.extended_help
32
- ShopifyCli::Context.message('script.disable.extended_help', ShopifyCli::TOOL_NAME)
33
- end
34
23
  end
35
24
  end
36
25
  end
@@ -4,32 +4,36 @@ module Script
4
4
  module Commands
5
5
  class Enable < ShopifyCli::Command
6
6
  options do |parser, flags|
7
- parser.on('--api_key=APIKEY') { |t| flags[:api_key] = t }
8
- parser.on('--shop_domain=MYSHOPIFYDOMAIN') { |t| flags[:shop_domain] = t }
7
+ parser.on('--config_props=KEYVALUEPAIRS', Array) do |t|
8
+ flags[:config_props] = Hash[t.map { |s| s.split(':') }]
9
+ end
10
+ parser.on('--config_file=CONFIGFILEPATH') { |t| flags[:config_file] = t }
9
11
  end
10
12
 
11
- def call(args, _name)
12
- form = Forms::Enable.ask(@ctx, args, options.flags)
13
- return @ctx.puts(self.class.help) unless form
14
-
13
+ def call(_args, _name)
14
+ ShopifyCli::Tasks::EnsureEnv.call(@ctx, required: [:api_key, :secret, :shop])
15
15
  project = ScriptProject.current
16
+ api_key = project.env[:api_key]
17
+ shop_domain = project.env[:shop]
16
18
 
17
19
  Layers::Application::EnableScript.call(
18
20
  ctx: @ctx,
19
- api_key: form.api_key,
20
- shop_domain: form.shop_domain,
21
- configuration: { entries: [] },
21
+ api_key: api_key,
22
+ shop_domain: shop_domain,
23
+ configuration: acquire_configuration(**slice(options.flags, :config_file, :config_props)),
22
24
  extension_point_type: project.extension_point_type,
23
25
  title: project.script_name
24
26
  )
25
27
  @ctx.puts(@ctx.message(
26
28
  'script.enable.script_enabled',
27
- api_key: form.api_key,
28
- shop_domain: form.shop_domain,
29
+ api_key: api_key,
30
+ shop_domain: shop_domain,
29
31
  type: project.extension_point_type.capitalize,
30
32
  title: project.script_name
31
33
  ))
32
34
  @ctx.puts(@ctx.message('script.enable.info'))
35
+ rescue Errors::InvalidConfigYAMLError => e
36
+ UI::ErrorHandler.pretty_print_and_raise(e)
33
37
  rescue StandardError => e
34
38
  UI::ErrorHandler.pretty_print_and_raise(e, failed_op: @ctx.message('script.enable.error.operation_failed'))
35
39
  end
@@ -38,8 +42,28 @@ module Script
38
42
  ShopifyCli::Context.message('script.enable.help', ShopifyCli::TOOL_NAME)
39
43
  end
40
44
 
41
- def self.extended_help
42
- ShopifyCli::Context.message('script.enable.extended_help', ShopifyCli::TOOL_NAME)
45
+ private
46
+
47
+ def acquire_configuration(config_file: nil, config_props: nil)
48
+ properties = {}
49
+ properties = YAML.load(File.read(config_file)) unless config_file.nil?
50
+ properties = properties.merge(config_props) unless config_props.nil?
51
+
52
+ configuration = { entries: [] }
53
+ properties.each do |key, value|
54
+ configuration[:entries].push({
55
+ key: key,
56
+ value: value,
57
+ })
58
+ end
59
+ configuration
60
+ rescue Errno::ENOENT, Psych::SyntaxError
61
+ raise Errors::InvalidConfigYAMLError, options.flags[:config_file]
62
+ end
63
+
64
+ # No slice pre Ruby 2.5 so roll our own
65
+ def slice(hash, *keys)
66
+ Hash[hash.to_a - hash.select { |key, _value| !keys.include?(key) }.to_a]
43
67
  end
44
68
  end
45
69
  end
@@ -4,26 +4,25 @@ module Script
4
4
  module Commands
5
5
  class Push < ShopifyCli::Command
6
6
  options do |parser, flags|
7
- parser.on('--api_key=APIKEY') { |t| flags[:api_key] = t }
8
7
  parser.on('--force') { |t| flags[:force] = t }
9
8
  end
10
9
 
11
- def call(args, _name)
12
- form = Forms::Push.ask(@ctx, args, options.flags)
10
+ def call(_args, _name)
11
+ ShopifyCli::Tasks::EnsureEnv.call(@ctx, required: [:api_key, :secret, :shop])
13
12
  project = ScriptProject.current
14
-
15
- return @ctx.puts(self.class.help) unless form && ScriptProject::SUPPORTED_LANGUAGES.include?(project.language)
16
-
13
+ api_key = project.env[:api_key]
14
+ return @ctx.puts(self.class.help) unless api_key &&
15
+ ScriptProject::SUPPORTED_LANGUAGES.include?(project.language)
17
16
  Layers::Application::PushScript.call(
18
17
  ctx: @ctx,
19
18
  language: project.language,
20
19
  extension_point_type: project.extension_point_type,
21
20
  script_name: project.script_name,
22
21
  source_file: project.source_file,
23
- api_key: form.api_key,
24
- force: form.force
22
+ api_key: api_key,
23
+ force: options.flags.key?(:force)
25
24
  )
26
- @ctx.puts(@ctx.message('script.push.script_pushed', api_key: form.api_key))
25
+ @ctx.puts(@ctx.message('script.push.script_pushed', api_key: api_key))
27
26
  rescue StandardError => e
28
27
  UI::ErrorHandler.pretty_print_and_raise(e, failed_op: @ctx.message('script.push.error.operation_failed'))
29
28
  end
@@ -31,10 +30,6 @@ module Script
31
30
  def self.help
32
31
  ShopifyCli::Context.message('script.push.help', ShopifyCli::TOOL_NAME)
33
32
  end
34
-
35
- def self.extended_help
36
- ShopifyCli::Context.message('script.push.extended_help', ShopifyCli::TOOL_NAME)
37
- end
38
33
  end
39
34
  end
40
35
  end
@@ -1,18 +1,24 @@
1
1
  discount:
2
2
  assemblyscript:
3
3
  package: "@shopify/extension-point-as-discount"
4
- version: "^0.2.2"
4
+ version: "^0.2.4"
5
5
  sdk-version: "^6.0.0"
6
6
  toolchain-version: "^1.1.0"
7
7
  unit_limit_per_order:
8
8
  assemblyscript:
9
9
  package: "@shopify/extension-point-as-unit-limit-per-order"
10
- version: "^0.1.2"
10
+ version: "^0.1.8"
11
11
  sdk-version: "^6.0.0"
12
12
  toolchain-version: "^1.1.0"
13
13
  payment_filter:
14
14
  assemblyscript:
15
15
  package: "@shopify/extension-point-as-payment-filter"
16
- version: "^0.1.2"
16
+ version: "^0.2.3"
17
+ sdk-version: "^6.0.0"
18
+ toolchain-version: "^1.1.0"
19
+ shipping_filter:
20
+ assemblyscript:
21
+ package: "@shopify/extension-point-as-shipping-filter"
22
+ version: "^0.2.4"
17
23
  sdk-version: "^6.0.0"
18
24
  toolchain-version: "^1.1.0"
@@ -9,9 +9,17 @@ module Script
9
9
  class NoExistingStoresError < ScriptProjectError
10
10
  attr_reader :organization_id
11
11
  def initialize(organization_id)
12
+ super()
12
13
  @organization_id = organization_id
13
14
  end
14
15
  end
15
16
  class ScriptProjectAlreadyExistsError < ScriptProjectError; end
17
+ class InvalidConfigYAMLError < ScriptProjectError
18
+ attr_reader :config_file
19
+ def initialize(config_file)
20
+ super()
21
+ @config_file = config_file
22
+ end
23
+ end
16
24
  end
17
25
  end
@@ -11,8 +11,11 @@ module Script
11
11
 
12
12
  def organizations
13
13
  return @organizations if defined?(@organizations)
14
- ctx.puts(ctx.message('script.forms.script_form.fetching_organizations'))
15
- @organizations = ShopifyCli::PartnersAPI::Organizations.fetch_with_app(ctx)
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
16
19
  end
17
20
 
18
21
  def ask_app_api_key(apps, message: ctx.message('script.forms.script_form.ask_app_api_key_default'))
@@ -12,8 +12,9 @@ module Script
12
12
  project = setup_project(ctx, script_name, extension_point)
13
13
  project_creator = Infrastructure::ProjectCreator
14
14
  .for(ctx, language, extension_point, script_name, project.directory)
15
- install_dependencies(ctx, language, script_name, project, project_creator)
16
- bootstrap(ctx, project_creator)
15
+ install_dependencies(ctx, language, script_name, project.source_file, project_creator)
16
+ bootstrap(ctx, project.source_path, project_creator)
17
+ project
17
18
  end
18
19
 
19
20
  private
@@ -30,16 +31,16 @@ module Script
30
31
  ScriptProject.current
31
32
  end
32
33
 
33
- def install_dependencies(ctx, language, script_name, project, project_creator)
34
- task_runner = Infrastructure::TaskRunner.for(ctx, language, script_name, project.source_file)
34
+ def install_dependencies(ctx, language, script_name, source_file, project_creator)
35
+ task_runner = Infrastructure::TaskRunner.for(ctx, language, script_name, source_file)
35
36
  project_creator.setup_dependencies
36
37
  ProjectDependencies.install(ctx: ctx, task_runner: task_runner)
37
38
  end
38
39
 
39
- def bootstrap(ctx, project_creator)
40
+ def bootstrap(ctx, source_path, project_creator)
40
41
  UI::StrictSpinner.spin(ctx.message('script.create.creating')) do |spinner|
41
42
  project_creator.bootstrap
42
- spinner.update_title(ctx.message('script.create.created'))
43
+ spinner.update_title(ctx.message('script.create.created', source_path))
43
44
  end
44
45
  end
45
46
  end