Skip to content

Instantly share code, notes, and snippets.

@jonasb
Created July 16, 2011 09:11
Show Gist options
  • Save jonasb/1086189 to your computer and use it in GitHub Desktop.
Save jonasb/1086189 to your computer and use it in GitHub Desktop.
My dotfiles install script
#!/usr/bin/env ruby
# update git submodules
`git submodule init && git submodule update`
# update symlinks
# inspired by http://errtheblog.com/posts/89-huba-huba
home = File.expand_path('~')
Dir['*'].each do |file|
next if file =~ /install/
target = File.join(home, ".#{file}")
if File.exists? target then
if File.symlink? target then
puts "Skipping .#{file} (already installed)"
else
puts "Skipping .#{file} (already exists)"
end
next
end
puts "Installing .#{file}"
`ln -s #{File.expand_path file} #{target}`
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment