slowlane 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b52987b795244f7b40dd6c324f905028b95e6076
4
- data.tar.gz: 3e320b6d61fa6c93a7d2b9d21cd02abda9e7b1a7
3
+ metadata.gz: ede906a4639c946696faec95ab53f61b05f8190f
4
+ data.tar.gz: a8d248811f8824a17a423feb49b6d9939cad0225
5
5
  SHA512:
6
- metadata.gz: a88fd7ea6495be716ed9ef25bb8ed7a3854674ed20e6fde950ee4070a14597ccfe5a75dffc0fd573fd904665a506b0b44144c62b6082c4256cfc8690c0abc0d3
7
- data.tar.gz: 77395be57e3ec83cfe77dfa943afcb486948b3c71227c17ba2df5dbc27acd01cca9f066c1d785b6b8fc80281111b23adc217c44bba9fb3ccbe7e9aee3c14026b
6
+ metadata.gz: 3d9288f99144675216ad98986e9d633f252a28535c81be27eaaf802f03353cae59e0e8ac08a0d07332d975e0e16445f19e59074a2ff7b35d4c0c848afd55c951
7
+ data.tar.gz: 4846b259818912fed7696babd0011b91cc67bc5537a8dd7ba837b3a2854f667edca7177e2e0fbbe48439d8750abe8a22dc7c11ff5e1577ffc6336b370e0159a5
data/README.md CHANGED
@@ -32,14 +32,10 @@ results in binaries:
32
32
  - `slowlane-ipa` (NOTE: this might change to a more generic `slowlane-ios` command)
33
33
 
34
34
  ## Changes
35
- 1.1.0
36
- - fix missing mechanize
37
-
38
- 1.1.0
39
- - added slowlane-fabric (organization, tester, apps)
40
-
41
- 1.0.0
42
- - first release
35
+ - 1.2.0: (fabric) list testers, list devices of tester, list members
36
+ - 1.1.1: fix missing mechanize gem
37
+ - 1.1.0: added slowlane-fabric (organization, tester, apps)
38
+ - 1.0.0: first release
43
39
 
44
40
  ## Kudos
45
41
  - [Fastlane](https://github.com/fastlane/fastlane)
@@ -80,7 +76,10 @@ results in binaries:
80
76
 
81
77
  #### Fabric
82
78
  - `slowlane-fabric app list`
83
- - `slowlane-fabric tester list <bundle_id>`
79
+ - `slowlane-fabric tester list`
80
+ - `slowlane-fabric tester devices <email>`
81
+ - `slowlane-fabric organization list`
82
+ - `slowlane-fabric member list`
84
83
 
85
84
  #### Ipa
86
85
  - `slowlane-ipa info <ipa_file>`
@@ -110,9 +109,8 @@ A lot is still focusing on the happy path , we need to catch better the errors a
110
109
  - all other commands
111
110
 
112
111
  #### Fabric
113
- - info organization
114
112
  - create|delete|list groups
115
- - create|delete|list testers
113
+ - create|delete
116
114
  - list, add device
117
115
 
118
116
  #### Playstore
data/bin/slowlane-fabric CHANGED
@@ -5,6 +5,7 @@ require "thor"
5
5
 
6
6
  require_relative '../lib/slowlane/fabric/app.rb'
7
7
  require_relative '../lib/slowlane/fabric/tester.rb'
8
+ require_relative '../lib/slowlane/fabric/member.rb'
8
9
  require_relative '../lib/slowlane/fabric/organization.rb'
9
10
  require_relative '../lib/slowlane/fabric/command.rb'
10
11
 
@@ -17,14 +17,18 @@ module Slowlane
17
17
  fabric.team = Utils.team(options)
18
18
  apps = fabric.list_apps()
19
19
 
20
- headings = ['id', 'name', 'bundle_id']
20
+ headings = ['id', 'name', 'bundle_id', 'plaform', 'status']
21
21
  rows = []
22
22
 
23
+ require 'pp'
24
+ pp apps
23
25
  apps.each do |app|
24
26
  row = []
25
27
  row << app['id']
26
28
  row << app['name']
27
29
  row << app['bundle_identifier']
30
+ row << app['platform']
31
+ row << app['status']
28
32
  rows << row
29
33
  end
30
34
 
@@ -122,137 +122,53 @@ module Slowlane
122
122
  return organizations
123
123
  end
124
124
 
125
- def find_app_by_bundle_id(bundle_id)
126
- apps = list_apps()
127
- apps.find { |app| app['bundle_identifier'] == bundle_id }
128
- end
129
-
130
- def list_testers(app_id)
131
- bootstrap
132
- page = get("/api/v2/organizations/#{self.team_id}/apps/#{app_id}/beta_distribution/testers_in_organization?include_developers=true")
133
-
134
- testers = JSON.parse(page.body)
135
-
136
- return testers['testers']
137
- end
138
-
139
- def list_people(group)
125
+ def list_members
140
126
  bootstrap
141
127
 
142
- apps = list_apps
143
-
144
- all_testers = {}
145
-
146
- apps.each do |app|
147
- testers = list_testers (app['id'])
148
-
149
- #
150
- # For each tester go through it's devices and add them
151
- #
152
-
153
- testers.each do |tester|
154
-
155
- #
156
- # If tester is not yet in, create it
157
- #
158
-
159
- if all_testers[tester['id']].nil?
160
-
161
- person = Person.new
162
- person.id = tester['id']
163
- person.name = tester['name']
164
- person.email = tester['email']
165
- person.groups = []
166
- person.devices = {}
167
-
168
- add_group = false
169
-
170
- if tester['groups']
171
- groups = tester['groups']
172
-
173
- groups.each do |current_group|
174
-
175
- person_group = Group.new
176
- person_group.id = current_group['id']
177
- person_group.name = current_group['name']
178
- person_group.alias = current_group['alias']
179
-
180
- person.groups << person_group
128
+ page = get("/api/v2/organizations/#{self.team_id}/team_members")
181
129
 
182
- if person_group.name == group or person_group.alias == group
183
- add_group = true
184
- end
185
- end
186
- end
130
+ members = JSON.parse(page.body)
187
131
 
188
- if (add_group == true or group.nil?) and !person.name.empty?
189
- all_testers[person.id] = person
190
- end
191
- else
192
- person = all_testers[tester['id']]
193
- end
132
+ return members
133
+ end
194
134
 
195
- append_devices(person, tester['devices'])
196
- end
197
- end
135
+ def find_app_by_bundle_id(bundle_id)
136
+ apps = list_apps()
137
+ apps.find { |app| app['bundle_identifier'] == bundle_id }
138
+ end
198
139
 
199
- return all_testers
140
+ def find_tester_by_email(email)
141
+ testers = list_testers()
142
+ testers.find { |tester| tester['email'] == email }
200
143
  end
201
144
 
202
- def list_devices(group)
203
- bootstrap
204
145
 
205
- testers = list_people(group)
146
+ def list_testers(app_id = nil)
206
147
 
207
- devices = {}
148
+ bootstrap
208
149
 
209
- testers.each do |id, tester|
210
- devices = devices.merge (tester.devices)
150
+ if app_id.nil?
151
+ app_id = self.list_apps.first['id']
211
152
  end
212
153
 
213
- return devices.values
214
- end
215
-
216
- def list_groups
217
- testers = list_people(nil)
218
-
219
- groups = {}
154
+ page = get("/api/v2/organizations/#{self.team_id}/apps/#{app_id}/beta_distribution/testers_in_organization?include_developers=true")
220
155
 
221
- testers.each do |id, tester|
222
- tester.groups.each do |group|
223
- groups[group.id] = group
224
- end
225
- end
156
+ testers = JSON.parse(page.body)
226
157
 
227
- return groups.values
158
+ return testers['testers']
228
159
  end
229
160
 
230
- private
231
-
232
- def append_devices (person, devices)
233
-
234
- if devices.nil?
235
- return nil
236
- end
237
-
238
- devices.each do |device|
161
+ def list_devices(app_id,tester_id)
162
+ bootstrap
239
163
 
240
- if person.devices[device['identifier']].nil?
241
- current_device = Device.new
242
- current_device.manufacturer = device['manufacturer']
243
- current_device.model = device['model']
244
- current_device.os_version = device['os_version']
245
- current_device.identifier = device['identifier']
246
- current_device.name = device['name']
247
- current_device.platform = device['platform']
248
- current_device.model_name = device['model_name']
164
+ page = get("/api/v2/organizations/#{self.team_id}/beta_distribution/testers/#{tester_id}/devices")
249
165
 
250
- person.devices[current_device.identifier] = current_device
251
- end
166
+ devices = JSON.parse(page.body)
167
+ return devices['devices']
252
168
 
253
- end
254
169
  end
255
170
 
171
+
256
172
  def csrf!
257
173
  page = get('/login')
258
174
 
@@ -311,7 +227,6 @@ module Slowlane
311
227
  teams = self.login_data['organizations']
312
228
 
313
229
  teams.each do |team|
314
- #puts team['name']
315
230
 
316
231
  if team['alias'] == self.team or team['name'] == self.team
317
232
  self.team_id = team['id']
@@ -325,7 +240,6 @@ module Slowlane
325
240
  raise Error
326
241
  end
327
242
 
328
- #puts "SELECTED TEAM: #{self.team_id}"
329
243
  end
330
244
 
331
245
  end
@@ -14,4 +14,7 @@ class SlowlaneFabric < Thor
14
14
  desc "tester SUBCOMMAND ...ARGS", "manage testers"
15
15
  subcommand "tester", Slowlane::Fabric::Tester
16
16
 
17
+ desc "member SUBCOMMAND ...ARGS", "manage testers"
18
+ subcommand "member", Slowlane::Fabric::Member
19
+
17
20
  end
@@ -0,0 +1,40 @@
1
+ require_relative './util.rb'
2
+ require_relative './client.rb'
3
+ require 'terminal-table'
4
+
5
+ module Slowlane
6
+ module Fabric
7
+ class Member <Thor
8
+
9
+ desc "list", "get list of members"
10
+ def list
11
+
12
+ c=Utils.credentials(options)
13
+
14
+ fabric = Slowlane::Fabric::Client.new
15
+ fabric.username = c.username
16
+ fabric.password = c.password
17
+ fabric.team = Utils.team(options)
18
+ members = fabric.list_members
19
+
20
+ headings = ['id', 'name', 'email','phone', 'is_admin', 'is_activated']
21
+ rows = []
22
+
23
+ members.each do |org|
24
+ row = []
25
+ row << org['id']
26
+ row << org['name']
27
+ row << org['email']
28
+ row << org['phone']
29
+ row << org['is_admin']
30
+ row << org['is_activated']
31
+ rows << row
32
+ end
33
+
34
+ table = Terminal::Table.new :headings => headings, :rows => rows
35
+ puts table
36
+
37
+ end
38
+ end
39
+ end
40
+ end
@@ -17,7 +17,6 @@ module Slowlane
17
17
  fabric.team = Utils.team(options)
18
18
  orgs = fabric.list_organizations
19
19
 
20
- puts orgs
21
20
  headings = ['id', 'name', 'alias','accounts_count', 'build_secret', 'api_key']
22
21
  rows = []
23
22
 
@@ -7,7 +7,7 @@ module Slowlane
7
7
  class Tester <Thor
8
8
 
9
9
  desc "list", "get list of tester"
10
- def list(bundle_id)
10
+ def list
11
11
 
12
12
  c=Utils.credentials(options)
13
13
 
@@ -15,9 +15,8 @@ module Slowlane
15
15
  fabric.username = c.username
16
16
  fabric.password = c.password
17
17
  fabric.team = Utils.team(options)
18
- app = fabric.find_app_by_bundle_id(bundle_id)
19
- app_id = app['id']
20
- testers = fabric.list_testers(app_id)
18
+
19
+ testers = fabric.list_testers(nil)
21
20
 
22
21
  headings = ['id', 'name', 'email','groups' ]
23
22
  rows = []
@@ -40,6 +39,52 @@ module Slowlane
40
39
  puts table
41
40
 
42
41
  end
42
+
43
+ desc "devices", "get devices of tester <email>"
44
+ def devices(email)
45
+
46
+ c=Utils.credentials(options)
47
+
48
+ fabric = Slowlane::Fabric::Client.new
49
+ fabric.username = c.username
50
+ fabric.password = c.password
51
+ fabric.team = Utils.team(options)
52
+
53
+ apps = fabric.list_apps()
54
+ if apps.nil?
55
+ puts "No applications found"
56
+ exit(-1)
57
+ end
58
+
59
+ app = apps.first()
60
+ tester = fabric.find_tester_by_email(email)
61
+ if tester.nil?
62
+ puts "No tester with email #{email} found"
63
+ exit(-1)
64
+ end
65
+
66
+ devices = fabric.list_devices(app['id'],tester['id'])
67
+
68
+ headings = ['id', 'name', 'platform', 'type' , 'os_version', 'transferred']
69
+ rows = []
70
+
71
+ devices.each do |device|
72
+ row = []
73
+
74
+ row << device['identifier']
75
+ row << device['model_name']
76
+ row << device['platform']
77
+ row << device['ui_idiom']
78
+ row << device['current_os_version']
79
+ row << device['transferred']
80
+
81
+ rows << row
82
+ end
83
+
84
+ table = Terminal::Table.new :headings => headings, :rows => rows
85
+ puts table
86
+
87
+ end
43
88
  end
44
89
  end
45
90
  end
data/slowlane.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "slowlane"
5
- s.version = "1.1.1"
5
+ s.version = "1.2.0"
6
6
  s.platform = Gem::Platform::RUBY
7
7
  s.license = 'MIT'
8
8
  s.authors = ["Patrick Debois"]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slowlane
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrick Debois
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-13 00:00:00.000000000 Z
11
+ date: 2016-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -146,6 +146,7 @@ files:
146
146
  - lib/slowlane/fabric/app.rb
147
147
  - lib/slowlane/fabric/client.rb
148
148
  - lib/slowlane/fabric/command.rb
149
+ - lib/slowlane/fabric/member.rb
149
150
  - lib/slowlane/fabric/organization.rb
150
151
  - lib/slowlane/fabric/tester.rb
151
152
  - lib/slowlane/fabric/util.rb