cmd/gist-logs: Bump to Sorbet typed: strict

This commit is contained in:
Issy Long 2024-08-11 00:09:14 +01:00
parent 0272c6efb2
commit 3433c938b7
No known key found for this signature in database

View File

@ -1,4 +1,4 @@
# typed: true # typed: strict
# frozen_string_literal: true # frozen_string_literal: true
require "abstract_command" require "abstract_command"
@ -33,11 +33,14 @@ module Homebrew
def run def run
Install.perform_preinstall_checks(all_fatal: true) Install.perform_preinstall_checks(all_fatal: true)
Install.perform_build_from_source_checks(all_fatal: true) Install.perform_build_from_source_checks(all_fatal: true)
gistify_logs(args.named.to_resolved_formulae.first) return unless (formula = args.named.to_resolved_formulae.first)
gistify_logs(formula)
end end
private private
sig { params(formula: Formula).void }
def gistify_logs(formula) def gistify_logs(formula)
files = load_logs(formula.logs) files = load_logs(formula.logs)
build_time = formula.logs.ctime build_time = formula.logs.ctime
@ -86,6 +89,7 @@ module Homebrew
puts url if url puts url if url
end end
sig { params(formula: Formula, with_hostname: T::Boolean).returns(String) }
def brief_build_info(formula, with_hostname:) def brief_build_info(formula, with_hostname:)
build_time_string = formula.logs.ctime.strftime("%Y-%m-%d %H:%M:%S") build_time_string = formula.logs.ctime.strftime("%Y-%m-%d %H:%M:%S")
string = +<<~EOS string = +<<~EOS
@ -100,6 +104,7 @@ module Homebrew
end end
# Causes some terminals to display secure password entry indicators. # Causes some terminals to display secure password entry indicators.
sig { void }
def noecho_gets def noecho_gets
system "stty", "-echo" system "stty", "-echo"
result = $stdin.gets result = $stdin.gets
@ -108,6 +113,7 @@ module Homebrew
result result
end end
sig { params(dir: Pathname, basedir: Pathname).returns(T::Hash[String, T::Hash[Symbol, String]]) }
def load_logs(dir, basedir = dir) def load_logs(dir, basedir = dir)
logs = {} logs = {}
if dir.exist? if dir.exist?