This repository has been archived by the owner on Jan 22, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathget-app-status.rb
94 lines (73 loc) · 1.67 KB
/
get-app-status.rb
1
2
3
4
5
6
7
8
9
10
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
require 'spaceship'
require 'json'
def getVersionInfo(app)
editVersionInfo = app.edit_version
liveVersionInfo = app.live_version
# send app info to stdout as JSON
version = Hash.new
if editVersionInfo
version["editVersion"] = {
"name" => app.name,
"version" => editVersionInfo.version,
"status" => editVersionInfo.app_status,
"appId" => app.apple_id,
"iconUrl" => app.app_icon_preview_url
}
end
if liveVersionInfo
version["liveVersion"] = {
"name" => app.name,
"version" => liveVersionInfo.version,
"status" => liveVersionInfo.app_status,
"appId" => app.apple_id,
"iconUrl" => app.app_icon_preview_url
}
end
return version
end
def getAppVersionFrom(bundle_id)
versions = []
# all apps
apps = []
if (bundle_id)
app = Spaceship::Tunes::Application.find(bundle_id)
apps.push(app)
else
apps = Spaceship::Tunes::Application.all
end
for app in apps do
version = getVersionInfo(app)
versions.push(version)
end
return versions
end
# Constants
itc_username = ENV['itc_username']
itc_password = ENV['itc_password']
#split team_id
itc_team_id_array = ENV['itc_team_id'].to_s.split(",")
bundle_id = ENV['bundle_id']
if (!itc_username)
puts "did not find username"
exit
end
if (itc_password)
Spaceship::Tunes.login(itc_username,itc_password)
else
Spaceship::Tunes.login(itc_username)
end
# all json data
versions = []
#add for the team_ids
#test if itc_team doesnt exists
unless(itc_team_id_array.length.zero?)
for itc_team_id in itc_team_id_array
if (itc_team_id)
Spaceship::Tunes.client.team_id = itc_team_id
end
versions += getAppVersionFrom(bundle_id)
end
else
versions += getAppVersionFrom(bundle_id)
end
puts JSON.dump versions