While I was installing RSpec I run a command here
$bundle binstub rspec-core
I was wondering, what exactly the binstub is?
And why we have to use it?
Binstub is the Binaries require by the executable files. Basically, Binstub prepare the environment around executables before dispatching the call. Ruby might need an extra stuff to their job and here the binstub is use to make sure that the stage is properly set.
let’s go through an example from the Guide
# Prepares the $LOAD_PATH by adding to it lib directories of the gem and
# its dependencies:
# Loads the original executable
load Gem.bin_path(‘rspec-core’, ‘rspec’)
The purpose of every RubyGems binstub is to use RubyGems to prepare the
$LOAD_PATH before calling the original executable.