Skip to content

Commit

Permalink
Merge pull request jf#14 from traviscline/master
Browse files Browse the repository at this point in the history
RBENV_GEMSET_FILE env var support
  • Loading branch information
jamis committed Oct 24, 2011
2 parents e37836b + a50c8da commit 63827e5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
3 changes: 3 additions & 0 deletions README.mkd
Expand Up @@ -32,6 +32,9 @@ The gemset plugin will cause rbenv to search for the `.rbenv-gemsets` file in
the current directory, as well as in all ancestor directories, so as long
as there is an `.rbenv-gemsets` file at or above the current directory.

Alternatively, you can set the RBENV_GEMSET_FILE environment variable to the
absolute path of the gemset file.


## License

Expand Down
24 changes: 16 additions & 8 deletions libexec/rbenv-gemset-file
@@ -1,12 +1,20 @@
#!/usr/bin/env bash
set -e

root="$(pwd)"
while [ -n "$root" ]; do
if [ -e "${root}/.rbenv-gemsets" ]; then
echo "${root}/.rbenv-gemsets"
exit
fi
root="${root%/*}"
done
if [ -z "$RBENV_GEMSET_FILE" ]; then
root="$(pwd)"
while [ -n "$root" ]; do
if [ -e "${root}/.rbenv-gemsets" ]; then
RBENV_GEMSET_FILE="${root}/.rbenv-gemsets"
break
fi
root="${root%/*}"
done
fi

if [ -e "$RBENV_GEMSET_FILE" ]; then
echo "$RBENV_GEMSET_FILE"
exit
fi

exit 1

0 comments on commit 63827e5

Please sign in to comment.