Skip to content
Browse files

Move execution of cmd line stuff to configuration, add codesign stuff

  • Loading branch information...
1 parent 372e0c8 commit 46059deb98282bd973bdd192040232409a2ea377 @rayh rayh committed Aug 19, 2011
Showing with 43 additions and 38 deletions.
  1. +42 −3 lib/xcode/configuration.rb
  2. +0 −34 lib/xcode/project.rb
  3. +1 −1 lib/xcode/version.rb
View
45 lib/xcode/configuration.rb
@@ -24,9 +24,28 @@ def info_plist
def build
cmd = []
+ cmd << "xcodebuild"
+ cmd << "-sdk #{@target.project.sdk}" unless @target.project.sdk.nil?
+ cmd << "-project \"#{@target.project.path}\""
cmd << "-target \"#{@target.name}\""
cmd << "-configuration \"#{name}\""
- @target.project.execute_xcodebuild(cmd.join(' '))
+ execute(cmd)
+ end
+
+
+ def sign(identity)
+ cmd = []
+ cmd << "codesign"
+ cmd << "--force"
+ cmd << "--sign \"#{identity}\""
+ cmd << "--resource-rules=\"#{app_path}/ResourceRules.plist\""
+ cmd << "--entitlements \"#{entitlements_path}\""
+ cmd << "\"#{ipa_path}\""
+ execute(cmd)
+ end
+
+ def entitlements_path
+ "#{File.dirname(@target.project.path)}/build/#{@target.productName}.build/#{name}-#{@target.project.sdk}/#{@target.productName}.build/#{@target.productName}.xcent"
end
def app_path
@@ -38,7 +57,10 @@ def ipa_path
end
def package(options={})
- cmd = []
+ cmd = []
+ cmd << "xcrun"
+ cmd << "-sdk #{@target.project.sdk.nil? ? "iphoneos" : @target.project.sdk}"
+ cmd << "PackageApplication"
cmd << "-v \"#{app_path}\""
cmd << "-o \"#{ipa_path}\""
@@ -50,7 +72,24 @@ def package(options={})
cmd << "--embed \"#{options[:profile]}\""
end
- @target.project.execute_package_application(cmd.join(' '))
+ execute(cmd)
+ end
+
+ private
+
+ def execute(bits, show_output=true)
+ out = []
+ cmd = bits.join(' ')
+ puts "EXECUTE: #{cmd}"
+ IO.popen (cmd) do |f|
+ f.each do |line|
+ puts line if show_output
+ out << line
+ end
+ end
+ #puts "RETURN: #{out.inspect}"
+ out
end
+
end
end
View
34 lib/xcode/project.rb
@@ -13,27 +13,6 @@ def initialize(path, sdk=nil)
parse_pbxproj
# parse_configurations
end
-
- def execute_package_application(options=nil)
- cmd = []
- cmd << "xcrun"
- cmd << "-sdk #{@sdk.nil? ? "iphoneos" : @sdk}"
- cmd << "PackageApplication"
- cmd << options unless options.nil?
-
- execute(cmd.join(' '), true)
- end
-
- def execute_xcodebuild(cmd_line=nil, show_output=true)
- cmd = []
- cmd << "xcodebuild"
- cmd << "-sdk #{@sdk}" unless @sdk.nil?
- cmd << "-project \"#{@path}\""
- cmd << cmd_line unless cmd_line.nil?
- yield cmd if block_given?
-
- execute(cmd.join(' '), show_output)
- end
def target(name)
target = @targets[name.to_s.to_sym]
@@ -62,19 +41,6 @@ def parse_pbxproj
@targets[target.name.to_sym] = target
end
end
-
- def execute(cmd, show_output=false)
- out = []
- puts "EXECUTE: #{cmd}"
- IO.popen (cmd) do |f|
- f.each do |line|
- puts line if show_output
- out << line
- end
- end
- #puts "RETURN: #{out.inspect}"
- out
- end
end
end
View
2 lib/xcode/version.rb
@@ -1,3 +1,3 @@
module Xcode
- VERSION = "0.0.2"
+ VERSION = "0.0.3"
end

0 comments on commit 46059de

Please sign in to comment.
Something went wrong with that request. Please try again.