Commit graph

207 commits

Author SHA1 Message Date
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
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
e0b8938fef Merge pull request #299 from sstephenson/automatic-local-exec
Automatic local exec
2012-12-28 09:05:24 -08:00
Sam Stephenson
811ca05916 Run hash -r after rbenv rehash when shell integration is enabled
Fixes #119
2012-12-28 10:59:10 -06:00
Sam Stephenson
df9bbd7ab3 Speed up rbenv-rehash with a simpler indexing approach 2012-12-27 17:16:57 -06:00
Sam Stephenson
339e331f1d Ensure outdated shims are removed first when rehashing 2012-12-27 13:42:25 -06:00
Sam Stephenson
283e67b57e When the ruby shim is invoked with a script, set RBENV_DIR to the script's dirname 2012-12-27 13:41:55 -06:00
Sam Stephenson
6c1fb9ffd0 Fall back to $PWD if a local version file can't be found in $RBENV_DIR 2012-12-27 13:39:36 -06:00
Sam Stephenson
1ebcbd92e2 Tweak rbenv --version output 2012-12-13 11:26:39 -06:00
Mislav Marohnić
3060578e3b use typeset instead of local in rbenv() function
This is to insure portability to ksh.

Fixes #205, references #209
2012-12-13 06:01:26 +01:00
Mislav Marohnić
b8715bfee6 foundation for a help system where each command holds its own docs
Docs are comprised from "Usage", "Summary" and "Help" sections, where
"Help" can span multiple commented lines. If it is missing, "Summary" is
shown in its place.

References #204, references #206
2012-12-13 05:48:28 +01:00
Sam Stephenson
7fe9231e64 Fix rbenv prefix for system version
Should be `/usr` or `/usr/local`, not `/usr/bin` or `/usr/local/bin`
2012-12-12 21:40:57 -06:00
Sam Stephenson
9289af0132 Don't include system in rbenv versions --bare output 2012-12-12 21:40:57 -06:00
Mislav Marohnić
1f7722088d make shell return an error code in case of failure
Fixes #274
2012-12-13 02:58:41 +01:00
Mislav Marohnić
e548877ead have versions also list "system" if it exists
Closes #263
2012-12-13 01:52:52 +01:00
Mislav Marohnić
21391c8d2f put up a note why version-file-read is tricky 2012-12-13 01:45:06 +01:00
Roy Liu
99551dd1ec fix rbenv-which with system ruby
Don't have `command -v` abort the whole script prematurely.
2012-12-13 01:00:24 +01:00
Mislav Marohnić
b5a26936e8 rbenv --version 2012-12-13 00:40:29 +01:00
Ruben Verborgh
cf28136003 speed up rbenv-init
Use `rbenv-commands` instead of `rbenv commands`. The latter
unnecessarily goes through `rbenv` executable.

Fixes #254
2012-12-13 00:18:32 +01:00
Guillermo Iguaran
0ce6fad14e Merge pull request #287 from mislav/versions-fix
fix `versions` in case current version doesn't exist
2012-12-12 14:12:39 -08:00
Mislav Marohnić
0ff3ca8a12 fix obsolete usage instruction 2012-12-12 00:32:27 +01:00
Mislav Marohnić
47c8a0e0b8 fix versions in case current version doesn't exist
`rbenv-versions` tries to read the current version to display a marker
next to it, but if that fails the whole script aborts.

This change makes it so that the failures from `rbenv-version-name` are
tolerated. It also makes the `--bare` mode never call it in the first
place, because it doesn't need to display a marker.
2012-12-12 00:25:02 +01:00
Alec Chen
3a94daeaf8 remove "+=" operator to support bash-3.0 2012-04-23 22:11:19 +08:00
Gabriel Horner
d3700dfd70 help for versions and commands, including their options 2012-03-23 16:21:53 -04:00
Andrew Marshall
9c43fa9161 Prevent $command from leaking outside of function 2012-02-04 18:05:43 -05:00
Antonio Terceiro
d1bfeee334 Add /usr/lib/rbenv/hooks to hook search path
This will help with the packaging of rbenv plugin that contain hooks in
Debian.
2012-01-26 20:23:31 -02:00
John Williams
f40bc773d2 Allow init arguments to be in any order. 2012-01-17 08:50:40 -06:00
Sam Stephenson
5d0a6630b9 Account for path entries with spaces in remove_from_path 2011-12-30 13:40:22 -06:00
Sam Stephenson
114b81c9a4 Use if instead of inline && so rbenv rehash exits with a zero status 2011-12-26 20:12:16 -06:00
Sam Stephenson
b10bdb1e78 rbenv 0.3.0 2011-12-25 21:32:48 -05:00
Sam Stephenson
ee5ad02d42 Add --no-rehash option to rbenv-init (#170) 2011-12-25 20:59:24 -05:00
Sam Stephenson
cd2094ff71 Remove deprecated set-default and set-local commands 2011-12-25 20:39:11 -05:00
Sam Stephenson
7fbcde8af0 Properly expand RBENV_DIR and ensure it exists 2011-12-25 16:41:15 -05:00
Sam Stephenson
b670849ebd Merge remote-tracking branch 'mlafeldt/rbenv-rehash'
Conflicts:
	libexec/rbenv-rehash
2011-12-24 18:03:10 -05:00
Sam Stephenson
288c6b3f09 Go with paren-style function definition 2011-12-24 17:49:22 -05:00
Sam Stephenson
802d70568c Merge pull request #168 from mgrubb/topic/portability-fixes
Made ksh portability changes
2011-12-24 14:48:34 -08:00
Sam Stephenson
efe600f6de Ensure shims don't disappear when rehashed 2011-12-24 15:16:37 -05:00
Michael Grubb
7e83e07cf3 Made ksh portability changes
Added specific message for ksh in identifying the proper shell
initialization file.

Changed rbenv functiond definition to be more portable.
Shell functions should be defined by using the function command or
using the parenthesis grammar, but using both is not portable:

rbenv() {...  -or-
function rbenv { ...
2011-12-15 14:54:38 -06:00
Per Velschow
dfc7645609 Quoting the argument to greadlink to make it work with paths containing spaces. 2011-11-18 21:21:16 +01:00
Mathias Lafeldt
9dde161b65 rbenv-rehash: use $OLDPWD to restore previous working directory
$OLDPWD is a standard shell variable that contains the previous working
directory as set by the "cd" command. No need to save $PWD to some
custom variable.

(We could also have used "cd -" but it prints out $OLDPWD too.)
2011-11-14 22:30:47 +01:00
Mathias Lafeldt
0324b118ee rbenv-rehash: remove superfluous trap signals
A trap on the special signal EXIT is executed before the shell
terminates. EXIT actually covers SIGINT and SIGTERM as well, and
we don't need any extra traps for them.

See bash(1) and "help trap" in bash.
2011-11-14 22:30:47 +01:00
Joshua Peek
be7dcc0ad8 Add rbenv root
Prints $RBENV_ROOT (defaults to ~/.rbenv)
2011-11-10 10:54:30 -06:00
Sam Stephenson
01a0ad0b69 rbenv 0.2.1 2011-10-01 12:26:19 -05:00
Sam Stephenson
e49be969ab Ensure RBENV_DIR is always an absolute path
Otherwise, `RBENV_DIR=bin rbenv version-file` loops indefinitely
2011-10-01 12:15:20 -05:00
Sam Stephenson
2cd12e3fa6 rbenv 0.2.0 2011-09-28 13:38:03 -05:00
Joshua Peek
149e61a649 Don't exit out of piped loop
Can cause the stdin of cat to close too soon causing:

  echo: write error: Broken pipe

Fixes #97
2011-09-28 12:08:34 -05:00
Sam Stephenson
72b62e13aa Make rbenv help a little nicer 2011-09-28 10:59:02 -05:00
Sam Stephenson
ada26ab92e Document rbenv which and rbenv whence 2011-09-28 10:48:04 -05:00
Sam Stephenson
058e2cb7a6 Add rbenv shell to help 2011-09-28 10:21:57 -05:00
Sam Stephenson
0a4ffcd15f Global version file is now ${RBENV_ROOT}/version
This is the last time it'll change. Promise.
2011-09-28 09:45:58 -05:00
Sam Stephenson
07815769ae RBENV_DIR sets the directory from which .rbenv-version files are scanned 2011-09-27 15:50:39 -05:00
Sam Stephenson
10084ae020 Automatically add ${RBENV_ROOT}/plugins/*/etc/rbenv.d to $RBENV_HOOK_PATH 2011-09-23 10:47:45 -05:00
Sam Stephenson
8ce5e84c21 Automatically add ${RBENV_ROOT}/plugins/*/bin to $PATH 2011-09-23 10:44:00 -05:00
Sam Stephenson
f9fb3c934e rbenv-plugin-scripts -> rbenv-hooks; RBENV_PLUGIN_PATH -> RBENV_HOOK_PATH 2011-09-23 10:43:06 -05:00
Joshua Peek
eae5e5e092 realpath plugin scripts 2011-09-22 19:15:00 -05:00
Joshua Peek
a238099e38 Include /usr/local/etc hooks 2011-09-22 19:08:03 -05:00
Sam Stephenson
699cd8c203 Quote script path and remove unnecessary semicolon 2011-09-21 13:05:08 -05:00
Sam Stephenson
096743acde Add support for RBENV_PLUGIN_PATH environment variable 2011-09-21 13:00:23 -05:00
Sam Stephenson
0c7c62dc04 Show usage if no arguments are passed to rbenv-plugin-scripts 2011-09-21 12:43:22 -05:00
Joshua Peek
2b5fb40b99 Not exec specific 2011-09-21 12:39:26 -05:00
Joshua Peek
96b98ed039 Use plugin-scripts 2011-09-21 12:38:58 -05:00
Joshua Peek
789ace54ec Add bin to list plugin scripts 2011-09-21 12:36:07 -05:00
Roy Liu
94d87211f9 Restore the current working directory in rbenv-rehash 2011-09-19 10:45:12 -04:00
Sam Stephenson
305db1c35b Fix rbenv-completions for shell commands. Closes #90. 2011-09-16 14:18:29 -05:00
Sam Stephenson
568cd4b23e Strip trailing slashes from RBENV_ROOT (#83) 2011-09-14 12:45:44 -05:00
Sam Stephenson
b4f8906b24 Update zsh completion adapter 2011-09-13 13:12:04 -05:00
Sam Stephenson
465a1472ba Completion for which 2011-09-13 13:02:55 -05:00
Sam Stephenson
3644840d4b Show usage for rbenv which without an argument 2011-09-13 13:01:31 -05:00
Sam Stephenson
03d664e048 Completion for whence 2011-09-13 12:59:59 -05:00
Sam Stephenson
61830048d5 Extract rbenv-shims 2011-09-13 12:55:19 -05:00
Sam Stephenson
69d596f56f Completion for commands 2011-09-13 12:48:49 -05:00
Sam Stephenson
4923838981 Completion for exec 2011-09-13 12:46:06 -05:00
Sam Stephenson
f1ca8906c0 Completions for global, local, prefix, shell 2011-09-13 12:38:34 -05:00
Sam Stephenson
43520db389 Fix rbenv prefix system 2011-09-13 12:37:29 -05:00
Sam Stephenson
d50ce90a36 Add --unset to local completion 2011-09-13 12:33:46 -05:00
Sam Stephenson
6da85246c6 Proof-of-concept external completions 2011-09-13 10:13:27 -05:00
Joshua Peek
964c12fe27 Ensure shims set RBENV_ROOT 2011-09-12 11:05:45 -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
2e3e141d2e RBENV_ROOT defaults to ~/.rbenv 2011-09-11 12:05:56 -05:00
Sam Stephenson
c36950a7cb RBENV_HOME -> RBENV_ROOT 2011-09-11 12:04:59 -05:00
Sam Stephenson
8f6b0bc1d4 Use RBENV_ROOT to search for rbenv-exec plugins 2011-09-11 12:00:02 -05:00
Sam Stephenson
7ac964353f RBENV_HOME -> RBENV_ROOT 2011-09-11 11:58:57 -05:00
Sam Stephenson
c6ce8fafd8 Merge remote-tracking branch 'alexrinass/systemwide' 2011-09-11 11:28:54 -05:00
Sam Stephenson
6fa81ef28d Add rbenv local --unset 2011-09-11 10:16:22 -05:00
Sam Stephenson
e5c0fd22e1 Exit with 0 status when a version file is read successfully 2011-09-11 10:16:08 -05:00
Sam Stephenson
fb6eee26d4 Only shift if an argument is passed. Fixes #78. 2011-09-10 20:10:07 -05:00
Sam Stephenson
1ba2ce0cb6 Fix quoting in rbenv function 2011-09-10 20:10:07 -05:00
Sam Stephenson
76929320c8 Make rbenv-sh-shell consistent with rbenv-local 2011-09-10 20:10:07 -05:00
Joshua Peek
5ad45afe5e Merge pull request #81 from eric/empty_path_to_remove_in_which
Deal with an empty result from expand_path
2011-09-09 15:05:34 -07:00
Eric Lindvall
b81b64453b Deal with an empty result from expand_path 2011-09-09 15:00:59 -07:00
Sam Stephenson
db2a94d4bc rbenv-version-name returns system for empty version files. Closes #62, #65, #77. 2011-09-09 15:52:31 -05:00
Joshua Peek
783a5700c4 reset isn't standard 2011-09-09 10:45:23 -05:00
Timothy King
555472210b Adds sh-shell subcommand to unset RBENV_VERSION 2011-09-09 08:22:03 -04:00
Timothy King
39497042bc Adds error handling to rbenv-sh-shell 2011-09-09 08:18:14 -04:00
Sam Stephenson
837bfc5aa9 Fix rbenv-version-file-read for version files without trailing newlines 2011-09-07 14:46:33 -05:00
Joshua Peek
042794b651 use -> shell 2011-09-07 10:26:11 -05:00
Joshua Peek
c928ba7a21 Include sh commands in default listing 2011-09-06 22:07:05 -05:00
Alexander Rinass
5130f0464a Support install locations other than $HOME/.rbenv.
Define RBENV_HOME env variable in libexec/rbenv and let all script delegates use this variable to determine rbenv's install location.
2011-08-25 09:28:01 +02:00
Joshua Peek
bff38d7e71 use command 2011-08-23 11:35:06 -05:00