Merge pull request #16807 from dduugg/numbered-params
Prefer numbered block params over proc conversion
This commit is contained in:
commit
c5e7282985
@ -77,7 +77,7 @@ class PATH
|
|||||||
|
|
||||||
sig { returns(T.nilable(T.self_type)) }
|
sig { returns(T.nilable(T.self_type)) }
|
||||||
def existing
|
def existing
|
||||||
existing_path = select(&File.method(:directory?))
|
existing_path = select { File.directory?(_1) }
|
||||||
# return nil instead of empty PATH, to unset environment variables
|
# return nil instead of empty PATH, to unset environment variables
|
||||||
existing_path unless existing_path.empty?
|
existing_path unless existing_path.empty?
|
||||||
end
|
end
|
||||||
|
|||||||
@ -135,7 +135,7 @@ module Cask
|
|||||||
# @api public
|
# @api public
|
||||||
sig { returns(T::Array[Version]) } # Only top-level T.self_type is supported https://sorbet.org/docs/self-type
|
sig { returns(T::Array[Version]) } # Only top-level T.self_type is supported https://sorbet.org/docs/self-type
|
||||||
def csv
|
def csv
|
||||||
split(",").map(&self.class.method(:new))
|
split(",").map { self.class.new(_1) }
|
||||||
end
|
end
|
||||||
|
|
||||||
# @api public
|
# @api public
|
||||||
|
|||||||
@ -90,7 +90,7 @@ module Cask
|
|||||||
.stdout
|
.stdout
|
||||||
.split("\n")
|
.split("\n")
|
||||||
.map { |path| root.join(path) }
|
.map { |path| root.join(path) }
|
||||||
.reject(&MacOS.public_method(:undeletable?))
|
.reject { MacOS.undeletable?(_1) }
|
||||||
end
|
end
|
||||||
|
|
||||||
sig { returns(Pathname) }
|
sig { returns(Pathname) }
|
||||||
|
|||||||
@ -679,7 +679,7 @@ module Homebrew
|
|||||||
|
|
||||||
class OptionConflictError < UsageError
|
class OptionConflictError < UsageError
|
||||||
def initialize(args)
|
def initialize(args)
|
||||||
args_list = args.map(&Formatter.public_method(:option))
|
args_list = args.map { Formatter.option(_1) }
|
||||||
.join(" and ")
|
.join(" and ")
|
||||||
super "Options #{args_list} are mutually exclusive."
|
super "Options #{args_list} are mutually exclusive."
|
||||||
end
|
end
|
||||||
|
|||||||
@ -664,7 +664,7 @@ on_request: installed_on_request?, options: options)
|
|||||||
puts "All dependencies for #{formula.full_name} are satisfied."
|
puts "All dependencies for #{formula.full_name} are satisfied."
|
||||||
elsif !deps.empty?
|
elsif !deps.empty?
|
||||||
oh1 "Installing dependencies for #{formula.full_name}: " \
|
oh1 "Installing dependencies for #{formula.full_name}: " \
|
||||||
"#{deps.map(&:first).map(&Formatter.method(:identifier)).to_sentence}",
|
"#{deps.map(&:first).map { Formatter.identifier(_1) }.to_sentence}",
|
||||||
truncate: false
|
truncate: false
|
||||||
deps.each { |dep, options| install_dependency(dep, options) }
|
deps.each { |dep, options| install_dependency(dep, options) }
|
||||||
end
|
end
|
||||||
@ -1184,7 +1184,7 @@ on_request: installed_on_request?, options: options)
|
|||||||
return if deps.empty?
|
return if deps.empty?
|
||||||
|
|
||||||
oh1 "Fetching dependencies for #{formula.full_name}: " \
|
oh1 "Fetching dependencies for #{formula.full_name}: " \
|
||||||
"#{deps.map(&:first).map(&Formatter.method(:identifier)).to_sentence}",
|
"#{deps.map(&:first).map { Formatter.identifier(_1) }.to_sentence}",
|
||||||
truncate: false
|
truncate: false
|
||||||
|
|
||||||
deps.each { |(dep, _options)| fetch_dependency(dep) }
|
deps.each { |(dep, _options)| fetch_dependency(dep) }
|
||||||
|
|||||||
@ -143,7 +143,7 @@ class Keg
|
|||||||
files ||= text_files | libtool_files
|
files ||= text_files | libtool_files
|
||||||
|
|
||||||
changed_files = T.let([], Array)
|
changed_files = T.let([], Array)
|
||||||
files.map(&path.method(:join)).group_by { |f| f.stat.ino }.each_value do |first, *rest|
|
files.map { path.join(_1) }.group_by { |f| f.stat.ino }.each_value do |first, *rest|
|
||||||
s = first.open("rb", &:read)
|
s = first.open("rb", &:read)
|
||||||
|
|
||||||
next unless relocation.replace_text(s)
|
next unless relocation.replace_text(s)
|
||||||
|
|||||||
@ -276,7 +276,7 @@ class SystemCommand
|
|||||||
|
|
||||||
sig { params(raw_stdin: IO).void }
|
sig { params(raw_stdin: IO).void }
|
||||||
def write_input_to(raw_stdin)
|
def write_input_to(raw_stdin)
|
||||||
input.each(&raw_stdin.method(:write))
|
input.each { raw_stdin.write(_1) }
|
||||||
end
|
end
|
||||||
|
|
||||||
sig { params(sources: T::Array[IO], _block: T.proc.params(type: Symbol, line: String).void).void }
|
sig { params(sources: T::Array[IO], _block: T.proc.params(type: Symbol, line: String).void).void }
|
||||||
|
|||||||
@ -322,11 +322,11 @@ class Tab
|
|||||||
end
|
end
|
||||||
|
|
||||||
def stable_version
|
def stable_version
|
||||||
versions["stable"]&.then(&Version.method(:new))
|
versions["stable"]&.then { Version.new(_1) }
|
||||||
end
|
end
|
||||||
|
|
||||||
def head_version
|
def head_version
|
||||||
versions["head"]&.then(&Version.method(:new))
|
versions["head"]&.then { Version.new(_1) }
|
||||||
end
|
end
|
||||||
|
|
||||||
def version_scheme
|
def version_scheme
|
||||||
|
|||||||
@ -97,7 +97,7 @@ RSpec.describe Cask::List, :cask do
|
|||||||
let(:casks) { [caffeine, transmission] }
|
let(:casks) { [caffeine, transmission] }
|
||||||
|
|
||||||
it "lists the installed files for those Casks" do
|
it "lists the installed files for those Casks" do
|
||||||
casks.each(&InstallHelper.method(:install_without_artifacts_with_caskfile))
|
casks.each { InstallHelper.install_without_artifacts_with_caskfile(_1) }
|
||||||
|
|
||||||
transmission.artifacts.select { |a| a.is_a?(Cask::Artifact::App) }.each do |artifact|
|
transmission.artifacts.select { |a| a.is_a?(Cask::Artifact::App) }.each do |artifact|
|
||||||
artifact.install_phase(command: NeverSudoSystemCommand, force: false)
|
artifact.install_phase(command: NeverSudoSystemCommand, force: false)
|
||||||
|
|||||||
@ -124,7 +124,7 @@ RSpec.describe Cask::Uninstall, :cask do
|
|||||||
before do
|
before do
|
||||||
app.tap(&:mkpath)
|
app.tap(&:mkpath)
|
||||||
.join("Contents").tap(&:mkpath)
|
.join("Contents").tap(&:mkpath)
|
||||||
.join("Info.plist").tap(&FileUtils.method(:touch))
|
.join("Info.plist").tap { FileUtils.touch(_1) }
|
||||||
|
|
||||||
caskroom_path.mkpath
|
caskroom_path.mkpath
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user