From b954d4481e238560bab1eb19ed4f9a3d2bf25ca4 Mon Sep 17 00:00:00 2001 From: apainintheneck Date: Sat, 12 Oct 2024 13:38:06 -0700 Subject: [PATCH] Fix service-diff command The problem here was that for some reason on CI the hashicorp tap is installed and that means that I was running this command for that tap too. This didn't really make any sense because we only really need to run this command for the core tap; nothing else gets serialized to the API. I removed the --tap= command and now it just runs on the core tap by default which should help us avoid this problem. I tested it both with all formulae in the core tap and a single formula. --- README.md | 1 - cmd/service-diff.rb | 6 +----- lib/diff-scripts/service_diff.rb | 9 ++++----- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 2052a48..50e3571 100644 --- a/README.md +++ b/README.md @@ -92,7 +92,6 @@ Warning: This command runs git commands on the main brew repo. To be safe avoid running other brew commands simultaneously. --formula Run the diff on only one formula. - --tap Run the diff on only one tap. --word-diff Show word diff instead of default line diff. --stat Shows condensed output based on git diff --stat diff --git a/cmd/service-diff.rb b/cmd/service-diff.rb index ba40d7c..0f1e56b 100755 --- a/cmd/service-diff.rb +++ b/cmd/service-diff.rb @@ -17,11 +17,9 @@ class ServiceDiff < AbstractCommand EOS flag "--formula=", description: "Run the diff on only one formula." - flag "--tap=", description: "Run the diff on only one tap." switch "--word-diff", description: "Show word diff instead of default line diff." switch "--stat", description: "Shows condensed output based on `git diff --stat`" - conflicts "--tap=", "--formula=" conflicts "--word-diff", "--stat" end @@ -32,9 +30,7 @@ def run odie "Script #{script_path} doesn't exist!" unless File.exist?(script_path) script_args = - if args.tap - ["tap", args.tap] - elsif args.formula + if args.formula ["formula", args.formula] else ["all"] diff --git a/lib/diff-scripts/service_diff.rb b/lib/diff-scripts/service_diff.rb index a10cdef..5bdaec0 100644 --- a/lib/diff-scripts/service_diff.rb +++ b/lib/diff-scripts/service_diff.rb @@ -11,12 +11,11 @@ # Expects: # 1. Command type from VALID_COMMAND_TYPES # 2. Command arg -# - for command type `tap` it should be the name of a tap # - for command type `formula` it should be the name of a formula # - for command type `all` it is NOT necessary COMMAND_TYPE, COMMAND_ARG, *extra = ARGV -VALID_COMMAND_TYPES = %w[all tap formula].freeze +VALID_COMMAND_TYPES = %w[all formula].freeze if VALID_COMMAND_TYPES.exclude?(COMMAND_TYPE) odie "Unknown command type `#{COMMAND_TYPE}`!" @@ -29,9 +28,9 @@ FORMULAE = case COMMAND_TYPE when "all" - Formula.all(eval_all: true) - when "tap" - Tap.fetch(COMMAND_ARG).formula_files.map(&Formulary.method(:factory)) + CoreTap.instance.formula_names.map do |name| + Formulary.factory(name) + end when "formula" [Formulary.factory(COMMAND_ARG)] end