Skip to content

Instantly share code, notes, and snippets.

@andrewgrant
Created August 19, 2019 19:58
Show Gist options
  • Select an option

  • Save andrewgrant/f842d87f48c4d54256e8d37c6d0d9f95 to your computer and use it in GitHub Desktop.

Select an option

Save andrewgrant/f842d87f48c4d54256e8d37c6d0d9f95 to your computer and use it in GitHub Desktop.

Revisions

  1. andrewgrant created this gist Aug 19, 2019.
    41 changes: 41 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,41 @@
    # Uncomment the line if you want fastlane to automatically update itself
    # update_fastlane

    require 'spaceship'

    default_platform(:ios)

    platform :ios do
    desc "Pulls a list of all devices from our accounts and dedupes them "
    lane :dump_devices do

    device_list = {}

    launcher = Spaceship::Launcher.new("[email protected]", "password")
    teams = ["ABCDE12345", "ABCDE12345", "ABCDE12345"]

    teams.each { |team|
    # select_team will prompt for a team, unless we set this var first...
    # (either way it needs to be called to update internal state)
    team_id team
    launcher.select_team()

    devices = launcher.device.all

    #Loop through all devices from account and add them to our hash
    devices.each { |device|
    if !device_list.has_key? device.udid
    device_list[device.udid] = device
    end
    }
    }

    open('device_list.csv', 'w') { |f|
    device_list.each do |key, device|
    f.printf("%s|%s|%s|%s\n", device.udid, device.name, device.platform, device.model)
    end
    printf("Wrote %d devices", device_list.keys.count)
    }

    end
    end