Method: Jets::Booter.require_bundle_gems
- Defined in:
- lib/jets/booter.rb
.require_bundle_gems ⇒ Object
require_bundle_gems called when environment boots up via Jets.boot. It also useful for when to loading Rake tasks in Jets::Commands::RakeTasks.load!
For example, some gems like webpacker that load rake tasks are specified with a git based source:
gem "webpacker", git: "https://github.com/tongueroo/webpacker.git"
This results in the user having to specific bundle exec in front of jets for those rake tasks to show up in jets help.
Instead, when the user is within the project folder, jets automatically requires bundler for the user. So the rake tasks show up when calling jets help.
When the user calls jets help from outside the project folder, bundler is not used and the load errors get rescued gracefully. This is done in Jets::Commands::RakeTasks.load! In the case when there are in another project with another Gemfile, the load errors will still be rescued.
54 55 56 57 58 59 60 61 |
# File 'lib/jets/booter.rb', line 54 def require_bundle_gems # NOTE: Dont think ENV['BUNDLE_GEMFILE'] is quite working right. We still need # to be in the project directory. Leaving logic in here for when it gets fix. if ENV['BUNDLE_GEMFILE'] || File.exist?("Gemfile") require "bundler/setup" Bundler.require(*bundler_groups) end end |