Feature #16744
closedFlag to load current bundle without using bundle exec
Description
The bundle exec
command is used by Ruby users primarily to start up a Ruby command or application with only its specific locked dependencies wired up. Unfortunately to do this it currently double-launches, executing a second Ruby command and doubling the base startup time for these use cases. With Bundler becoming part of the standard library, it seems a good time to add support for doing what bundle exec
does without requiring a relaunch.
For many years, JRuby has implemented the -G
/--gemfile
flag which requires in bundler/setup
before user code starts, eliminating the need to bundle exec in these situations.
https://github.com/jruby/jruby/commit/ea0eed02b4eb57c2198afa9fd47f94bc46cfc69f
This is based on the same flags in Rubinius:
https://github.com/rubinius/rubinius/commit/edc94f2e3a61d8c94031a942b2024c6c5aa3ea94
There's at least one more commit later on in Rubinius that fixes some interations between -G
and -S
.
Obviously this does not eliminate bundle exec
use cases where the target command is not a Ruby command, but that is a very specific (and rather strange to me) feature. The majority of use cases are booting up a Ruby command, for which this implementation of -G
would be sufficient (I think).
There may be different or additional ways that bundle exec
attempts to isolate the subcommand's environment and dependencies, but I believe requiring bundler/setup
at boot comes pretty close.
See also this bug report where I suggest using JRuby's embedding APIs to do bundle exec
. We very much want to help eliminate this double-launching, one way or another.
Updated by nobu (Nobuyoshi Nakada) about 5 years ago
- Status changed from Open to Third Party's Issue