-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall.rb
executable file
·34 lines (29 loc) · 895 Bytes
/
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
#!/usr/bin/env ruby
$mydir = File.expand_path(File.dirname(__FILE__))
$files = %w{zshrc zsh_aliases zshenv vimrc gvimrc vim tmux.conf gitconfig ruby editorconfig npmrc}
$extensions = %w{osx linux}
def link(file)
filepath = File.join($mydir, file)
if File.exist?(filepath)
home_file = File.join(Dir::home, ".#{file}")
if File.exist?(home_file)
unless File.realpath(home_file) == File.realpath(filepath)
puts "WARNING: Not overwriting #{home_file}"
end
else
`ln -s #{filepath} #{home_file}`
end
end
end
# Main
$files.each do |file|
all_ext = [ '' ] + $extensions.collect { |e| ".#{e}" }
all_ext.each do |ext|
link file + ext
end
end
# Color setup
puts 'Make sure to set up the correct color reporting in the terminal!'
puts ' May need to change the command to `env TERM=xterm-256color /bin/zsh`'
# Vim setup
system('./setup_vim.sh')