Created
March 19, 2010 09:15
-
-
Save aereal/337371 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# | |
# usage: | |
# $ git clone git://github.com/motemen/git-vim.git git-vim | |
# $ ruby vsm.rb git-vim/ | |
VIMDIR = '~/.vim' | |
SRCDIR = ARGV[0] | |
require 'pathname' | |
require 'fileutils' | |
include FileUtils::Verbose | |
vimdirs = %w( | |
after | |
autoload | |
colors | |
compilers | |
dict | |
ftdetect | |
ftplugin | |
indent | |
keymap | |
lang | |
macros | |
plugin | |
spell | |
syntax | |
tools | |
tutor | |
) | |
vimdir, srcdir = *[VIMDIR, SRCDIR].map {|i| Pathname.new(i).expand_path } | |
[vimdir, srcdir].each {|i| i.mkpath } | |
def link(src, dst) | |
dst.parent.mkpath unless dst.parent.exist? | |
dst.delete if dst.symlink? || dst.file? | |
ln_sf src.to_s, dst.to_s | |
end | |
vimdirs.map {|i| vimdir + i }.each do |i| | |
next unless (working = srcdir + i).directory? | |
working.mkpath | |
working.children.each do |entry| | |
link(entry, i + entry.basename) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment