Add support for `GEM_HOME` and `GEM_PATH`

This should fix #657. Unfortunately I’m not versed in PHP unit testing proces (I’m front-end developer primarily) so I hope this won’t create any problems in merging this pull request. Please fell free to revise this pull request with any additions or fixes.
I’ve used similar process as in `BaseNodeFilter` so I suppose that would also need to be revised?