Automatically load RVM if available or needed

When deploying to remotes that use RVM, the /etc/profile.d/rvm.sh environment is not automatically loaded. In the past we have simply edited the post-receive hook by hand, but it seems it would be nice to automatically do so if the user is in the rvm group and the /etc/profile.d/rvm.sh script exists.
Is `groups` guaranteed to be cross-platform?