Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 99035a4
Showing
8 changed files
with
139 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
command="$1" | ||
if [ -z "$command" ]; then | ||
echo "rbenv 0.1.0" >&2 | ||
|
||
else | ||
command_path="$(command -v "rbenv-$command" || true)" | ||
if [ -z "$command_path" ]; then | ||
echo "rbenv: no such command \`$command'" >&2 | ||
exit 1 | ||
fi | ||
|
||
shift 1 | ||
exec "$command_path" $* | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
RBENV_COMMAND="$1" | ||
if [ -z "$RBENV_COMMAND" ]; then | ||
echo "usage: rbenv exec COMMAND [arg1 arg2...]" >&2 | ||
exit 1 | ||
fi | ||
|
||
RBENV_COMMAND_PATH="$(rbenv-which "$RBENV_COMMAND")" | ||
|
||
shift 1 | ||
exec -a "$RBENV_COMMAND" "$RBENV_COMMAND_PATH" $* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
cd "$HOME/.rbenv/shims" | ||
rm * | ||
|
||
for file in ../versions/*/bin/*; do | ||
ln -fs ../bin/rbenv-shim "${file##*/}" | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
|
||
RBENV_VERSION="$1" | ||
if [ -z "$RBENV_VERSION" ]; then | ||
echo "usage: rbenv set-default VERSION" >&2 | ||
exit 1 | ||
fi | ||
|
||
RBENV_VERSION_PATH="${HOME}/.rbenv/versions/${RBENV_VERSION}" | ||
if [ ! -d "$RBENV_VERSION_PATH" ]; then | ||
echo "rbenv: version \`${RBENV_VERSION}' not installed" >&2 | ||
exit 1 | ||
fi | ||
|
||
echo "$RBENV_VERSION" > "${HOME}/.rbenv/default" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
exec rbenv-exec "${0##*/}" $* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
read_version_file() { | ||
egrep -m 1 '[^[:space:]]' "$1" | ||
} | ||
|
||
find_version_file() { | ||
root="$(pwd)" | ||
while [ -n "$root" ]; do | ||
if [ -e "${root}/.rbenv-version" ]; then | ||
echo "${root}/.rbenv-version" | ||
return 0 | ||
fi | ||
root="${root%/*}" | ||
done | ||
return 1 | ||
} | ||
|
||
find_default_version_file() { | ||
default_path="$HOME/.rbenv/default" | ||
if [ -e "$default_path" ]; then | ||
echo "$default_path" | ||
return 0 | ||
fi | ||
return 1 | ||
} | ||
|
||
if [ -z "$RBENV_VERSION" ]; then | ||
RBENV_VERSION_FILE="$(find_version_file || find_default_version_file || true)" | ||
|
||
if [ -n "$RBENV_VERSION_FILE" ]; then | ||
RBENV_VERSION="$(read_version_file "$RBENV_VERSION_FILE")" | ||
else | ||
echo "rbenv: no default version specified" >&2 | ||
exit 1 | ||
fi | ||
fi | ||
|
||
RBENV_VERSION_PATH="${HOME}/.rbenv/versions/${RBENV_VERSION}" | ||
|
||
if [ -d "$RBENV_VERSION_PATH" ]; then | ||
echo "$RBENV_VERSION" | ||
else | ||
echo "rbenv: version \`$RBENV_VERSION' is not installed" >&2 | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
|
||
RBENV_VERSION="$(rbenv-version)" | ||
|
||
for path in ~/.rbenv/versions/*; do | ||
if [ -d "$path" ]; then | ||
version="${path##*/}" | ||
|
||
if [ "$version" == "$RBENV_VERSION" ]; then | ||
echo "* ${version##*/}" | ||
else | ||
echo " ${version##*/}" | ||
fi | ||
fi | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
RBENV_VERSION="$(rbenv-version)" | ||
RBENV_COMMAND="$1" | ||
RBENV_COMMAND_PATH="${HOME}/.rbenv/versions/${RBENV_VERSION}/bin/${RBENV_COMMAND}" | ||
|
||
if [ -x "$RBENV_COMMAND_PATH" ]; then | ||
echo "$RBENV_COMMAND_PATH" | ||
else | ||
echo "rbenv: $1: command not found" >&2 | ||
exit 127 | ||
fi |