3

Given two directories: /a and /b

And /a/.ruby-version has 2.0.0-p353

And /b/.ruby-version has jruby-1.7.9

And the following /a/Procfile

a: ruby --version
b: sh -c 'cd /b && ruby --version'

When I cd /a and run foreman run b

Then I should see jruby 1.7.9 .. etc but instead I see 2.0.0-p353

Jared Beck
  • 16,796
  • 9
  • 72
  • 97

1 Answers1

2

With the proper sudo permisions, you can do:

b: sudo -u $USER bash -l -c "cd /b && ruby --version"

It's the safest way I know of.

Juan Ibiapina
  • 300
  • 2
  • 7
  • Thanks for the idea but it didn't work for me. It outputs my system ruby version, *not* the version specified by `/b/.ruby-version`. – Jared Beck Feb 28 '14 at 17:45
  • I have just tested it and it works again. Maybe you've got a different problem preventing it from working? – Juan Ibiapina Mar 13 '14 at 12:51