Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benbahrenburg/72c3ecf717d3b3a1a6d316559172481d to your computer and use it in GitHub Desktop.
Save benbahrenburg/72c3ecf717d3b3a1a6d316559172481d 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.
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