postmodern / chruby

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

chruby is reset after cd from a directory with .ruby-version #293

Closed plutino closed 9 years ago

plutino commented 9 years ago

Not sure if this is to be expected, but this is the scenario that causes us trouble:

start at a directory containing a .ruby-version file; explicitly change Ruby version by chruby 2.1.2; cd to working directory cd /path/to/work; Ruby version is no longer set.

An easy work around is to cd before chruby, although it's awkardly inconvenient for us. I'm wondering if it's better to keep previous version if no .ruby-version file is found in the tree.

adeluccar commented 9 years ago

I can confirm a similar scenario:

$ ruby -v
> ruby 2.1.3 # (set as system default through bashrc file with chruby)
$ cd dir_with_ruby_version_file
$ ruby -v
> ruby 2.1.1
$ cd ..
$ ruby -v
> ruby 2.0.0 # (system ruby)

I have no clue what could be causing this but this pretty much defeats the purpose of chruby. Yosemite 10.10

adeluccar commented 9 years ago

Noticed my scenario is a duplicate of #184 Provisional workaround: https://github.com/postmodern/chruby/issues/184#issuecomment-21380629]

postmodern commented 9 years ago

Yep, this is unfortunately well known behavior.