Skip to content
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

Optional auto-switching #8

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

estum
Copy link

@estum estum commented Apr 11, 2015

This commit provides the same workflow as chruby's auto.sh. When
auto.sh script loaded into environment, it makes gem_home to
automatically use a .ruby-gemhome to get project's $GEM_HOME path
(.ruby-gemhome filename is customizable by the $GEM_HOME_FILENAME
variable).

This commit provides the same workflow as chruby's auto.sh. When
`auto.sh` script loaded into environment, it makes gem_home to
automatically use a `.ruby-gemhome` to get project's `$GEM_HOME` path
(`.ruby-gemhome` filename is customizable by the `$GEM_HOME_FILENAME`
variable).
@postmodern
Copy link
Owner

One major problem with this is that you cannot have multiple traps on bash. It's also very difficult to get the current trap command and append to it.

}

if [[ -n "$ZSH_VERSION" ]]; then
if [[ ! "$preexec_functions" == *chruby_auto* ]]; then

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be

if [[ ! "$preexec_functions" == *gem_home_auto* ]]; then

@calebhearth
Copy link

@postmodern Would it be possible to detect the chruby auto switching here and set up a trap that does both things? Likewise in chruby's auto we could detect the gem_home auto behavior and set up the trap.

if bash
  if $USING_CHRUBY_AUTO
    trap gem_home and chruby stuff
  else
    trap gem_home stuff
  end
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants