Skip to content

Instantly share code, notes, and snippets.

@timjb
Created January 16, 2011 01:02
Show Gist options
  • 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