First, Bundler.setup after require "bundler/setup" does nothing. If you require "bundler/setup", it calls Bundler.setup, and once Bundler.setup is called once, all future Bundler.setup calls are ignored. This switches require "bundler/setup" to require "bundler", and then updates the Bundler.setup calls to only load the expected groups. In the loader, only load the :default and either the :test or :development groups, depending on the rack environment. For the linter:rubocop task, run the rubocop command line tool. This allows the use of a normal task, and means you don't need to require rubocop every time you run the Rakefile (and handle failures). This runs rubocop with BUNDLE_WITH so it only loads the rubocop related gems. Have the brakeman and erb_formatter tasks load only the :lint group.
9.9 KiB
9.9 KiB