Open Sherry520 opened 3 weeks ago
Updating bundler to 2.4.22 worked fine, but it was difficult to enable the default use of the new version of bundler, and it somehow succeeded. Can you test if there is a problem with bundler2.1.4? Can you change the default configuration and use bundler2.4.22 for ruby2.7.8?
Hi, when you install gems using bundle install
, rbenv won't generally know about their executables nor add them to rbenv shims. This is not related to any specific Bundler version. Let me explain.
Using plain RubyGems and not Bundler, when you do gem install asciidoctor
(I've abbreviated the name of the gem for the sake of readability), RubyGems will by default place the asciidoctor
executable alongside the ruby
executable for that Ruby version and rbenv will pick that up and generate an asciidoctor
shim in ~/.rbenv/shims/ascidooctor
. Thus, a gem gets installed "globally" for that specific Ruby version that was active at the time gem install
ran.
However, when you do bundle install
in a project that uses the "asciidoctor" gem, those gems are only installed in the project directory that contains the Gemfile, and no gem binstubs are ever generated. After running bundle install
, there is no asciidoctor
executable in that Ruby version nor in the directory of the project that contains the Gemfile. Instead, to run executables of gems that are in your current bundle, you need to use bundle exec <command>
.
However, constantly writing bundle exec asciidoctor…
would quickly get tedious. So, making gem binstubs easily accessible to your project can be useful. To generate gem binstubs, you've already discovered that you need to run the bundle binstubs
command, but you have tried to run asciidoctor
command too quickly afterwards. You see, the asciidoctor
binstub was generated, but it wasn't in the PATH and thus you can't run it just by typing its name. It was placed in the local ./bin
directory by default, which is not in PATH, and therefore you can only activate it by executing bin/asciidoctor
instead.
To make it easier for yourself, you could add ./bin
to your global PATH so you don't have to prefix your executables with relative paths, but plenty of developers will warn you that this practice applied globally to your system could be dangerous because someone could exploit that via malicious executables placed in bin/
directories. Personally, I use the direnv tool to only add ./bin
directories of projects to PATH that I have explicitly allow-listed.
I use
bundle install
to installasciidoctor-pdf-cjk-kai_gen_gothic-install
from github. My Gemfile looks like this:When I run
bundle install
, things look good:But it didn't work, I have tried the method mentioned in Understanding-binstubs :
It looks like this command does not exist in shim:
Environment