mirror of
https://github.com/rbenv/ruby-build.git
synced 2025-10-22 13:50:33 +02:00
Auto-discovery of build definitions from rbenv plugins
The `share/ruby-build/` directory from each rbenv plugin, if it exists, is added to RUBY_BUILD_DEFINITIONS automatically during `rbenv install`.
This commit is contained in:
parent
6847c47274
commit
78bc84660b
2 changed files with 29 additions and 0 deletions
|
@ -162,6 +162,15 @@ if [ -z "${RUBY_BUILD_CACHE_PATH}" ] && [ -d "${RBENV_ROOT}/cache" ]; then
|
|||
export RUBY_BUILD_CACHE_PATH="${RBENV_ROOT}/cache"
|
||||
fi
|
||||
|
||||
# Add `share/ruby-build/` directory from each rbenv plugin to the list of
|
||||
# paths where build definitions are looked up.
|
||||
shopt -s nullglob
|
||||
for plugin_path in "$RBENV_ROOT"/plugins/*/share/ruby-build; do
|
||||
RUBY_BUILD_DEFINITIONS="${RUBY_BUILD_DEFINITIONS}:${plugin_path}"
|
||||
done
|
||||
export RUBY_BUILD_DEFINITIONS
|
||||
shopt -u nullglob
|
||||
|
||||
# Default RBENV_VERSION to the globally-specified Ruby version. (The
|
||||
# REE installer requires an existing Ruby installation to run. An
|
||||
# unsatisfied local .ruby-version file can cause the installer to
|
||||
|
|
|
@ -73,3 +73,23 @@ OUT
|
|||
|
||||
unstub ruby-build
|
||||
}
|
||||
|
||||
@test "no build definitions from plugins" {
|
||||
assert [ ! -e "${RBENV_ROOT}/plugins" ]
|
||||
stub_ruby_build 'echo $RUBY_BUILD_DEFINITIONS'
|
||||
|
||||
run rbenv-install 2.1.2
|
||||
assert_success ""
|
||||
}
|
||||
|
||||
@test "some build definitions from plugins" {
|
||||
mkdir -p "${RBENV_ROOT}/plugins/foo/share/ruby-build"
|
||||
mkdir -p "${RBENV_ROOT}/plugins/bar/share/ruby-build"
|
||||
stub_ruby_build "echo \$RUBY_BUILD_DEFINITIONS | tr ':' $'\\n'"
|
||||
|
||||
run rbenv-install 2.1.2
|
||||
assert_success <<OUT
|
||||
${RBENV_ROOT}/plugins/bar/share/ruby-build
|
||||
${RBENV_ROOT}/plugins/foo/share/ruby-build
|
||||
OUT
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue