From 93896fb9ea74097c0508e2d10baf393c626bb7a3 Mon Sep 17 00:00:00 2001 From: Tee Parham Date: Wed, 4 Dec 2024 11:24:54 -0700 Subject: [PATCH 1/2] Do not require debug on CI --- test/test_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_helper.rb b/test/test_helper.rb index c79c97f..b50af9f 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -5,7 +5,7 @@ require "gemdiff" begin - require "debug" + require "debug" unless ENV["CI"] rescue LoadError # ok end From 0dee647721a84eeb37d7a8c721f95e125fbb19e3 Mon Sep 17 00:00:00 2001 From: Tee Parham Date: Wed, 4 Dec 2024 11:40:00 -0700 Subject: [PATCH 2/2] Extract constants, rename local variables --- lib/gemdiff/cli.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/gemdiff/cli.rb b/lib/gemdiff/cli.rb index ef58534..6ea875c 100644 --- a/lib/gemdiff/cli.rb +++ b/lib/gemdiff/cli.rb @@ -12,6 +12,8 @@ class CLI < Thor CHECKING_FOR_OUTDATED = "Checking for outdated gems in your bundle..." NOTHING_TO_UPDATE = "Nothing to update." WORKING_DIRECTORY_IS_NOT_CLEAN = "Your working directory is not clean. Please commit or stash before updating." + RESPONSES_ALL = %w[s A].freeze + RESPONSES_COMPARE = %w[y A].freeze desc "find ", "Find the github repository URL for a gem" def find(gem_name) @@ -64,12 +66,12 @@ def each puts CHECKING_FOR_OUTDATED inspector = BundleInspector.new puts inspector.outdated - open_all = false + all_action = false inspector.list.each do |outdated_gem| puts outdated_gem.compare_message - response = open_all || ask("Open? (y to open, x to exit, A to open all, s to show all to stdout, else skip)") - open_all = response if %w[s A].include?(response) - outdated_gem.compare if %w[y A].include?(response) + response = all_action || ask("Open? (y to open, x to exit, A to open all, s to show all to stdout, else skip)") + all_action = response if RESPONSES_ALL.include?(response) + outdated_gem.compare if RESPONSES_COMPARE.include?(response) puts outdated_gem.compare_url if response == "s" break if response == "x" end