shopify-cli 1.7.0 → 1.10.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 (91) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/build.yml +28 -0
  3. data/.rubocop_todo.yml +15 -2
  4. data/CHANGELOG.md +21 -0
  5. data/Gemfile.lock +14 -14
  6. data/README.md +2 -1
  7. data/dev.yml +3 -0
  8. data/lib/docgen/markdown.rb +1 -1
  9. data/lib/graphql/extension_create.graphql +17 -2
  10. data/lib/graphql/fetch_specifications.graphql +14 -0
  11. data/lib/project_types/extension/cli.rb +4 -10
  12. data/lib/project_types/extension/commands/create.rb +2 -2
  13. data/lib/project_types/extension/commands/extension_command.rb +10 -6
  14. data/lib/project_types/extension/commands/push.rb +2 -2
  15. data/lib/project_types/extension/commands/register.rb +6 -5
  16. data/lib/project_types/extension/commands/serve.rb +1 -7
  17. data/lib/project_types/extension/extension_project.rb +19 -4
  18. data/lib/project_types/extension/extension_project_keys.rb +2 -1
  19. data/lib/project_types/extension/features/argo.rb +18 -34
  20. data/lib/project_types/extension/features/argo_renderer_package.rb +47 -0
  21. data/lib/project_types/extension/features/argo_serve.rb +69 -0
  22. data/lib/project_types/extension/features/argo_setup.rb +1 -1
  23. data/lib/project_types/extension/forms/questions/ask_type.rb +16 -5
  24. data/lib/project_types/extension/messages/message_loading.rb +3 -1
  25. data/lib/project_types/extension/messages/messages.rb +6 -6
  26. data/lib/project_types/extension/models/registration.rb +1 -0
  27. data/lib/project_types/extension/models/specification.rb +6 -2
  28. data/lib/project_types/extension/models/specification_handlers/default.rb +9 -1
  29. data/lib/project_types/extension/models/specifications.rb +12 -1
  30. data/lib/project_types/extension/models/version.rb +1 -1
  31. data/lib/project_types/extension/tasks/configure_features.rb +3 -1
  32. data/lib/project_types/extension/tasks/converters/registration_converter.rb +2 -0
  33. data/lib/project_types/extension/tasks/fetch_specifications.rb +8 -28
  34. data/lib/project_types/node/commands/generate.rb +0 -22
  35. data/lib/project_types/node/forms/create.rb +10 -1
  36. data/lib/project_types/node/messages/messages.rb +5 -4
  37. data/lib/project_types/rails/forms/create.rb +11 -1
  38. data/lib/project_types/rails/messages/messages.rb +5 -4
  39. data/lib/project_types/script/cli.rb +7 -7
  40. data/lib/project_types/script/commands/create.rb +2 -7
  41. data/lib/project_types/script/commands/push.rb +3 -3
  42. data/lib/project_types/script/config/extension_points.yml +27 -10
  43. data/lib/project_types/script/errors.rb +0 -35
  44. data/lib/project_types/script/forms/create.rb +3 -14
  45. data/lib/project_types/script/graphql/app_script_update_or_create.graphql +5 -5
  46. data/lib/project_types/script/graphql/get_app_scripts.graphql +6 -0
  47. data/lib/project_types/script/graphql/script_service_proxy.graphql +1 -2
  48. data/lib/project_types/script/layers/application/create_script.rb +32 -22
  49. data/lib/project_types/script/layers/application/extension_points.rb +3 -2
  50. data/lib/project_types/script/layers/application/push_script.rb +6 -3
  51. data/lib/project_types/script/layers/domain/config_ui.rb +16 -0
  52. data/lib/project_types/script/layers/domain/errors.rb +16 -0
  53. data/lib/project_types/script/layers/domain/extension_point.rb +60 -45
  54. data/lib/project_types/script/layers/domain/metadata.rb +18 -25
  55. data/lib/project_types/script/layers/domain/push_package.rb +4 -4
  56. data/lib/project_types/script/layers/domain/script_project.rb +54 -0
  57. data/lib/project_types/script/layers/infrastructure/assemblyscript_project_creator.rb +37 -8
  58. data/lib/project_types/script/layers/infrastructure/assemblyscript_task_runner.rb +5 -40
  59. data/lib/project_types/script/layers/infrastructure/errors.rb +50 -19
  60. data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +8 -9
  61. data/lib/project_types/script/layers/infrastructure/rust_task_runner.rb +1 -1
  62. data/lib/project_types/script/layers/infrastructure/script_project_repository.rb +198 -0
  63. data/lib/project_types/script/layers/infrastructure/script_service.rb +27 -66
  64. data/lib/project_types/script/messages/messages.rb +28 -51
  65. data/lib/project_types/script/tasks/ensure_env.rb +77 -0
  66. data/lib/project_types/script/ui/error_handler.rb +63 -47
  67. data/lib/shopify-cli/context.rb +28 -0
  68. data/lib/shopify-cli/js_system.rb +2 -2
  69. data/lib/shopify-cli/messages/messages.rb +3 -2
  70. data/lib/shopify-cli/method_object.rb +1 -1
  71. data/lib/shopify-cli/oauth.rb +2 -2
  72. data/lib/shopify-cli/packager.rb +1 -1
  73. data/lib/shopify-cli/resolve_constant.rb +1 -1
  74. data/lib/shopify-cli/resources/env_file.rb +1 -1
  75. data/lib/shopify-cli/result.rb +3 -3
  76. data/lib/shopify-cli/tasks/ensure_dev_store.rb +1 -1
  77. data/lib/shopify-cli/transform_data_structure.rb +2 -2
  78. data/lib/shopify-cli/version.rb +1 -1
  79. data/lib/shopify_cli.rb +0 -1
  80. data/vendor/deps/smart_properties/REVISION +1 -1
  81. data/vendor/deps/smart_properties/lib/smart_properties/property.rb +7 -1
  82. data/vendor/deps/smart_properties/lib/smart_properties/version.rb +1 -1
  83. metadata +11 -10
  84. data/.travis.yml +0 -14
  85. data/lib/project_types/script/commands/disable.rb +0 -25
  86. data/lib/project_types/script/commands/enable.rb +0 -80
  87. data/lib/project_types/script/graphql/shop_script_delete.graphql +0 -14
  88. data/lib/project_types/script/graphql/shop_script_update_or_create.graphql +0 -28
  89. data/lib/project_types/script/layers/application/disable_script.rb +0 -21
  90. data/lib/project_types/script/layers/application/enable_script.rb +0 -23
  91. data/lib/project_types/script/script_project.rb +0 -85
@@ -144,6 +144,34 @@ module ShopifyCli
144
144
  File.write(ctx_path(fname), content)
145
145
  end
146
146
 
147
+ # will read a binary file relative to the context root unless the file path is absolute.
148
+ #
149
+ # #### Parameters
150
+ # * `fname` - filename of the file that you are reading, relative to root unless it is absolute.
151
+ #
152
+ # #### Example
153
+ #
154
+ # @ctx.read('binary.out')
155
+ #
156
+ def binread(fname)
157
+ File.binread(ctx_path(fname))
158
+ end
159
+
160
+ # will write/overwrite a binary file with the provided contents, relative to the context root
161
+ # unless the file path is absolute.
162
+ #
163
+ # #### Parameters
164
+ # * `fname` - filename of the file that you are writing, relative to root unless it is absolute.
165
+ # * `content` - the body contents of the file that you are writing
166
+ #
167
+ # #### Example
168
+ #
169
+ # @ctx.binwrite('binary.out', 'ASCII-8BIT encoded binary')
170
+ #
171
+ def binwrite(fname, content)
172
+ File.binwrite(ctx_path(fname), content)
173
+ end
174
+
147
175
  # will change directories and update the root, the filepath is relative to the command root unless absolute
148
176
  #
149
177
  # #### Parameters
@@ -37,8 +37,8 @@ module ShopifyCli
37
37
  #
38
38
  # ShopifyCli::JsSystem.call(ctx, yarn: ['install', '--silent'], npm: ['install', '--no-audit'])
39
39
  #
40
- def call(ctx, yarn:, npm:)
41
- JsSystem.new(ctx: ctx).call(yarn: yarn, npm: npm)
40
+ def call(ctx, yarn:, npm:, capture_response: false)
41
+ JsSystem.new(ctx: ctx).call(yarn: yarn, npm: npm, capture_response: capture_response)
42
42
  end
43
43
  end
44
44
 
@@ -82,7 +82,8 @@ module ShopifyCli
82
82
  error: {
83
83
  directory_exists: "Project directory already exists. Please create a project with a new name.",
84
84
  no_branches_found: "Could not find any git branches",
85
- repo_not_initiated: "Git repo is not initiated. Please run `git init` and make at least one commit.",
85
+ repo_not_initiated:
86
+ "Git repo is not initiated. Please run {{command:git init}} and make at least one commit.",
86
87
  no_commits_made: "No git commits have been made. Please make at least one commit.",
87
88
  },
88
89
 
@@ -110,7 +111,7 @@ module ShopifyCli
110
111
  deploy: "Could not deploy to Heroku",
111
112
  download: "Heroku CLI could not be downloaded",
112
113
  install: "Could not install Heroku CLI",
113
- could_not_select_app: "Heroku app `%s` could not be selected",
114
+ could_not_select_app: "Heroku app {{green:%s}} could not be selected",
114
115
  },
115
116
  },
116
117
 
@@ -61,7 +61,7 @@ module ShopifyCli
61
61
  ##
62
62
  # creates a new instance and invokes `call`. Any positional argument
63
63
  # is forward to `call`. Keyword arguments are either forwarded to the
64
- # inializer or to `call`. If the keyword argument matches the name of
64
+ # initializer or to `call`. If the keyword argument matches the name of
65
65
  # property, it is forwarded to the initializer, otherwise to call.
66
66
  #
67
67
  def call(*args, **kwargs)
@@ -24,10 +24,10 @@ module ShopifyCli
24
24
  property! :service, accepts: String
25
25
  property! :client_id, accepts: String
26
26
  property! :scopes
27
- property :store, default: ShopifyCli::DB.new
27
+ property :store, default: -> { ShopifyCli::DB.new }
28
28
  property :secret, accepts: String
29
29
  property :request_exchange, accepts: String
30
- property :options, default: {}, accepts: Hash
30
+ property :options, default: -> { {} }, accepts: Hash
31
31
  property :auth_path, default: "/authorize", accepts: ->(path) { path.is_a?(String) && path.start_with?("/") }
32
32
  property :token_path, default: "/token", accepts: ->(path) { path.is_a?(String) && path.start_with?("/") }
33
33
  property :state_token, accepts: String, default: SecureRandom.hex(30)
@@ -99,7 +99,7 @@ module ShopifyCli
99
99
  raise <<~MESSAGE
100
100
 
101
101
  Could not find program #{program} which is required to build the package.
102
- You can install it by running `#{installation_cmd}`.
102
+ You can install it by running #{installation_cmd}.
103
103
 
104
104
  MESSAGE
105
105
  end
@@ -11,7 +11,7 @@
11
11
  module ShopifyCli
12
12
  class ResolveConstant
13
13
  include ShopifyCli::MethodObject
14
- property! :namespace, accepts: ->(ns) { ns.respond_to?(:const_get) }, default: Kernel
14
+ property! :namespace, accepts: ->(ns) { ns.respond_to?(:const_get) }, default: -> { Kernel }
15
15
 
16
16
  def call(name)
17
17
  name
@@ -57,7 +57,7 @@ module ShopifyCli
57
57
  property :shop
58
58
  property :scopes
59
59
  property :host
60
- property :extra, default: {}
60
+ property :extra, default: -> { {} }
61
61
 
62
62
  def to_h
63
63
  out = {}
@@ -104,7 +104,7 @@ module ShopifyCli
104
104
  end
105
105
 
106
106
  ##
107
- # raises an `UnexpectedSuccess` as a `Failure` does not carry an error
107
+ # raises an `UnexpectedSuccess` as a `Success` does not carry an error
108
108
  # value.
109
109
  #
110
110
  def error
@@ -221,8 +221,8 @@ module ShopifyCli
221
221
  # .then { |data| data.values_at(:firstname, :lastname) } # Ignored
222
222
  # .unwrap(Person.new("John", "Doe")) # => Person
223
223
  #
224
- # Alternatively, we could resucue from the error and then proceed with the
225
- # remanining transformations:
224
+ # Alternatively, we could rescue from the error and then proceed with the
225
+ # remaining transformations:
226
226
  #
227
227
  # Person = Struct.new(:firstname, :lastname)
228
228
  # Failure
@@ -5,7 +5,7 @@ module ShopifyCli
5
5
  class EnsureDevStore < ShopifyCli::Task
6
6
  def call(ctx)
7
7
  @ctx = ctx
8
- return ctx.puts(ctx.message(
8
+ return ctx.abort(ctx.message(
9
9
  "core.tasks.ensure_dev_store.could_not_verify_store", project.env.shop
10
10
  )) if shop.nil?
11
11
  return if shop["transferDisabled"] == true
@@ -42,7 +42,7 @@ module ShopifyCli
42
42
  property! :symbolize_keys, accepts: [true, false], default: false, reader: :symbolize_keys?
43
43
  property! :associative_array_container,
44
44
  accepts: ->(c) { c.respond_to?(:new) && c.method_defined?(:[]=) },
45
- default: Hash
45
+ default: -> { Hash }
46
46
 
47
47
  def call(object)
48
48
  case object
@@ -68,7 +68,7 @@ module ShopifyCli
68
68
  def underscore_key(key)
69
69
  return key unless underscore_keys? && key.respond_to?(:to_str)
70
70
 
71
- key.to_str.dup.yield_self do |k|
71
+ key.to_str.dup.tap do |k|
72
72
  k.gsub!(/([A-Z\d]+)([A-Z][a-z])/, '\1_\2')
73
73
  k.gsub!(/([a-z\d])([A-Z])/, '\1_\2')
74
74
  k.tr!("-", "_")
@@ -1,3 +1,3 @@
1
1
  module ShopifyCli
2
- VERSION = "1.7.0"
2
+ VERSION = "1.10.0"
3
3
  end
data/lib/shopify_cli.rb CHANGED
@@ -110,7 +110,6 @@ module ShopifyCli
110
110
  autoload :JsSystem, "shopify-cli/js_system"
111
111
  autoload :MethodObject, "shopify-cli/method_object"
112
112
  autoload :LazyDelegator, "shopify-cli/lazy_delegator"
113
- autoload :Log, "shopify-cli/log"
114
113
  autoload :OAuth, "shopify-cli/oauth"
115
114
  autoload :Options, "shopify-cli/options"
116
115
  autoload :PartnersAPI, "shopify-cli/partners_api"
@@ -1 +1 @@
1
- 691028e47d022a29405b7f0ccc8683c9d062c502
1
+ cfe83ef361e68ba7c471af75144f2b85cf1e1ec6
@@ -1,6 +1,7 @@
1
1
  module SmartProperties
2
2
  class Property
3
3
  MODULE_REFERENCE = :"@_smart_properties_method_scope"
4
+ ALLOWED_DEFAULT_CLASSES = [Proc, Numeric, String, Range, TrueClass, FalseClass, NilClass, Symbol, Module].freeze
4
5
 
5
6
  attr_reader :name
6
7
  attr_reader :converter
@@ -27,6 +28,11 @@ module SmartProperties
27
28
 
28
29
  @instance_variable_name = :"@#{name}"
29
30
 
31
+ unless ALLOWED_DEFAULT_CLASSES.any? { |cls| @default.is_a?(cls) }
32
+ raise ConfigurationError, "Default attribute value #{@default.inspect} cannot be specified as literal, "\
33
+ "use the syntax `default: -> { ... }` instead."
34
+ end
35
+
30
36
  unless attrs.empty?
31
37
  raise ConfigurationError, "SmartProperties do not support the following configuration options: #{attrs.keys.map { |m| m.to_s }.sort.join(', ')}."
32
38
  end
@@ -66,7 +72,7 @@ module SmartProperties
66
72
  end
67
73
 
68
74
  def default(scope)
69
- @default.kind_of?(Proc) ? scope.instance_exec(&@default) : @default
75
+ @default.kind_of?(Proc) ? scope.instance_exec(&@default) : @default.dup
70
76
  end
71
77
 
72
78
  def accepts?(value, scope)
@@ -1,3 +1,3 @@
1
1
  module SmartProperties
2
- VERSION = "1.14.0"
2
+ VERSION = "1.15.0"
3
3
  end
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.7.0
4
+ version: 1.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-11 00:00:00.000000000 Z
11
+ date: 2021-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -77,6 +77,7 @@ files:
77
77
  - ".github/ISSUE_TEMPLATE.md"
78
78
  - ".github/PULL_REQUEST_TEMPLATE.md"
79
79
  - ".github/probots.yml"
80
+ - ".github/workflows/build.yml"
80
81
  - ".github/workflows/release.yml"
81
82
  - ".github/workflows/triage.yml"
82
83
  - ".gitignore"
@@ -85,7 +86,6 @@ files:
85
86
  - ".ruby-version"
86
87
  - ".tmp/.gitkeep"
87
88
  - ".tmp/sv/.gitkeep"
88
- - ".travis.yml"
89
89
  - CHANGELOG.md
90
90
  - Gemfile
91
91
  - Gemfile.lock
@@ -126,6 +126,7 @@ files:
126
126
  - lib/graphql/create_product.graphql
127
127
  - lib/graphql/extension_create.graphql
128
128
  - lib/graphql/extension_update_draft.graphql
129
+ - lib/graphql/fetch_specifications.graphql
129
130
  - lib/graphql/find_organization.graphql
130
131
  - lib/graphql/get_app_by_api_key.graphql
131
132
  - lib/graphql/get_app_urls.graphql
@@ -143,6 +144,8 @@ files:
143
144
  - lib/project_types/extension/features/argo.rb
144
145
  - lib/project_types/extension/features/argo_config.rb
145
146
  - lib/project_types/extension/features/argo_dependencies.rb
147
+ - lib/project_types/extension/features/argo_renderer_package.rb
148
+ - lib/project_types/extension/features/argo_serve.rb
146
149
  - lib/project_types/extension/features/argo_setup.rb
147
150
  - lib/project_types/extension/features/argo_setup_step.rb
148
151
  - lib/project_types/extension/features/argo_setup_steps.rb
@@ -207,27 +210,24 @@ files:
207
210
  - lib/project_types/rails/ruby.rb
208
211
  - lib/project_types/script/cli.rb
209
212
  - lib/project_types/script/commands/create.rb
210
- - lib/project_types/script/commands/disable.rb
211
- - lib/project_types/script/commands/enable.rb
212
213
  - lib/project_types/script/commands/push.rb
213
214
  - lib/project_types/script/config/extension_points.yml
214
215
  - lib/project_types/script/errors.rb
215
216
  - lib/project_types/script/forms/create.rb
216
217
  - lib/project_types/script/graphql/app_script_update_or_create.graphql
218
+ - lib/project_types/script/graphql/get_app_scripts.graphql
217
219
  - lib/project_types/script/graphql/script_service_proxy.graphql
218
- - lib/project_types/script/graphql/shop_script_delete.graphql
219
- - lib/project_types/script/graphql/shop_script_update_or_create.graphql
220
220
  - lib/project_types/script/layers/application/build_script.rb
221
221
  - lib/project_types/script/layers/application/create_script.rb
222
- - lib/project_types/script/layers/application/disable_script.rb
223
- - lib/project_types/script/layers/application/enable_script.rb
224
222
  - lib/project_types/script/layers/application/extension_points.rb
225
223
  - lib/project_types/script/layers/application/project_dependencies.rb
226
224
  - lib/project_types/script/layers/application/push_script.rb
225
+ - lib/project_types/script/layers/domain/config_ui.rb
227
226
  - lib/project_types/script/layers/domain/errors.rb
228
227
  - lib/project_types/script/layers/domain/extension_point.rb
229
228
  - lib/project_types/script/layers/domain/metadata.rb
230
229
  - lib/project_types/script/layers/domain/push_package.rb
230
+ - lib/project_types/script/layers/domain/script_project.rb
231
231
  - lib/project_types/script/layers/infrastructure/assemblyscript_project_creator.rb
232
232
  - lib/project_types/script/layers/infrastructure/assemblyscript_task_runner.rb
233
233
  - lib/project_types/script/layers/infrastructure/errors.rb
@@ -236,10 +236,11 @@ files:
236
236
  - lib/project_types/script/layers/infrastructure/push_package_repository.rb
237
237
  - lib/project_types/script/layers/infrastructure/rust_project_creator.rb
238
238
  - lib/project_types/script/layers/infrastructure/rust_task_runner.rb
239
+ - lib/project_types/script/layers/infrastructure/script_project_repository.rb
239
240
  - lib/project_types/script/layers/infrastructure/script_service.rb
240
241
  - lib/project_types/script/layers/infrastructure/task_runner.rb
241
242
  - lib/project_types/script/messages/messages.rb
242
- - lib/project_types/script/script_project.rb
243
+ - lib/project_types/script/tasks/ensure_env.rb
243
244
  - lib/project_types/script/ui/error_handler.rb
244
245
  - lib/project_types/script/ui/printing_spinner.rb
245
246
  - lib/project_types/script/ui/strict_spinner.rb
data/.travis.yml DELETED
@@ -1,14 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 3.0.0
4
- - 2.5.8
5
- - 2.6.6
6
- - 2.7.1
7
- before_install:
8
- - gem install bundler -v '1.17.3'
9
- cache:
10
- bundler: true
11
- install:
12
- - bundle install
13
- script:
14
- - bundle exec rake
@@ -1,25 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Script
4
- module Commands
5
- class Disable < ShopifyCli::Command
6
- def call(_args, _name)
7
- ShopifyCli::Tasks::EnsureEnv.call(@ctx, required: [:api_key, :secret, :shop])
8
- project = ScriptProject.current
9
- Layers::Application::DisableScript.call(
10
- ctx: @ctx,
11
- api_key: project.env[:api_key],
12
- shop_domain: project.env[:shop],
13
- extension_point_type: project.extension_point_type
14
- )
15
- @ctx.puts(@ctx.message("script.disable.script_disabled"))
16
- rescue StandardError => e
17
- UI::ErrorHandler.pretty_print_and_raise(e, failed_op: @ctx.message("script.disable.error.operation_failed"))
18
- end
19
-
20
- def self.help
21
- ShopifyCli::Context.message("script.disable.help", ShopifyCli::TOOL_NAME)
22
- end
23
- end
24
- end
25
- end
@@ -1,80 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Script
4
- module Commands
5
- class Enable < ShopifyCli::Command
6
- options do |parser, flags|
7
- parser.on("--config_props=KEYVALUEPAIRS", Array) { |t| flags[:config_props] = t }
8
- parser.on("--config-props=KEYVALUEPAIRS", Array) { |t| flags[:config_props] = t }
9
- parser.on("--config_file=CONFIGFILEPATH") { |t| flags[:config_file] = t }
10
- parser.on("--config-file=CONFIGFILEPATH") { |t| flags[:config_file] = t }
11
- end
12
-
13
- def call(_args, _name)
14
- ShopifyCli::Tasks::EnsureEnv.call(@ctx, required: [:api_key, :secret, :shop])
15
- project = ScriptProject.current
16
- api_key = project.env[:api_key]
17
- shop_domain = project.env[:shop]
18
-
19
- Layers::Application::EnableScript.call(
20
- ctx: @ctx,
21
- api_key: api_key,
22
- shop_domain: shop_domain,
23
- configuration: acquire_configuration(**slice(options.flags, :config_file, :config_props)),
24
- extension_point_type: project.extension_point_type,
25
- title: project.script_name
26
- )
27
- @ctx.puts(@ctx.message(
28
- "script.enable.script_enabled",
29
- api_key: api_key,
30
- shop_domain: shop_domain,
31
- type: project.extension_point_type.capitalize,
32
- title: project.script_name
33
- ))
34
- @ctx.puts(@ctx.message("script.enable.info"))
35
- rescue Errors::InvalidConfigYAMLError => e
36
- UI::ErrorHandler.pretty_print_and_raise(e)
37
- rescue StandardError => e
38
- UI::ErrorHandler.pretty_print_and_raise(e, failed_op: @ctx.message("script.enable.error.operation_failed"))
39
- end
40
-
41
- def self.help
42
- ShopifyCli::Context.message("script.enable.help", ShopifyCli::TOOL_NAME)
43
- end
44
-
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(parse_config_props(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
- def parse_config_props(config_props)
65
- Hash[
66
- config_props.map do |s|
67
- args = s.split(":").map(&:strip)
68
- raise Errors::InvalidConfigProps unless args.size == 2
69
- args
70
- end
71
- ]
72
- end
73
-
74
- # No slice pre Ruby 2.5 so roll our own
75
- def slice(hash, *keys)
76
- Hash[hash.to_a - hash.select { |key, _value| !keys.include?(key) }.to_a]
77
- end
78
- end
79
- end
80
- end
@@ -1,14 +0,0 @@
1
- mutation ShopScriptDelete($extensionPointName: ExtensionPointName!) {
2
- shopScriptDelete(extensionPointName: $extensionPointName) {
3
- userErrors {
4
- field
5
- message
6
- tag
7
- }
8
- shopScript {
9
- extensionPointName
10
- shopId
11
- title
12
- }
13
- }
14
- }