-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathRakefile
74 lines (64 loc) · 1.64 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 'rake'
desc "install the dot files into user's home directory"
task :default do
Dir['*'].each do |file|
next if %w[README.md Rakefile].include? file
delete_file(file)
link_file(file)
end
install_homebrew
install_vim
install_vim_plugins
install_chruby
install_mri
use_zsh
make_tmp
end
def delete_file(file)
puts "removing ~/.#{file}"
`rm -rf "$HOME/.#{file}"`
end
def link_file(file)
puts "linking ~/.dotfiles/#{file} as ~/.#{file}"
`ln -s "$PWD/#{file}" "$HOME/.#{file}"`
end
def make_tmp
`mkdir ~/.tmp`
end
def use_zsh
print 'switching shells to zsh'
`brew install zsh`
`chsh -s $(which zsh)`
end
def install_homebrew
print "installing vim via homebrew"
print ' (skipping)\n' && return if `which brew` =~ /\/usr\/local/
`ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"`
end
def install_chruby
print "installing chruby and ruby-install via homebrew"
print ' (skipping)\n' && return if `ls ` =~ /\/chruby\/chruby/
`brew install chruby && brew install ruby-install`
end
def install_mri
print "install Ruby (MRI) ? (y/n)"
if gets.chomp == "y"
puts "Instaling ruby, this isn't the fastest thing in the world."
`ruby-install ruby`
else
print " (skipping)\n"
end
end
def install_vim
return if `which vim` =~ /\/usr\/local/
puts "installing vim via homebrew"
`brew install vim`
end
def install_vim_plugins
if `ls ~/.vim/bundle/Vundle.vim` == ""
puts 'cloning vundle'
`git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim`
end
puts 'installing vundles, it might take a bit'
`vim +PluginInstall +qall`
end