Advertisement
Guest User

Untitled

a guest
May 30th, 2015
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. # Reset all iOS Simulators
  2. simulatorList = []
  3.  
  4. # Get all of the simulator UUIDs from Xcode
  5. rawSimulatorList = `xcrun simctl list`
  6. rawSimulatorList.each_line do |line|
  7. if line.start_with?(" ")
  8. simulator = line.strip
  9.  
  10. # Ignore any simulators that aren't working
  11. if !simulator.include?("unavailable")
  12.  
  13. # Extract the UUID
  14. uuid = simulator.match(/\([A-Z0-9\-]+\)/)[0]
  15. uuid = uuid.gsub("(","")
  16. uuid = uuid.gsub(")","")
  17.  
  18. # Extract the device name
  19. deviceName = simulator.split(' ')[0] + " " + simulator.split(' ')[1]
  20. device = { "name" => deviceName, "uuid" => uuid }
  21. simulatorList.push(device)
  22. end
  23. end
  24. end
  25.  
  26. puts "We will be resetting #{simulatorList.count} simulators."
  27. notRecognizedResponse = true
  28. while notRecognizedResponse
  29. print "Continue? (Yes/No) [Yes]: "
  30. response = gets.chomp.downcase
  31. if response == "no"
  32. exit
  33. elsif response == "yes"
  34. notRecognizedResponse = false
  35. elsif response == ""
  36. notRecognizedResponse = false
  37. end
  38. end
  39.  
  40. simulatorList.each do |simulator|
  41. print "Erasing #{simulator['name']}... "
  42. `xcrun simctl erase #{simulator['uuid']}`
  43. puts "Done"
  44. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement