I have a gitmodules file like this:
[submodule "dotfiles/vim/bundle/cucumber"]
path = dotfiles/vim/bundle/cucumber
url = git://github.com/tpope/vim-cucumber.git
[submodule "dotfiles/vim/bundle/Command-T"]
path = dotfiles/vim/bundle/Command-T
url = git://github.com/vim-scripts/Command-T.git
What I want to do is to for each submodule get path and url as a hash or other structure which will keep data like:
submodule: cucumber (path -> ‘path’, url -> ‘url’)
How can I do it with regex? Or maybe there is more efficient way of parsing this kind of files?
This file format is something of a standard and so I imagine there is a gem or other code floating around that will parse it. On the other hand, it’s easy to parse and encapsulated little text problems like this are “the fun part” of development, so why not reinvent the wheel? It’s kind of like playing a game…