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.

47 rivejä
1.1 KiB

11 vuotta sitten
13 vuotta sitten
13 vuotta sitten
13 vuotta sitten
13 vuotta sitten
13 vuotta sitten
13 vuotta sitten
13 vuotta sitten
13 vuotta sitten
13 vuotta sitten
  1. #!/usr/bin/env bash
  2. #
  3. # Summary: Run an executable with the selected Ruby version
  4. #
  5. # Usage: rbenv exec <command> [arg1 arg2...]
  6. #
  7. # Runs an executable by first preparing PATH so that the selected Ruby
  8. # version's `bin' directory is at the front.
  9. #
  10. # For example, if the currently selected Ruby version is 1.9.3-p327:
  11. # rbenv exec bundle install
  12. #
  13. # is equivalent to:
  14. # PATH="$RBENV_ROOT/versions/1.9.3-p327/bin:$PATH" bundle install
  15. set -e
  16. [ -n "$RBENV_DEBUG" ] && set -x
  17. # Provide rbenv completions
  18. if [ "$1" = "--complete" ]; then
  19. exec rbenv shims --short
  20. fi
  21. RBENV_VERSION="$(rbenv-version-name)"
  22. RBENV_COMMAND="$1"
  23. if [ -z "$RBENV_COMMAND" ]; then
  24. rbenv-help --usage exec >&2
  25. exit 1
  26. fi
  27. export RBENV_VERSION
  28. RBENV_COMMAND_PATH="$(rbenv-which "$RBENV_COMMAND")"
  29. RBENV_BIN_PATH="${RBENV_COMMAND_PATH%/*}"
  30. OLDIFS="$IFS"
  31. IFS=$'\n' scripts=(`rbenv-hooks exec`)
  32. IFS="$OLDIFS"
  33. for script in "${scripts[@]}"; do
  34. source "$script"
  35. done
  36. shift 1
  37. if [ "$RBENV_VERSION" != "system" ]; then
  38. export PATH="${RBENV_BIN_PATH}:${PATH}"
  39. fi
  40. exec -a "$RBENV_COMMAND" "$RBENV_COMMAND_PATH" "$@"