Replace native 'which' with Ruby version.

Courtesy of http://stackoverflow.com/questions/2108727/which-in-ruby-checking-if-program-exists-in-path-from-ruby.