Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' of github.com:ddonahue/dotfiles

  • Loading branch information...
commit 9fb193600381783cafc7c76b9c30ea3eb80d87cc 2 parents 80c6d4a + 4c4b47c
@ddonahue authored
Showing with 12 additions and 5 deletions.
  1. +12 −5 link_dotfiles.rb
  2. BIN  zsh/.DS_Store
View
17 link_dotfiles.rb
@@ -1,13 +1,20 @@
#!/usr/bin/env ruby
# from http://errtheblog.com/posts/89-huba-huba
+dotfiles_dir = File.dirname(__FILE__)
+home_dir = File.expand_path('~')
-home = File.expand_path('~')
-dot_files = ['bash_profile','bashrc','bash', 'gvimrc', 'vimrc','gitconfig','git-completion.bash', 'zshrc', 'zsh']
+dotfiles = ['bash_profile','bashrc','gvimrc','vimrc','gitconfig','git-completion.bash','zshrc', 'bash', 'zsh']
-dot_files.each do |file|
- target = File.join(home, ".#{file}")
- `ln -s #{File.expand_path file} #{target}`
+dotfiles.each do |file|
+ source = File.expand_path(File.join(dotfiles_dir, file))
+ target = File.expand_path(File.join(home_dir, ".#{file}"))
+
+ if (File.directory?(source) && File.exist?(target))
+ File.delete(target)
+ end
+
+ `ln -s #{source} #{target}`
end
# git push on commit
View
BIN  zsh/.DS_Store
Binary file not shown
Please sign in to comment.
Something went wrong with that request. Please try again.