5 Commits

Author SHA1 Message Date
Mike McQuaid
753add2cc7
cmd/setup-ruby: handle empty command path.
If this is empty: don't try to `grep` it.
2024-06-03 13:35:37 +01:00
Mike McQuaid
bc0f5ee62a
Library/Homebrew: move stdin ruby scripts to files under utils.
This avoids can avoid UID/EUID related issues with Ruby scripts passed
over `stdin` clashing with Ruby security features.

It's also just a bit nicer to have Ruby scripts in files instead.

While we're here:
- refactor some shared logic into a new `setup-gem-home-bundle-gemfile`
  function in `ruby.sh`
- do some general cleanup of `lock.sh`
- prioritise `flock` over `python` in `lock.sh`
2024-05-02 10:33:42 +01:00
Mike McQuaid
97ad3567d1
Optimise more command handling/speed
- 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`
2024-04-30 12:48:29 +01:00
Bo Anderson
2f05b47242
Fix setup-ruby/rubocop issues when euid != uid 2024-03-28 15:39:07 +00:00
Mike McQuaid
a2cd92b115
cmd/setup-ruby.sh: add new command.
This command, a bit like `install-bundler-gems`, is intended to be run
to ensure that the next invocation of `brew` will not need to try and
install Ruby or Bundler gems.
2023-10-27 09:27:56 +01:00