Skip to content

Commit

Permalink
use xcodeproj for setting value
Browse files Browse the repository at this point in the history
  • Loading branch information
Helmut Januschka committed Nov 9, 2016
1 parent 71be4f8 commit 87b55e0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion fastlane-plugin-update_project_codesigning.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ['lib']

# spec.add_dependency 'your-dependency', '~> 1.0.0'
spec.add_dependency 'xcodeproj'

spec.add_development_dependency 'pry'
spec.add_development_dependency 'bundler'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
require 'xcodeproj'
module Fastlane
module Actions
class UpdateProjectCodesigningAction < Action
def self.run(params)
path = params[:path]
path = File.join(File.expand_path(path), "project.pbxproj")


project = Xcodeproj::Project.open(params[:path])
UI.user_error!("Could not find path to project config '#{path}'. Pass the path to your project (not workspace)!") unless File.exist?(path)
UI.message("Updating the Automatic Codesigning flag to #{params[:use_automatic_signing] ? 'enabled' : 'disabled'} for the given project '#{path}'")
p = File.read(path)
File.write(path, p.gsub(/ProvisioningStyle = .*;/, "ProvisioningStyle = #{params[:use_automatic_signing] ? 'Automatic' : 'Manual'};"))
project.root_object.attributes["TargetAttributes"].each do | target, sett |
sett["ProvisioningStyle"] = params[:use_automatic_signing] ? 'Automatic' : 'Manual'
end
project.save
UI.success("Successfully updated project settings to use ProvisioningStyle '#{params[:use_automatic_signing] ? 'Automatic' : 'Manual'}'")
end

Expand Down

0 comments on commit 87b55e0

Please sign in to comment.