slowlane 1.2.0 → 1.2.1

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: ede906a4639c946696faec95ab53f61b05f8190f
4
- data.tar.gz: a8d248811f8824a17a423feb49b6d9939cad0225
3
+ metadata.gz: 54cc6428d0bde63578b1c4a7a1f87ef81088ad1f
4
+ data.tar.gz: 6daa808c5bef31ae74e1863046a829b7955fe168
5
5
  SHA512:
6
- metadata.gz: 3d9288f99144675216ad98986e9d633f252a28535c81be27eaaf802f03353cae59e0e8ac08a0d07332d975e0e16445f19e59074a2ff7b35d4c0c848afd55c951
7
- data.tar.gz: 4846b259818912fed7696babd0011b91cc67bc5537a8dd7ba837b3a2854f667edca7177e2e0fbbe48439d8750abe8a22dc7c11ff5e1577ffc6336b370e0159a5
6
+ metadata.gz: 8bf4711b75005ad0a8e4b8e0a42d44cba10793da5f68c061dd26dd36f45bb6f17883338e9407c9450c545dc1bce116b2f4f3991d8822e591d5c72e596980be0d
7
+ data.tar.gz: bf7f380e75422ad60c7836fe11829c9e84d6b19534052d818d880e2e54a998fdb8a8363bfba0a8728cf71597c5d8418294a3dbd519dc040946e8e5051ba4c58d
data/README.md CHANGED
@@ -32,6 +32,7 @@ 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.2.1: (fabric) list all devices
35
36
  - 1.2.0: (fabric) list testers, list devices of tester, list members
36
37
  - 1.1.1: fix missing mechanize gem
37
38
  - 1.1.0: added slowlane-fabric (organization, tester, apps)
@@ -77,6 +78,7 @@ results in binaries:
77
78
  #### Fabric
78
79
  - `slowlane-fabric app list`
79
80
  - `slowlane-fabric tester list`
81
+ - `slowlane-fabric device list`
80
82
  - `slowlane-fabric tester devices <email>`
81
83
  - `slowlane-fabric organization list`
82
84
  - `slowlane-fabric member list`
@@ -111,7 +113,7 @@ A lot is still focusing on the happy path , we need to catch better the errors a
111
113
  #### Fabric
112
114
  - create|delete|list groups
113
115
  - create|delete
114
- - list, add device
116
+ - add device
115
117
 
116
118
  #### Playstore
117
119
  - all commands
data/bin/slowlane-fabric CHANGED
@@ -7,6 +7,7 @@ require_relative '../lib/slowlane/fabric/app.rb'
7
7
  require_relative '../lib/slowlane/fabric/tester.rb'
8
8
  require_relative '../lib/slowlane/fabric/member.rb'
9
9
  require_relative '../lib/slowlane/fabric/organization.rb'
10
+ require_relative '../lib/slowlane/fabric/device.rb'
10
11
  require_relative '../lib/slowlane/fabric/command.rb'
11
12
 
12
13
  SlowlaneFabric.start(ARGV)
@@ -10,9 +10,14 @@ module Slowlane
10
10
  attr_accessor :username,:password,:team
11
11
  attr_accessor :developer_token, :access_token, :csrf_token, :login_data, :team_id
12
12
 
13
- def initialize
14
- self.agent = Mechanize.new
13
+ def agent
14
+ unless @agent
15
+ @agent = ::Mechanize.new
16
+ end
17
+ @agent
18
+ end
15
19
 
20
+ def initialize
16
21
  self.host = "fabric.io"
17
22
  end
18
23
 
@@ -37,9 +42,9 @@ module Slowlane
37
42
 
38
43
  3.times do
39
44
 
40
- self.agent.get(uri, parameters, referer, headers)
45
+ agent.get(uri, parameters, referer, headers)
41
46
 
42
- return self.agent.page
47
+ return agent.page
43
48
  end
44
49
 
45
50
  #raise NetworkError
@@ -71,37 +76,6 @@ module Slowlane
71
76
  end
72
77
  end
73
78
 
74
- def list_devices(distribution_list)
75
- people = list_people(distribution_list)
76
-
77
- people_list = []
78
-
79
- people.each do |person|
80
- people_list << person.id
81
- end
82
-
83
- self.agent.post('/dashboard/team/export/devices/', { "members" => people_list.join('|'), "csrfmiddlewaretoken" => self.agent.page.parser.css("[name='csrfmiddlewaretoken']")[0]['value'] } )
84
-
85
- device_list = self.agent.page.body.split( /\r?\n/ )
86
-
87
- # Remove first one
88
- device_list.shift
89
-
90
- devices = []
91
-
92
- device_list.each do |dev|
93
- #puts dev
94
-
95
- device = Device.new
96
- device.udid = dev.split(/\t/)[0]
97
- device.name = dev.split(/\t/)[1]
98
-
99
- devices << device
100
- end
101
-
102
- devices
103
- end
104
-
105
79
  def list_apps
106
80
  bootstrap
107
81
 
@@ -195,7 +169,7 @@ module Slowlane
195
169
  def login!
196
170
  begin
197
171
 
198
- session = self.agent.post('https://fabric.io/api/v2/session', { "email" => self.username, "password" => self.password }, { 'X-CRASHLYTICS-DEVELOPER-TOKEN' => self.developer_token, 'X-CSRF-Token' => self.csrf_token, 'X-Requested-With' => 'XMLHttpRequest' } )
172
+ session = agent.post('https://fabric.io/api/v2/session', { "email" => self.username, "password" => self.password }, { 'X-CRASHLYTICS-DEVELOPER-TOKEN' => self.developer_token, 'X-CSRF-Token' => self.csrf_token, 'X-Requested-With' => 'XMLHttpRequest' } )
199
173
 
200
174
  rescue Mechanize::ResponseCodeError => ex
201
175
  message = JSON.parse(ex.page.body)
@@ -205,7 +179,7 @@ module Slowlane
205
179
  end
206
180
  end
207
181
 
208
- self.login_data = JSON.parse(self.agent.page.body)
182
+ self.login_data = JSON.parse(agent.page.body)
209
183
 
210
184
  unless self.login_data['token'].nil?
211
185
  self.access_token = self.login_data['token']
@@ -17,4 +17,7 @@ class SlowlaneFabric < Thor
17
17
  desc "member SUBCOMMAND ...ARGS", "manage testers"
18
18
  subcommand "member", Slowlane::Fabric::Member
19
19
 
20
+ desc "device SUBCOMMAND ...ARGS", "manage devices"
21
+ subcommand "device", Slowlane::Fabric::Device
22
+
20
23
  end
@@ -0,0 +1,67 @@
1
+ require_relative './util.rb'
2
+ require_relative './client.rb'
3
+ require 'terminal-table'
4
+
5
+ module Slowlane
6
+ module Fabric
7
+ class Device <Thor
8
+
9
+ desc "list", "get list of devices"
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
+
19
+
20
+ apps = fabric.list_apps()
21
+ if apps.nil?
22
+ puts "No applications found"
23
+ exit(-1)
24
+ end
25
+
26
+ app = apps.first()
27
+
28
+ all_devices = []
29
+
30
+ testers = fabric.list_testers(nil)
31
+ testers.each do |tester|
32
+ tester_id = tester['id']
33
+ if tester_id.is_a? Integer
34
+ tester_devices = fabric.list_devices(app['id'],tester_id)
35
+ tester_devices.each do |d|
36
+ d['owner'] = tester['name']
37
+ d['email'] = tester['email']
38
+ all_devices << d
39
+ end
40
+ end
41
+
42
+ end
43
+
44
+ headings = ['owner','email','id', 'name', 'platform', 'type' , 'os_version', 'transferred']
45
+ rows = []
46
+
47
+ all_devices.each do |device|
48
+ row = []
49
+
50
+ row << device['owner']
51
+ row << device['identifier']
52
+ row << device['model_name']
53
+ row << device['platform']
54
+ row << device['ui_idiom']
55
+ row << device['current_os_version']
56
+ row << device['transferred']
57
+
58
+ rows << row
59
+ end
60
+
61
+ table = Terminal::Table.new :headings => headings, :rows => rows
62
+ puts table
63
+
64
+ end
65
+ end
66
+ end
67
+ 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.2.0"
5
+ s.version = "1.2.1"
6
6
  s.platform = Gem::Platform::RUBY
7
7
  s.license = 'MIT'
8
8
  s.authors = ["Patrick Debois"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slowlane
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrick Debois
@@ -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/device.rb
149
150
  - lib/slowlane/fabric/member.rb
150
151
  - lib/slowlane/fabric/organization.rb
151
152
  - lib/slowlane/fabric/tester.rb