commit 5566363a9603aa7210c43a51a6050cd1aa88fece parent d37b76c2c520961555ca61a9ea6a7838a136659e Author: Xiaodong Xu <[email protected]> Date: Tue Apr 17 21:51:53 +0800 Support backup original files Diffstat:
_vim/_vim | | | 2 | ++ |
vimenv | | | 10 | ++++++++-- |
diff --git a/_vim/_vim b/_vim/_vim @@ -0,0 +1 @@ +/home/xiaodong/code/vimenv/_vim+ \ No newline at end of file diff --git a/vimenv b/vimenv @@ -5,7 +5,7 @@ # author: Xu Xiaodong <[email protected]> # license: GPL # created: 2012 Apr 14 -# modified: 2012 Apr 16 +# modified: 2012 Apr 17 # require 'fileutils' @@ -16,6 +16,12 @@ def init conf.each do |item| orig = Dir.pwd + '/_' + item target = Dir.home + '/.' + item + bak = target + '.bak' + + if File.exist?(target) && ! File.symlink?(target) + puts "Backuping #{target} to #{bak}" + FileUtils.mv(target, bak) + end puts "Symlinking #{orig} to #{target}" FileUtils.symlink(orig, target, force: true) @@ -38,7 +44,7 @@ def add(author_slash_name) end def remove(name) - path = '_vim/bundle/' + name + path = '_vim/bundle/' + name.downcase files = [".git/config", ".gitmodules"] puts "Removing #{path}"