Merge pull request #3316 from DomT4/handle_apfs_love_of_hash_order

Handle APFS returning hash order.
This commit is contained in:
Mike McQuaid 2017-10-18 10:55:22 +01:00 committed by GitHub
commit 1d541804c8
13 changed files with 23 additions and 22 deletions

View File

@ -16,12 +16,12 @@ module Homebrew
else
# Find commands in Homebrew/cmd
puts "Built-in commands"
puts Formatter.columns(internal_commands)
puts Formatter.columns(internal_commands.sort)
# Find commands in Homebrew/dev-cmd
puts
puts "Built-in developer commands"
puts Formatter.columns(internal_developer_commands)
puts Formatter.columns(internal_developer_commands.sort)
# Find commands in the path
unless (exts = external_commands).empty?

View File

@ -68,16 +68,16 @@ module Homebrew
if mode.tree?
if mode.installed?
puts_deps_tree Formula.installed, !ARGV.one?
puts_deps_tree Formula.installed.sort, !ARGV.one?
else
raise FormulaUnspecifiedError if ARGV.named.empty?
puts_deps_tree ARGV.formulae, !ARGV.one?
end
elsif mode.all?
puts_deps Formula
puts_deps Formula.sort
elsif ARGV.named.empty?
raise FormulaUnspecifiedError unless mode.installed?
puts_deps Formula.installed
puts_deps Formula.installed.sort
elsif mode.for_each?
puts_deps ARGV.formulae
else

View File

@ -67,9 +67,9 @@ module Homebrew
def print_json
ff = if ARGV.include? "--all"
Formula
Formula.sort
elsif ARGV.include? "--installed"
Formula.installed
Formula.installed.sort
else
ARGV.formulae
end

View File

@ -9,7 +9,7 @@ module Homebrew
module_function
def leaves
installed = Formula.installed
installed = Formula.installed.sort
deps_of_installed = Set.new
installed.each do |f|

View File

@ -87,7 +87,7 @@ module Homebrew
dirs.delete "etc"
dirs.delete "var"
args = dirs + %w[-type f (]
args = dirs.sort + %w[-type f (]
args.concat UNBREWED_EXCLUDE_FILES.flat_map { |f| %W[! -name #{f}] }
args.concat UNBREWED_EXCLUDE_PATHS.flat_map { |d| %W[! -path #{d}] }
args.concat %w[)]

View File

@ -16,9 +16,9 @@ module Homebrew
return unless HOMEBREW_CELLAR.exist?
ff = if ARGV.named.empty?
Formula.installed
Formula.installed.sort
else
ARGV.resolved_formulae
ARGV.resolved_formulae.sort
end
ff.each do |f|

View File

@ -16,9 +16,9 @@ module Homebrew
def options
if ARGV.include? "--all"
puts_options Formula.to_a
puts_options Formula.to_a.sort
elsif ARGV.include? "--installed"
puts_options Formula.installed
puts_options Formula.installed.sort
else
raise FormulaUnspecifiedError if ARGV.named.empty?
puts_options ARGV.formulae

View File

@ -24,7 +24,7 @@ module Homebrew
def search
if ARGV.empty?
puts Formatter.columns(Formula.full_names)
puts Formatter.columns(Formula.full_names.sort)
elsif ARGV.include? "--macports"
exec_browser "https://www.macports.org/ports.php?by=name&substr=#{ARGV.next}"
elsif ARGV.include? "--fink"
@ -52,15 +52,15 @@ module Homebrew
results = search_taps(name)
end
puts Formatter.columns(results) unless results.empty?
puts Formatter.columns(results.sort) unless results.empty?
else
query = ARGV.first
regex = query_regexp(query)
local_results = search_formulae(regex)
puts Formatter.columns(local_results) unless local_results.empty?
puts Formatter.columns(local_results.sort) unless local_results.empty?
tap_results = search_taps(query)
puts Formatter.columns(tap_results) unless tap_results.empty?
puts Formatter.columns(tap_results.sort) unless tap_results.empty?
if $stdout.tty?
count = local_results.length + tap_results.length

View File

@ -21,10 +21,11 @@ module Homebrew
module_function
def tap_info
# TODO: This still returns a non-alphabetised list on APFS.
if ARGV.include? "--installed"
taps = Tap
else
taps = ARGV.named.map do |name|
taps = ARGV.named.sort.map do |name|
Tap.fetch(name)
end
end

View File

@ -598,7 +598,7 @@ class ReporterHub
return if formulae.empty?
# Dump formula list.
ohai title
puts Formatter.columns(formulae)
puts Formatter.columns(formulae.sort)
end
def installed?(formula)

View File

@ -125,7 +125,7 @@ module Homebrew
end
return if uses.empty?
puts Formatter.columns(uses.map(&:full_name))
puts Formatter.columns(uses.map(&:full_name).sort)
odie "Missing formulae should not have dependents!" if used_formulae_missing
end
end

View File

@ -804,7 +804,7 @@ module Homebrew
def check_for_linked_keg_only_brews
return unless HOMEBREW_CELLAR.exist?
linked = Formula.installed.select do |f|
linked = Formula.installed.sort.select do |f|
f.keg_only? && __check_linked_brew(f)
end
return if linked.empty?

View File

@ -494,7 +494,7 @@ class Tap
# an array of all installed {Tap} names.
def self.names
map(&:name)
map(&:name).sort
end
# @private