Skip to content
This repository
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 67 lines (58 sloc) 1.792 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 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
require 'ftools'

target_locations = [
  File::expand_path("~/Applications/"),
  "/Applications/"
]

desc "Build and install (or upgrade) GitX"
task :install => [:uninstall_app, :build_app, :install_app]
desc "Clean build directory, uninstall application"
task :uninstall => [:clean_app, :uninstall_app]
desc "Clean build directory"
task :clean => [:clean_app]

desc "Build gitX using XCode"
task :build_app do
  system("xcodebuild build OBJROOT=build/ SYMROOT=build/")
end

task :clean_app do
  system("xcodebuild -alltargets clean OBJROOT=build/ SYMROOT=build/")
end

desc "Copies the built GitX.app to the application folder"
task :install_app do
  target_locations.each do |loc|
    if File.directory?(loc)
      puts "Copying to (#{loc})"
      system("cp -R build/Release/GitX.app #{loc}")
      break
    end
  end
end

desc "Remove GitX.app from ~/Applications/ or /Applications/"
task :uninstall_app do
  found = false
  target_locations.each do |loc|
    cur_path = File.join(loc, "GitX.app")
    puts "Checking #{cur_path}"
    if File.exists?( cur_path )
      puts "Removing GitX.app from #{cur_path}"
      system("rm", "-rf", cur_path)
      found = true
      break
    end
  end
  puts "Couldn't find installed GitX.app" unless found
end

desc "Creates a zip file with current GitX"
task :create_zip do
  if ENV["STABLE"]
    name = "GitXStable"
  else
    name = "Nightly"
  end

  delete = File.directory?("build/Release")
  system("xcodebuild")
  system("cd build/Release && zip -r #{name}.app.zip GitX.app")
  system("mv build/Release/#{name}.app.zip .")
  system("rm -rf build/Release") if delete
  system("scp #{name}.app.zip sydney:public_html/gitx/Downloads/") # This is a local script -- Pieter
  puts "Uploaded to http://gitx.frim.nl/Downloads/#{name}.app.zip"
end
Something went wrong with that request. Please try again.