Skip to content

Commit

Permalink
List runtimes as json
Browse files Browse the repository at this point in the history
  • Loading branch information
testableapple committed Jun 26, 2024
1 parent a567600 commit d18144d
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -765,15 +765,18 @@ lane :rubocop do
end

lane :install_sim do |options|
runtime_list = sh("xcrun simctl runtime list | grep 'iOS #{options[:ios]}' || true")
if runtime_list.include?('Ready')
UI.important("iOS #{options[:ios]} Runtime already exists")
else
available_simulators = JSON.parse(`xcrun simctl runtime list -j`).select do |_, sim|
sim["version"] == options[:ios] && sim["state"] == "Ready"
end

if available_simulators.empty?
Dir.chdir('..') do
sh("echo 'iOS #{options[:ios]} Simulator' | ipsw download xcode --sim") if Dir['*.dmg'].first.nil?
sh("./Scripts/install_ios_runtime.sh #{Dir['*.dmg'].first}")
UI.success("iOS #{options[:ios]} Runtime successfuly installed")
end
else
UI.important("iOS #{options[:ios]} Runtime already exists")
end
end

Expand Down

0 comments on commit d18144d

Please sign in to comment.