Skip to content

Commit b4b1dd2

Browse files
authored
Enable shellcheck parsing of ruby-build source (#2268)
1 parent d9af2ad commit b4b1dd2

File tree

2 files changed

+138
-82
lines changed

2 files changed

+138
-82
lines changed

bin/rbenv-install

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,19 +149,20 @@ DEFINITION="${ARGUMENTS[0]}"
149149
# after the installation process.
150150
declare -a before_hooks after_hooks
151151

152+
# shellcheck disable=SC2317
152153
before_install() {
153154
local hook="$1"
154155
before_hooks["${#before_hooks[@]}"]="$hook"
155156
}
156157

158+
# shellcheck disable=SC2317
157159
after_install() {
158160
local hook="$1"
159161
after_hooks["${#after_hooks[@]}"]="$hook"
160162
}
161163

162-
OLDIFS="$IFS"
163-
IFS=$'\n' scripts=(`rbenv-hooks install`)
164-
IFS="$OLDIFS"
164+
IFS=$'\n' read -d '' -r -a scripts <<<"$(rbenv-hooks install)" || true
165+
# shellcheck disable=SC1090
165166
for script in "${scripts[@]}"; do source "$script"; done
166167

167168

@@ -177,7 +178,7 @@ PREFIX="${RBENV_ROOT}/versions/${VERSION_NAME}"
177178
if [ -d "${PREFIX}/bin" ]; then
178179
if [ -z "$FORCE" ] && [ -z "$SKIP_EXISTING" ]; then
179180
echo "rbenv: $PREFIX already exists" >&2
180-
read -p "continue with installation? (y/N) "
181+
read -rp "continue with installation? (y/N) "
181182

182183
case "$REPLY" in
183184
y* | Y* ) ;;
@@ -241,7 +242,7 @@ if [ "$STATUS" == "2" ]; then
241242
echo "See all available versions with \`rbenv install --list'."
242243
echo
243244
echo -n "If the version you need is missing, try upgrading ruby-build"
244-
if [ "$here" != "${here#$(brew --prefix 2>/dev/null)}" ]; then
245+
if [ "$here" != "${here#"$(brew --prefix 2>/dev/null)"}" ]; then
245246
printf ":\n\n"
246247
echo " brew upgrade ruby-build"
247248
elif [ -d "${here}/.git" ]; then

0 commit comments

Comments
 (0)