availability: January 2017
I've become a big fan of homebrew package system on Macosx. I moved away from macports because it allows me to easily change the way packages are compiled: sometimes I need experimental versions of software or versions that are not in macports yet. Instead of compiling them in a separate place, I can now create my own formulas and still use the repository in case I need it: this is made possible because it's all based on git and allows you to merge your changes even if upstream packages get updated.
Enough raving about homebrew now. I'm currently exploring Puppet , it has builtin support for macports (or as it calls it darwinports) but not for my new love. I guess it was the perfect excuse to write my own provider.
On the puppet wiki I found a document describing in generic terms what you need to do to write a custom provider. It's probably me, but I didn't get it when I read. Therefore I dug into the code of other providers. I found the gem provider most useful, but that's probably because I'm familiar with the gem command and output to see how it works.
It will only work in new versions of puppet as it uses the new directory structure lib/puppet instead of lib/plugins. There was one gotcha for me. I assumed that I needed to put my provider, well in the directory modulename/puppet/provider/ . It turns out that you need to put it in a subdirectory of the type your are implementing the provider for : module/puppet/provider/package in my case.
Code is up on github : https://github.com/jedi4ever/puppet-homebrew .
I hope one day, this provider gets into the main puppet provider list :)