Thor Not Using the Correct Ruby Version with Shell Commands

163 Views Asked by At

I have a rails project using ruby 2.3.1. OSX has 1.9.3 but I'm using rvm to manage rubies. The rails project has 2.3.1 specified in the gemfile and a .ruby-version dot-file.

Here's the problem: I am converting a rake task to a thor script. It performs some shell commands (specifically pg_dump -- I've tried others though) but finds the OSX ruby instead of the one the project uses.

I've tried running the script wrapped with bundle exec, and changing the ways I call out to the shell (backticks, run, and system) and no matter what is done, the following error is issued in stdout:

Your Ruby version is 1.9.3, but your Gemfile specified 2.3.1

I must have missed something in the documentation.

0

There are 0 best solutions below