Skip to content

Commit

Permalink
reworked "gem: --user-install" check, fix rvm#1401
Browse files Browse the repository at this point in the history
  • Loading branch information
mpapis committed Dec 24, 2012
1 parent c750b41 commit 7bdae9a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 29 deletions.
29 changes: 0 additions & 29 deletions scripts/initialize
Original file line number Diff line number Diff line change
Expand Up @@ -86,35 +86,6 @@ 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 'export rvm_ignore_gemrc_issues=1' to your ${HOME}/.rvmrc" >&2
fi
done
fi

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

#
Expand Down
22 changes: 22 additions & 0 deletions scripts/notes
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,28 @@ $notes_type Notes:
sudo sed -i'' -e \"s#rvm_configure_env=('LDFLAGS=-L/opt/sm/pkg/active/lib CFLAGS=-I/opt/sm/pkg/active/include CPATH=/opt/sm/pkg/active/include')#rvm_configure_env=('LDFLAGS=-L/opt/sm/pkg/active/lib' 'CFLAGS=-I/opt/sm/pkg/active/include' 'CPATH=/opt/sm/pkg/active/include')#\" /etc/rvmrc
"
fi

if
[[ -z "${rvm_ignore_gemrc_issues:-}" ]]
then
typeset -a _gemrc_files
_gemrc_files=()
for gemrc in "/etc/gemrc" "${HOME}/.gemrc"
do
if [[ -r "${gemrc}" ]]
then _gemrc_files+=( "${gemrc}" )
fi
done
if
(( ${#_gemrc_files[@]} )) &&
GREP_OPTIONS="" \grep -E -- ' -n|--user-install' "${_gemrc_files[@]}" >/dev/null
then
important_message "
* WARNING: Found -n / --user-install in one of ${_gemrc_files[@]}, please remove it, as it will break rubygems in RVM.
If it is intended or a mistake 'export rvm_ignore_gemrc_issues=1' to avoid this warning.
"
fi
fi
} | new_notes | eval "${PAGER:-cat}"

rvm_warn "
Expand Down

0 comments on commit 7bdae9a

Please sign in to comment.