spaceship 0.14.2 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 193c64d9d18c91250a1b79c4ba14ebc1acc04447
|
4
|
+
data.tar.gz: 45621bf70cad9244851cb6cdb22e6f7ac86ba837
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 048dbc075a88165e383aefb420fcafb2f3fac027f80479d18fcfddab5bd1071502a36ed77602c6d1efe8fefd85dc2b64db2ebe8417290f58f0d466dfdf3d0d2f
|
7
|
+
data.tar.gz: 9b02bb4b3aa146aa2f9bd4a436067f40ac7663c801bcee6c1e898bc8fc3fa8b542ca5f4ca2cec3fe29451da48ad23d61d43429ee4600206c1752a883c927e971
|
@@ -292,7 +292,7 @@ module Spaceship
|
|
292
292
|
if r.success? && a.include?("Apple Inc")
|
293
293
|
return a
|
294
294
|
else
|
295
|
-
raise UnexpectedResponse.new, "Couldn't download
|
295
|
+
raise UnexpectedResponse.new, "Couldn't download certificate, got this instead: #{a}"
|
296
296
|
end
|
297
297
|
end
|
298
298
|
|
@@ -21,6 +21,14 @@ module Spaceship
|
|
21
21
|
def login(user = nil, password = nil)
|
22
22
|
@client = TunesClient.login(user, password)
|
23
23
|
end
|
24
|
+
|
25
|
+
# Open up the team selection for the user (if necessary).
|
26
|
+
#
|
27
|
+
# If the user is in multiple teams, a team selection is shown.
|
28
|
+
# The user can then select a team by entering the number
|
29
|
+
def select_team
|
30
|
+
@client.select_team
|
31
|
+
end
|
24
32
|
end
|
25
33
|
end
|
26
34
|
end
|
@@ -38,11 +38,93 @@ module Spaceship
|
|
38
38
|
"https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/"
|
39
39
|
end
|
40
40
|
|
41
|
+
# @return (Array) A list of all available teams
|
42
|
+
def teams
|
43
|
+
return @teams if @teams
|
44
|
+
r = request(:get, "ra/user/detail")
|
45
|
+
@teams = parse_response(r, 'data')['associatedAccounts']
|
46
|
+
end
|
47
|
+
|
48
|
+
# @return (String) The currently selected Team ID
|
49
|
+
def team_id
|
50
|
+
return @current_team_id if @current_team_id
|
51
|
+
|
52
|
+
if teams.count > 1
|
53
|
+
puts "The current user is in #{teams.count} teams. Pass a team ID or call `select_team` to choose a team. Using the first one for now."
|
54
|
+
end
|
55
|
+
@current_team_id ||= teams[0]['contentProvider']['contentProviderId']
|
56
|
+
end
|
57
|
+
|
58
|
+
# Set a new team ID which will be used from now on
|
59
|
+
def team_id=(t_id)
|
60
|
+
r = request(:post) do |req|
|
61
|
+
req.url "ra/v1/session/webSession"
|
62
|
+
req.body = { contentProviderId: t_id }.to_json
|
63
|
+
req.headers['Content-Type'] = 'application/json'
|
64
|
+
end
|
65
|
+
|
66
|
+
unless r.headers['Set-Cookie'].to_s.include?("itctx")
|
67
|
+
raise "Looks like your Apple ID is not enabled for iTunes Connect, make sure to be able to login online"
|
68
|
+
end
|
69
|
+
|
70
|
+
itctx_regex = /itctx=([^;]*)/
|
71
|
+
new_itctx = r.headers['Set-Cookie'].match(itctx_regex).to_s
|
72
|
+
|
73
|
+
@cookie = @cookie.gsub(itctx_regex, new_itctx)
|
74
|
+
handle_itc_response(r.body)
|
75
|
+
|
76
|
+
@current_team_id = t_id
|
77
|
+
end
|
78
|
+
|
79
|
+
# Shows a team selection for the user in the terminal. This should not be
|
80
|
+
# called on CI systems
|
81
|
+
def select_team
|
82
|
+
t_id = (ENV['FASTLANE_ITC_TEAM_ID'] || '').strip
|
83
|
+
t_name = (ENV['FASTLANE_ITC_TEAM_NAME'] || '').strip
|
84
|
+
|
85
|
+
if t_name.length > 0
|
86
|
+
teams.each do |t|
|
87
|
+
t_id = t['contentProvider']['contentProviderId'].to_s if t['contentProvider']['name'].downcase == t_name.downcase
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
t_id = teams.first['contentProvider']['contentProviderId'].to_s if teams.count == 1
|
92
|
+
|
93
|
+
if t_id.length > 0
|
94
|
+
# actually set the team id here
|
95
|
+
self.team_id = t_id
|
96
|
+
return
|
97
|
+
end
|
98
|
+
|
99
|
+
# user didn't specify a team... #thisiswhywecanthavenicethings
|
100
|
+
loop do
|
101
|
+
puts "Multiple teams found, please enter the number of the team you want to use: "
|
102
|
+
teams.each_with_index do |team, i|
|
103
|
+
puts "#{i + 1}) \"#{team['contentProvider']['name']}\" (#{team['contentProvider']['contentProviderId']})"
|
104
|
+
end
|
105
|
+
|
106
|
+
selected = ($stdin.gets || '').strip.to_i - 1
|
107
|
+
team_to_use = teams[selected] if selected >= 0
|
108
|
+
|
109
|
+
if team_to_use
|
110
|
+
self.team_id = team_to_use['contentProvider']['contentProviderId'].to_s # actually set the team id here
|
111
|
+
break
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
# @return (Hash) Fetches all information of the currently used team
|
117
|
+
def team_information
|
118
|
+
teams.find do |t|
|
119
|
+
t['teamId'] == team_id
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
41
123
|
# returns wosinst, wosid and itctx
|
42
124
|
def login_overhead_cookies(myacinfo)
|
43
125
|
return @login_overhead_cookies if @login_overhead_cookies
|
44
126
|
|
45
|
-
response = request(:get, "
|
127
|
+
response = request(:get, "route?noext") # for woinst and wosid
|
46
128
|
cookies = {
|
47
129
|
woinst: response['Set-Cookie'].match(/woinst=([^;]*)/)[1],
|
48
130
|
wosid: response['Set-Cookie'].match(/wosid=([^;]*)/)[1],
|
data/lib/spaceship/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spaceship
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.15.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Felix Krause
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-12-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: credentials_manager
|