CodeShop

iPhone Capistrano deployment

October 28th, 2008

You can automatically deploy your own application to the iPhonedevice by using Capistrano.

Requirements: Capistrano (gem install capistrano) and ldid (install via Cydia).

Build your application for the ARM architecture:


  bjam --toolset=darwin macosx-version=iphone-2.0 architecture=arm release

Deploy the application to the iPhone:


  cap deploy

Your app is packaged (tar), copied (scp) to your iphone and SpringBoards is restarted. I use the following Capfile:



set :application_name, "LocateMe" 
set :iphone_ip, "192.168.1.4" 
set :user, "root" 
# password = alpine

desc "Package your iPhone application" 
task :package do
 %x[cd "~/Library/Application Support/iPhone Simulator/User/Applications/00000000-0000-0000-0000-000000000000" && \
    tar -czpvf #{application_name}.tar.gz #{application_name}.app && \
    scp #{application_name}.tar.gz #{user}@#{iphone_ip}:/Applications]
end

desc "Install the application on your iPhone" 
task :install, :hosts => "#{iphone_ip}" do
  run <<-CMD
    cd /Applications/;
    tar -xzpvf #{application_name}.tar.gz;
    rm #{application_name}.tar.gz;
    ldid -S /Applications/#{application_name}.app/#{application_name};
    killall SpringBoard;                  # OS 2.0
#   /Applications/BossPrefs.app/Respring; # OS 2.1
  CMD
end

desc "Package and install the application on your iPhone" 
task :deploy, :hosts => "#{iphone_ip}" do
  package
  install
end

Sorry, comments are closed for this article.