Method: Produce::DeveloperCenter#create_new_app

Defined in:
produce/lib/produce/developer_center.rb

#create_new_appObject



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'produce/lib/produce/developer_center.rb', line 49

def create_new_app
  ENV["CREATED_NEW_APP_ID"] = Time.now.to_i.to_s
  if app_exists?
    UI.success("[DevCenter] App '#{Produce.config[:app_identifier]}' already exists, nothing to do on the Dev Center")
    ENV["CREATED_NEW_APP_ID"] = nil
    # Nothing to do here
  else
    app_name = Produce.config[:app_name]
    UI.message("Creating new app '#{app_name}' on the Apple Dev Center")

    app = Spaceship.app.create!(bundle_id: app_identifier,
                                     name: app_name,
                                     enable_services: enable_services,
                                     mac: Produce.config[:platform] == "osx")

    if app.name != Produce.config[:app_name]
      UI.important("Your app name includes non-ASCII characters, which are not supported by the Apple Developer Portal.")
      UI.important("To fix this a unique (internal) name '#{app.name}' has been created for you. Your app's real name '#{Produce.config[:app_name]}'")
      UI.important("will still show up correctly on App Store Connect and the App Store.")
    end

    UI.message("Created app #{app.app_id}")

    UI.crash!("Something went wrong when creating the new app - it's not listed in the apps list") unless app_exists?

    ENV["CREATED_NEW_APP_ID"] = Time.now.to_i.to_s

    UI.success("Finished creating new app '#{app_name}' on the Dev Center")
  end

  return true
end