Class: ShopifyCLI::Services::App::Create::PHPService

Inherits:
BaseService
  • Object
show all
Defined in:
lib/shopify_cli/services/app/create/php_service.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BaseService

call

Constructor Details

#initialize(name:, organization_id:, store_domain:, type:, verbose:, context:) ⇒ PHPService

Returns a new instance of PHPService.



10
11
12
13
14
15
16
17
18
# File 'lib/shopify_cli/services/app/create/php_service.rb', line 10

def initialize(name:, organization_id:, store_domain:, type:, verbose:, context:)
  @name = name
  @organization_id = organization_id
  @store_domain = store_domain
  @type = type
  @verbose = verbose
  @context = context
  super()
end

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



8
9
10
# File 'lib/shopify_cli/services/app/create/php_service.rb', line 8

def context
  @context
end

#nameObject (readonly)

Returns the value of attribute name.



8
9
10
# File 'lib/shopify_cli/services/app/create/php_service.rb', line 8

def name
  @name
end

#organization_idObject (readonly)

Returns the value of attribute organization_id.



8
9
10
# File 'lib/shopify_cli/services/app/create/php_service.rb', line 8

def organization_id
  @organization_id
end

#store_domainObject (readonly)

Returns the value of attribute store_domain.



8
9
10
# File 'lib/shopify_cli/services/app/create/php_service.rb', line 8

def store_domain
  @store_domain
end

#typeObject (readonly)

Returns the value of attribute type.



8
9
10
# File 'lib/shopify_cli/services/app/create/php_service.rb', line 8

def type
  @type
end

#verboseObject (readonly)

Returns the value of attribute verbose.



8
9
10
# File 'lib/shopify_cli/services/app/create/php_service.rb', line 8

def verbose
  @verbose
end

Instance Method Details

#callObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/shopify_cli/services/app/create/php_service.rb', line 20

def call
  form = PHP::Forms::Create.ask(context, [], {
    name: name,
    organization_id: organization_id,
    shop_domain: store_domain,
    type: type,
    verbose: verbose,
  })
  raise ShopifyCLI::AbortSilent if form.nil?

  check_php
  check_composer
  check_npm
  app_id = build(form)

  ShopifyCLI::Project.write(
    context,
    project_type: "php",
    organization_id: form.organization_id,
  )

  partners_url = ShopifyCLI::PartnersAPI.partners_url_for(form.organization_id, app_id)

  context.puts(context.message("apps.create.info.created", form.name, partners_url))
  context.puts(context.message("apps.create.info.serve", form.name, ShopifyCLI::TOOL_NAME))
  unless ShopifyCLI::Shopifolk.acting_as_shopify_organization?
    context.puts(context.message("apps.create.info.install", partners_url, form.name))
  end
end