-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
74 lines (64 loc) · 1.89 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
require File.expand_path('../support/dotfile', __FILE__)
require 'fileutils'
SYMLINKS = %w[
zshrc
zshenv
tmux.conf
agignore
git_template
gitconfig
gitignore
]
SYMLINKS.each do |file|
desc "Symlink #{file} into home"
task file do
Dotfile.new(file).install_symlink
end
end
desc "Create the .config directory"
task :config_dir do
FileUtils.mkdir_p(File.expand_path("~/.config"))
end
desc "Symlink the Scripts directory"
task :scripts do
scripts = Dotfile.new("Scripts")
scripts.home_path = Pathname.new("~/Scripts")
scripts.install_symlink
end
desc "Install stuff from brew"
task :homebrew do
system('brew install rbenv ruby-build git zsh zsh-syntax-highlighting tmux neovim the_silver_searcher ctags nmap node yarn')
end
desc "Install vim config"
task :vim_config => :config_dir do
nvim = Dotfile.new("nvim")
nvim.home_path = Pathname.new("~/.config/nvim")
nvim.install_symlink
vimrc = Dotfile.new("vimrc", "~/.config/nvim/init.vim")
vimrc.install_symlink
vim = Dotfile.new("vim", "~/.config/nvim")
vim.install_symlink
end
desc "Install vim-plug"
task :vim_plug do
unless File.exist?('nvim/autoload/plug.vim')
unless system('curl -fLo nvim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim')
STDERR.puts "Could not fetch vim-plug. Continuing..."
end
end
end
desc "Install vim plugins"
task :vim_plugins => :vim_plug do
unless system('nvim -c ":PlugInstall" -c ":qa"')
STDERR.puts "Could not automatically install vim bundles. Continuing..."
end
end
desc "Install all files"
task :install => (SYMLINKS + %w[gitconfig gitignore scripts homebrew vim_config vim_plugins]) do
if ENV['SHELL'] !~ /zsh/
STDERR.puts "Warning: You seem to be using a shell different from zsh (#{ENV['SHELL']})"
STDERR.puts "Fix this by running:"
STDERR.puts " chsh -s `which zsh`"
end
end
task default: :install