Created
August 19, 2019 19:58
-
-
Save andrewgrant/f842d87f48c4d54256e8d37c6d0d9f95 to your computer and use it in GitHub Desktop.
Fastlane script that pulls all devices from one or more apple accounts, dedupes them, and writes them to a csv
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment