rvmrc_to 646 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/usr/bin/env bash
  2. __rvm_rvmrc_to()
  3. {
  4. case "${1:-help}" in
  5. (.ruby-version|ruby-version)
  6. __rvm_rvmrc_to_ruby_version || return $?
  7. ;;
  8. (help)
  9. rvm_help rvmrc to
  10. return 0
  11. ;;
  12. (*)
  13. rvm_error_help "Unknown subcommand '$1'" rvmrc to
  14. return 1
  15. ;;
  16. esac
  17. }
  18. __rvm_rvmrc_to_ruby_version()
  19. (
  20. [[ -s "$PWD/.rvmrc" ]] ||
  21. {
  22. rvm_error "No .rvmrc to convert"
  23. return 2
  24. }
  25. __rvm_load_project_config "$PWD/.rvmrc" ||
  26. {
  27. rvm_error "Could not load .rvmrc"
  28. return 3
  29. }
  30. __rvm_set_ruby_version
  31. \command \rm .rvmrc ||
  32. {
  33. rvm_error "Could not remove .rvmrc"
  34. return 4
  35. }
  36. )