fastlane 2.29.0.beta.20170426010043 → 2.29.0.beta.20170427010043

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: 37e87d72458af7c88fe6f7bb0fee4d1cd3c5add4
4
- data.tar.gz: 73188156461337eaeb5b21cf86a67d05cb9fdae0
3
+ metadata.gz: 938e4b0dc6e8d5661b43c1531faf76e43f329083
4
+ data.tar.gz: 54895c188864c896e72c6d069b3616ee7d463707
5
5
  SHA512:
6
- metadata.gz: c3b79aee1d3c508149d0e9192eb26c5b7519e8425ddcf315199aa52d5577523b74405c365bb28b0bdd520ffe4d0245b55270a5c5cecc0efe80c557ae7504cc54
7
- data.tar.gz: 889663d2ad46713de80b3fa55fd6b9aff67656a77802bba5a40f2123084fb978da037d71477a68d87791c211fa6cf6d0d010dcfaa97d94094cd0db8df5300e68
6
+ metadata.gz: 216e8a1d0cb1b25c7277b8ccff5b92760eb3aefa32806df6058cc7a66fbc76f670389cb6df8f9a7d33b42bb19f6437269132929f181875b915c6f95d7d22566d
7
+ data.tar.gz: e4b3a5b1aa6517630e4bdc484ad675d3efa2a04832b82a1d8bd55eac71a5cca0f54c786df10790ec2bc9ce86ebc1541ecee796b53a161194745e49244e203538
@@ -1,4 +1,4 @@
1
1
  module Fastlane
2
- VERSION = '2.29.0.beta.20170426010043'.freeze
2
+ VERSION = '2.29.0.beta.20170427010043'.freeze
3
3
  DESCRIPTION = "The easiest way to automate beta deployments and releases for your iOS and Android apps".freeze
4
4
  end
@@ -7,39 +7,23 @@ module Pilot
7
7
  def add_tester(options)
8
8
  start(options)
9
9
 
10
+ app = find_app(app_filter: config[:apple_id] || config[:app_identifier])
11
+ UI.user_error!("You must provide either a Apple ID for the app (with the `:apple_id` option) or app identifier (with the `:app_identifier` option)") unless app
12
+
13
+ tester = find_or_create_tester(email: config[:email], first_name: config[:first_name], last_name: config[:last_name])
14
+
10
15
  begin
11
- tester = Spaceship::Tunes::Tester::External.find(config[:email])
12
- if tester
13
- UI.success("Existing tester #{tester.email}")
16
+ groups = add_tester_to_groups!(tester: tester, app: app, groups: config[:groups])
17
+ if tester.kind_of?(Spaceship::Tunes::Tester::Internal)
18
+ UI.success("Successfully added tester to app #{app.name}")
14
19
  else
15
- # make sure the user isn't already an internal tester, because we don't support those
16
- internal_tester = Spaceship::Tunes::Tester::Internal.find(config[:email])
17
- UI.user_error!("#{internal_tester.email} is an internal tester; pilot does not support internal testers") unless internal_tester.nil?
18
-
19
- tester = Spaceship::Tunes::Tester::External.create!(email: config[:email],
20
- first_name: config[:first_name],
21
- last_name: config[:last_name])
22
- UI.success("Successfully added tester: #{tester.email} to your account")
20
+ group_names = groups.map(&:name).join(", ")
21
+ UI.success("Successfully added tester to app #{app.name} in group(s) #{group_names}")
23
22
  end
24
23
  rescue => ex
25
- UI.error("Could not create tester #{config[:email]}")
24
+ UI.error("Could not add #{tester.email} to app: #{app.name}")
26
25
  raise ex
27
26
  end
28
-
29
- app_filter = (config[:apple_id] || config[:app_identifier])
30
- if app_filter
31
- begin
32
- app = Spaceship::Application.find(app_filter)
33
- UI.user_error!("Couldn't find app with '#{app_filter}'") unless app
34
-
35
- groups = add_tester_to_groups!(tester: tester, app: app, groups: config[:groups])
36
- group_names = groups.map(&:name).join(", ")
37
- UI.success("Successfully added tester to app #{app_filter} in group(s) #{group_names}")
38
- rescue => ex
39
- UI.error("Could not add #{tester.email} to app: #{app.name}")
40
- raise ex
41
- end
42
- end
43
27
  end
44
28
 
45
29
  def find_tester(options)
@@ -58,38 +42,30 @@ module Pilot
58
42
  start(options)
59
43
 
60
44
  tester = Spaceship::Tunes::Tester::External.find(config[:email])
45
+ tester ||= Spaceship::Tunes::Tester::Internal.find(config[:email])
46
+ UI.user_error!("Tester not found: #{config[:email]}") if tester.nil?
61
47
 
62
- if tester
63
- app_filter = (config[:apple_id] || config[:app_identifier])
64
- if app_filter
65
- begin
66
- app = Spaceship::Application.find(app_filter)
67
- UI.user_error!("Couldn't find app with '#{app_filter}'") unless app
68
-
69
- # If no groups are passed to options, remove the tester from the app-level,
70
- # otherwise remove the tester from the groups specified.
71
- if config[:groups].nil?
72
- test_flight_tester = Spaceship::TestFlight::Tester.find(app_id: app.apple_id, email: tester.email)
73
- test_flight_tester.remove_from_app!(app_id: app.apple_id)
74
- UI.success("Successfully removed tester, #{test_flight_tester.email}, from app: #{app_filter}")
75
- else
76
- groups = remove_tester_from_groups!(tester: tester, app: app, groups: config[:groups])
77
- group_names = groups.map(&:name).join(", ")
78
- UI.success("Successfully removed tester #{tester.email} from app #{app_filter} in group(s) #{group_names}")
79
- end
80
- rescue => ex
81
- UI.error("Could not remove #{tester.email} from app: #{ex}")
82
- raise ex
83
- end
48
+ app = find_app(app_filter: config[:apple_id] || config[:app_identifier])
49
+ unless app
50
+ tester.delete!
51
+ UI.success("Successfully removed tester #{tester.email}")
52
+ end
53
+
54
+ begin
55
+ # If no groups are passed to options, remove the tester from the app-level,
56
+ # otherwise remove the tester from the groups specified.
57
+ if config[:groups].nil? && tester.kind_of?(Spaceship::Tunes::Tester::External)
58
+ test_flight_tester = Spaceship::TestFlight::Tester.find(app_id: app.apple_id, email: tester.email)
59
+ test_flight_tester.remove_from_app!(app_id: app.apple_id)
60
+ UI.success("Successfully removed tester, #{test_flight_tester.email}, from app: #{app.name}")
84
61
  else
85
- tester.delete!
86
- UI.success("Successfully removed tester #{tester.email}")
62
+ groups = remove_tester_from_groups!(tester: tester, app: app, groups: config[:groups])
63
+ group_names = groups.map(&:name).join(", ")
64
+ UI.success("Successfully removed tester #{tester.email} from app #{app.name} in group(s) #{group_names}")
87
65
  end
88
- else
89
- internal_tester = Spaceship::Tunes::Tester::Internal.find(config[:email])
90
- UI.user_error!("#{internal_tester.email} is an internal tester; pilot does not support internal testers") unless internal_tester.nil?
91
-
92
- UI.user_error!("Tester not found: #{config[:email]}")
66
+ rescue => ex
67
+ UI.error("Could not remove #{tester.email} from app: #{ex}")
68
+ raise ex
93
69
  end
94
70
  end
95
71
 
@@ -106,6 +82,33 @@ module Pilot
106
82
 
107
83
  private
108
84
 
85
+ def find_app(app_filter: nil)
86
+ if app_filter
87
+ app = Spaceship::Application.find(app_filter)
88
+ UI.user_error!("Could not find an app by #{app_filter}") unless app
89
+ return app
90
+ end
91
+ nil
92
+ end
93
+
94
+ def find_or_create_tester(email: nil, first_name: nil, last_name: nil)
95
+ tester = Spaceship::Tunes::Tester::Internal.find(config[:email])
96
+ tester ||= Spaceship::Tunes::Tester::External.find(config[:email])
97
+
98
+ if tester
99
+ UI.success("Existing tester #{tester.email}")
100
+ else
101
+ tester = Spaceship::Tunes::Tester::External.create!(email: config[:email],
102
+ first_name: config[:first_name],
103
+ last_name: config[:last_name])
104
+ UI.success("Successfully added tester: #{tester.email} to your account")
105
+ end
106
+ return tester
107
+ rescue => ex
108
+ UI.error("Could not create tester #{config[:email]}")
109
+ raise ex
110
+ end
111
+
109
112
  def perform_for_groups_in_app(app: nil, groups: nil, &block)
110
113
  if groups.nil?
111
114
  default_external_group = app.default_external_group
@@ -125,11 +128,19 @@ module Pilot
125
128
  end
126
129
 
127
130
  def add_tester_to_groups!(tester: nil, app: nil, groups: nil)
128
- perform_for_groups_in_app(app: app, groups: groups) { |group| group.add_tester!(tester) }
131
+ if tester.kind_of?(Spaceship::Tunes::Tester::Internal)
132
+ Spaceship::TestFlight::Group.internal_group(app_id: app.apple_id).add_tester!(tester)
133
+ else
134
+ perform_for_groups_in_app(app: app, groups: groups) { |group| group.add_tester!(tester) }
135
+ end
129
136
  end
130
137
 
131
138
  def remove_tester_from_groups!(tester: nil, app: nil, groups: nil)
132
- perform_for_groups_in_app(app: app, groups: groups) { |group| group.remove_tester!(tester) }
139
+ if tester.kind_of?(Spaceship::Tunes::Tester::Internal)
140
+ Spaceship::TestFlight::Group.internal_group(app_id: app.apple_id).remove_tester!(tester)
141
+ else
142
+ perform_for_groups_in_app(app: app, groups: groups) { |group| group.remove_tester!(tester) }
143
+ end
133
144
  end
134
145
 
135
146
  def list_testers_by_app(app_filter)
@@ -3,12 +3,14 @@ module Spaceship::TestFlight
3
3
  attr_accessor :id
4
4
  attr_accessor :name
5
5
  attr_accessor :is_default_external_group
6
+ attr_accessor :is_internal_group
6
7
 
7
8
  attr_accessor :app_id
8
9
 
9
10
  attr_mapping({
10
11
  'id' => :id,
11
12
  'name' => :name,
13
+ 'isInternalGroup' => :is_internal_group,
12
14
  'isDefaultExternalGroup' => :is_default_external_group
13
15
  })
14
16
 
@@ -36,6 +38,11 @@ module Spaceship::TestFlight
36
38
  groups.select(&block)
37
39
  end
38
40
 
41
+ def self.internal_group(app_id: nil)
42
+ groups = self.all(app_id: app_id)
43
+ groups.find(&:internal_group?)
44
+ end
45
+
39
46
  # First we need to add the tester to the app
40
47
  # It's ok if the tester already exists, we just have to do this... don't ask
41
48
  # This will enable testing for the tester for a given app, as just creating the tester on an account-level
@@ -43,9 +50,9 @@ module Spaceship::TestFlight
43
50
  # This is a bug we reported to the iTunes Connect team, as it also happens on the iTunes Connect UI on 18. April 2017
44
51
  def add_tester!(tester)
45
52
  # This post request makes the account-level tester available to the app
46
- client.post_tester(app_id: self.app_id, tester: tester)
53
+ tester_data = client.post_tester(app_id: self.app_id, tester: tester)
47
54
  # This put request adds the tester to the group
48
- client.put_tester_to_group(group_id: self.id, tester_id: tester.tester_id, app_id: self.app_id)
55
+ client.put_tester_to_group(group_id: self.id, tester_id: tester_data['id'], app_id: self.app_id)
49
56
  end
50
57
 
51
58
  def remove_tester!(tester)
@@ -55,5 +62,9 @@ module Spaceship::TestFlight
55
62
  def default_external_group?
56
63
  is_default_external_group
57
64
  end
65
+
66
+ def internal_group?
67
+ is_internal_group
68
+ end
58
69
  end
59
70
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.29.0.beta.20170426010043
4
+ version: 2.29.0.beta.20170427010043
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felix Krause
@@ -15,7 +15,7 @@ authors:
15
15
  autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
- date: 2017-04-26 00:00:00.000000000 Z
18
+ date: 2017-04-27 00:00:00.000000000 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: slack-notifier
@@ -1342,23 +1342,23 @@ metadata:
1342
1342
  post_install_message:
1343
1343
  rdoc_options: []
1344
1344
  require_paths:
1345
- - supply/lib
1346
- - pilot/lib
1347
- - match/lib
1348
- - fastlane/lib
1349
- - credentials_manager/lib
1350
- - cert/lib
1351
- - spaceship/lib
1352
1345
  - snapshot/lib
1346
+ - gym/lib
1347
+ - scan/lib
1348
+ - spaceship/lib
1349
+ - credentials_manager/lib
1350
+ - fastlane/lib
1353
1351
  - pem/lib
1352
+ - sigh/lib
1354
1353
  - fastlane_core/lib
1355
- - gym/lib
1354
+ - match/lib
1355
+ - pilot/lib
1356
+ - produce/lib
1356
1357
  - deliver/lib
1357
1358
  - frameit/lib
1358
- - produce/lib
1359
- - scan/lib
1360
- - sigh/lib
1359
+ - cert/lib
1361
1360
  - screengrab/lib
1361
+ - supply/lib
1362
1362
  required_ruby_version: !ruby/object:Gem::Requirement
1363
1363
  requirements:
1364
1364
  - - ">="