Skip to content

Commit

Permalink
added 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 89892f2 commit 88d869c
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,25 @@ 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}"

# Remove all symlinks created during installation
if File.symlink?(target)
FileUtils.rm(target)
end

# Replace any backups made during installation
if File.exists?("#{ENV["HOME"]}/.#{file}.backup")
`mv "$HOME/.#{file}.backup" "$HOME/.#{file}"`
end

end
end

task :default => 'install'

0 comments on commit 88d869c

Please sign in to comment.