-
-
Notifications
You must be signed in to change notification settings - Fork 16
/
install.rb
executable file
·70 lines (59 loc) · 1.94 KB
/
install.rb
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
#!/usr/bin/env ruby
def print_cyan(text)
puts "\e[36m#{text}\e[0m"
end
def print_green(text)
puts "\e[32m#{text}\e[0m"
end
def print_red(text)
puts "\e[31m#{text}\e[0m"
end
def path(filepath)
File.expand_path(filepath)
end
print_cyan "Checking if vim-plug exists..."
if File.exists? path("~/.vim/autoload/plug.vim")
print_green "You already have vim-plug, awesome!"
else
print_red "Nope, installing vim-plug"
`curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim`
end
print_cyan "Checking if rg exists..."
if `which rg`.include? "not found"
print_red "Nope, installing rg (ripgrep)"
`brew install ripgrep`
else
print_green "You already have rg, awesome!"
end
print_cyan "Checking if zsh is installed"
if `which zsh`.include? "not found"
print_red "Nope, installing zsh"
`brew install zsh`
else
print_green "You already have zsh, awesome!"
end
print_cyan "Checking if oh-my-zsh is installed"
if File.exists? path("~/.oh-my-zsh")
print_green "You already have oh-my-zsh, awesome!"
else
print_red "Nope, installing oh-my-zsh"
`sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"`
end
print_cyan "Checking if honukai theme is installed"
if File.exists? path("~/.oh-my-zsh/themes/honukai.zsh-theme")
print_green "You already have honukai theme, awesome!"
else
print_red "Nope, installing honukai theme"
`wget -P ~/.oh-my-zsh/themes "https://raw.githubusercontent.com/oskarkrawczyk/honukai-iterm/master/honukai.zsh-theme"`
end
print_cyan "Copying .vimrc to ~/.vimrc"
`cp -i .vimrc ~/.vimrc`
print_cyan "Copying .gitconfig to ~/.gitconfig"
`cp -i .gitconfig ~/.gitconfig`
print_cyan "Copying .zsh-aliases to ~/.zsh-aliases"
`cp -i .zsh-aliases ~/.zsh-aliases`
if File.readlines(path("~/.zshrc")).grep(/zsh-aliases/).size == 0
print_cyan "Adding .zsh-aliases to ~/.zshrc"
`echo "source ~/.zsh-aliases" >> ~/.zshrc`
end