Class: Pilot::Manager
- Inherits:
-
Object
show all
- Defined in:
- lib/pilot/manager.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Instance Attribute Details
#config ⇒ Object
Access the current configuration
32
33
34
|
# File 'lib/pilot/manager.rb', line 32
def config
@config
end
|
Instance Method Details
#app ⇒ Object
The app object we’re currently using
21
22
23
24
25
26
27
28
29
|
# File 'lib/pilot/manager.rb', line 21
def app
@apple_id ||= fetch_app_id
@app ||= Spaceship::Application.find(@apple_id)
unless @app
UI.user_error!("Could not find app with #{(config[:apple_id] || config[:app_identifier])}")
end
return @app
end
|
#fetch_app_id ⇒ Object
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/pilot/manager.rb', line 37
def fetch_app_id
return @apple_id if @apple_id
config[:app_identifier] = fetch_app_identifier
if config[:app_identifier]
@app ||= Spaceship::Application.find(config[:app_identifier])
UI.user_error!("Couldn't find app '#{config[:app_identifier]}' on the account of '#{config[:username]}' on iTunes Connect") unless @app
app_id ||= @app.apple_id
end
app_id ||= UI.input("Could not automatically find the app ID, please enter it here (e.g. 956814360): ")
return app_id
end
|
#fetch_app_identifier ⇒ Object
52
53
54
55
56
57
58
|
# File 'lib/pilot/manager.rb', line 52
def fetch_app_identifier
result = config[:app_identifier]
result ||= FastlaneCore::IpaFileAnalyser.fetch_app_identifier(config[:ipa])
result ||= UI.input("Please enter the app's bundle identifier: ")
UI.verbose("App identifier (#{result})")
return result
end
|
60
61
62
63
64
65
66
67
68
69
|
# File 'lib/pilot/manager.rb', line 60
def fetch_app_platform(required: true)
result = config[:app_platform]
result ||= FastlaneCore::IpaFileAnalyser.fetch_app_platform(config[:ipa]) if config[:ipa]
if required
result ||= ask("Please enter the app's platform (appletvos, ios, osx): ")
UI.user_error!("App Platform must be ios, appletvos, or osx") unless ['ios', 'appletvos', 'osx'].include? result
UI.verbose("App Platform (#{result})")
end
return result
end
|
#login ⇒ Object
11
12
13
14
15
16
17
18
|
# File 'lib/pilot/manager.rb', line 11
def login
config[:username] ||= CredentialsManager::AppfileConfig.try_fetch_value(:apple_id)
UI.message("Login to iTunes Connect (#{config[:username]})")
Spaceship::Tunes.login(config[:username])
Spaceship::Tunes.select_team
UI.message("Login successful")
end
|
#start(options) ⇒ Object
5
6
7
8
9
|
# File 'lib/pilot/manager.rb', line 5
def start(options)
return if @config @config = options
login
end
|