-
Notifications
You must be signed in to change notification settings - Fork 0
/
install
executable file
·36 lines (35 loc) · 1.19 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
#!/usr/bin/env ruby
# encoding: UTF-8
# rubocop:disable LineLength
require 'fileutils'
begin
home_dir = File.expand_path '~'
current_dir = Dir.pwd
puts 'Installing dotfiles …'
FileUtils.mkdir_p "#{home_dir}/.ssh"
dot_files = %w(bash_aliases bash_profile gemrc gitconfig gitignore irbrc railsrc rubocop.yml svgo.yml ssh/config)
dot_files.each do |dot_file|
path = "#{home_dir}/.#{dot_file}"
real = "#{current_dir}/#{dot_file}"
if File.exists?(path)
puts " #{path} already exists as a #{File.symlink?(path) ? 'symlink' : 'file'}."
else
puts " Creating symlink for #{real} at #{path}"
File.symlink(real, path)
end
end
FileUtils.mkdir_p "#{home_dir}/bin"
bin_files = %w{ginit git-create-server-repo git-wtf claim rm_bom file_to_base64 base64_to_file rubyloc}
bin_files.each do |bin_file|
path = "#{home_dir}/bin/#{bin_file}"
real = "#{current_dir}/bin/#{bin_file}"
if File.exists?(path)
puts " #{path} already exists as a #{File.symlink?(path) ? 'symlink' : 'file'}."
else
puts " Creating symlink for #{real} at #{path}"
File.symlink(real, path)
end
end
rescue NotImplementedError => nie
STDERR.puts nie.message
end