Commit graph

205 commits

Author SHA1 Message Date
Mislav Marohnić
681435e0b4 Simplify version-file-read to avoid process substitution
Process substitution seems to be causing problems with some versions of
bash on specific systems.

Fixes #401
2013-10-30 02:33:49 +01:00
Mislav Marohnić
3300587c6b strip initial - from the name of shell process
Avoids the case where shell detection would result in
`basename "-bash"` invocation, triggering the error:

    basename: illegal option -- b

fixes #462
2013-10-07 14:19:37 +02: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ć
5ae2cac088 fix rbenv() function in ksh and dash
ksh syntax becomes:

    function rbenv {
      typeset command

`typeset` only declares a local variable if there's an explicit
`function` declaration; otherwise the variable leaks.

Other shells use this syntax:

    rbenv() {
      local command

This is for dash compatibility, which supports neither `function` nor
`typeset`.

references #205, fixes #408
2013-09-28 16:12:53 +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
James FitzGibbon
81bb14e181 bail out early if readlink is not available
readlink comes from GNU coreutils.  On systems without it, rbenv used to
spin out of control when it didn't have readlink or greadlink available
because it would re-exec the frontend script over and over instead of the
worker script in libexec.

Fixes #389
2013-06-07 19:16:38 +02:00
Ian Yang
6ca591ab75 restore original IFS for hooks 2013-04-16 14:01:43 +02:00
Mislav Marohnić
ab197ef51e add tests for version commands 2013-04-08 23:16:35 +02:00
Alisdair Sullivan
497911d6c0 improve detection of completion support for commands
Enable JavasCript, Lua and Erlang scripts to provide completions
2013-04-01 16:39:51 +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
Shohei Yamasaki
2bbf49b2f5 replace tab with spaces 2013-03-23 22:37:25 +09:00
Tim Pope
03fa148e81 Don't duplicate shims in PATH 2013-03-20 13:16:02 +01:00
Mislav Marohnić
ea3203dbab fix resolving symlinks in rbenv-hooks 2013-03-08 14:35:46 -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
YanhaoYang
13f36e0416 rbenv(): preserve multiline output of sh-* commands 2013-02-22 15:42:31 +01:00
Sam Stephenson
e3f72ebae2 Guard against exported CDPATH (fixes #316) 2013-01-25 12:02:11 -06:00
Sam Stephenson
98f45695db Suppress shell warnings when hashing is disabled by set +h 2013-01-25 11:50:37 -06:00
Sam Stephenson
3cb95b4d2d Add rbenv --debug <command> as a shortcut for setting RBENV_DEBUG=1 2013-01-23 19:07:37 -06:00
Sam Stephenson
892aea138e Export PS4 when RBENV_DEBUG is set for more informative debug output 2013-01-23 19:07:37 -06:00
Leo Cassarani
1d687ac734 Fix incorrect formatting of rbenv-help output under MAWK
In systems that use the MAWK interpreter (the default AWK installed with
Ubuntu), the output of `rbenv help <command>` would have no line breaks.
The issue is fixed by changing `gsub` to `sub` in the snippet of awk
commands that are used to extract documentation comments.

I suspect the bug is something to do with the way the '^' and '$'
characters are interpreted by different AWK interpreters (per-line vs
per-string anchors).

If I understand correctly, the purpose of trim() is to remove all line
breaks from the start and end of each sections of a command's
documentation, in which case `sub` should serve the same purpose.
2013-01-05 16:55:19 +00:00
Mislav Marohnić
cd940bd797 typo in docs 2013-01-04 23:26:01 +01:00
Sam Stephenson
9375e99f92 rbenv 0.4.0 2013-01-04 12:27:26 -06:00
Sam Stephenson
266d896871 Prioritize rbenv local over rbenv global and rbenv shell 2013-01-03 10:40:28 -06:00
Sam Stephenson
e56885f4c9 "binary" -> "executable" 2013-01-03 10:06:12 -06:00
Sam Stephenson
149f4b4607 "per-project" -> "application-specific" 2013-01-03 10:00:10 -06:00
Sam Stephenson
80750f730f Merge pull request #302 from sstephenson/ruby-version
Support for .ruby-version files
2013-01-03 07:32:02 -08:00
Sam Stephenson
919c4240fc Clarify that .rbenv-version is removed when migrating 2013-01-02 12:51:47 -06:00
Sam Stephenson
44c2378f2a Shims include the full path to rbenv
This makes it possible to execute rbenv shims without rbenv's bin
directory in the path.
2013-01-01 13:27:39 -06:00
Sam Stephenson
d2a8ca7d89 Tweak the ruby- prefix warning 2012-12-31 09:58:10 -06:00
Sam Stephenson
d4faae187a Read both .ruby-version and .rbenv-version, but write (and migrate to) .ruby-version 2012-12-30 21:20:29 -06:00
Sam Stephenson
5e52fae7c1 Accept "ruby-" version prefix but print a warning to stderr 2012-12-30 19:01:30 -06:00
Sam Stephenson
b974bf54dc Prefer .ruby-version to .rbenv-version for reading local versions 2012-12-30 18:35:20 -06:00
Sam Stephenson
4b6c91e827 Usage consistency 2012-12-30 16:00:53 -06:00
Sam Stephenson
51467dc4a3 Include install and uninstall in help if ruby-build is installed 2012-12-30 15:30:37 -06: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ć
5cc6b0e3d3 allow indented lines in help text
Before, lines of help that were indented were stripped away.
2012-12-29 22:48:28 +01:00
Mislav Marohnić
2b21e22e97 display help for commands that have Summary but not Usage
A command doesn't have to specify Usage docs if it doesn't accept any
arguments. The default usage for a command will be printed as:

    Usage: rbenv ${command}
2012-12-29 22:14:54 +01:00
Sam Stephenson
57df945738 Don't print version before help summary (bare rbenv already does this) 2012-12-29 12:19:06 -06:00
Sam Stephenson
e2e474c59d Add rbenv help --usage 2012-12-29 12:12:47 -06:00
Sam Stephenson
4c19dc22d7 Improve syntax for inline documentation and allow for multi-line usage 2012-12-29 12:06:20 -06:00
Sam Stephenson
ef44b4ccac Merge branch 'master' into help 2012-12-29 11:23:23 -06:00