Skip to content

Instantly share code, notes, and snippets.

@Lutzifer
Created July 10, 2023 15:23
Show Gist options
  • Save Lutzifer/6dbf8a370dfb19547f154feaf81bf13d to your computer and use it in GitHub Desktop.
Save Lutzifer/6dbf8a370dfb19547f154feaf81bf13d to your computer and use it in GitHub Desktop.
Recreate simulators with fastlane, appending iOS Version to name
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'parallel'
end
puts %x(bundle exec fastlane snapshot reset_simulators --force -i 16.4,17.0)
path = File.expand_path('~/Library/Developer/CoreSimulator/Devices/')
Parallel.each(Dir.entries(path)) do |entry|
next if entry == '.' || entry == '..'
full_path = File.join(path, entry)
if File.directory?(full_path)
name = %x(defaults read #{full_path}/device.plist name).strip!
runtime = %x(defaults read #{full_path}/device.plist runtime).split(".").last.strip!
if not name.empty? and not runtime.empty?
command = %Q(xcrun simctl rename #{entry} "#{name} #{runtime}")
puts command
%x(#{command})
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment