Skip to content

Commit

Permalink
add uninstall to rakefile
Browse files Browse the repository at this point in the history
  • Loading branch information
Colin Rymer authored and Colin Rymer committed Oct 28, 2011
1 parent 54f576d commit 864bb4c
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
11 changes: 10 additions & 1 deletion README.markdown
Expand Up @@ -9,11 +9,20 @@ This is my collection of dotfiles, as inspired by Zack Holman, Ryan Bates, Eric
To install, you must have rake installed on your machine. You can test for rake with the command `rake -V`. RVM is highly recommended.

1. `git clone git@github.com:crymer11/dotfiles.git ~/.dotfiles`
2. `cd .dotfiles`
2. `cd ~/.dotfiles`
3. `rake install`

Any files ending in ".symlink" will be appropriately linked in the home directory (files beginning with a "." will not be symlinked).

### uninstall

To uninstall this setup:

1. `cd ~/.dotfiles`
2. `rake uninstall`

All the symlinks created by `rake install` will be removed and any backups made during the installation will be replaced.

## ooh, secrets

The .gitignore file includes a line that ignores anything in a "secrets" directory. I use this to store anything private.
Expand Down
17 changes: 17 additions & 0 deletions Rakefile
Expand Up @@ -32,4 +32,21 @@ task :install do
`ln -s "$PWD/#{linkable}" "#{target}"`
end
end

task :uninstall do

Dir.glob('**/*.symlink').each do |linkable|

file = linkable.split('/').last.split('.symlink').last
target = "#{ENV["HOME"]}/.#{file}"

if File.symlink?(target)
FileUtils.rm(target)
end
if File.exists?("#{ENV["HOME"]}/.#{file}.backup")
`mv "$HOME/.#{file}.backup" "$HOME/.#{file}"`
end
end

end
task :default => 'install'

0 comments on commit 864bb4c

Please sign in to comment.