override_gem 567 B

123456789101112131415161718192021222324
  1. #!/usr/bin/env bash
  2. if [[ ${rvm_leave_gem_alone:-0} -eq 0 ]]
  3. then
  4. function gem
  5. {
  6. \typeset result
  7. (
  8. \typeset rvmrc
  9. rvm_rvmrc_files=("/etc/rvmrc" "$HOME/.rvmrc")
  10. if [[ -n "${rvm_prefix:-}" ]] && ! [[ "$HOME/.rvmrc" -ef "${rvm_prefix}/.rvmrc" ]]
  11. then rvm_rvmrc_files+=( "${rvm_prefix}/.rvmrc" )
  12. fi
  13. for rvmrc in "${rvm_rvmrc_files[@]}"
  14. do [[ -s "${rvmrc}" ]] && source "${rvmrc}" || true
  15. done
  16. unset rvm_rvmrc_files
  17. command gem "$@"
  18. ) || result=$?
  19. hash -r
  20. return ${result:-0}
  21. }
  22. fi