Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

49 řádky
1.1 KiB

  1. #!/usr/bin/env bash
  2. #
  3. # Summary: Set or show the shell-specific Ruby version
  4. #
  5. # Usage: rbenv shell <version>
  6. # rbenv shell --unset
  7. #
  8. # Sets a shell-specific Ruby version by setting the `RBENV_VERSION'
  9. # environment variable in your shell. This version overrides local
  10. # application-specific versions and the global version.
  11. #
  12. # <version> should be a string matching a Ruby version known to rbenv.
  13. # The special version string `system' will use your default system Ruby.
  14. # Run `rbenv versions' for a list of available Ruby versions.
  15. set -e
  16. [ -n "$RBENV_DEBUG" ] && set -x
  17. # Provide rbenv completions
  18. if [ "$1" = "--complete" ]; then
  19. echo --unset
  20. echo system
  21. exec rbenv-versions --bare
  22. fi
  23. version="$1"
  24. if [ -z "$version" ]; then
  25. if [ -z "$RBENV_VERSION" ]; then
  26. echo "rbenv: no shell-specific version configured" >&2
  27. exit 1
  28. else
  29. echo "echo \"\$RBENV_VERSION\""
  30. exit
  31. fi
  32. fi
  33. if [ "$version" = "--unset" ]; then
  34. echo "unset RBENV_VERSION"
  35. exit
  36. fi
  37. # Make sure the specified version is installed.
  38. if rbenv-prefix "$version" >/dev/null; then
  39. echo "export RBENV_VERSION=\"${version}\""
  40. else
  41. echo "return 1"
  42. exit 1
  43. fi