11
12
13
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
39
40
41
42
43
44
45
46
47
48
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
|
# File 'sigh/lib/sigh/download_all.rb', line 11
def download_all(download_xcode_profiles: false)
if (api_token = Spaceship::ConnectAPI::Token.from(hash: Sigh.config[:api_key], filepath: Sigh.config[:api_key_path]))
UI.message("Creating authorization token for App Store Connect API")
Spaceship::ConnectAPI.token = api_token
elsif !Spaceship::ConnectAPI.token.nil?
UI.message("Using existing authorization token for App Store Connect API")
else
UI.message("Starting login with user '#{Sigh.config[:username]}'")
Spaceship::ConnectAPI.login(Sigh.config[:username], nil, use_portal: true, use_tunes: false)
UI.message("Successfully logged in")
end
if download_xcode_profiles
UI.deprecated("The App Store Connect API does not support querying for Xcode managed profiles: --download_code_profiles is deprecated")
end
case Sigh.config[:platform].to_s
when 'ios'
profile_types = [
Spaceship::ConnectAPI::Profile::ProfileType::IOS_APP_STORE,
Spaceship::ConnectAPI::Profile::ProfileType::IOS_APP_INHOUSE,
Spaceship::ConnectAPI::Profile::ProfileType::IOS_APP_ADHOC,
Spaceship::ConnectAPI::Profile::ProfileType::IOS_APP_DEVELOPMENT
]
when 'macos'
profile_types = [
Spaceship::ConnectAPI::Profile::ProfileType::MAC_APP_STORE,
Spaceship::ConnectAPI::Profile::ProfileType::MAC_APP_DEVELOPMENT,
Spaceship::ConnectAPI::Profile::ProfileType::MAC_APP_DIRECT
]
if Spaceship::ConnectAPI.token
UI.important("Skipping #{Spaceship::ConnectAPI::Profile::ProfileType::MAC_APP_INHOUSE}... only available with Apple ID auth")
else
profile_types << Spaceship::ConnectAPI::Profile::ProfileType::MAC_APP_INHOUSE
end
when 'catalyst'
profile_types = [
Spaceship::ConnectAPI::Profile::ProfileType::MAC_CATALYST_APP_STORE,
Spaceship::ConnectAPI::Profile::ProfileType::MAC_CATALYST_APP_DEVELOPMENT,
Spaceship::ConnectAPI::Profile::ProfileType::MAC_CATALYST_APP_DIRECT
]
if Spaceship::ConnectAPI.token
UI.important("Skipping #{Spaceship::ConnectAPI::Profile::ProfileType::MAC_CATALYST_APP_INHOUSE}... only available with Apple ID auth")
else
profile_types << Spaceship::ConnectAPI::Profile::ProfileType::MAC_CATALYST_APP_INHOUSE
end
when 'tvos'
profile_types = [
Spaceship::ConnectAPI::Profile::ProfileType::TVOS_APP_STORE,
Spaceship::ConnectAPI::Profile::ProfileType::TVOS_APP_INHOUSE,
Spaceship::ConnectAPI::Profile::ProfileType::TVOS_APP_ADHOC,
Spaceship::ConnectAPI::Profile::ProfileType::TVOS_APP_DEVELOPMENT
]
end
profiles = Spaceship::ConnectAPI::Profile.all(filter: { profileType: profile_types.join(",") }, includes: "bundleId")
download_profiles(profiles)
end
|