postmodern / chruby

Changes the current Ruby
MIT License
2.85k stars 190 forks source link

GEM_HOME and GEM_PATH not set #365

Closed mustmodify closed 7 years ago

mustmodify commented 7 years ago

I have an upstart script which starts puma. For unfortunate reasons, I just had to reinstall my OS. This previously worked and now it doesn't. Seems like chruby isn't setting GEM_HOME and GEM_PATH.

upstart and related script environment differences

If I add the following right above bundle exec puma it succeeds.

So I have a workaround -- setting those variables -- but it's obviously going to be high maintenance, and confusing whenever I change Ruby versions. Can you help me to understand what's happening?

see also https://github.com/postmodern/chruby/issues/236

skull-squadron commented 7 years ago

I also had this problem early on. You gotta use /path/to/chruby-exec {{ruby-engine}}-{{ruby-version}} -- bin/bundle exec puma... in a script/non-interactive use, because chruby is a shell function and chruby-auto uses interactive shell hooks, they're not real executables. (chruby-exec is a wrapper runner around chruby)

mustmodify commented 7 years ago

Thanks for the note. That's an issue for me because I'd like to be able to change the .ruby-version file and have the script continue to work.... I guess I could add some cat /path/to/.ruby-version stuff...