
- in `brew.sh` split the `case` into those cases that take a single or no arguments and those that take multiple arguments or handle multiple commands. This considerably speeds up the `brew shellenv bash` case that wasn't being handled here before. - add `setup-ruby` to the list of commands that can be called quickly by `brew.sh` without additional setup. This speeds up the `brew setup-ruby` no-op case by ~10x. - add a parameter to `setup-ruby` to avoid running Bundler if the command doesn't need it. This makes many more cases for `brew setup-ruby` to be no-op cases. - Remove the (now) unused `HOMEBREW_RUBY3` check in `setup-ruby`. - Improve argument handling in `command_path.sh` to allow it to be used as a function in `setup-ruby.sh`. - Add a new RuboCop to check usage of `install_bundler_gems!` is only inside `dev-cmd` (or a few other acceptable places). - Use new `processed_source.file_path` API in `formula_cop.rb`
13 lines
405 B
Ruby
13 lines
405 B
Ruby
# frozen_string_literal: true
|
|
|
|
require "rubocops/install_bundler_gems"
|
|
|
|
RSpec.describe RuboCop::Cop::Homebrew::InstallBundlerGems, :config do
|
|
it "registers an offense and corrects when using `Homebrew.install_bundler_gems!`" do
|
|
expect_offense(<<~RUBY)
|
|
Homebrew.install_bundler_gems!
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Only use `Homebrew.install_bundler_gems!` in dev-cmd.
|
|
RUBY
|
|
end
|
|
end
|