lib/myosx/dotfiles.rb in myosx-0.2.4 vs lib/myosx/dotfiles.rb in myosx-0.2.5

- old
+ new

@@ -30,17 +30,17 @@ def link(file, dest) dest = File.expand_path(dest) raise "#{file} doesn't exist! Check your config or repo" unless File.exist?(file) + if File.symlink?(dest) + File.delete(dest) + end + if File.exist?(dest) backup_file = "#{dest}.#{Date.today.to_s}" puts "Creating backup of #{dest} called: #{backup_file}" File.rename(dest, backup_file) - end - - if File.symlink?(dest) - File.delete(dest) end puts "Linking #{file} to #{dest}" File.symlink(file, dest) end