As it seems, JRuby 1.7 complains on stderr every time you invoke `system`:
warning: executable? does not in this environment and will return a dummy value
It doesn't seem to complain when backtics are used. It's safe to use
backticks here because `rbenv rehash` doesn't output anything on stdout,
and the exit status of the command is irrelevant.
This bakes in the functionality of rbenv-gem-rehash plugin.
The Rubygems hook is improved:
- It will not rehash for gems installed in locations that rbenv otherwise
doesn't search for binstubs; for instance in case of
`bundle --path vendor/bundle`.
- It rescues exceptions and makes them non-lethal by warning on stderr.
It doesn't need to be a bash array and we don't need a separate index of
shims registered. Simply keep everything in a space-separated string and
use that as an index as well.
This assumes that executable names *never* have spaces in them.
On my system that has 25 versions under rbenv, this speeds up rehash
almost 3-fold:
- before: 391 ms
- after: 134 ms
This is achieved by removing duplicate names of executables before
registering them as shims. Since most Rubies will share a lot of the
same executable names ("ruby", "rake", "bundle", ...), this is a
considerable reduction in number of shims registered.
Too many of our users have a shell initialization set up that
inadvertently duplicates some or most of the entries in their PATH,
bringing the system paths again in front of rbenv's shims. If this was a
nested shell (a typical scenario when starting up tmux), `rbenv init`
would get eval'd again but this time, shims won't get added to the front
of the PATH and would only stay and the end of the path, effectively
rendering them useless.
I tried to argue that this is a user problem rather than rbenv's, but I
can't fix everybody shell init when they report bugs. Instead, let's
revert to simpler times in rbenv where we just roll along with the
duplication and don't ask any questions.
This reverts commit 03fa148e81.
Fixes#369
Delegate to `rbenv-shims` instead of `rbenv shims` and therefore skip
going through the main `rbenv` executable again that would set up a lot
of the environment that was already set.
This is the remaining part of
c69d9a1128.
commit c69d9a1128
Author: Mislav Marohnić <mislav.marohnic@gmail.com>
Date: Mon Oct 13 12:39:47 2014 +0200
Isolate rbenv-which tests from any `.ruby-version` file on the system
Having a `.ruby-version` file in any of the parent directories of the
local clone of rbenv could cause the test suite to fail because it
wasn't expecting a local version to be set.
Having a `.ruby-version` file in any of the parent directories of the
local clone of rbenv could cause the test suite to fail because it
wasn't expecting a local version to be set.
Fixes#533
Running any shim (and thus `rbenv-exec`) would always execute
`rbenv-version-name` twice: once in `rbenv-exec` and another time in
`rbenv-which`, even though RBENV_VERSION variable would have already
been populated at this point.
Now RBENV_VERSION is respected within `rbenv-which`.
The previous Makefile only worked on OS X. The dynamically generated
Makefile (from `Makefile.in`) should now work on multiple platforms
(tested on OS X and Ubuntu).
The `shobj-conf` script imported from bash seems to not support the
latest OS X. This makes sure that `SHOBJ_LDFLAG=-dynamiclib` is output
for Darwin10+ (latest version is Darwin 13.0).
Given the `-o <HOST-OS>` parameter, the script generates environment
variables with information how to compile dynamically loadable libraries
for that system.
Imported from bash-3.2.48
It's slow and not necessary since we expect `$0` to already be expanded.
In tests this change forces us to deal with some relative paths, but
it's not a big deal. The `rbenv init -` output in the most common case
will be the same as before:
source '/home/myuser/.rbenv/libexec/../completions/rbenv.bash'