Last active
July 6, 2016 06:21
-
-
Save jhonnymoreira/6f34bd2d63220de82350 to your computer and use it in GitHub Desktop.
Create symlink to your dotfiles
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'fileutils' | |
home = %x`echo $HOME`.gsub("\n", '') | |
dotfiles_path = home + '/dotfiles/' | |
# All the files to be filtered | |
exceptions = ['.', '..', '.git'] | |
# Filter directories such as '.' and '..' | |
dotfiles = Dir.glob(dotfiles_path + '.*').delete_if { |file| | |
exceptions.include?(file) | |
} | |
# Create the symlink for each file | |
dotfiles.each { |file| | |
FileUtils.ln_s(dotfiles_path + file, home + file) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment