Last updated April 11, 2009 23:26, by Logan Barnett
The following code is the task used to create JotBot's .dmg installer. The installer was customized using Finder with a JotBot.app already inside it (for location storage in .DS_Store). This .dmg is not locked/packed yet. The .dmg is then added to the source control so anyone with the source may build the file (although it's a large binary file).
desc "Make an installer for OS X"
task :mac => 'rawr:bundle:app' do
require 'src/version'
puts "Creating Mac installer"
volume_name = "JotBot"
image_file_name = "JotBot.dmg"
require 'src/version'
versioned_image_file_name = "JotBot-#{JOTBOT_VERSION}-temp.dmg"
FileUtils.cp image_file_name, versioned_image_file_name
# this mounts the dmg
sh "hdiutil attach #{versioned_image_file_name}"
FileUtils.rm_rf("/Volumes/#{volume_name}/JotBot.app")
FileUtils.cp_r "#{Rawr::Options.data.osx_output_dir}/JotBot.app", "/Volumes/#{volume_name}/JotBot.app"
sh "hdiutil detach /Volumes/#{volume_name}"
sh "hdiutil convert #{versioned_image_file_name} -format UDZO -o #{versioned_image_file_name.gsub("-temp", "")}"
FileUtils.rm(versioned_image_file_name)
FileUtils.mv(versioned_image_file_name.gsub("-temp", ""), "#{Rawr::Options.data.osx_output_dir}/#{versioned_image_file_name.gsub("-temp", "")}")
end




