mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-21 20:47:00 -05:00
Add experimental ruby-local-exec
This commit is contained in:
parent
7bbfecd9af
commit
1411fa5a16
1 changed files with 23 additions and 0 deletions
23
bin/ruby-local-exec
Executable file
23
bin/ruby-local-exec
Executable file
|
@ -0,0 +1,23 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# `ruby-local-exec` is a drop-in replacement for the standard Ruby
|
||||
# shebang line:
|
||||
#
|
||||
# #!/usr/bin/env ruby-local-exec
|
||||
#
|
||||
# Use it for scripts inside a project with an `.rbenv-version`
|
||||
# file. When you run the scripts, they'll use the project-specified
|
||||
# Ruby version, regardless of what directory they're run from. Useful
|
||||
# for e.g. running project tasks in cron scripts without needing to
|
||||
# `cd` into the project first.
|
||||
|
||||
set -e
|
||||
|
||||
cwd="$(pwd)"
|
||||
dirname="${1%/*}"
|
||||
|
||||
cd "$dirname"
|
||||
export RBENV_VERSION="$(rbenv version-name)"
|
||||
cd "$cwd"
|
||||
|
||||
exec ruby "$@"
|
Loading…
Reference in a new issue