-
Notifications
You must be signed in to change notification settings - Fork 11
How Does It Work
The rbenv-binstubs plugin works by enhancing rbenv-which
to use the files generated by the bundle --binstubs
command if they exist. The bundle --binstubs
command creates files that are configured to use the version of the command specified in the Gemfile rather than the default (highest version installed). The shims generated by rbenv use rbenv-exec which uses rbenv-which to determine which file to execute.
Using this plugin after you have run bundle --binstubs
has the same effect as either using bin/COMMAND
or bundle exec COMMAND
to run your commands. Ie it will execute the binaries associated the gem versions specified in the Gemfile.
The plugin also checks if you used a non standard binstub directory, and if so checks there rather than the local bin directory.
If you have not run bundle --binstubs
then there will be no bin stubs for this plugin to use, and the default commands will be run instead. Note the binstubs setting is sticky, ie it is saved in .bundle/config and used when you next run bundle.
Without this plugin you will need to prefix your commands with bundle exec
or bin/
(if you have run bundle --binstubs). If you do not do this then the highest available version will be executed, irrespective of what is specified in your Gemfile.