Skip to content
This repository
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 44 lines (38 sloc) 1.452 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
desc "build a nightly pkg installer"
task :nightly do
  build_destination = '/tmp/macruby-nightly'
  directory build_destination
  rm_rf build_destination
  unless ENV['NO_CLEAN']
    puts "Cleaning the repo"
    `rake clean`
    puts "Updating the repo..."
    if File.exist?('.git')
      `git pull`
    else
      `svn up`
    end
  end

  puts "Building MacRuby"
  `rake`

  puts "Preparing for packaging"
  `rake install DESTDIR=#{build_destination}`

  ## prepare for post install script
  xcode_dir = `xcode-select -print-path`.chomp
  # remove '/tmp/macruby-nightly/Developer/' and '/tmp/macruby-nightly/Users/'
  rm_rf "#{build_destination}/#{xcode_dir.split('/')[1]}"
  rm_rf "#{build_destination}/Users"

  temporary_dir = "#{build_destination}/tmp/macruby"
  mkdir_p temporary_dir
  cp_r "sample-macruby", temporary_dir

  puts "Packaging MacRuby"
  package_dir = ["#{ENV['HOME']}/tmp", "#{ENV['HOME']}/Desktop", '/tmp'].find { |dir| File.exist?(dir) }
  package_date = Time.now.strftime("%Y-%m-%d")
  package = "#{package_dir}/macruby_nightly-#{package_date}.pkg"
  `/Developer/usr/bin/packagemaker --doc #{File.expand_path(File.dirname(__FILE__))}/../misc/release/macruby_nightly.pmdoc/ --out #{package} --scripts #{File.expand_path(File.dirname(__FILE__))}/../misc/release/package_script --version #{package_date}-nightly`
  if $?.success?
    puts "Package saved to #{package}"
  else
    puts "Failed to save package"
  end
end
Something went wrong with that request. Please try again.