Skip to content

Instantly share code, notes, and snippets.

@amcaplan
Created July 3, 2017 18:58
Show Gist options
  • Save amcaplan/da7a865036a746ada18ac7488c177198 to your computer and use it in GitHub Desktop.
Save amcaplan/da7a865036a746ada18ac7488c177198 to your computer and use it in GitHub Desktop.
.gitmodules generation script
# Assumes all your submodules are accessed via SSH, not HTTPS
template = <<-TEMPLATE
[submodule "%{submodule}"]
path = vim/.vim.symlink/bundle/%{submodule}
url = %{submodule_url}
ignore = dirty
TEMPLATE
puts Dir.foreach('.').reject { |i| %w(. .. script.rb).include? i }.map { |dir|
template % { submodule: dir, submodule_url: `cd #{dir} && git remote -v | grep -o 'git.*git' | head -1`.strip }
}.join
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment