Remove use of deprecated stringWithCString
[GitX.git] / Rakefile
blob028349282598f17bdecd2b4c65482647a8513b31
1 require 'ftools'
3 target_locations = [
4   File::expand_path("~/Applications/"),
5   "/Applications/"
8 desc "Build and install (or upgrade) GitX"
9 task :install => [:uninstall_app, :build_app, :install_app]
10 desc "Clean build directory, uninstall application"
11 task :uninstall => [:clean_app, :uninstall_app]
12 desc "Clean build directory"
13 task :clean => [:clean_app]
15 desc "Build gitX using XCode"
16 task :build_app do
17   system("xcodebuild build OBJROOT=build/ SYMROOT=build/")
18 end
20 task :clean_app do
21   system("xcodebuild -alltargets clean OBJROOT=build/ SYMROOT=build/")
22 end
24 desc "Copies the built GitX.app to the application folder"
25 task :install_app do
26   target_locations.each do |loc|
27     if File.directory?(loc)
28       puts "Copying to (#{loc})"
29       system("cp -R build/Release/GitX.app #{loc}")
30       break
31     end
32   end
33 end
35 desc "Remove GitX.app from ~/Applications/ or /Applications/"
36 task :uninstall_app do
37   found = false
38   target_locations.each do |loc|
39     cur_path = File.join(loc, "GitX.app")
40     puts "Checking #{cur_path}"
41     if File.exists?( cur_path )
42       puts "Removing GitX.app from #{cur_path}"
43       system("rm", "-rf", cur_path)
44       found = true
45       break
46     end
47   end
48   puts "Couldn't find installed GitX.app" unless found
49 end
51 desc "Creates a zip file with current GitX"
52 task :create_zip do
53   if ENV["STABLE"]
54     name = "GitXStable"
55   else
56     name = "Nightly"
57   end
59   delete = File.directory?("build/Release")
60   system("xcodebuild")
61   system("cd build/Release && zip -r #{name}.app.zip GitX.app")
62   system("mv build/Release/#{name}.app.zip .")
63   system("rm -rf build/Release") if delete
64   system("scp #{name}.app.zip sydney:public_html/gitx/Downloads/") # This is a local script -- Pieter
65   puts "Uploaded to http://gitx.frim.nl/Downloads/#{name}.app.zip"
66 end