Skip to content

Commit

Permalink
Merge pull request #1132 from lemoinem/fix/check-for-compatible-rubyg…
Browse files Browse the repository at this point in the history
…em-config

Check for trouble-prone config in "gemrc"s, fix #855
  • Loading branch information
mpapis committed Sep 25, 2012
2 parents e0a5fc3 + 35523b7 commit aa2351a
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions scripts/initialize
Expand Up @@ -87,6 +87,35 @@ Error:
fi
fi

# Intends to fix #855 by checking for and warning about rubygem incompatible
# configs.
# -- lemoinem 2012-09-25
if [[ -z "${rvm_ignore_gemrc_issues:-}" ]]
then
for gemrc in "/etc/gemrc" "${HOME}/.gemrc"
do
if [[ -r "${gemrc}" ]]
then
unset double_check
typeset double_check

if GREP_OPTIONS="" \grep '^gem:' "${gemrc}" | GREP_OPTIONS="" \grep ' -n/\?' >/dev/null 2>&1
then
echo 'BEWARE! Forcing rubygems to use a constant path (-n option) to install gems is not recommended for RVM installations.' >&2
: double_check:${double_check:="${gemrc}"}
fi

if GREP_OPTIONS="" \grep '^gem\(_\(install\|update\)\)\?:' "${gemrc}" | GREP_OPTIONS="" \grep ' --user-install\( \|$\)' >/dev/null 2>&1
then
echo 'BEWARE! rubygems "--user-install" option is not recommended for RVM installations.' >&2
: double_check:${double_check:="${gemrc}"}
fi

[[ -n "${double_check:-}" ]] && echo "Double check your ${double_check}. You could remove this warning by adding rvm_ignore_gemrc_issues=1 in your ${HOME}/.rvmrc" >&2
fi
done
fi

true ${rvm_scripts_path:="$rvm_path/scripts"}

#
Expand Down

0 comments on commit aa2351a

Please sign in to comment.