32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
# File 'lib/cocoapods-kz/command/clean.rb', line 32
def run
if @clean_xcode
xcodeproj_path = Pathname.new(Dir[Pod::Config.instance.installation_root + "*.xcodeproj"].first)
return unless xcodeproj_path
xcode_derived_data_path = Pathname.new(Dir.home + "/Library/Developer/Xcode/DerivedData")
module_cache_noindex_path = xcode_derived_data_path + "ModuleCache.noindex"
FileUtils.rm_rf(module_cache_noindex_path) if module_cache_noindex_path.exist?
project_name = xcodeproj_path.basename.to_s.split(".").first
Dir.foreach(xcode_derived_data_path) do |file_name|
next if file_name == '.' || file_name == '..' || file_name == '.DS_Store'
if file_name.start_with?(project_name)
project_path = xcode_derived_data_path + file_name
index_noindex_path = project_path + "Index.noindex"
FileUtils.rm_rf(index_noindex_path) if index_noindex_path.exist?
end
end
default_xcode_path = Pathname.new('/Applications/Xcode.app')
if default_xcode_path.exist?
system("osascript -e 'quit app \"Xcode\"'")
sleep 1
workspace_path = Dir[Pod::Config.instance.installation_root + "*.xcworkspace"].first
system("open \"#{workspace_path}\"")
end
end
if @clean_framework
FileUtils.rm_r(KZ::KZ_POD_CONFIG_ROOT) if File.exist?(KZ::KZ_POD_CONFIG_ROOT)
end
end
|