forked from jlindsey/dot-vim
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Rakefile
40 lines (32 loc) · 956 Bytes
/
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
PWD = ENV['PWD']
def install_in path
dot_vim_target = File.join path, '.vim'
vimrc_target = File.join path, '.vimrc'
dot_vim = File.join PWD, '.vim'
vimrc = File.join PWD, '.vimrc'
if File.exists?(dot_vim_target) or File.exists?(vimrc_target)
puts "#{dot_vim_target} or #{vimrc_target} already exist.
Please remove these files before installing."
exit 1
end
puts "Linking files..."
%x(ln -s #{dot_vim} #{dot_vim_target})
%x(ln -s #{vimrc} #{vimrc_target})
end
desc "Installs the .vim and .vimrc files"
task :install do
puts "Where to install? [#{ENV['HOME']}]"
root = $stdin.gets.chomp
root = root.empty? ? ENV['HOME'] : root
install_in root
puts "Installing plugins"
`vim +PluginInstall +qall`
puts "Done installing plugins"
end
namespace :install do
desc "Installs using the default paths, with no user input"
task :no_user_input do
install_in ENV['HOME']
end
end
task :default => :install