Class: Jumpstarter::Xcode::EditTargetBundleID
- Inherits:
-
I_Instructions
- Object
- I_Instructions
- Jumpstarter::Xcode::EditTargetBundleID
- Defined in:
- lib/jumpstarter_core/xcode.rb
Instance Method Summary collapse
Methods inherited from I_Instructions
#clean_value, #compose!, #crash_on_error!, #error_message!, #initialize, #options, #success_message!
Constructor Details
This class inherits a constructor from Jumpstarter::I_Instructions
Instance Method Details
#run! ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/jumpstarter_core/xcode.rb', line 42 def run!() project = Xcodeproj::Project.open(@proj_path) unless project.root_object.attributes["TargetAttributes"] puts "Your file format is old, please update and try again" return false end target_dictionary = project.targets.map { |f| { name: f.name, uuid: f.uuid, build_configuration_list: f.build_configuration_list } } changed_targets = [] project.root_object.attributes["TargetAttributes"].each do |target, sett| found_target = target_dictionary.detect { |h| h[:uuid] == target } style_value = @code_sign_style == "manual" ? 'Manual' : 'Automatic' build_configuration_list = found_target[:build_configuration_list] build_configuration_list.set_setting("CODE_SIGN_STYLE", style_value) sett["ProvisioningStyle"] = style_value if not @team_id.empty? sett["DevelopmentTeam"] = @team_id build_configuration_list.set_setting("DEVELOPMENT_TEAM", @team_id) else teams = Jumpstarter::XCHelper.teams! puts "Provisioning Profile" puts (teams) print "Please select the team for #{found_target[:name]}: " num = (STDIN.gets.chomp).to_i team = teams[num] build_configuration_list.set_setting("DEVELOPMENT_TEAM", team) end if @code_siging_identity build_configuration_list.set_setting("CODE_SIGN_IDENTITY", @code_siging_identity) end if @bundle_id build_configuration_list.set_setting("PRODUCT_BUNDLE_IDENTIFIER", @bundle_id) end changed_targets << found_target[:name] end project.save changed_targets.each do |target| puts "Updated Target: #{target}" end return true end |