forked from adamhjk/adam-vim
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Rakefile
31 lines (29 loc) · 954 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
if ENV['OS'] =~ /Windows.*/
winarc = ENV['PROCESSOR_ARCHITECTURE'] =~ /x86/ ? " (x86)" : ''
vimdir = File.expand_path("C:/Program Files#{winarc}/Vim/vim72")
vimrc = File.expand_path("~/_vimrc")
else
vimdir = File.expand_path("~/.vim")
vimrc = File.expand_path("~/.vimrc")
end
desc "Install vim configuration"
task :install do
puts "Installing to #{vimdir}"
if ENV['OS'] =~ /Windows.*/
Dir.entries(".").each do |d|
if FileTest.directory?(d) && d =~ /^[a-z]/
Dir.entries(d).each do |source|
next if FileTest.directory?(source)
copy("#{d}/#{source}", "#{vimdir}/#{d}")
end
end
end
copy("vimrc", "#{vimrc}")
else
sh "mkdir -p #{vimdir}" unless FileTest.directory?("#{vimdir}")
sh "tar -cpf - * | (cd #{vimdir} && tar -xpf -)"
puts "Creating link for #{vimrc}"
File.symlink("#{vimdir}/vimrc", vimrc) unless File.exists?(vimrc)
end
end
task :default => :install