lib/xcjobs/xcodebuild.rb in xcjobs-0.0.3 vs lib/xcjobs/xcodebuild.rb in xcjobs-0.0.4
- old
+ new
@@ -1,8 +1,9 @@
require 'rake/tasklib'
require 'rake/clean'
require 'open3'
+require_relative 'helper'
module XCJobs
class Xcodebuild < Rake::TaskLib
include Rake::DSL if defined?(Rake::DSL)
@@ -48,28 +49,11 @@
@after_action = block
end
def provisioning_profile=(provisioning_profile)
@provisioning_profile = provisioning_profile
-
- if File.file?(provisioning_profile)
- @provisioning_profile_path = provisioning_profile
- else
- path = File.join("#{Dir.home}/Library/MobileDevice/Provisioning Profiles/", provisioning_profile)
- if File.file?(path)
- @provisioning_profile_path = path
- end
- end
- if @provisioning_profile_path
- out, status = Open3.capture2 %[/usr/libexec/PlistBuddy -c Print:UUID /dev/stdin <<< $(security cms -D -i "#{@provisioning_profile_path}")]
- @provisioning_profile_uuid = out.strip if status.success?
-
- out, status = Open3.capture2 %[/usr/libexec/PlistBuddy -c Print:Name /dev/stdin <<< $(security cms -D -i "#{@provisioning_profile_path}")]
- @provisioning_profile_name = out.strip if status.success?
- else
- @provisioning_profile_name = provisioning_profile
- end
+ @provisioning_profile_path, @provisioning_profile_uuid, @provisioning_profile_name = XCJobs::Helper.extract_provisioning_profile(provisioning_profile)
end
def add_destination(destination)
@destinations << destination
end
@@ -264,9 +248,18 @@
@archive_path || (build_dir && scheme ? File.join(build_dir, scheme) : nil)
end
def export_format
@export_format || 'IPA'
+ end
+
+ def export_provisioning_profile=(provisioning_profile)
+ provisioning_profile_path, provisioning_profile_uuid, provisioning_profile_name = XCJobs::Helper.extract_provisioning_profile(provisioning_profile)
+ if provisioning_profile_name
+ @export_provisioning_profile = provisioning_profile_name
+ else
+ @export_provisioning_profile = provisioning_profile
+ end
end
private
def define