Skip to content

Instantly share code, notes, and snippets.

@borgand
Forked from lukeredpath/gist:72511
Created February 1, 2010 10:32
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save borgand/291580 to your computer and use it in GitHub Desktop.
Save borgand/291580 to your computer and use it in GitHub Desktop.
Rakefile for iPhone distribution releasing
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 bumps all versions)."
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 all version numbers, including Project and Marketing"
task :all => [:project, :minor] do
# nothing to be done here
end
desc "Bump current project version in all targets"
task :project do
puts "* Bumping build version."
`agvtool bump -all`
end
desc "Bumps marketing minor version (e.g. 1.0.1 -> 1.0.2, 1.1 -> 1.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
print "* Bumping marketing minor version ("
lines = `agvtool mvers -terse`
mvers = lines.split.detect{|l| l =~ /Info.plist\"=/}.split(/=/).last
print mvers
print " -> "
mvers = mvers.split(/\./)
mvers.push(mvers.pop.to_i + 1)
mvers = mvers.join(".")
print mvers
puts ")"
`agvtool new-marketing-version #{mvers}`
end
desc "Bump marketing major version (1.1 -> 2.0, 1.0.1 -> 1.1)"
task :major do
print "* Bumping marketing major version ("
lines = `agvtool mvers -terse`
mvers = lines.split.detect{|l| l =~ /Info.plist\"=/}.split(/=/).last
print mvers
print " -> "
mvers = mvers.split(/\./)
mvers.pop
mvers.push(mvers.pop.to_i + 1)
mvers.push 0
mvers = mvers.join(".")
print mvers
puts ")"
`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