-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathinstall.rb
More file actions
35 lines (27 loc) · 795 Bytes
/
install.rb
File metadata and controls
35 lines (27 loc) · 795 Bytes
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
#!/usr/bin/env ruby
require 'fileutils'
puts 'Setting up vim...'
def link_with_check(old, new)
FileUtils.symlink(old, new)
rescue Errno::EEXIST
print "#{new} exists. Replace? (y/N) "
if $stdin.gets.chomp.casecmp? 'y'
puts "Replacing #{new}"
FileUtils.symlink(old, new, force: true)
else
puts "Skipping #{new}"
end
end
# start
HERE = File.dirname(__FILE__)
DOTVIM_DIR = '~/.vim'.freeze
%w[colors ftdetect ftplugin UltiSnips].each do |dir|
puts "Copying #{dir} into #{DOTVIM_DIR}..."
path = File.expand_path(dir, HERE)
FileUtils.copy_entry(path, File.expand_path(dir, DOTVIM_DIR))
end
%w[vimrc gvimrc ackrc vrapperrc gitignore_global].each do |name|
path = File.expand_path(name, HERE)
link_with_check(path, File.expand_path("~/.#{name}"))
end
puts 'done.'