-
Notifications
You must be signed in to change notification settings - Fork 4
/
cleanup.rb
38 lines (29 loc) · 1.07 KB
/
cleanup.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#import the xcodeproj ruby gem
require "xcodeproj"
#define the path to your .xcodeproj file
project_path = "./TableCollectionFeatures.xcodeproj"
#open the xcode project
project = Xcodeproj::Project.open(project_path)
#iterate over groups, remove Fastlane and Environment references
project.groups.each do |group|
group.recursive_children_groups.each do |childGroup|
if childGroup.display_name == "Fastlane" || childGroup.display_name == "Environment"
childGroup.remove_from_project
end
end
end
#iterate over files, remove unnecessary files
project.files.each do |file|
hierPath = file.hierarchy_path
if hierPath == "/TableCollectionFeatures/Info.plist"
file.remove_from_project
File.delete("." + hierPath) if File.exist?("." + hierPath)
end
if hierPath == "/TableCollectionFeatures/Assets.xcassets"
file.remove_from_project
FileUtils.rm_rf("./TableCollectionFeatures/Assets.xcassets")
end
end
puts "All unnecessary files and references were removed"
# Save the project file
project.save