From 7d7083d0f3f8402be4ddc84b74771e4d022b9fdc Mon Sep 17 00:00:00 2001 From: Bo Anderson Date: Sat, 5 Nov 2022 01:58:12 +0000 Subject: [PATCH] Universally apply Ruby disable options --- Library/Homebrew/brew.sh | 4 ++-- Library/Homebrew/dev-cmd/rubocop.sh | 2 +- Library/Homebrew/startup/config.rb | 1 + Library/Homebrew/test/support/lib/startup/config.rb | 1 + 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/brew.sh b/Library/Homebrew/brew.sh index 888c95cba2..22ea354764 100644 --- a/Library/Homebrew/brew.sh +++ b/Library/Homebrew/brew.sh @@ -724,7 +724,7 @@ then fi # Disable Ruby options we don't need. -RUBY_DISABLE_OPTIONS="--disable=gems,rubyopt" +export HOMEBREW_RUBY_DISABLE_OPTIONS="--disable=gems,rubyopt" if [[ -z "${HOMEBREW_RUBY_WARNINGS}" ]] then @@ -839,7 +839,7 @@ else # shellcheck disable=SC2154 { auto-update "$@" - exec "${HOMEBREW_RUBY_PATH}" "${HOMEBREW_RUBY_WARNINGS}" "${RUBY_DISABLE_OPTIONS}" \ + exec "${HOMEBREW_RUBY_PATH}" "${HOMEBREW_RUBY_WARNINGS}" "${HOMEBREW_RUBY_DISABLE_OPTIONS}" \ "${HOMEBREW_LIBRARY}/Homebrew/brew.rb" "$@" } fi diff --git a/Library/Homebrew/dev-cmd/rubocop.sh b/Library/Homebrew/dev-cmd/rubocop.sh index 28e9df7a42..e14f056c9a 100644 --- a/Library/Homebrew/dev-cmd/rubocop.sh +++ b/Library/Homebrew/dev-cmd/rubocop.sh @@ -11,7 +11,7 @@ homebrew-rubocop() { source "${HOMEBREW_LIBRARY}/Homebrew/utils/ruby.sh" setup-ruby-path - GEM_VERSION="$("${HOMEBREW_RUBY_PATH}" "${RUBY_DISABLE_OPTIONS}" -rrbconfig -e 'puts RbConfig::CONFIG["ruby_version"]')" + GEM_VERSION="$("${HOMEBREW_RUBY_PATH}" "${HOMEBREW_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" diff --git a/Library/Homebrew/startup/config.rb b/Library/Homebrew/startup/config.rb index 52c6836acc..827d71388e 100644 --- a/Library/Homebrew/startup/config.rb +++ b/Library/Homebrew/startup/config.rb @@ -52,4 +52,5 @@ end.freeze HOMEBREW_RUBY_EXEC_ARGS = [ RUBY_PATH, ENV.fetch("HOMEBREW_RUBY_WARNINGS"), + ENV.fetch("HOMEBREW_RUBY_DISABLE_OPTIONS"), ].freeze diff --git a/Library/Homebrew/test/support/lib/startup/config.rb b/Library/Homebrew/test/support/lib/startup/config.rb index b748525955..822b0f51c5 100644 --- a/Library/Homebrew/test/support/lib/startup/config.rb +++ b/Library/Homebrew/test/support/lib/startup/config.rb @@ -36,6 +36,7 @@ HOMEBREW_TEMP = (HOMEBREW_PREFIX.parent/"temp").freeze HOMEBREW_RUBY_EXEC_ARGS = [ RUBY_PATH, ENV.fetch("HOMEBREW_RUBY_WARNINGS"), + ENV.fetch("HOMEBREW_RUBY_DISABLE_OPTIONS"), "-I", HOMEBREW_LIBRARY_PATH/"test/support/lib" ].freeze