forked from XVimProject/XVim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
62 lines (51 loc) · 1.42 KB
/
Rakefile
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
require 'rake'
require 'fileutils'
$plugin_filename ="#{ENV['HOME']}/Library/Application Support/Developer/Shared/Xcode/Plug-ins/XVim.xcplugin"
def isDebug?(reqs)
return (reqs and reqs.contain? "debug")
end
def getConfiguration(reqs)
if isDebug? reqs
return "Debug"
else
return "Release"
end
end
def isInstalled?()
return File.exists? $plugin_filename
end
def getXcodeVersion
return Integer(`xcodebuild -version`.split(' ')[1].split('.')[0])
end
task :xcode56, [:reqs] do |t, args|
if getXcodeVersion == 5 or getXcodeVersion == 6
if isInstalled?
puts "XVim already installed, Use `rake uninstall` to uninstall XVim"
else
reqs = args[:reqs]
conf = getConfiguration(reqs)
puts "Building and Installing XVim for Xcode 5 and 6"
sh "xcodebuild -scheme 'XVim for Xcode5 and 6' -configuration '#{conf}'"
end
else
sh "ERROR: Wrong Xcode version. You need Xcode 5 or 6 to use XVim."
end
end
task :clean do
puts "Cleaning"
sh "xcodebuild clean"
end
task :uninstall do
if isInstalled?
print "#{$plugin_filename} found, Uninstalling..."
FileUtils.rm_r $plugin_filename
print " [done]\n"
else
puts "WARNING: #{$plugin_filename} not found. Have you really installed XVim?"
end
end
task :pluginuuid do
plugin_uuid = `defaults read /Applications/Xcode.app/Contents/Info DVTPlugInCompatibilityUUID`
puts "UUID:#{plugin_uuid}"
end
task :default => [:xcode56]