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 else
# Find commands in Homebrew/cmd # Find commands in Homebrew/cmd
puts "Built-in commands" puts "Built-in commands"
puts Formatter.columns(internal_commands) puts Formatter.columns(internal_commands.sort)
# Find commands in Homebrew/dev-cmd # Find commands in Homebrew/dev-cmd
puts puts
puts "Built-in developer commands" puts "Built-in developer commands"
puts Formatter.columns(internal_developer_commands) puts Formatter.columns(internal_developer_commands.sort)
# Find commands in the path # Find commands in the path
unless (exts = external_commands).empty? unless (exts = external_commands).empty?

View File

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

View File

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

View File

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

View File

@ -87,7 +87,7 @@ module Homebrew
dirs.delete "etc" dirs.delete "etc"
dirs.delete "var" 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_FILES.flat_map { |f| %W[! -name #{f}] }
args.concat UNBREWED_EXCLUDE_PATHS.flat_map { |d| %W[! -path #{d}] } args.concat UNBREWED_EXCLUDE_PATHS.flat_map { |d| %W[! -path #{d}] }
args.concat %w[)] args.concat %w[)]

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -125,7 +125,7 @@ module Homebrew
end end
return if uses.empty? 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 odie "Missing formulae should not have dependents!" if used_formulae_missing
end end
end end

View File

@ -804,7 +804,7 @@ module Homebrew
def check_for_linked_keg_only_brews def check_for_linked_keg_only_brews
return unless HOMEBREW_CELLAR.exist? 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) f.keg_only? && __check_linked_brew(f)
end end
return if linked.empty? return if linked.empty?

View File

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