Skip to content

Instantly share code, notes, and snippets.

@simonoff
Forked from mps/Gemfile
Created May 18, 2014 17:39
Show Gist options
  • Save simonoff/e3bb8c4f1a1e67124976 to your computer and use it in GitHub Desktop.
Save simonoff/e3bb8c4f1a1e67124976 to your computer and use it in GitHub Desktop.
source 'http://rubygems.org'
# Make sure you have bundler installed
# gem install bundler
gem 'shenzhen'
PROJECT_SCHEME = '' # Your Project scheme for building ex MyApp
PROJECT_NAME = '' # Your Project file name ex. MyApp.xcodeproj
API_TOKEN = '' # Your TestFlight API Token
TEAM_TOKEN = '' # Your TestFlight Team Token
INTERNAL_LIST = '' # TestFlight list of people you want to notify internally
RELEASE_LIST = '' # TestFlight list of people you want to notify for release
desc 'Build Handset IPA'
task :buildipa do
sh "rm -rf *.ipa"
sh "rm -rf *.app.dSYM.zip"
sh "ipa build --scheme #{PROJECT_SCHEME} --project #{PROJECT_NAME} --configuration Release --clean /tmp"
end
desc 'Deploy Internal Build to Testflight'
task :internal => ['buildipa'] do
sh "ipa distribute:testflight --api_token #{API_TOKEN} --team_token #{TEAM_TOKEN} --lists #{INTERNAL_LIST} --notify --notes 'Internal Release' "
end
desc 'Deploy Release Build to Testflight'
task :release => ['buildipa'] do
sh "ipa distribute:testflight --api_token #{API_TOKEN} --team_token #{TEAM_TOKEN} --lists #{RELEASE_LIST} --notify "
end
def revBuild(plistFile)
puts "Attempting to update #{plistFile} build version..."
oldVersion = `/usr/libexec/PlistBuddy -c "Print CFBundleVersion" #{plistFile}`
puts "The old version: #{oldVersion}"
versionParts = oldVersion.split(".")
previousDate = versionParts[2]
newDate = Time.now.strftime("%Y%m%d")
versionParts[2] = newDate
versionParts[3] = previousDate == versionParts[2] ? (versionParts[3].to_i+1).to_s : "1"
versionParts.each do |part|
part.chomp!
end
newVersion = versionParts.join(".")
`/usr/libexec/PlistBuddy -c "Set :CFBundleVersion #{newVersion}" #{plistFile}`
puts "The new version: #{newVersion}"
end
desc "Rev the build numbers in a project's plist"
task :rev do
revBuild './path/to/my.plist'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment