forked from binaryage/totalfinder-i18n
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrakefile
71 lines (57 loc) · 1.83 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
63
64
65
66
67
68
69
70
71
require 'rake'
################################################################################################
# constants
ROOT_DIR = File.expand_path('.')
FINDER_DIR = '/System/Library/CoreServices/Finder.app'
FINDER_RESOURCES_DIR = File.join(FINDER_DIR, 'Contents/Resources')
################################################################################################
# dependencies
begin
require 'colored'
rescue LoadError
raise 'You must "gem install colored" to use terminal colors'
end
################################################################################################
# helpers
def die(msg, status=1)
puts "Error[#{status||$?}]: #{msg}".red
exit status||$?
end
def sys(cmd)
puts "> #{cmd}".yellow
system(cmd)
end
################################################################################################
# tasks
desc "switch /Applications/TotalFinder.app into dev mode"
task :dev do
sys("./dev.sh")
end
desc "switch /Applications/TotalFinder.app into non-dev mode"
task :undev do
sys("./undev.sh")
end
desc "compile XIBs to NIBs (after modified the UI)"
task :compile do
sys("./compile.sh")
end
desc "restart Finder.app"
task :restart do
sys("./restart.sh")
end
desc "normalize Finder.app so it contains all our language folders (run with sudo)"
task :normalize do
lprojs = File.join(ROOT_DIR, 'plugin', 'Resources', '*.lproj')
Dir.glob(lprojs) do |folder|
dir = File.join(FINDER_RESOURCES_DIR, File.basename(folder))
if File.exists? dir then
puts dir.blue + " exists".yellow
else
if !sys("mkdir -p \"#{dir}\"") then
die("Unable to create a folder. Hint: you should run this as sudo rake normalize")
end
puts dir.blue + " created".green
end
end
end
task :default => :restart