From 18b362aa96e49d0968226cde6c4415ef3a0d9e48 Mon Sep 17 00:00:00 2001 From: Douglas F Shearer Date: Wed, 16 May 2018 13:01:12 +0100 Subject: [PATCH] Alphabetize the `brew outdated` formula listing. Sorts by `Formula#<=>`. Includes updated test example. --- Library/Homebrew/cmd/outdated.rb | 4 +++- Library/Homebrew/test/cmd/outdated_spec.rb | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/cmd/outdated.rb b/Library/Homebrew/cmd/outdated.rb index 97367ca1e2..65a4e316e5 100644 --- a/Library/Homebrew/cmd/outdated.rb +++ b/Library/Homebrew/cmd/outdated.rb @@ -41,7 +41,9 @@ module Homebrew verbose = ($stdout.tty? || ARGV.verbose?) && !ARGV.flag?("--quiet") fetch_head = ARGV.fetch_head? - outdated_formulae = formulae.select { |f| f.outdated?(fetch_head: fetch_head) } + outdated_formulae = formulae + .select { |f| f.outdated?(fetch_head: fetch_head) } + .sort outdated_formulae.each do |f| if verbose diff --git a/Library/Homebrew/test/cmd/outdated_spec.rb b/Library/Homebrew/test/cmd/outdated_spec.rb index 8b4c01e538..f24a3c5710 100644 --- a/Library/Homebrew/test/cmd/outdated_spec.rb +++ b/Library/Homebrew/test/cmd/outdated_spec.rb @@ -4,8 +4,11 @@ describe "brew outdated", :integration_test do setup_test_formula "testball" (HOMEBREW_CELLAR/"testball/0.0.1/foo").mkpath + setup_test_formula "foo" + (HOMEBREW_CELLAR/"foo/0.0.1/foo").mkpath + expect { brew "outdated" } - .to output("testball\n").to_stdout + .to output("foo\ntestball\n").to_stdout .and not_to_output.to_stderr .and be_a_success end