Class: Extension::Tasks::MergeServerConfig

Inherits:
Object
  • Object
show all
Includes:
SmartProperties
Defined in:
lib/project_types/extension/tasks/merge_server_config.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.call(*args) ⇒ Object



17
18
19
# File 'lib/project_types/extension/tasks/merge_server_config.rb', line 17

def self.call(*args)
  new(*args).call
end

Instance Method Details

#callObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/project_types/extension/tasks/merge_server_config.rb', line 21

def call
  config = YAML.load_file(file_path) if File.file?(file_path)
  config ||= {}

  project = ExtensionProject.current
  Tasks::ConvertServerConfig.call(
    api_key: project.env.api_key,
    context: context,
    hash: config,
    registration_uuid: project.registration_uuid,
    resource_url: resource_url || project.resource_url,
    store: project.env.shop || "",
    title: project.title,
    tunnel_url: tunnel_url,
    type: type,
    port: port,
    metafields: config["metafields"]
  )
rescue Psych::SyntaxError => e
  raise(
    ShopifyCLI::Abort,
    ShopifyCLI::Context.message("core.yaml.error.invalid", file_name, e.message)
  )
end