-
-
Save borgand/291580 to your computer and use it in GitHub Desktop.
Rakefile for iPhone distribution releasing
This file contains hidden or 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
TARGET_NAME = "Rivals" | |
RELEASE_OUTPUT_PATH = File.expand_path("~/proged/releases/#{TARGET_NAME}") | |
CONFIGURATION = ENV['CONFIGURATION'] || "Release" | |
SDK_VERSION = ENV['SDK'] || 'iphoneos3.1' | |
desc "Build main target and zip the release bundle (also runs bump:all)." | |
task :release => ['bump:all'] do | |
puts "* Building #{CONFIGURATION} release." | |
`xcodebuild -target #{TARGET_NAME} -configuration #{CONFIGURATION} -sdk #{SDK_VERSION}` | |
build_path = File.join('build', "#{CONFIGURATION}-iphoneos") | |
puts "* Creating #{CONFIGURATION} package" | |
output_path = File.join(RELEASE_OUTPUT_PATH, `agvtool mvers -terse1`.strip + "-#{CONFIGURATION.downcase}") | |
`rm -Rf #{output_path}` if File.exist?(output_path) | |
`mkdir #{output_path} && mv #{File.join(build_path, '*')} #{output_path}` | |
puts "* Compressing." | |
`cd #{output_path} && zip -ry #{TARGET_NAME}.zip #{TARGET_NAME}.app` | |
puts "* Done." | |
end | |
namespace :bump do | |
desc "Bump current project version in all targets" | |
task :all do | |
puts "* Bumping build version." | |
`agvtool bump -all` | |
end | |
desc "Bumps marketing minor version (e.g. 1.0.1 -> 1.0.2)" | |
# Note: It assumes mvers is handled by agvtool only and is the same across all targets | |
# Note 2: It derives the current mvers from the line matching Info.plist (not other target plists) | |
task :minor do | |
puts "* Bumping marketing minor version" | |
lines = `agvtool mvers -terse` | |
mvers = lines.split.detect{|l| l =~ /Info.plist\"=/}.split(/=/).last | |
puts " current: #{mvers}" | |
mvers = mvers.split(/\./) | |
mvers.push(mvers.pop.to_i + 1) | |
mvers = mvers.join(".") | |
puts " new: #{mvers}" | |
`agvtool new-marketing-version #{mvers}` | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment