Last active
January 21, 2022 22:36
-
-
Save daltonclaybrook/e109033af85e6efd6972 to your computer and use it in GitHub Desktop.
A post install script for CocoaPods that changes the bundle identifier of all pods to the one specified.
This file contains 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
post_install do |installer| | |
installer.project.targets.each do |target| | |
target.build_configurations.each do |config| | |
if config.name == 'BREnterprise' | |
config.build_settings['CODE_SIGN_IDENTITY[sdk=iphoneos*]'] = 'iPhone Distribution: The Carter Group LLC' | |
config.build_settings['PROVISIONING_PROFILE'] = '${BR_ENTERPRISE_PROVISIONING_PROFILE}' | |
end | |
end | |
end | |
# change bundle id of each pod to 'com.bottlerocketapps.*' | |
bundle_id = 'com.bottlerocketapps' | |
directory = installer.config.project_pods_root + 'Target Support Files/' | |
Dir.foreach(directory) do |path| | |
full_path = directory + path | |
if File.directory?(full_path) | |
info_plist_path = full_path + 'Info.plist' | |
if File.exist?(info_plist_path) | |
text = File.read(info_plist_path) | |
new_contents = text.gsub('org.cocoapods', bundle_id) | |
File.open(info_plist_path, "w") {|file| file.puts new_contents } | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Extremely helpful. Since I wanted a different bundle_id per POD framework I changed the code to: