Commit graph

22 commits

Author SHA1 Message Date
Mislav Marohnić
95a039aaaa Revert "rbenv exec: avoid mutating PATH"
It was supposed to fix shelling out to Ruby but it in fact broke another
kind of shelling out to Ruby: invoking the `ruby` binary directly with
the `-S` flag.

Fixes #480

This reverts commit db143bb654.
2013-11-03 12:18:28 +02:00
Mislav Marohnić
db143bb654 rbenv exec: avoid mutating PATH
Enables shelling out from a ruby process started with rbenv to a ruby
process with a different RBENV_VERSION. Fixes #121

This removes the workaround created for #15 and solves `ruby -S` support
by setting RUBYPATH. PATH is never changed.

To illustrate how RUBYPATH changes in various configurations:

    PATH=~/bin:~/.rbenv/shims:/usr/bin:/bin
    RBENV_VERSION=1.8 ruby -S rake
    #=> executes ~/.rbenv/versions/1.8/bin/rake
    #=> RUBYPATH=~/bin:~/.rbenv/versions/1.8/bin:/usr/bin:/bin

    RBENV_VERSION=2.0 ruby -S rake
    #=> executes ~/.rbenv/versions/2.0/bin/rake
    #=> RUBYPATH=~/bin:~/.rbenv/versions/2.0/bin:/usr/bin:/bin

    RBENV_VERSION=system ruby -S rake
    #=> executes /usr/bin/rake
    #=> RUBYPATH=~/bin:/rbenv_shims_were_here:/usr/bin:/bin

    RBENV_VERSION=1.8 ruby -S rake
    #=> executes ~/.rbenv/versions/1.8/bin/rake
    #=> RUBYPATH=~/bin:~/.rbenv/versions/1.8/bin:/usr/bin:/bin
2013-06-20 20:41:22 +02:00
Ian Yang
6ca591ab75 restore original IFS for hooks 2013-04-16 14:01:43 +02:00
Mislav Marohnić
400fe31061 fix exec fails for invalid version 2013-04-01 03:01:37 +02:00
Mislav Marohnić
baf7656d2f fix iterating through paths that have spaces in them
Fixes #344, #196
2013-04-01 01:04:19 +02:00
Sam Stephenson
37eca782cc Documentation tweaks 2012-12-29 22:05:04 -06:00
Sam Stephenson
19666f2598 Wrap documentation comments at 70 columns 2012-12-29 21:50:38 -06:00
Mislav Marohnić
3436bddaea new-style documentation for most commands 2012-12-29 23:34:53 +01:00
Mislav Marohnić
8ee2f2657a avoid prepending system ruby to PATH
System ruby is already on PATH (that's the definition of system ruby) and by
duplicating its path by putting it in front, we can break the user's
environment.

Fixes #275
2012-12-29 00:17:16 +01:00
Sam Stephenson
f9fb3c934e rbenv-plugin-scripts -> rbenv-hooks; RBENV_PLUGIN_PATH -> RBENV_HOOK_PATH 2011-09-23 10:43:06 -05:00
Sam Stephenson
699cd8c203 Quote script path and remove unnecessary semicolon 2011-09-21 13:05:08 -05:00
Joshua Peek
96b98ed039 Use plugin-scripts 2011-09-21 12:38:58 -05:00
Sam Stephenson
61830048d5 Extract rbenv-shims 2011-09-13 12:55:19 -05:00
Sam Stephenson
4923838981 Completion for exec 2011-09-13 12:46:06 -05:00
Sam Stephenson
0632325a43 Set RBENV_DEBUG=1 to see what's going on under the hood 2011-09-12 10:11:59 -05:00
Sam Stephenson
8f6b0bc1d4 Use RBENV_ROOT to search for rbenv-exec plugins 2011-09-11 12:00:02 -05:00
Andreas Johansson
6938692ca2 Fix argument that cannot be sent to bash via env
/usr/bin/env seems to have problems with arguments to bash on some
platforms. To bypass this, use set -e instead.
2011-08-12 11:33:45 +02:00
Sam Stephenson
2a495dc9ac Prepend $PATH with the command's dirname before execing for compatibility with ruby -S 2011-08-05 10:13:30 -05:00
Jamis Buck
5d8c40444d iterate over all matching plugins, not just the first 2011-08-03 20:55:03 -06:00
Jamis Buck
a9837f3a06 look for plugin scripts to extend functionality 2011-08-03 07:28:50 -06:00
Joshua Peek
d65141c7b5 Merge branch 'master' into libexec
Conflicts:
	bin/rbenv
	libexec/rbenv-shim
2011-08-02 19:41:03 -05:00
Joshua Peek
43624943ee Move subcommands into libexec/ 2011-08-02 18:01:46 -05:00
Renamed from bin/rbenv-exec (Browse further)