Skip to content

Commit

Permalink
Add -d, --dir option to install to <prefix>/<definition> instead of <…
Browse files Browse the repository at this point in the history
…prefix>

* Similar to ruby-install's -r, --rubies-dir flag.
  • Loading branch information
eregon committed Sep 23, 2024
1 parent ed384c8 commit 66d188a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions bin/ruby-build
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# --definitions List all local definitions, including outdated ones
# --version Show version of ruby-build
#
# -d, --dir Install the Ruby in <prefix>/<definition> instead of <prefix>
# -v, --verbose Verbose mode: forward all build output to stdout/stderr
# -p, --patch Apply a patch from stdin before building
# -k, --keep Do not remove source tree after installation
Expand Down Expand Up @@ -1358,6 +1359,7 @@ unset HAS_PATCH
unset IPV4
unset IPV6
unset EARLY_EXIT
unset APPEND_DEFINITION_TO_PREFIX

RUBY_BUILD_INSTALL_PREFIX="$(abs_dirname "$0")/.."

Expand All @@ -1378,6 +1380,9 @@ for option in "${OPTIONS[@]}"; do
"l" | "list")
EARLY_EXIT=list_maintained_versions
;;
"d" | "dir")
APPEND_DEFINITION_TO_PREFIX=true
;;
"k" | "keep" )
KEEP_BUILD_PATH=true
;;
Expand Down Expand Up @@ -1425,6 +1430,10 @@ if [ "${#EXTRA_ARGUMENTS[@]}" -gt 0 ]; then
RUBY_CONFIGURE_OPTS_ARRAY=("${EXTRA_ARGUMENTS[@]}")
fi

if [ "$APPEND_DEFINITION_TO_PREFIX" = "true" ]; then
PREFIX_PATH="$PREFIX_PATH/$(basename "$DEFINITION_PATH")"
fi

case "$EARLY_EXIT" in
help )
version
Expand Down

0 comments on commit 66d188a

Please sign in to comment.