-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRakefile
More file actions
88 lines (74 loc) · 2.47 KB
/
Rakefile
File metadata and controls
88 lines (74 loc) · 2.47 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
VIM_HOME = File.join(ENV['HOME'], ".vim")
POWERLINE_FONTS = {
"https://github.com/abertsch/Menlo-for-Powerline/blob/master/Menlo%20Bold%20Italic%20for%20Powerline.ttf?raw=true" =>
"Menlo Bold Italic for Powerline.ttf",
"https://github.com/abertsch/Menlo-for-Powerline/blob/master/Menlo%20Bold%20for%20Powerline.ttf?raw=true" =>
"Menlo Bold for Powerline.ttf",
"https://github.com/abertsch/Menlo-for-Powerline/blob/master/Menlo%20Italic%20for%20Powerline.ttf?raw=true" =>
"Menlo Italic for Powerline.ttf",
"https://github.com/abertsch/Menlo-for-Powerline/blob/master/Menlo%20for%20Powerline.ttf?raw=true" =>
"Menlo Regular for Powerline.ttf",
}
FONT_INSTALL_LOCATION = "/Library/Fonts"
desc "update all installed bundles including vundle"
task :bundle => ["bundle:update"]
namespace :bundle do
task :update => ["bundle:update_vundle", "bundle:update_all"]
desc "update vundle, the vim bundle manager"
task :update_vundle do
vundle_home = File.join(VIM_HOME, "bundle", "vundle")
if File.exist? vundle_home
Dir.chdir vundle_home do
puts "Running update on vundle"
sh "git pull"
end
else
puts "Installing vundle into bundle directory"
sh "git clone https://github.com/gmarik/vundle.git #{vundle_home}"
end
end
desc "update all bundles installed through vundle"
task :update_all do
sh "vim +BundleInstall +qall"
end
end
desc "Run all setup tasks"
task :setup => [
"setup:tmp_dirs",
"setup:install_bundles",
"setup:link",
"setup:install_powerline_fonts"
]
namespace :setup do
desc "install all bundles"
task :install_bundles => ["bundle"]
desc "symlink the vimrc and gvimrc files in place"
task :link do
%w[vimrc gvimrc].each do |script|
dotfile = File.join(ENV['HOME'], ".#{script}")
if File.exist? dotfile
warn "~/.#{script} already exists"
else
ln_s File.join('.vim', script), dotfile
end
end
end
desc "Create the temporary directories"
task :tmp_dirs do
mkdir_p "_data/backup"
mkdir_p "_data/swap"
mkdir_p "_data/undo"
end
desc "download and install the appropriate fonts for powerline"
task :install_powerline_fonts do
puts "Downloading the fonts..."
tmp_dir = "/tmp/vim-fonts"
begin
Dir.mkdir tmp_dir
POWERLINE_FONTS.each { |font_url, name| sh %{wget #{font_url} -O "#{tmp_dir}/#{name}"} }
sh "sudo cp #{tmp_dir}/* #{FONT_INSTALL_LOCATION}/"
ensure
sh "rm -rf #{tmp_dir}"
end
end
end