spaceship 0.0.15 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/lib/assets/languageMapping.json +224 -0
  3. data/lib/spaceship.rb +20 -63
  4. data/lib/spaceship/base.rb +71 -14
  5. data/lib/spaceship/client.rb +9 -274
  6. data/lib/spaceship/launcher.rb +1 -1
  7. data/lib/spaceship/portal/app.rb +125 -0
  8. data/lib/spaceship/portal/certificate.rb +273 -0
  9. data/lib/spaceship/portal/device.rb +102 -0
  10. data/lib/spaceship/portal/portal.rb +6 -0
  11. data/lib/spaceship/portal/portal_base.rb +13 -0
  12. data/lib/spaceship/portal/portal_client.rb +289 -0
  13. data/lib/spaceship/portal/provisioning_profile.rb +369 -0
  14. data/lib/spaceship/portal/spaceship.rb +94 -0
  15. data/lib/spaceship/{ui → portal/ui}/select_team.rb +0 -0
  16. data/lib/spaceship/tunes/app_screenshot.rb +28 -0
  17. data/lib/spaceship/tunes/app_status.rb +63 -0
  18. data/lib/spaceship/tunes/app_submission.rb +149 -0
  19. data/lib/spaceship/tunes/app_version.rb +337 -0
  20. data/lib/spaceship/tunes/application.rb +253 -0
  21. data/lib/spaceship/tunes/build.rb +128 -0
  22. data/lib/spaceship/tunes/build_train.rb +79 -0
  23. data/lib/spaceship/tunes/language_converter.rb +44 -0
  24. data/lib/spaceship/tunes/language_item.rb +54 -0
  25. data/lib/spaceship/tunes/processing_build.rb +30 -0
  26. data/lib/spaceship/tunes/spaceship.rb +26 -0
  27. data/lib/spaceship/tunes/tester.rb +177 -0
  28. data/lib/spaceship/tunes/tunes.rb +12 -0
  29. data/lib/spaceship/tunes/tunes_base.rb +15 -0
  30. data/lib/spaceship/tunes/tunes_client.rb +360 -0
  31. data/lib/spaceship/version.rb +1 -1
  32. metadata +27 -7
  33. data/lib/spaceship/app.rb +0 -125
  34. data/lib/spaceship/certificate.rb +0 -271
  35. data/lib/spaceship/device.rb +0 -100
  36. data/lib/spaceship/provisioning_profile.rb +0 -367
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7738def08370fc2d941f9bce3cd8b045113284d9
4
- data.tar.gz: b0d56eab4d5952abd9e0783817791b5cb91362ec
3
+ metadata.gz: 23f971e7d7b5ede6c4c93239d7ada418bbdf5481
4
+ data.tar.gz: b51315f65436991606e46d58096f7a2f3bedd7e3
5
5
  SHA512:
6
- metadata.gz: f03419aa0a4b6928eb7e02cfef46ea4937ef59d216784d1ed882cc47695bffc45f2a68720703374faa13e94d367e6bb7d8622924837729cb351fa96a9a5b498e
7
- data.tar.gz: 35eb4c008ffc11a44feb6f985d38d05bf5a87460d311dde77ce303937c4a635336faf1060ee68ee6d886c1a3dfccf67a196101058f9493780961067c7e5e917e
6
+ metadata.gz: 0d7fa284e26beb96cf3c097e947f7f7af7e04491c6a7e191e5c0e7406f2d0c85933ebcc496b319d97154ed08e4433d3bbb425881e56c215a835e3e59ca4dc726
7
+ data.tar.gz: ee10e4b8fb198da08b65141c58f545e67d879e13b5debeeb4925855c929683e42f2abd0cca35fbd8ff5bad1cf54cd77ba8eb0a52c31c151805669c5eea1ce79f
@@ -0,0 +1,224 @@
1
+ [
2
+ {
3
+ "locale": "cmn-Hans",
4
+ "name": "Simplified Chinese",
5
+ "game-center": true
6
+ },
7
+ {
8
+ "locale": "cmn-Hant",
9
+ "name": "Traditional Chinese",
10
+ "game-center": true
11
+ },
12
+ {
13
+ "locale": "da-DK",
14
+ "name": "Danish",
15
+ "game-center": true,
16
+ "alternatives": [
17
+ "da"
18
+ ]
19
+ },
20
+ {
21
+ "locale": "nl-NL",
22
+ "name": "Dutch",
23
+ "game-center": true,
24
+ "alternatives": [
25
+ "nl"
26
+ ]
27
+ },
28
+ {
29
+ "locale": "en-AU",
30
+ "name": "Australian English",
31
+ "game-center": false
32
+ },
33
+ {
34
+ "locale": "en-AU",
35
+ "name": "English_Australian",
36
+ "game-center": false
37
+ },
38
+ {
39
+ "locale": "en-CA",
40
+ "name": "Canadian English",
41
+ "game-center": false
42
+ },
43
+ {
44
+ "locale": "en-CA",
45
+ "name": "English_CA",
46
+ "game-center": false
47
+ },
48
+ {
49
+ "locale": "en-GB",
50
+ "name": "UK English",
51
+ "game-center": true
52
+ },
53
+ {
54
+ "locale": "en-GB",
55
+ "name": "English_UK",
56
+ "game-center": true
57
+ },
58
+ {
59
+ "locale": "en-US",
60
+ "name": "English",
61
+ "game-center": true
62
+ },
63
+ {
64
+ "locale": "fi-FI",
65
+ "name": "Finnish",
66
+ "game-center": true,
67
+ "alternatives": [
68
+ "fi"
69
+ ]
70
+ },
71
+ {
72
+ "locale": "fr-CA",
73
+ "name": "Canadian French",
74
+ "game-center": false
75
+ },
76
+ {
77
+ "locale": "fr-CA",
78
+ "name": "French_CA",
79
+ "game-center": false
80
+ },
81
+ {
82
+ "locale": "fr-FR",
83
+ "name": "French",
84
+ "game-center": true,
85
+ "alternatives": [
86
+ "fr"
87
+ ]
88
+ },
89
+ {
90
+ "locale": "de-DE",
91
+ "name": "German",
92
+ "game-center": true,
93
+ "alternatives": [
94
+ "de"
95
+ ]
96
+ },
97
+ {
98
+ "locale": "el-GR",
99
+ "name": "Greek",
100
+ "game-center": true,
101
+ "alternatives": [
102
+ "el"
103
+ ]
104
+ },
105
+ {
106
+ "locale": "id-ID",
107
+ "name": "Indonesian",
108
+ "game-center": true,
109
+ "alternatives": [
110
+ "id"
111
+ ]
112
+ },
113
+ {
114
+ "locale": "it-IT",
115
+ "name": "Italian",
116
+ "game-center": true,
117
+ "alternatives": [
118
+ "it"
119
+ ]
120
+ },
121
+ {
122
+ "locale": "ja-JP",
123
+ "name": "Japanese",
124
+ "game-center": true,
125
+ "alternatives": [
126
+ "ja"
127
+ ]
128
+ },
129
+ {
130
+ "locale": "ko-KR",
131
+ "name": "Korean",
132
+ "game-center": true,
133
+ "alternatives": [
134
+ "ko"
135
+ ]
136
+ },
137
+ {
138
+ "locale": "ms-MY",
139
+ "name": "Malay",
140
+ "game-center": true,
141
+ "alternatives": [
142
+ "ms"
143
+ ]
144
+ },
145
+ {
146
+ "locale": "no-NO",
147
+ "name": "Norwegian",
148
+ "game-center": true,
149
+ "alternatives": [
150
+ "no"
151
+ ]
152
+ },
153
+ {
154
+ "locale": "pt-BR",
155
+ "name": "Brazilian Portuguese",
156
+ "game-center": true
157
+ },
158
+ {
159
+ "locale": "pt-PT",
160
+ "name": "Portuguese",
161
+ "game-center": true,
162
+ "alternatives": [
163
+ "pt"
164
+ ]
165
+ },
166
+ {
167
+ "locale": "ru-RU",
168
+ "name": "Russian",
169
+ "game-center": true,
170
+ "alternatives": [
171
+ "ru"
172
+ ]
173
+ },
174
+ {
175
+ "locale": "es-MX",
176
+ "name": "Mexican Spanish",
177
+ "game-center": false
178
+ },
179
+ {
180
+ "locale": "es-MX",
181
+ "name": "Spanish_MX",
182
+ "game-center": false
183
+ },
184
+ {
185
+ "locale": "es-ES",
186
+ "name": "Spanish",
187
+ "game-center": true,
188
+ "alternatives": [
189
+ "es"
190
+ ]
191
+ },
192
+ {
193
+ "locale": "sv-SE",
194
+ "name": "Swedish",
195
+ "game-center": true,
196
+ "alternatives": [
197
+ "sv"
198
+ ]
199
+ },
200
+ {
201
+ "locale": "th-TH",
202
+ "name": "Thai",
203
+ "game-center": true,
204
+ "alternatives": [
205
+ "th"
206
+ ]
207
+ },
208
+ {
209
+ "locale": "tr-TR",
210
+ "name": "Turkish",
211
+ "game-center": true,
212
+ "alternatives": [
213
+ "tr"
214
+ ]
215
+ },
216
+ {
217
+ "locale": "vi-VI",
218
+ "name": "Vietnamese",
219
+ "game-center": true,
220
+ "alternatives": [
221
+ "vi"
222
+ ]
223
+ }
224
+ ]
data/lib/spaceship.rb CHANGED
@@ -1,71 +1,28 @@
1
1
  require 'spaceship/version'
2
2
  require 'spaceship/base'
3
3
  require 'spaceship/client'
4
- require 'spaceship/app'
5
- require 'spaceship/certificate'
6
- require 'spaceship/device'
7
- require 'spaceship/provisioning_profile'
8
4
  require 'spaceship/launcher'
9
5
 
10
- module Spaceship
11
- # Use this to just setup the configuration attribute and set it later somewhere else
12
- class << self
13
- # This client stores the default client when using the lazy syntax
14
- # Spaceship.app instead of using the spaceship launcher
15
- attr_accessor :client
16
-
17
- # Authenticates with Apple's web services. This method has to be called once
18
- # to generate a valid session. The session will automatically be used from then
19
- # on.
20
- #
21
- # This method will automatically use the username from the Appfile (if available)
22
- # and fetch the password from the Keychain (if available)
23
- #
24
- # @param user (String) (optional): The username (usually the email address)
25
- # @param password (String) (optional): The password
26
- #
27
- # @raise InvalidUserCredentialsError: raised if authentication failed
28
- #
29
- # @return (Spaceship::Client) The client the login method was called for
30
- def login(user = nil, password = nil)
31
- @client = Client.login(user, password)
32
- end
33
-
34
- # Open up the team selection for the user (if necessary).
35
- #
36
- # If the user is in multiple teams, a team selection is shown.
37
- # The user can then select a team by entering the number
38
- #
39
- # Additionally, the team ID is shown next to each team name
40
- # so that the user can use the environment variable `FASTLANE_TEAM_ID`
41
- # for future user.
42
- #
43
- # @return (String) The ID of the select team. You also get the value if
44
- # the user is only in one team.
45
- def select_team
46
- @client.select_team
47
- end
48
-
49
- # Helper methods for managing multiple instances of spaceship
6
+ # Dev Portal
7
+ require 'spaceship/portal/portal'
8
+ require 'spaceship/portal/spaceship'
50
9
 
51
- # @return (Class) Access the apps for the spaceship
52
- def app
53
- Spaceship::App.set_client(@client)
54
- end
10
+ # iTunes Connect
11
+ require 'spaceship/tunes/tunes'
12
+ require 'spaceship/tunes/spaceship'
13
+ require 'spaceship/tunes/tester'
55
14
 
56
- # @return (Class) Access the devices for the spaceship
57
- def device
58
- Spaceship::Device.set_client(@client)
59
- end
60
-
61
- # @return (Class) Access the certificates for the spaceship
62
- def certificate
63
- Spaceship::Certificate.set_client(@client)
64
- end
65
-
66
- # @return (Class) Access the provisioning profiles for the spaceship
67
- def provisioning_profile
68
- Spaceship::ProvisioningProfile.set_client(@client)
69
- end
70
- end
15
+ # To support legacy code
16
+ module Spaceship
17
+ # Dev Portal
18
+ Certificate = Spaceship::Portal::Certificate
19
+ ProvisioningProfile = Spaceship::Portal::ProvisioningProfile
20
+ Device = Spaceship::Portal::Device
21
+ App = Spaceship::Portal::App
22
+
23
+ # iTunes Connect
24
+ AppVersion = Spaceship::Tunes::AppVersion
25
+ AppSubmission = Spaceship::Tunes::AppSubmission
26
+ Application = Spaceship::Tunes::Application
71
27
  end
28
+
@@ -19,14 +19,44 @@ module Spaceship
19
19
  #
20
20
  # When you want to instantiate a model pass in the parsed response: `Widget.new(widget_json)`
21
21
  class Base
22
+ class DataHash
23
+ def initialize(hash)
24
+ @hash = hash
25
+ end
26
+
27
+ def get(*keys)
28
+ lookup(keys)
29
+ end
30
+ alias [] get
31
+
32
+ def set(keys, value)
33
+ last = keys.pop
34
+ ref = lookup(keys) || @hash
35
+ ref[last] = value
36
+ end
37
+
38
+ def lookup(keys)
39
+ head, *tail = *keys
40
+ if tail.empty?
41
+ @hash[head]
42
+ else
43
+ DataHash.new(@hash[head]).lookup(tail)
44
+ end
45
+ end
46
+
47
+ def to_json
48
+ @hash.to_json
49
+ end
50
+ end
51
+
22
52
  class << self
23
53
  attr_accessor :client
24
54
 
25
55
  ##
26
56
  # The client used to make requests.
27
- # @return (Spaceship::Client) Defaults to the singleton `Spaceship.client`
57
+ # @return (Spaceship::Client) Defaults to the singleton
28
58
  def client
29
- @client || Spaceship.client
59
+ raise "`client` must be implemented in subclasses"
30
60
  end
31
61
 
32
62
  ##
@@ -38,18 +68,25 @@ module Spaceship
38
68
  end
39
69
 
40
70
  ##
41
- # Remaps the attributes passed into the initializer to the model
42
- # attributes using the map defined by `attr_map`.
43
- #
44
- # This method consumes the input parameter meaning attributes that were
45
- # remapped are deleted.
71
+ # Binds attributes getters and setters to underlying data returned from the API.
72
+ # Setting any properties will alter the `raw_data` hash.
46
73
  #
47
- # @return (Hash) the attribute mapping used by `remap_keys!`
48
- def remap_keys!(attrs)
49
- return if attr_mapping.nil?
74
+ # @return (Module) with the mapped getters and setters defined. Can be `include`, `extend`, or `prepend` into a class or object
75
+ def mapping_module(attr_mapping)
76
+ Module.new do
77
+ attr_mapping.each do |source, dest|
78
+ getter = dest.to_sym
79
+ setter = "#{dest}=".to_sym
50
80
 
51
- attr_mapping.each do |from, to|
52
- attrs[to] = attrs.delete(from)
81
+ define_method(getter) do
82
+ raw_data.get(*source.split('.'))
83
+ end
84
+
85
+ define_method(setter) do |value|
86
+ self.raw_data ||= DataHash.new({})
87
+ raw_data.set(source.split('.'), value)
88
+ end
89
+ end
53
90
  end
54
91
  end
55
92
 
@@ -70,12 +107,20 @@ module Spaceship
70
107
  def attr_mapping(attr_map = nil)
71
108
  if attr_map
72
109
  @attr_mapping = attr_map
110
+ @attr_mapping.values.each do |method_name|
111
+ getter = method_name.to_sym
112
+ setter = "#{method_name}=".to_sym
113
+ remove_method(getter) if public_instance_methods.include?(getter)
114
+ remove_method(setter) if public_instance_methods.include?(setter)
115
+ end
116
+ include(mapping_module(@attr_mapping))
73
117
  else
74
118
  begin
75
- @attr_mapping ||= ancestors[1].attr_mapping
119
+ @attr_mapping ||= ancestors[1].attr_mapping
76
120
  rescue NameError, NoMethodError
77
121
  end
78
122
  end
123
+ return @attr_mapping
79
124
  end
80
125
 
81
126
  ##
@@ -108,17 +153,29 @@ module Spaceship
108
153
  end
109
154
  end
110
155
 
156
+ ##
157
+ # @return (Hash/Array) Holds the raw data we got from Apple's
158
+ # server to use it later
159
+ attr_accessor :raw_data
160
+
111
161
  ##
112
162
  # The initialize method accepts a parsed response from Apple and sets all
113
163
  # attributes that are defined by `attr_mapping`
114
164
  #
115
165
  # Do not override `initialize` in your own models.
116
166
  def initialize(attrs = {})
117
- self.class.remap_keys!(attrs)
118
167
  attrs.each do |key, val|
119
168
  self.send("#{key}=", val) if respond_to?("#{key}=")
120
169
  end
170
+ self.raw_data = DataHash.new(attrs)
121
171
  @client = self.class.client
172
+ self.setup
173
+ end
174
+
175
+ # This method can be used by subclasses to do additional initialisation
176
+ # using the `raw_data`
177
+ def setup
178
+
122
179
  end
123
180
 
124
181
  ##