You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
1.8 KiB

  1. #!/usr/bin/env bash
  2. set -e
  3. print_set_version() {
  4. echo "<version> should be a string matching a Ruby version known by rbenv."
  5. local versions="$(rbenv-versions --bare)"
  6. if [ -z "$versions" ]; then
  7. echo "There are currently no Ruby versions installed for rbenv."
  8. else
  9. echo "The currently installed Ruby versions are:"
  10. echo "$versions" | sed 's/^/ /'
  11. fi
  12. echo
  13. echo "The special version string 'system' will use your default system Ruby."
  14. }
  15. case "$1" in
  16. "") echo "usage: rbenv <command> [<args>]
  17. Some useful rbenv commands are:
  18. commands List all commands
  19. rehash Rehash rbenv shims (run this after installing binaries)
  20. global Set or show the global Ruby version
  21. local Set or show the local directory-specific Ruby version
  22. version Show the current Ruby version
  23. versions List all Ruby versions known by rbenv
  24. See 'rbenv help <command>' for more information on a specific command.
  25. For more information, see: https://github.com/sstephenson/rbenv#readme"
  26. ;;
  27. global) echo "usage: rbenv global <version>
  28. Sets the global Ruby version. You can override the global version at
  29. any time by setting a directory-specific version with \`rbenv local'
  30. or by setting the RBENV_VERSION environment variable.
  31. $(print_set_version)"
  32. ;;
  33. local) echo "usage: rbenv local <version>
  34. Sets the local directory-specific Ruby version by writing the version
  35. name to a file named '.rbenv-version'.
  36. When you run a Ruby command, rbenv will look for an '.rbenv-version'
  37. file in the current directory and each parent directory. If no such
  38. file is found in the tree, rbenv will use the global Ruby version
  39. specified with \`rbenv global', or the version specified in the
  40. RBENV_VERSION environment variable.
  41. $(print_set_version)"
  42. ;;
  43. *) echo "No command arguments needed or invalid/undocumented command."
  44. esac