slowlane 1.2.0 → 1.2.1
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 +4 -4
 - data/README.md +3 -1
 - data/bin/slowlane-fabric +1 -0
 - data/lib/slowlane/fabric/client.rb +11 -37
 - data/lib/slowlane/fabric/command.rb +3 -0
 - data/lib/slowlane/fabric/device.rb +67 -0
 - data/slowlane.gemspec +1 -1
 - metadata +2 -1
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 54cc6428d0bde63578b1c4a7a1f87ef81088ad1f
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 6daa808c5bef31ae74e1863046a829b7955fe168
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 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 
     | 
    
         
            -
            -  
     | 
| 
      
 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  
     | 
| 
       14 
     | 
    
         
            -
                     
     | 
| 
      
 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 
     | 
    
         
            -
                       
     | 
| 
      
 45 
     | 
    
         
            +
                      agent.get(uri, parameters, referer, headers)
         
     | 
| 
       41 
46 
     | 
    
         | 
| 
       42 
     | 
    
         
            -
                      return  
     | 
| 
      
 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 =  
     | 
| 
      
 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( 
     | 
| 
      
 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']
         
     | 
| 
         @@ -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
    
    
    
        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. 
     | 
| 
      
 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
         
     |