Automatically look for built-in definitions

This commit is contained in:
Sam Stephenson 2011-08-07 12:36:08 -05:00
parent db8d713917
commit 021280a3e1

View file

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