Class: Deliver::DetectValues

Inherits:
Object
  • Object
show all
Defined in:
lib/deliver/detect_values.rb

Instance Method Summary collapse

Instance Method Details

#find_app(options) ⇒ Object



23
24
25
26
27
28
29
30
31
32
# File 'lib/deliver/detect_values.rb', line 23

def find_app(options)
  search_by = options[:app_identifier]
  search_by = options[:app] if search_by.to_s.length == 0
  app = Spaceship::Application.find(search_by)
  if app
    options[:app] = app
  else
    raise "Could not find app with app identifier '#{options[:app_identifier]}' in your iTunes Connect account (#{options[:username]} - Team: #{Spaceship::Tunes.client.team_id})".red
  end
end

#find_app_identifier(options) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/deliver/detect_values.rb', line 10

def find_app_identifier(options)
  return if options[:app_identifier]

  if options[:ipa]
    identifier = FastlaneCore::IpaFileAnalyser.fetch_app_identifier(options[:ipa])
  elsif options[:pkg]
    identifier = FastlaneCore::PkgFileAnalyser.fetch_app_identifier(options[:pkg])
  end

  options[:app_identifier] = identifier if identifier.to_s.length > 0
  options[:app_identifier] ||= ask("The Bundle Identifier of your App: ")
end

#find_folders(options) ⇒ Object



34
35
36
37
38
39
40
41
# File 'lib/deliver/detect_values.rb', line 34

def find_folders(options)
  containing = Helper.fastlane_enabled? ? './fastlane' : '.'
  options[:screenshots_path] ||= File.join(containing, 'screenshots')
  options[:metadata_path] ||= File.join(containing, 'metadata')

  FileUtils.mkdir_p(options[:screenshots_path])
  FileUtils.mkdir_p(options[:metadata_path])
end

#find_version(options) ⇒ Object



43
44
45
46
47
48
49
# File 'lib/deliver/detect_values.rb', line 43

def find_version(options)
  if options[:ipa]
    options[:app_version] ||= FastlaneCore::IpaFileAnalyser.fetch_app_version(options[:ipa])
  elsif options[:pkg]
    options[:app_version] ||= FastlaneCore::PkgFileAnalyser.fetch_app_version(options[:pkg])
  end
end

#run!(options) ⇒ Object



3
4
5
6
7
8
# File 'lib/deliver/detect_values.rb', line 3

def run!(options)
  find_app_identifier(options)
  find_app(options)
  find_folders(options)
  find_version(options)
end