mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Bump some files to Sorbet typed: strict
This commit is contained in:
parent
0e7f19f2f1
commit
6c11916cbc
@ -1,4 +1,4 @@
|
||||
# typed: true # rubocop:todo Sorbet/StrictSigil
|
||||
# typed: strict
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "bundle/brewfile"
|
||||
@ -9,6 +9,7 @@ module Homebrew
|
||||
module Adder
|
||||
module_function
|
||||
|
||||
sig { params(args: String, type: Symbol, global: T::Boolean, file: String).void }
|
||||
def add(*args, type:, global:, file:)
|
||||
brewfile = Brewfile.read(global:, file:)
|
||||
content = brewfile.input
|
||||
|
@ -1,4 +1,4 @@
|
||||
# typed: true # rubocop:todo Sorbet/StrictSigil
|
||||
# typed: strict
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "bundle/checker"
|
||||
@ -7,6 +7,10 @@ module Homebrew
|
||||
module Bundle
|
||||
module Commands
|
||||
module Check
|
||||
sig {
|
||||
params(global: T::Boolean, file: T.nilable(String), no_upgrade: T::Boolean, verbose: T::Boolean,
|
||||
quiet: T::Boolean).void
|
||||
}
|
||||
def self.run(global: false, file: nil, no_upgrade: false, verbose: false, quiet: false)
|
||||
output_errors = verbose
|
||||
exit_on_first_error = !verbose
|
||||
|
@ -7,6 +7,7 @@ module Homebrew
|
||||
module Bundle
|
||||
module Skipper
|
||||
class << self
|
||||
sig { params(entry: Dsl::Entry, silent: T::Boolean).returns(T::Boolean) }
|
||||
def skip?(entry, silent: false)
|
||||
require "bundle/brew_dumper"
|
||||
|
||||
|
@ -1,23 +1,29 @@
|
||||
# typed: true # rubocop:todo Sorbet/StrictSigil
|
||||
# typed: strict
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Homebrew
|
||||
module Bundle
|
||||
module WhalebrewDumper
|
||||
sig { void }
|
||||
def self.reset!
|
||||
@images = nil
|
||||
@images = T.let(nil, T.nilable(T::Array[String]))
|
||||
end
|
||||
|
||||
sig { returns(T::Array[T.nilable(String)]) }
|
||||
def self.images
|
||||
return [] unless Bundle.whalebrew_installed?
|
||||
|
||||
odeprecated "`brew bundle` `whalebrew` support", "using `whalebrew` directly"
|
||||
@images ||= `whalebrew list 2>/dev/null`.split("\n")
|
||||
@images ||= T.let(
|
||||
`whalebrew list 2>/dev/null`.split("\n")
|
||||
.reject { |line| line.start_with?("COMMAND ") }
|
||||
.map { |line| line.split(/\s+/).last }
|
||||
.uniq
|
||||
.filter_map { |line| line.split(/\s+/).last }
|
||||
.uniq,
|
||||
T.nilable(T::Array[String]),
|
||||
)
|
||||
end
|
||||
|
||||
sig { returns(String) }
|
||||
def self.dump
|
||||
images.map { |image| "whalebrew \"#{image}\"" }.join("\n")
|
||||
end
|
||||
|
@ -1,4 +1,4 @@
|
||||
# typed: true # rubocop:todo Sorbet/StrictSigil
|
||||
# typed: strict
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "cask/cask_loader"
|
||||
@ -27,6 +27,7 @@ module OS
|
||||
true
|
||||
end
|
||||
|
||||
sig { params(entry: Homebrew::Bundle::Dsl::Entry, silent: T::Boolean).returns(T::Boolean) }
|
||||
def skip?(entry, silent: false)
|
||||
if macos_only_entry?(entry) || macos_only_cask?(entry)
|
||||
unless silent
|
||||
|
@ -1,14 +1,16 @@
|
||||
# typed: true # rubocop:todo Sorbet/StrictSigil
|
||||
# typed: strict
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "software_spec"
|
||||
|
||||
class HeadSoftwareSpec < SoftwareSpec
|
||||
sig { params(flags: T::Array[String]).void }
|
||||
def initialize(flags: [])
|
||||
super
|
||||
@resource.version(Version.new("HEAD"))
|
||||
end
|
||||
|
||||
sig { params(_filename: Pathname).returns(NilClass) }
|
||||
def verify_download_integrity(_filename)
|
||||
# no-op
|
||||
end
|
||||
|
@ -38,7 +38,7 @@ class SoftwareSpec
|
||||
super()
|
||||
|
||||
# Ensure this is synced with `initialize_dup` and `freeze` (excluding simple objects like integers and booleans)
|
||||
@resource = Resource::Formula.new
|
||||
@resource = T.let(Resource::Formula.new, Resource::Formula)
|
||||
@resources = {}
|
||||
@dependency_collector = DependencyCollector.new
|
||||
@bottle_specification = BottleSpecification.new
|
||||
|
@ -10,6 +10,6 @@ RSpec.describe HeadSoftwareSpec do
|
||||
end
|
||||
|
||||
specify "#verify_download_integrity" do
|
||||
expect(head_spec.verify_download_integrity(Object.new)).to be_nil
|
||||
expect(head_spec.verify_download_integrity(Pathname.new("head.zip"))).to be_nil
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user