-
-
Notifications
You must be signed in to change notification settings - Fork 190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optionally support auto-switching #40
Comments
|
also consider using http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/x264.html instead to avoid |
|
I assume you'd do something like |
|
I think yes, to speed up you can do: |
|
👍 |
* This has the added benefit of detecting a new .ruby-version after a `git pull` or `echo "1.9" > .ruby-version`.
|
Now using |
|
Can't wait for it! |
|
Coming in 0.3.0. But first I need to release 0.2.5, with a brand new |
* Due to PROMPT_COMMAND and precmd not being called in non-interactive mode, I had to explicitly call chruby_auto after every cd invocation.
|
just added rvm/rvm#1388 - works great |
|
Just commented on one of the tests. |
|
Copy/pasting my comment so no one missing it. To avoid ascending each directory in search of a .ruby-version (I assume this would degrade performance) after every command, I decided to require the user cd into the project root. Thoughts? |
|
descending directories should not have any impact on performance, unix/linux does cache filesystem calls, so first call to a new directory might be slightly slower (like double disk seek time) but otherwise it's fast - tested it with RVM - you do not see the difference |
|
Alright, I will add an ascending search for |
|
OK, I think I covered all the edge-cases. Please review. |
|
That said; I couldn't figure out how this protects from infinitely looping once |
|
|
|
Realized that the current implementation will not allow overriding the |
|
I do not thinks so, it's quite important to allow switching to something else, especially to try other rubies with your project |
|
Next question, if a user explicitly selects a Ruby, should entering a project with a |
|
I would want entering the directory to set it to the version in |
|
Ah, my mistake. Due to the |
|
I think I'd like to suggest (And since this is the first time I've popped up on the project; thanks for making chruby, I switched a few days ago and have been really enjoying it.) |
|
Isn't |
|
|
|
I do agree that the name |
|
I was totally unaware that was a shared standard, that's wonderful. I retract my suggestion. :) |
* This allows existing PROMPT_COMMANDs to check $?, before chruby_auto is invoked.
|
I'm with @mpapis on ability to override version specified in .ruby-version with call to chruby. That's not uncommon use-case. |
|
What should
|
|
@wilmoore I think it should be still what user picked in second step |
In the above scenario, when the user did |
|
Here's an example of the current behaviour: [hal@tank ronin]$ pwd /vault/1/code/ronin [hal@tank ronin]$ cat ronin/.ruby-version 1.9 [hal@tank ronin]$ cd ronin [hal@tank ronin]$ chruby jruby-1.7.0 rubinius-2.0.0-rc1 * ruby-1.9.3-p327 [hal@tank ronin]$ cd lib [hal@tank lib]$ chruby jruby-1.7.0 rubinius-2.0.0-rc1 * ruby-1.9.3-p327 [hal@tank lib]$ chruby rubinius [hal@tank lib]$ chruby jruby-1.7.0 * rubinius-2.0.0-rc1 ruby-1.9.3-p327 [hal@tank lib]$ cd ronin/ui/cli/ [hal@tank cli]$ chruby jruby-1.7.0 * rubinius-2.0.0-rc1 ruby-1.9.3-p327 [hal@tank cli]$ cd ../../../../ [hal@tank ronin]$ pwd /vault/1/code/ronin/ronin [hal@tank ronin]$ chruby jruby-1.7.0 * rubinius-2.0.0-rc1 ruby-1.9.3-p327 [hal@tank ronin]$ cd .. [hal@tank ronin]$ chruby jruby-1.7.0 rubinius-2.0.0-rc1 ruby-1.9.3-p327 |
|
Appears to work as requested. |
|
Without further ado, merging this into 0.3.0 branch. |
|
Merged. Any pre-release comments/commits should be directed towards the 0.3.0 branch. |
|
This has been released in 0.3.0. |
Many users have requested the ability to automatically switch to a Ruby when entering a directory which contains a
.ruby-versionfile. While in the directory and all sub-directories, the Ruby should remain set. Only when the user ascends the directory containing the.ruby-versionfile should chruby switch back to system Ruby.This feature is optional and would be enabled by loading
/usr/local/share/chruby/auto.sh.The text was updated successfully, but these errors were encountered: