0

I am running within a Ruby script (a Vagrantfile, specifically) and I want to invoke another ruby executable (berks installed against system ruby, specifically). I know I can do something like

PATH=/usr/bin GEM_PATH=/var/lib/ruby/1.9.1 berks ...

But, that's not very portable. (Different machines will need different GEM_PATH, for instance). So, how can I invoke a script installed against a different Ruby environment from within a Ruby script?

Rob Kinyon
  • 1,770
  • 2
  • 19
  • 28

1 Answers1

2

Well, the task at hand sounds not-very-portable, since its entire reason for being is a system-specific quirk of different Rubies being installed in different places. Not all systems will even have those specific Ruby versions.

It sounds to me like your best bet would probably be to allow the user to set certain environment variables (I dunno, $BERKS_SUBRUBY_PATH or something) and use those if they are set. That way anyone who needs to use the workaround has an easy way to do so, but you're not forcing everybody to have the same system config.

Chuck
  • 234,037
  • 30
  • 302
  • 389