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