mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00

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`
27 lines
693 B
Bash
27 lines
693 B
Bash
#: * `rubocop`
|
|
#:
|
|
#: Installs, configures and runs Homebrew's `rubocop`.
|
|
|
|
# HOMEBREW_LIBRARY is from the user environment.
|
|
# HOMEBREW_RUBY_PATH is set by utils/ruby.sh
|
|
# HOMEBREW_BREW_FILE is set by extend/ENV/super.rb
|
|
# shellcheck disable=SC2154
|
|
homebrew-rubocop() {
|
|
source "${HOMEBREW_LIBRARY}/Homebrew/utils/ruby.sh"
|
|
setup-ruby-path
|
|
setup-gem-home-bundle-gemfile
|
|
|
|
BUNDLE_WITH="style"
|
|
export BUNDLE_WITH
|
|
|
|
if ! bundle check &>/dev/null
|
|
then
|
|
"${HOMEBREW_BREW_FILE}" install-bundler-gems --add-groups="${BUNDLE_WITH}"
|
|
fi
|
|
|
|
export PATH="${GEM_HOME}/bin:${PATH}"
|
|
|
|
RUBOCOP="${HOMEBREW_LIBRARY}/Homebrew/utils/rubocop.rb"
|
|
exec "${HOMEBREW_RUBY_PATH}" "${RUBOCOP}" "$@"
|
|
}
|