Skip to content

Optional auto-switching#8

Open
estum wants to merge 2 commits into
postmodern:masterfrom
estum:auto-switching
Open

Optional auto-switching#8
estum wants to merge 2 commits into
postmodern:masterfrom
estum:auto-switching

Conversation

@estum

@estum estum commented Apr 11, 2015

Copy link
Copy Markdown

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
Copy Markdown
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.

Comment thread share/gem_home/auto.sh

Copy link
Copy Markdown

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
Copy Markdown

@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.

4 participants