Created
April 23, 2014 06:52
-
-
Save croath/11204989 to your computer and use it in GitHub Desktop.
Remove specific apps installed in iPhone simulator.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'fileutils' | |
class String | |
def numeric? | |
return true if self =~ /^\d+$/ | |
true if Float(self) rescue false | |
end | |
end | |
def remove_app (app_name) | |
sim_dir = '~/Library/Application Support/iPhone Simulator' | |
Dir.foreach(sim_dir) do |item| | |
next unless item[0].numeric? | |
Dir.foreach("#{sim_dir}/#{item}/Applications") do |sim_apps_folder| | |
full_sim_apps_folder = "#{sim_dir}/#{item}/Applications/#{sim_apps_folder}" | |
next unless File.directory?("#{full_sim_apps_folder}/#{app_name}.app") | |
FileUtils.rm_rf "#{full_sim_apps_folder}" | |
end | |
end | |
end | |
remove_app ARGV[0] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment