Commit graph

755 commits

Author SHA1 Message Date
Mislav Marohnić
82e5ad053b
avoid shellcheck warnings in tests 2022-10-09 13:56:24 +02:00
Mislav Marohnić
5ce2fd8a2f
Enable fallback to PATH from rbenv shims
Previously, when someone activated rbenv shim `foo`, rbenv would error out if `RBENV_ROOT/versions/RBENV_VERSION/bin/foo` did not exist.

This change allows `foo` to be additionally looked up in PATH as fallback. This prevents a case where one of the Ruby versions is shadowing a system-wide command of the same name, preventing the use of the global command across all other Ruby versions.

rbenv used to be strict around this, allowing the fallback to avoid ever falling back to system Ruby for invocations like `bundle` if the current Ruby version did not yet install Bundler. The current approach prevents this scenario by explicitly disallowing fallback for the following executables: ruby, rake, gem, bundle, bundler, irb, rdoc, ri.
2022-10-07 16:16:34 +02:00
Mislav Marohnić
6b1cc34610
Merge pull request #1445 from rbenv/allow-userinstall-warning
Restore Rubygems warning for user-installed gems
2022-10-07 13:17:35 +02:00
Mislav Marohnić
d2d3012f17
Restore Rubygems warning for user-installed gems 2022-10-07 13:02:18 +02:00
Mislav Marohnić
410e05bf8c
Revert support for user-installed gems (#1443) 2022-10-07 12:56:54 +02:00
Mislav Marohnić
a6cf6aeadb
Merge pull request #1440 from rbenv/type-P
Test for executables but not functions
2022-09-30 18:30:08 +02:00
Mislav Marohnić
8406a2bc7f
Test for executables but not functions 2022-09-30 12:29:49 +02:00
Mislav Marohnić
ed1a3a5545
Switch back to resolving symlinks for rbenv executable (#1439)
Considerations:

- `./libexec/rbenv` executable is the entrypoint to the program;

- BASH_SOURCE might be the path to a symlink that has activated `./libexec/rbenv`;

- We must resolve the symlink to learn where rbenv's libexec directory is;

- It's not guaranteed that rbenv commands will always remain directly under their own "libexec" directory, since a package maintainer can change that, e.g. rbenv commands are sometimes placed into `/usr/libexec/rbenv/*`;

- Resolving symlinks might fail and in that case we just assume rbenv project layout.
2022-09-29 15:27:17 +02:00
Mislav Marohnić
22ee5d4175
Add man page (#1438)
`rbenv help` without arguments now runs `man rbenv` on systems where man is present.
2022-09-27 02:17:50 +02:00
Mislav Marohnić
7c7c4dc11c
Delete CNAME 2022-09-26 16:15:55 +02:00
Mislav Marohnić
45ae8d2ebc
Create CNAME 2022-09-26 16:15:21 +02:00
Mislav Marohnić
396e65a461
Add note about troubleshooting BUILD FAILED 2022-09-26 03:14:36 +02:00
Mislav Marohnić
959968c46d
Support GEM_HOME, add limited support for user-installed gems (#1436)
The rehash process will now discover executables in additional locations:
- `~/.gem/ruby/<version>/bin/*`
- `$GEM_HOME/bin`

The `rbenv which` (and thus `rbenv exec`) command will also search these locations when looking up a command. This enables shims to dispatch calls to executables added by `gem install --user-install`.

Note that this support is limited:
- It will only work with C Ruby, as it's difficult to guess the `~/.gem/<engine>/<version>` directory for other Rubies without actually loading Ruby;
- It will only work for RBENV_VERSION values in the format `X.Y.Z` and not "system".
2022-09-26 02:57:15 +02:00
Mislav Marohnić
009ef3a2db
Undo collapsable installation instructions
The resulting UI seemed simpler but was harder to interact with.
2022-09-25 23:26:02 +02:00
Mislav Marohnić
acdd8a95bd
Fix wiki link, add note about plugins 2022-09-25 23:24:05 +02:00
Mislav Marohnić
98412dba80
Merge pull request #1434 from rbenv/init-path
Use absolute path in `rbenv init` instructions if needed
2022-09-25 22:55:44 +02:00
Mislav Marohnić
6426f852d0
Use absolute path in rbenv init instructions if needed 2022-09-25 22:32:46 +02:00
Mislav Marohnić
33f8621ec8
Massive README overhaul (#1433)
rbenv is now the most popular Ruby version manager, so we don't need to
sell it so hard. Instead, help the reader find installation and usage
instructions more easily.

The installation instructions are now simpler and pointing out that
ruby-build needs a separate install is now done in the "Installing Ruby
versions" section.

Finally, link to a wiki doc about potential downsides of rbenv along
with the comparison of different version manager tools.
2022-09-25 00:08:32 +02:00
Mislav Marohnić
9572edf4bb
Init script automatically adds rbenv to PATH if necessary (#1432) 2022-09-24 23:59:13 +02:00
Mislav Marohnić
117a381575
Simplify resolving symlinks, remove native extension (#1428) 2022-09-22 11:34:02 +02:00
Jan Macku
56a440e4a7
Add Shell linter - Differential-ShellCheck (#1419)
Signed-off-by: Jan Macku <jamacku@redhat.com>
Co-authored-by: Mislav Marohnić <git@mislav.net>
2022-09-18 23:57:43 +02:00
Richie Thomas
a8ecfc743e
Make zsh tab completion more resilient against user's shell configuration (#1422)
Ensure a zsh user's prior shell options don't interfere with indexing into an array of arguments
2022-09-15 18:59:26 +02:00
Hiroshi SHIBATA
c4395e5820
Merge pull request #1418 from uraitakahito/patch-0
Fix link to Pow because the server is down
2022-07-16 08:14:44 +09:00
Takahito Urai
a54b47e783 Fix link to Pow because the server is down 2022-07-15 21:46:32 +09:00
Mislav Marohnić
c6cc0a1959
Merge pull request #1393 from scop/refactor/simplify-version-file-read
Simplify version file read
2022-03-09 13:03:36 +01:00
Ville Skyttä
b39d4291be Simplify version file read
Avoid a subshell and external `cut` invocation, as well as a throwaway
intermediate array.
2022-03-08 21:10:15 +02:00
Ville Skyttä
cec6d46792 Don't bother reading empty version files 2022-03-08 20:56:22 +02:00
Mislav Marohnić
e4f61e67e2 Fix indentation in installation instructions 2022-02-18 22:36:23 +01:00
Mislav Marohnić
42aa760e2e
Merge pull request #1388 from tommyjanna/readme
Redirect Debian/Ubuntu users to install using git
2022-02-18 22:26:50 +01:00
tommyjanna
d2c527cdd7
Redirect Debian/Ubuntu users to install using git
Resolves #1347
2022-02-18 15:36:53 -05:00
Mislav Marohnić
a76c4aaafa
Merge pull request #1379 from dmerejkowsky/grammar-fix
README: grammar fix
2022-01-17 17:23:26 +01:00
Dimitri Merejkowsky
5b5c60fb6e README: grammar fix 2022-01-17 15:17:20 +01:00
Hiroshi SHIBATA
304cb7b6a7
Merge pull request #1359 from scop/which-a-to-type-aP
Use test -aP instead of which -a in test helper
2021-11-17 21:36:16 +09:00
Mislav Marohnić
25fdc1caf9
Remove the word "groom" from documentation
Fixes #1361
2021-11-17 13:28:39 +01:00
Hiroshi SHIBATA
264cb65a1e
Merge pull request #1360 from simonschaufi/patch-1
Make bash commands copy-able by GitHub
2021-11-17 09:24:47 +09:00
Simon Schaufelberger
00d93c1d91
Make bash commands copy-able by GitHub
In order to be able to copy the commands, remove the `$`
2021-11-16 16:11:00 +01:00
Ville Skyttä
68fca03bb8 Use test -aP instead of which -a in test helper
The former is a bash builtin, latter not necessarily available. For
example, `which` is deprecated in Debian's debianutils >= 5.0.
2021-11-11 18:46:44 +02:00
Audree Steinberg
6cc7bff383
Update code block in readme for rbenv-doctor script (#1353)
Co-authored-by: Mislav Marohnić <git@mislav.net>
2021-10-21 15:23:46 +02:00
Mislav Marohnić
38e1fbb08e rbenv 1.2.0 2021-09-29 20:47:10 +02:00
Mislav Marohnić
69323e77cc Clarify bash config for Ubuntu Desktop vs. other platforms
Fixes #1130
2021-09-29 20:23:42 +02:00
Mislav Marohnić
526f2de13d
Merge pull request #1111 from prrrnd/prrrnd/versions-sorted-semantically
Sort versions semantically in rbenv versions
2021-09-29 20:09:57 +02:00
Mislav Marohnić
28cd6f123e 💅 Clean up version sorting and add test 2021-09-29 20:07:47 +02:00
prrrnd
d3d4606d2f Sort versions semantically in rbenv versions 2021-09-29 20:07:04 +02:00
Mislav Marohnić
0767d64344
Merge pull request #1350 from rbenv/rehash-path-to-rbenv
Have shims survive upgrades via Homebrew
2021-09-29 20:02:24 +02:00
Mislav Marohnić
76e64ff2ea Have shims survive symlinked rbenv updates a la Homebrew
Homebrew places the rbenv executable in a location such as
`/usr/local/bin/rbenv`, which is in PATH. However, that is a symlink to
`/usr/local/Cellar/rbenv/<VERSION>/bin/rbenv`, which is itself a symlink to
`/usr/local/Cellar/rbenv/<VERSION>/libexec/rbenv`. Upon executing, rbenv
will add its own directory to PATH so that it can easily invoke its
subcommands.

When generating shims during `rbenv rehash`, rbenv will try to put the
absolute path to itself inside each shim so that shims would work even
if rbenv itself isn't in PATH. Under Homebrew, rbenv's directory will be
the versioned directory in Homebrew's Cellar. However, due to Homebrew's
auto-cleanup functionality, shims generated this way will be broken
after upgrading rbenv because of the versioned Cellar path.

This changes how rbenv discovers itself in PATH: it will look at the
original PATH, not in the one modified by rbenv, with the intention of
excluding results under rbenv's own `libexec/`. If rbenv wasn't found in
PATH, return the absolute path to rbenv's own `bin/rbenv`.
2021-09-29 19:54:36 +02:00
Mislav Marohnić
b0fb351419 GitHub now auto-generates a Table of Contents 2021-09-28 13:41:20 +02:00
Mislav Marohnić
e7fd07dd91
Merge pull request #1334 from rbenv/rehash-speedup
Speed up rehash
2021-09-28 13:25:38 +02:00
Mislav Marohnić
faf999211b Speed up rehash
Before (20 ruby versions, producing 200 shims total):

    mean:    0.124 s
    stdev:   0.003

After:

    mean:    0.090 s
    stdev:   0.004
2021-05-11 11:51:00 +02:00
Mislav Marohnić
585ed84283
Merge pull request #1099 from blueyed/init-shell
Improve init: warn about missing shell and use it in the template
2021-05-06 00:46:43 +02:00
Daniel Hahler
d061cb4651 Have rbenv init print instructions that hardcode the detected shell
This speeds up subsequent `rbenv init -` executions for the user who
followed these instructions because the shell will no longer have to be
detected each time.
2021-05-06 00:43:16 +02:00