-
Notifications
You must be signed in to change notification settings - Fork 0
/
install
95 lines (81 loc) · 2.33 KB
/
install
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
84
85
86
87
88
89
90
91
92
93
94
95
#!/usr/bin/env ruby
OFFSET = 70
def operation(op, &block)
if op.length < OFFSET
print op + (' ' * (OFFSET - op.length))
else
print op
end
result, msg = yield
case result
when :skipped
print "\033[33m SKIPPED \033[0m\n"
when :success
print "\033[32m SUCCESS \033[0m\n"
when :failed
print "\033[31m FAILED \033[0m\n"
puts msg if msg
end
end
operation('Set lang:') do
system('sudo languagesetup -langspec English 2>&1 >/dev/null')
$? == 0 ? :success : :failed
end
operation('Clone oh-my-zsh:') do
if File.exists?("#{ENV['HOME']}/.oh-my-zsh")
:skipped
else
`git clone https://github.com/robbyrussell/oh-my-zsh.git #{ENV['HOME']}/.oh-my-zsh`
$? == 0 ? :success : :failed
end
end
%w[zshrc npmrc bundlerrc Brewfile pryrc gitignore_global gitconfig config].each do |sym|
operation("Create symlink ~/.#{sym}:") do
if File.exists?("#{ENV['HOME']}/.#{sym}")
:skipped
else
`ln -s #{ENV['HOME']}/.dotfiles/#{sym} #{ENV['HOME']}/.#{sym}`
$? == 0 ? :success : :failed
end
end
end
operation('Create symlink ~/.vim:') do
if File.exists?("#{ENV['HOME']}/.vim")
:skipped
else
`ln -s #{ENV['HOME']}/.config/nvim #{ENV['HOME']}/.vim 2>&1 >/dev/null`
$? == 0 ? :success : :failed
end
end
operation('Create symlink ~/.vimrc:') do
if File.exists?("#{ENV['HOME']}/.vimrc")
:skipped
else
`ln -s #{ENV['HOME']}/.config/nvim/init.vim #{ENV['HOME']}/.vimrc 2>&1 >/dev/null`
$? == 0 ? :success : :failed
end
end
operation('Run brew bundle:') do
output = `brew bundle install --global`
$? == 0 ? :success : [:failed, output]
end
operation('Install plug.vim:') do
if File.exists?("#{ENV['HOME']}/.config/nvim/autoload/plug.vim")
:skipped
else
system("curl -fLo #{ENV['HOME']}/.config/nvim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim 2>&1 >/dev/null")
$? == 0 ? :success : :failed
end
end
operation('Install neovim for python2:') do
`pip2 install --upgrade neovim 2>&1 >/dev/null`
$? == 0 ? :success : :failed
end
operation('Install neovim for python3:') do
`pip3 install --upgrade neovim 2>&1 >/dev/null`
$? == 0 ? :success : :failed
end
operation('Perform PlugInstall for neovim:') do
system('nvim -c "execute \"PlugInstall\" | qa" 2>&1 >/dev/null')
$? == 0 ? :success : :failed
end