Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do I need binstubs in Rails?

I don't completely understand the purpose of binstubs feature in Rails.

For example, when I ran bin/bundle binstubs rspec-rails I got the following output:

rspec-rails has no executables, but you may want one from a gem it depends on.
  railties has: rails
  rspec-core has: autospec, rspec

What does it mean? And why do I need bin/bundle binstubs rspec-core command?

like image 510
Alex Shmatko Avatar asked Nov 01 '25 01:11

Alex Shmatko


1 Answers

Binstubs are wrapper scripts around executables (sometimes referred to as "binaries", although they don't have to be compiled) whose purpose is to prepare the environment before dispatching the call to the original executable.

In the Ruby world, the most common binstubs are the ones that RubyGems generates after installing a gem that contains executables. But binstubs can be written in any language, and it often makes sense to create them manually.

Source: rbenv wiki – Understanding binstubs

like image 192
Philidor Avatar answered Nov 02 '25 23:11

Philidor