Commit graph

183 commits

Author SHA1 Message Date
Mislav Marohnić
44e76bea23 Merge pull request #372 from sstephenson/exec-next
Change `exec` semantics to allow using rbenv from a ruby process
2013-10-29 18:53:33 -07:00
Mislav Marohnić
d2eace00c9 Add more tests for version-file-read 2013-10-30 02:33:23 +01:00
Mislav Marohnić
878bd87328 reliably detect parent shell in rbenv init
`$SHELL` variable is a terrible way of detecting the current shell
because it's not even supposed to reflect the current shell; it's meant
for keeping the value of the default shell for programs to start.

If an explicit `<shell>` argument wasn't passed to `rbenv init`, it
tries to detect the shell by getting the name of its parent process. If
this fails, it falls back on the value of `$SHELL` as before.

Furthermore, `rbenv init` will set the RBENV_SHELL variable in the
current shell to the value of the detected shell so that `sh-shell` and
`sh-rehash` commands don't have to repeat the detection.
2013-10-07 03:24:45 +02:00
Mislav Marohnić
f4fade3d26 better error message for rbenv prefix system
Have `rbenv prefix` handle the case where system Ruby is not installed,
i.e. `rbenv which ruby` doesn't find ruby in PATH.

Fixes #362
2013-10-03 21:42:52 +02:00
Mislav Marohnić
e97326845c Ubuntu fix: don't use . in place of source
If `rbenv init -` outputs `.` in place of `source` and that gets eval'd
by the desktop manager via `~/.profile`, it chokes and prevents the user
from logging in.

Fixes #457
2013-10-03 16:12:24 +02:00
Mislav Marohnić
31fab8cdae cleanup in fish
Use process subtitution syntax:

    . (rbenv init -|psub)

instead of:

    eval (rbenv init -)

because the latter doesn't work well with newlines.
2013-09-28 16:12:43 +02:00
Yamashita Yuu
5bfec84432 add fish shell support 2013-09-28 16:11:02 +02:00
Jeffrey 'jf' Lim
caa4a8e228 fix rehash when paths have spaces in them
fixes #450
2013-09-26 01:42:34 +02:00
Mislav Marohnić
bdcc2e1790 check if completion script is readable
fixes #444
2013-09-09 09:53:50 +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
Mislav Marohnić
8b043038b8 ensure cleaner PATH in test environment 2013-06-20 20:41:22 +02:00
Mislav Marohnić
e93ab45dc3 work around bug in git 1.8.2.1 in tests
Making empty commits in tests blocked by opening the default text
editor, waiting for a message which we specified to be empty.

http://thread.gmane.org/gmane.comp.version-control.git/225529
2013-06-07 19:13:54 +02:00
Mislav Marohnić
060f141b21 test that IFS in hooks is correct
closes #379
2013-04-16 14:01:43 +02:00
Mislav Marohnić
bc1049f5ae improve versions tests by cd'ing into a clean slate 2013-04-16 12:52:42 +02:00
Mislav Marohnić
ab9ebb9d0d add tests for help and rbenv --version 2013-04-08 23:16:35 +02:00
Mislav Marohnić
ab197ef51e add tests for version commands 2013-04-08 23:16:35 +02:00
Mislav Marohnić
7fc5f46bbb undo assert_output_lines in tests
It was a dumb idea and it wasn't even implemented perfectly.
2013-04-08 23:16:35 +02:00
Mislav Marohnić
969af1567a add tests for rehash, whence, which 2013-04-08 23:02:30 +02:00
Mislav Marohnić
7a10b64cf7 better emulate ruby -S behavior in testing
Per https://github.com/ruby/ruby/blob/7d3db3c/ruby.c#L1383-1391
2013-04-02 02:48:27 +02:00
Mislav Marohnić
f6db678b20 un-indent shebang for test executables 2013-04-02 02:48:04 +02:00
Mislav Marohnić
97290b2442 simplify iterating through arglist 2013-04-02 02:41:28 +02:00
Mislav Marohnić
b8504ed2a9 saner assertions for multiline output 2013-04-02 00:27:27 +02:00
Mislav Marohnić
4d96d0a6c6 add tests for completions 2013-04-01 16:22:02 +02:00
Mislav Marohnić
9b58b6642e test completions for exec 2013-04-01 03:45:15 +02:00
Mislav Marohnić
45f651ab00 hack around the hack around bash echo 2013-04-01 03:12:15 +02:00
Mislav Marohnić
400fe31061 fix exec fails for invalid version 2013-04-01 03:01:37 +02:00
Mislav Marohnić
4b6ab0389b add tests for exec 2013-04-01 02:58:58 +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
Mislav Marohnić
6a6ae8ae46 tests for rbenv-init 2013-03-20 13:43:57 +01:00
Mislav Marohnić
ea3203dbab fix resolving symlinks in rbenv-hooks 2013-03-08 14:35:46 -05:00
Mislav Marohnić
a81ace2ccb add hook lookup tests 2013-03-07 23:55:02 -05:00
Mislav Marohnić
bb6bccb782 tests galore 2013-03-07 15:07:32 -05:00
Mislav Marohnić
1fe59e41ea error message when rehash fails on non-writable directory
Fixes #238
2013-03-07 00:13:50 -05:00