Skip to content

Instantly share code, notes, and snippets.

@sgtsquiggs
Created December 13, 2016 16:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sgtsquiggs/5f215ffc0a4387740bce86a70a26a96e to your computer and use it in GitHub Desktop.
Save sgtsquiggs/5f215ffc0a4387740bce86a70a26a96e to your computer and use it in GitHub Desktop.
Fastlane action to download device UDIDs for the current team
module Fastlane
module Actions
class DownloadDevicesAction < Action
def self.run(params)
require 'spaceship'
ship = Spaceship::Portal.login(ENV['DELIVER_USER'], ENV['DELIVER_PASSWORD'])
ship.team_id = CredentialsManager::AppfileConfig.try_fetch_value(:team_id)
devices = ship.devices
for device in devices
puts "#{device['deviceNumber']}\t#{device['name']}"
end
path = File.absolute_path('devices.txt')
File.open(path, 'w') do |f|
f.puts "Device ID\tDevice Name"
devices.each do |device|
f.puts "#{device['deviceNumber']}\t#{device['name']}"
end
end
path
end
def self.description
"Download device list from Apple Dev Portal"
end
def self.details
[
"This action allows you to download the full device list from Apple.",
"It's extra useful if you maintain your device list in a repo.",
].join(" ")
end
def self.return_value
"The downloaded device list path"
end
def self.authors
["sgtsquiggs"]
end
def self.is_supported?(platform)
platform == :ios
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment