mirror of
https://github.com/rbenv/ruby-build.git
synced 2025-01-01 14:44:48 +01:00
Automatically look for built-in definitions
This commit is contained in:
parent
db8d713917
commit
021280a3e1
1 changed files with 23 additions and 2 deletions
|
@ -2,6 +2,20 @@
|
|||
|
||||
set -e
|
||||
|
||||
abs_dirname() {
|
||||
local cwd="$(pwd)"
|
||||
local path="$1"
|
||||
|
||||
while [ -n "$path" ]; do
|
||||
cd "${path%/*}"
|
||||
local name="${path##*/}"
|
||||
path="$(readlink "$name" || true)"
|
||||
done
|
||||
|
||||
pwd
|
||||
cd "$cwd"
|
||||
}
|
||||
|
||||
install_package() {
|
||||
local cwd="$(pwd)"
|
||||
local package_name="$1"
|
||||
|
@ -96,12 +110,19 @@ usage() {
|
|||
}
|
||||
|
||||
|
||||
RUBY_BUILD_ROOT="$(abs_dirname "$0")/.."
|
||||
|
||||
DEFINITION_PATH="$1"
|
||||
if [ -z "$DEFINITION_PATH" ]; then
|
||||
usage
|
||||
elif [ ! -e "$DEFINITION_PATH" ]; then
|
||||
echo "ruby-build: definition not found: ${DEFINITION_PATH}" >&2
|
||||
exit 1
|
||||
BUILTIN_DEFINITION_PATH="${RUBY_BUILD_ROOT}/share/ruby-build/${DEFINITION_PATH}"
|
||||
if [ -e "$BUILTIN_DEFINITION_PATH" ]; then
|
||||
DEFINITION_PATH="$BUILTIN_DEFINITION_PATH"
|
||||
else
|
||||
echo "ruby-build: definition not found: ${DEFINITION_PATH}" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
PREFIX_PATH="$2"
|
||||
|
|
Loading…
Reference in a new issue