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

Allow RUBIES to contain dir globs that are expanded on each run #217

Open
postmodern opened this issue Oct 20, 2013 · 5 comments
Open

Allow RUBIES to contain dir globs that are expanded on each run #217

postmodern opened this issue Oct 20, 2013 · 5 comments
Assignees
Milestone

Comments

@postmodern
Copy link
Owner

Allow RUBIES to contain dir glob strings ("$HOME/.rubies/*") which are expanded as chruby iterates over RUBIES. This would allow chruby to see rubies that were just installed into ~/.rubies/.

Example Code

RUBIES=("/opt/rubies/*" "$HOME/.rubies/*")

for ruby in ${RUBIES[@]}; do
    echo "Testing: $ruby"
    if [[ -d "$ruby" ]] && [[ "$ruby" == *$1* ]]; then
        echo "Found: $ruby"
        exit
    fi
done
@ghost ghost assigned postmodern Oct 20, 2013
@postmodern
Copy link
Owner Author

Inspired by #212.

@postmodern
Copy link
Owner Author

Of course this will misbehave if $HOME contains spaces.

@mpapis
Copy link
Contributor

mpapis commented Oct 21, 2013

this should work https://gist.github.com/mpapis/7ffdd6e97533f92a5cff you could shorten the read lines code:

__chruby_get_dirs()
{
  # NEW LINE, BE CAREFUL
  typeset IFS="
"
  __dirs=( $( \cat - ) )
}

@aprescott
Copy link

@postmodern does @mpapis's approach avoid the keyword splitting problem you were facing?

@postmodern
Copy link
Owner Author

@aprescott sort of, but I want to keep $RUBIES an explicit list of directories until 1.0.0.

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

No branches or pull requests

3 participants