From 74a8e5bb235cfdc476b84863e2eb1847fc3eec3e Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Thu, 11 Aug 2022 10:57:19 +0100 Subject: [PATCH] dev-cmd/rubocop: use bundle check. It's not reliable enough to just check for the binary. --- Library/Homebrew/dev-cmd/rubocop.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/dev-cmd/rubocop.sh b/Library/Homebrew/dev-cmd/rubocop.sh index bc1b8ca769..28e9df7a42 100644 --- a/Library/Homebrew/dev-cmd/rubocop.sh +++ b/Library/Homebrew/dev-cmd/rubocop.sh @@ -13,13 +13,16 @@ homebrew-rubocop() { GEM_VERSION="$("${HOMEBREW_RUBY_PATH}" "${RUBY_DISABLE_OPTIONS}" -rrbconfig -e 'puts RbConfig::CONFIG["ruby_version"]')" GEM_HOME="${HOMEBREW_LIBRARY}/Homebrew/vendor/bundle/ruby/${GEM_VERSION}" + BUNDLE_GEMFILE="${HOMEBREW_LIBRARY}/Homebrew/Gemfile" - if ! [[ -f "${GEM_HOME}/bin/rubocop" ]] + export GEM_HOME + export BUNDLE_GEMFILE + + if ! bundle check &>/dev/null then "${HOMEBREW_BREW_FILE}" install-bundler-gems fi - export GEM_HOME export PATH="${GEM_HOME}/bin:${PATH}" RUBOCOP="${HOMEBREW_LIBRARY}/Homebrew/utils/rubocop.rb"