chruby
chruby copied to clipboard
Auto switching does not work with latest release of elementary OS
Elementary comes with some setup in .bashrc
which sets up it's own hooks.
I've included the part of the .bashrc
where the hooks are setup, and added chruby_auto
in there as a workaround.
https://gist.github.com/AndrewVos/4ec760fbef47760547ba8e8e6a9958c2
preexec_functions
is a zsh special variable and doesn't work under bash unless there's a trap DEBUG setup which emulates that behavior.
(Might want to post output of echo $SHELL
)
Please paste the output of the bug_report.sh script so we can get some diagnostics.
@postmodern, thanks:
## System
Linux vos 4.4.0-47-generic #68-Ubuntu SMP Wed Oct 26 19:39:52 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
GNU bash, version 4.3.46(1)-release (x86_64-pc-linux-gnu) [/bin/bash]
ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-linux] [/home/vos/.rubies/ruby-2.3.3/bin/ruby]
Bundler version 1.13.6 [/home/vos/.gem/ruby/2.3.3/bin/bundle]
chruby version 0.3.9 [/usr/local/bin/chruby-exec]
## Environment
CHRUBY_VERSION=0.3.9
SHELL=/bin/bash
PATH=/home/andrew/Nim/bin:/usr/local/heroku/bin:/home/vos/gopath/bin:/home/vos/.gem/ruby/2.3.3/bin:/home/vos/.rubies/ruby-2.3.3/lib/ruby/gems/2.3.0/bin:/home/vos/.rubies/ruby-2.3.3/bin:/home/andrew/Nim/bin:/usr/local/heroku/bin:/home/vos/gopath/bin:/home/vos/bin:/home/vos/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/local/go/bin:/home/vos/dotfiles/scripts:/home/vos/dotfiles/git-scripts:/usr/local/go/bin:/home/vos/dotfiles/scripts:/home/vos/dotfiles/git-scripts
HOME=/home/vos
RUBIES=(/home/vos/.rubies/ruby-2.1.10 /home/vos/.rubies/ruby-2.3.1 /home/vos/.rubies/ruby-2.3.3)
RUBY_ROOT=/home/vos/.rubies/ruby-2.3.3
RUBY_VERSION=2.3.3
RUBY_ENGINE=ruby
RUBY_AUTO_VERSION=ruby-2.3.3
RUBYLIB=
RUBYOPT=
RUBYPATH=
RUBYSHELL=
GEM_ROOT=/home/vos/.rubies/ruby-2.3.3/lib/ruby/gems/2.3.0
GEM_HOME=/home/vos/.gem/ruby/2.3.3
GEM_PATH=/home/vos/.gem/ruby/2.3.3:/home/vos/.rubies/ruby-2.3.3/lib/ruby/gems/2.3.0
## Hooks
trap -- '' SIGTSTP
trap -- '' SIGTTIN
trap -- '' SIGTTOU
trap -- '[[ "$BASH_COMMAND" != "$PROMPT_COMMAND" ]] && chruby_auto' DEBUG
## .ruby-version
ruby-2.3.3
## Aliases
alias b='bundle exec'
alias ll='ls -ahlF --color=auto'
alias ls='ls -1 -G --color=auto'
@steakknife This is not bash.
Worth noting that there's a workaround in that gist I added ^
I am also having problems. I need to run exec bash all the time. chruby does not even recognize I have set a value to a .ruby-version file. First I need to exec shell or manually choose the ruby version I want to use.
Works fine on my Mac, though. I also am researching what is going on and started a stackexchange thread. https://elementaryos.stackexchange.com/questions/11439/i-need-to-run-exec-bash-to-accsess-jekyll-or-ruby-for-example
@danrabbit could lend a hand maybe?
@bigfatbird Have you tried my workaround?
@steakknife whoops just read my comment above... I meant to say "this is not zsh".
[~] ∞ echo $SHELL
/bin/bash
This also works as a workaround in .bashrc
preexec_functions+=(chruby_auto)