Spaceshop公开了Apple Developer Center APIApp Store Connect API,使得繁琐的Web操作可以通过Ruby脚本达到同样的目的。

Sign a lot of devices

sign

  • Ruby environment on MacOS
  • Install Spaceship $ sudo gem install spaceship -n /usr/local/bin
  • Prepare a file (Devices.txt) to collect device UDID
  • Write ruby script and excute $ ruby <rb-path>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
require 'spaceship'
require 'pathname'

Spaceship::Portal.login("account", "password")
Spaceship::Tunes.login('account', 'password')
# app = Spaceship::Application.find("")

# 批量注册测试设备
def SignDevices()
currentPath = Pathname.new(__FILE__).realpath.to_s
devicePath = "#{currentPath.chomp("/Sign.rb")}/Devices.txt"
File.open(devicePath,"r").each_line do |udid|
Spaceship::Portal.device.create!(name: "iPhone", udid: udid)
end
end

# 执行
SignDevices()

Add all available devices to the profile

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
require 'spaceship'

Spaceship::Portal.login("account", "password")
Spaceship::Tunes.login('account', 'password')

# 将所有设备加入配置文件并下载
def ResetProfile()
# devProfile = Spaceship::Portal.provisioning_profile.development.all.find { |p| p.name == "Name" }
# devProfile.devices = Spaceship::Portal.device.all
# dev_profile_content = devProfile.first.download
adhocPorfile = Spaceship::Portal.provisioning_profile.ad_hoc.all.find { |p| p.name == "Name" }
adhocPorfile.devices = Spaceship::Portal.device.all
adhoc_profile_content = adhocPorfile.first.download
end

ResetProfile()