So young. So innocent. This approach has been combined with https://github.com/mpapis/rubygems-bundler for great justice! Go there instead, and for the love of God, don't use this anymore.
Let's stop using bundle exec, kthx.
gem install noexec
Then, in your .profile (or somewhere you can set env variables)
RUBYOPT="-r`noexec`"
And you're done!
Alternatively you can use rubygems-bundler to generate wrappers aware of noexec, install:
gem install rubygems-bundler
change a line in ~/.gemrc to:
custom_shebang: $env ruby_noexec_wrapper
and run (once):
gem regenerate_binstubs
Though you can let noexec do it's own thing and rely on looking up your binary via your Gemfile, you can also specify which binaries you want included or excluded. Create a .noexec.yaml file along side any Gemfiles you want to use. Then, to enable (or disable) the usage of your particular binary into your bundle, add an include or exclude section. For example:
exclude: [rake]
Or,
include: [irb, ruby]
Things not going the way you'd like? Try your command again with NOEXEC_DEBUG=1 set and create a ticket. I'll fix it right away!
It adds a script to every execution of ruby via the RUBYOPT environment variable. Then, when you run ruby, it takes a look at your working directory, and every directory above it until it can find a Gemfile
. If the executable you're running is present in your Gemfile, it switches to using that Gemfile
instead (via Bundle.setup
).
Thank you Carl!!!!