From d69c3ef3df7c332fdc646e0533b898b661f5fccf Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 28 Mar 2023 09:12:48 +0100 Subject: [PATCH] Vendor more gems Let's resolve the intermittent issues we've seen when various installed on demand gems cannot be installed by including them all in the Gemfile. --- Library/Homebrew/Gemfile | 6 +++++- Library/Homebrew/Gemfile.lock | 3 +++ Library/Homebrew/dev-cmd/irb.rb | 1 - Library/Homebrew/dev-cmd/prof.rb | 6 +++--- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Library/Homebrew/Gemfile b/Library/Homebrew/Gemfile index 79cb2bcdaa9f2..66660c553f39b 100644 --- a/Library/Homebrew/Gemfile +++ b/Library/Homebrew/Gemfile @@ -17,6 +17,7 @@ gem "byebug", require: false gem "json_schemer", require: false gem "minitest", require: false gem "parallel_tests", require: false +gem "pry", require: false gem "ronn", require: false gem "rspec", require: false gem "rspec-github", require: false @@ -26,6 +27,9 @@ gem "rspec-retry", require: false gem "rspec-sorbet", require: false gem "rubocop", require: false gem "rubocop-ast", require: false +# NOTE: ruby-prof v1.4.3 is the last version that supports Ruby 2.6.x +# TODO: remove explicit version when HOMEBREW_REQUIRED_RUBY_VERSION >= 2.7 +gem "ruby-prof", "1.4.3", require: false gem "simplecov", require: false gem "simplecov-cobertura", require: false gem "stackprof", require: false @@ -52,7 +56,7 @@ gem "rubocop-sorbet" gem "ruby-macho" gem "sorbet-runtime" -# remove when HOMEBREW_REQUIRED_RUBY_VERSION >= 2.7 +# TODO: remove when HOMEBREW_REQUIRED_RUBY_VERSION >= 2.7 install_if -> { RUBY_VERSION < "2.7" } do gem "did_you_mean" end diff --git a/Library/Homebrew/Gemfile.lock b/Library/Homebrew/Gemfile.lock index eeab086f4cca6..e3dbdab3e079b 100644 --- a/Library/Homebrew/Gemfile.lock +++ b/Library/Homebrew/Gemfile.lock @@ -157,6 +157,7 @@ GEM rubocop-sorbet (0.7.0) rubocop (>= 0.90.0) ruby-macho (3.0.0) + ruby-prof (1.4.3) ruby-progressbar (1.13.0) rubyntlm (0.6.3) simplecov (0.22.0) @@ -239,6 +240,7 @@ DEPENDENCIES parlour patchelf plist + pry ronn rspec rspec-github @@ -253,6 +255,7 @@ DEPENDENCIES rubocop-rspec rubocop-sorbet ruby-macho + ruby-prof (= 1.4.3) simplecov simplecov-cobertura sorbet-runtime diff --git a/Library/Homebrew/dev-cmd/irb.rb b/Library/Homebrew/dev-cmd/irb.rb index f7a7a48231746..07e42818f3c26 100644 --- a/Library/Homebrew/dev-cmd/irb.rb +++ b/Library/Homebrew/dev-cmd/irb.rb @@ -64,7 +64,6 @@ def irb end if args.pry? - Homebrew.install_gem_setup_path! "pry" require "pry" else require "irb" diff --git a/Library/Homebrew/dev-cmd/prof.rb b/Library/Homebrew/dev-cmd/prof.rb index 0d02cdb26a385..42b14123d27f1 100644 --- a/Library/Homebrew/dev-cmd/prof.rb +++ b/Library/Homebrew/dev-cmd/prof.rb @@ -41,6 +41,7 @@ def prof end if args.stackprof? + # Already installed from Gemfile but use this to setup PATH and LOADPATH Homebrew.install_gem_setup_path! "stackprof" with_env HOMEBREW_STACKPROF: "1" do system(*HOMEBREW_RUBY_EXEC_ARGS, brew_rb, *args.named) @@ -48,9 +49,8 @@ def prof output_filename = "prof/d3-flamegraph.html" safe_system "stackprof --d3-flamegraph prof/stackprof.dump > #{output_filename}" else - # NOTE: ruby-prof v1.4.3 is the last version that supports Ruby 2.6.x - # TODO: Remove explicit version arg when we move to a newer version of Ruby - Homebrew.install_gem_setup_path! "ruby-prof", version: "1.4.3" + # Already installed from Gemfile but use this to setup PATH and LOADPATH + Homebrew.install_gem_setup_path! "ruby-prof" output_filename = "prof/call_stack.html" safe_system "ruby-prof", "--printer=call_stack", "--file=#{output_filename}", brew_rb, "--", *args.named end