Class: Produce::ItunesConnect

Inherits:
Object
  • Object
show all
Defined in:
lib/produce/itunes_connect.rb

Instance Method Summary collapse

Instance Method Details

#create_new_appObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/produce/itunes_connect.rb', line 14

def create_new_app
  application = fetch_application
  if application
    Helper.log.info "[iTC] App '#{Produce.config[:app_identifier]}' already exists (#{application.apple_id}), nothing to do on iTunes Connect".green
    # Nothing to do here
  else
    Helper.log.info "Creating new app '#{Produce.config[:app_name]}' on iTunes Connect".green

    Produce.config[:bundle_identifier_suffix] = '' unless wildcard_bundle?

    Spaceship::Tunes::Application.create!(name: Produce.config[:app_name],
                                          primary_language: language,
                                          version: Produce.config[:app_version],
                                          sku: Produce.config[:sku].to_s, # might be an int
                                          bundle_id: app_identifier,
                                          bundle_id_suffix: Produce.config[:bundle_identifier_suffix],
                                          company_name: Produce.config[:company_name])
    application = fetch_application
    raise "Something went wrong when creating the new app - it's not listed in the App's list" unless application

    Helper.log.info "Successfully created new app '#{Produce.config[:app_name]}' on iTunes Connect with ID #{application.apple_id}".green
  end

  return Spaceship::Application.find(@full_bundle_identifier).apple_id
end

#runObject



5
6
7
8
9
10
11
12
# File 'lib/produce/itunes_connect.rb', line 5

def run
  @full_bundle_identifier = app_identifier
  @full_bundle_identifier.gsub!('*', Produce.config[:bundle_identifier_suffix].to_s) if wildcard_bundle?

  Spaceship::Tunes.(Produce.config[:username], nil)

  create_new_app
end