Last active
September 27, 2016 12:41
-
-
Save 82times/5594887 to your computer and use it in GitHub Desktop.
Quick and dirty use of the wonderful xcodeproj gem to modify the CODE_SIGN_IDENTITY and PROVISIONING_PROFILE property of all configurations of each target where that property is set.
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
#!/usr/bin/ruby | |
# Use the xcodeproj gem to modify code sign identity in all targets where | |
# that attribute is set. | |
# | |
# Kind of getto. | |
require 'rubygems' | |
require 'xcodeproj' | |
path = 'Foo.xcodeproj' | |
identity = 'iPhone Developer: Friendly Ghost (XYZ123ABC)' | |
profile = '00000000-FEED-DADA-ICED-C0FFEE000000' | |
csi_key = 'CODE_SIGN_IDENTITY' | |
csi_key_iphone = "#{csi_key}[sdk=iphoneos*]" | |
profile_key = 'PROVISIONING_PROFILE' | |
profile_key_ios = "#{profile_key}[sdk=iphoneos*]" | |
project = Xcodeproj::Project.new(path) | |
project.targets.each do |target| | |
target.build_configurations.each do |conf| | |
conf.build_settings[csi_key] = identity unless conf.build_settings[csi_key] == nil | |
conf.build_settings[csi_key_iphone] = identity unless conf.build_settings[csi_key_iphone] == nil | |
conf.build_settings[profile_key] = profile unless conf.build_settings[profile_key] == nil | |
conf.build_settings[profile_key_ios] = profile unless conf.build_settings[profile_key_ios] == nil | |
end | |
end | |
project.save_as(path) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment