mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Merge pull request #17047 from Homebrew/block-params
Prefer numbered block params over proc conversion, cont'd
This commit is contained in:
commit
56fc9a1fb2
@ -20,9 +20,9 @@ module Cask
|
||||
elsif full_name
|
||||
puts output.map(&:full_name).sort(&tap_and_name_comparison)
|
||||
elsif versions
|
||||
puts output.map(&method(:format_versioned))
|
||||
puts output.map { format_versioned(_1) }
|
||||
elsif !output.empty? && casks.any?
|
||||
output.map(&method(:list_artifacts))
|
||||
output.map { list_artifacts(_1) }
|
||||
elsif !output.empty?
|
||||
puts Formatter.columns(output.map(&:to_s))
|
||||
end
|
||||
|
@ -76,7 +76,7 @@ module Cask
|
||||
|
||||
sig { returns(T::Array[Pathname]) }
|
||||
def pkgutil_bom_specials
|
||||
@pkgutil_bom_specials ||= pkgutil_bom_all.select(&method(:special?))
|
||||
@pkgutil_bom_specials ||= pkgutil_bom_all.select { special?(_1) }
|
||||
end
|
||||
|
||||
sig { returns(T::Array[Pathname]) }
|
||||
|
@ -345,7 +345,7 @@ module Homebrew
|
||||
|
||||
def cleanup_formula(formula, quiet: false, ds_store: true, cache_db: true)
|
||||
formula.eligible_kegs_for_cleanup(quiet:)
|
||||
.each(&method(:cleanup_keg))
|
||||
.each { cleanup_keg(_1) }
|
||||
cleanup_cache(Pathname.glob(cache/"#{formula.name}{_bottle_manifest,}--*").map { |path| { path:, type: nil } })
|
||||
rm_ds_store([formula.rack]) if ds_store
|
||||
cleanup_cache_db(formula.rack) if cache_db
|
||||
@ -687,7 +687,7 @@ module Homebrew
|
||||
formulae = Formula.installed
|
||||
# Remove formulae listed in HOMEBREW_NO_CLEANUP_FORMULAE and their dependencies.
|
||||
if Homebrew::EnvConfig.no_cleanup_formulae.present?
|
||||
formulae -= formulae.select(&method(:skip_clean_formula?))
|
||||
formulae -= formulae.select { skip_clean_formula?(_1) }
|
||||
.flat_map { |f| [f, *f.runtime_formula_dependencies] }
|
||||
end
|
||||
casks = Cask::Caskroom.casks
|
||||
|
@ -590,9 +590,9 @@ module Homebrew
|
||||
end
|
||||
|
||||
select_cli_arg = violations.count - env_var_options.count == 1
|
||||
raise OptionConflictError, violations.map(&method(:name_to_option)) unless select_cli_arg
|
||||
raise OptionConflictError, violations.map { name_to_option(_1) } unless select_cli_arg
|
||||
|
||||
env_var_options.each(&method(:disable_switch))
|
||||
env_var_options.each { disable_switch(_1) }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -29,12 +29,12 @@ module Homebrew
|
||||
CaskDependent.new(cask).runtime_dependencies.map(&:to_formula)
|
||||
end
|
||||
leaves_list -= casks_runtime_dependencies
|
||||
leaves_list.select!(&method(:installed_on_request?)) if args.installed_on_request?
|
||||
leaves_list.select!(&method(:installed_as_dependency?)) if args.installed_as_dependency?
|
||||
leaves_list.select! { installed_on_request?(_1) } if args.installed_on_request?
|
||||
leaves_list.select! { installed_as_dependency?(_1) } if args.installed_as_dependency?
|
||||
|
||||
leaves_list.map(&:full_name)
|
||||
.sort
|
||||
.each(&method(:puts))
|
||||
.each { puts(_1) }
|
||||
end
|
||||
|
||||
private
|
||||
|
@ -135,13 +135,13 @@ module Commands
|
||||
|
||||
def self.find_internal_commands(path)
|
||||
find_commands(path).map(&:basename)
|
||||
.map(&method(:basename_without_extension))
|
||||
.map { basename_without_extension(_1) }
|
||||
end
|
||||
|
||||
def self.external_commands
|
||||
Tap.cmd_directories.flat_map do |path|
|
||||
find_commands(path).select(&:executable?)
|
||||
.map(&method(:basename_without_extension))
|
||||
.map { basename_without_extension(_1) }
|
||||
.map { |p| p.to_s.delete_prefix("brew-").strip }
|
||||
end.map(&:to_s)
|
||||
.sort
|
||||
|
@ -963,7 +963,7 @@ module Homebrew
|
||||
end
|
||||
|
||||
def check_cask_load_path
|
||||
paths = $LOAD_PATH.map(&method(:user_tilde))
|
||||
paths = $LOAD_PATH.map { user_tilde(_1) }
|
||||
|
||||
add_info "$LOAD_PATHS", paths.presence || none_string
|
||||
|
||||
|
@ -82,7 +82,7 @@ module Homebrew
|
||||
man_page_lines = []
|
||||
|
||||
# preserve existing manpage order
|
||||
cmd_paths.sort_by(&method(:sort_key_for_path))
|
||||
cmd_paths.sort_by { sort_key_for_path(_1) }
|
||||
.each do |cmd_path|
|
||||
cmd_man_page_lines = if (cmd_parser = Homebrew::CLI::Parser.from_cmd_path(cmd_path))
|
||||
next if cmd_parser.hide_from_man_page
|
||||
|
@ -90,7 +90,7 @@ module MachOShim
|
||||
def dynamically_linked_libraries(except: :none, resolve_variable_references: true)
|
||||
lcs = macho.dylib_load_commands.reject { |lc| lc.type == except }
|
||||
names = lcs.map { |lc| lc.name.to_s }.uniq
|
||||
names.map!(&method(:resolve_variable_name)) if resolve_variable_references
|
||||
names.map! { resolve_variable_name(_1) } if resolve_variable_references
|
||||
|
||||
names
|
||||
end
|
||||
|
@ -581,11 +581,11 @@ module Homebrew
|
||||
when String
|
||||
replace_placeholders(api_hash["run"])
|
||||
when Array
|
||||
api_hash["run"].map(&method(:replace_placeholders))
|
||||
api_hash["run"].map { replace_placeholders(_1) }
|
||||
when Hash
|
||||
api_hash["run"].to_h do |key, elem|
|
||||
run_cmd = if elem.is_a?(Array)
|
||||
elem.map(&method(:replace_placeholders))
|
||||
elem.map { replace_placeholders(_1) }
|
||||
else
|
||||
replace_placeholders(elem)
|
||||
end
|
||||
|
@ -624,7 +624,7 @@ class Tap
|
||||
formula_dir.children
|
||||
else
|
||||
formula_dir.find
|
||||
end.select(&method(:formula_file?))
|
||||
end.select { formula_file?(_1) }
|
||||
else
|
||||
[]
|
||||
end
|
||||
@ -647,7 +647,7 @@ class Tap
|
||||
sig { returns(T::Array[Pathname]) }
|
||||
def cask_files
|
||||
@cask_files ||= if cask_dir.directory?
|
||||
cask_dir.find.select(&method(:ruby_file?))
|
||||
cask_dir.find.select { ruby_file?(_1) }
|
||||
else
|
||||
[]
|
||||
end
|
||||
@ -701,7 +701,7 @@ class Tap
|
||||
# An array of all {Formula} names of this {Tap}.
|
||||
sig { returns(T::Array[String]) }
|
||||
def formula_names
|
||||
@formula_names ||= formula_files.map(&method(:formula_file_to_name))
|
||||
@formula_names ||= formula_files.map { formula_file_to_name(_1) }
|
||||
end
|
||||
|
||||
# A hash of all {Formula} name prefixes to versioned {Formula} in this {Tap}.
|
||||
@ -718,7 +718,7 @@ class Tap
|
||||
# An array of all {Cask} tokens of this {Tap}.
|
||||
sig { returns(T::Array[String]) }
|
||||
def cask_tokens
|
||||
@cask_tokens ||= cask_files.map(&method(:formula_file_to_name))
|
||||
@cask_tokens ||= cask_files.map { formula_file_to_name(_1) }
|
||||
end
|
||||
|
||||
# path to the directory of all alias files for this {Tap}.
|
||||
@ -946,7 +946,7 @@ class Tap
|
||||
sig { returns(T::Array[Tap]) }
|
||||
def self.installed
|
||||
cache[:installed] ||= if TAP_DIRECTORY.directory?
|
||||
TAP_DIRECTORY.subdirs.flat_map(&:subdirs).map(&method(:from_path))
|
||||
TAP_DIRECTORY.subdirs.flat_map(&:subdirs).map { from_path(_1) }
|
||||
else
|
||||
[]
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user