Yeah, that's the only way I'm aware of. The code is only a few lines,
and we have a pe_gem example:
https://github.com/puppetlabs/puppetlabs-pe_gem
The bigger problem is you can't have duplicate package names, so you
either need to two environments or separate manifests if you wish to
manage the same gems in 1.8.7 and 1.9. There's no way to install in
one puppet run at the moment.
Thanks,
Nan