-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
83 lines (72 loc) · 2.13 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
72
73
74
75
76
77
78
79
80
81
82
83
desc "Link vim/macvim/tmux configuration files"
task :link_config_files do
Dir['{g,}vimrc{.*,}', 'tmux.conf'].each do |file|
dest = File.expand_path("~/.#{file}")
unless File.exist?(dest)
ln_s(File.expand_path(file), dest)
end
end
Dir['tmux.local.conf'].each do |file|
dest = File.expand_path("~/.#{file}")
unless File.exist?(dest)
cp(File.expand_path(file), dest)
end
end
`mkdir -p ~/.config/nvim`
nvim_dir = File.expand_path('~/.config/nvim')
unless Dir.exist?(nvim_dir)
Dir.mkdir(nvim_dir)
end
nvim_conf = File.expand_path('~/.config/nvim/init.vim')
vimrc = File.expand_path('vimrc')
unless File.symlink?(nvim_conf)
ln_s(vimrc, nvim_conf)
end
alacritty_conf_dir = File.expand_path('~/.config/alacritty')
alacritty_dir = File.expand_path('config/alacritty/')
unless File.symlink?(alacritty_conf_dir)
ln_s(alacritty_dir, alacritty_conf_dir)
end
git_conf_legacy = File.expand_path('~/.gitconfig')
if File.exist?(git_conf_legacy)
puts 'Old git config file exists at ~/.gitconfig. Please remove and run again.'
exit 1
end
git_dir = File.expand_path('~/.config/git/')
unless Dir.exist?(git_dir)
Dir.mkdir(git_dir)
end
Dir.chdir("config/") do
Dir['git/*'].each do |file|
dest = File.expand_path("~/.config/#{file}")
unless File.exist?(dest)
ln_s(File.expand_path(file), dest)
end
end
end
end
desc "Install bundles"
task :install_bundles do
vundle_dir = File.expand_path('~/.vim/bundle/Vundle.vim')
unless Dir.exist?(vundle_dir)
`git clone https://github.com/VundleVim/Vundle.vim.git #{vundle_dir}`
end
puts 'Please install bundles by executing:'
puts 'vim -u ~/.vim/bundles.vim +BundleInstall +q'
end
desc "Update .vim repository"
task :update do
`git pull`
`git submodule update`
end
desc "Update bundles"
task :update_bundles do
puts 'Please update bundles by executing:'
puts 'vim -u ~/.vim/bundles.vim +BundleUpdate +q'
end
desc "Install everything"
task :install => [:link_config_files,
:install_bundles]
desc "Update everything"
task :default => [:update,
:install]