Fix puppet loadpath related issues.

* Add support for Rubygems in 1.8.7.
* Use pathname work around for #14073.