Skip to content

Instantly share code, notes, and snippets.

@timjb
Created January 16, 2011 01:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timjb/781435 to your computer and use it in GitHub Desktop.
Save timjb/781435 to your computer and use it in GitHub Desktop.
PATH = ".vim/bundle"
def github_url(user, repo)
"http://github.com/#{user}/#{repo}.git"
end
def sh(cmd)
print cmd
system cmd
end
submodules = [
'tpope/vim-speeddating', # Short syntax for GitHub repos
'https://github.com/ecomba/vim-ruby-refactoring.git' # Long URL
]
submodules = submodules.map do |url|
if match = url.match(/^([0-9a-zA-Z._-]+)\/([0-9a-zA-Z._-]+)$/)
# Expand short syntax
github_url(match[1], match[2])
else
url
end
end
submodules.each do |url|
name = url.match(/\/([0-9a-zA-Z._-]+)\.git$/)[1]
sh "git submodule add #{url} #{File.join(PATH, name)}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment