From 26ea6b7f9e30b1ca741e1e397d6e673728178b14 Mon Sep 17 00:00:00 2001 From: Bo Anderson Date: Fri, 27 Oct 2023 19:44:02 +0100 Subject: [PATCH] Pull in REXML gem as it doesn't ship with Ruby 3 --- Library/Homebrew/Gemfile | 5 +++++ Library/Homebrew/Gemfile.lock | 1 + Library/Homebrew/dev-cmd/audit.rb | 4 ++++ Library/Homebrew/dev-cmd/bump-cask-pr.rb | 5 ++++- Library/Homebrew/dev-cmd/bump-formula-pr.rb | 2 +- Library/Homebrew/dev-cmd/bump-unversioned-casks.rb | 2 ++ Library/Homebrew/dev-cmd/livecheck.rb | 2 +- Library/Homebrew/livecheck/strategy/sparkle.rb | 1 + Library/Homebrew/livecheck/strategy/xml.rb | 2 -- 9 files changed, 19 insertions(+), 5 deletions(-) diff --git a/Library/Homebrew/Gemfile b/Library/Homebrew/Gemfile index 4f2872b628..bde7647d45 100644 --- a/Library/Homebrew/Gemfile +++ b/Library/Homebrew/Gemfile @@ -68,6 +68,11 @@ group :typecheck, optional: true do gem "tapioca", require: false end +# shared gems (used by multiple groups) +group :audit, :bump_unversioned_casks, :livecheck, optional: true do + gem "rexml", require: false +end + # vendored gems (no group) gem "activesupport" gem "addressable" diff --git a/Library/Homebrew/Gemfile.lock b/Library/Homebrew/Gemfile.lock index 46049965b0..59701e92b5 100644 --- a/Library/Homebrew/Gemfile.lock +++ b/Library/Homebrew/Gemfile.lock @@ -201,6 +201,7 @@ DEPENDENCIES patchelf plist pry + rexml ronn rspec rspec-github diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 7302b62de2..dd781745c0 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -153,6 +153,10 @@ module Homebrew return end + gem_groups = ["audit"] + gem_groups << "style" unless skip_style + Homebrew.install_bundler_gems!(groups: gem_groups) + style_files = args.named.to_paths unless skip_style only_cops = args.only_cops diff --git a/Library/Homebrew/dev-cmd/bump-cask-pr.rb b/Library/Homebrew/dev-cmd/bump-cask-pr.rb index cc0f8c0d12..23efb2850e 100644 --- a/Library/Homebrew/dev-cmd/bump-cask-pr.rb +++ b/Library/Homebrew/dev-cmd/bump-cask-pr.rb @@ -70,7 +70,10 @@ module Homebrew # odeprecated "brew bump-cask-pr --online" if args.online? # This will be run by `brew audit` or `brew style` later so run it first to # not start spamming during normal output. - Homebrew.install_bundler_gems!(groups: ["style"]) if !args.no_audit? || !args.no_style? + gem_groups = [] + gem_groups << "style" if !args.no_audit? || !args.no_style? + gem_groups << "audit" unless args.no_audit? + Homebrew.install_bundler_gems!(groups: gem_groups) unless gem_groups.empty? # As this command is simplifying user-run commands then let's just use a # user path, too. diff --git a/Library/Homebrew/dev-cmd/bump-formula-pr.rb b/Library/Homebrew/dev-cmd/bump-formula-pr.rb index 338ad2df9b..e6a6467cee 100644 --- a/Library/Homebrew/dev-cmd/bump-formula-pr.rb +++ b/Library/Homebrew/dev-cmd/bump-formula-pr.rb @@ -117,7 +117,7 @@ module Homebrew # This will be run by `brew audit` later so run it first to not start # spamming during normal output. - Homebrew.install_bundler_gems!(groups: ["style"]) unless args.no_audit? + Homebrew.install_bundler_gems!(groups: ["audit", "style"]) unless args.no_audit? tap_remote_repo = formula.tap.full_name || formula.tap.remote_repo remote = "origin" diff --git a/Library/Homebrew/dev-cmd/bump-unversioned-casks.rb b/Library/Homebrew/dev-cmd/bump-unversioned-casks.rb index d4367c873d..04bd56092e 100644 --- a/Library/Homebrew/dev-cmd/bump-unversioned-casks.rb +++ b/Library/Homebrew/dev-cmd/bump-unversioned-casks.rb @@ -33,6 +33,8 @@ module Homebrew def self.bump_unversioned_casks args = bump_unversioned_casks_args.parse + Homebrew.install_bundler_gems!(groups: ["bump_unversioned_casks"]) + state_file = if args.state_file.present? Pathname(args.state_file).expand_path else diff --git a/Library/Homebrew/dev-cmd/livecheck.rb b/Library/Homebrew/dev-cmd/livecheck.rb index c29f42ea6f..36cf601b37 100644 --- a/Library/Homebrew/dev-cmd/livecheck.rb +++ b/Library/Homebrew/dev-cmd/livecheck.rb @@ -66,7 +66,7 @@ module Homebrew def livecheck args = livecheck_args.parse - Homebrew.install_bundler_gems!(groups: ["livecheck"]) if args.json? + Homebrew.install_bundler_gems!(groups: ["livecheck"]) all = args.eval_all? diff --git a/Library/Homebrew/livecheck/strategy/sparkle.rb b/Library/Homebrew/livecheck/strategy/sparkle.rb index 4b0c53acd4..bffe664d2a 100644 --- a/Library/Homebrew/livecheck/strategy/sparkle.rb +++ b/Library/Homebrew/livecheck/strategy/sparkle.rb @@ -62,6 +62,7 @@ module Homebrew # @return [Item, nil] sig { params(content: String).returns(T::Array[Item]) } def self.items_from_content(content) + require "rexml/document" xml = Xml.parse_xml(content) return [] if xml.blank? diff --git a/Library/Homebrew/livecheck/strategy/xml.rb b/Library/Homebrew/livecheck/strategy/xml.rb index 5c0816b96c..d78c5f0574 100644 --- a/Library/Homebrew/livecheck/strategy/xml.rb +++ b/Library/Homebrew/livecheck/strategy/xml.rb @@ -1,8 +1,6 @@ # typed: true # frozen_string_literal: true -require "rexml/document" - module Homebrew module Livecheck module Strategy