Merge pull request #20530 from Homebrew/typed-strict
bundle: some more `typed: strict`
This commit is contained in:
commit
3998a4fe85
@ -1,4 +1,4 @@
|
|||||||
# typed: true # rubocop:todo Sorbet/StrictSigil
|
# typed: strict
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require "bundle/dsl"
|
require "bundle/dsl"
|
||||||
@ -6,6 +6,13 @@ require "bundle/dsl"
|
|||||||
module Homebrew
|
module Homebrew
|
||||||
module Bundle
|
module Bundle
|
||||||
module Brewfile
|
module Brewfile
|
||||||
|
sig {
|
||||||
|
params(
|
||||||
|
dash_writes_to_stdout: T::Boolean,
|
||||||
|
global: T::Boolean,
|
||||||
|
file: T.nilable(String),
|
||||||
|
).returns(Pathname)
|
||||||
|
}
|
||||||
def self.path(dash_writes_to_stdout: false, global: false, file: nil)
|
def self.path(dash_writes_to_stdout: false, global: false, file: nil)
|
||||||
env_bundle_file_global = ENV.fetch("HOMEBREW_BUNDLE_FILE_GLOBAL", nil)
|
env_bundle_file_global = ENV.fetch("HOMEBREW_BUNDLE_FILE_GLOBAL", nil)
|
||||||
env_bundle_file = ENV.fetch("HOMEBREW_BUNDLE_FILE", nil)
|
env_bundle_file = ENV.fetch("HOMEBREW_BUNDLE_FILE", nil)
|
||||||
@ -36,12 +43,19 @@ module Homebrew
|
|||||||
Pathname.new(filename).expand_path(Dir.pwd)
|
Pathname.new(filename).expand_path(Dir.pwd)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
sig { params(global: T::Boolean, file: T.nilable(String)).returns(Dsl) }
|
||||||
def self.read(global: false, file: nil)
|
def self.read(global: false, file: nil)
|
||||||
Homebrew::Bundle::Dsl.new(Brewfile.path(global:, file:))
|
Homebrew::Bundle::Dsl.new(Brewfile.path(global:, file:))
|
||||||
rescue Errno::ENOENT
|
rescue Errno::ENOENT
|
||||||
raise "No Brewfile found"
|
raise "No Brewfile found"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
sig {
|
||||||
|
params(
|
||||||
|
filename: String,
|
||||||
|
dash_writes_to_stdout: T::Boolean,
|
||||||
|
).returns(String)
|
||||||
|
}
|
||||||
private_class_method def self.handle_file_value(filename, dash_writes_to_stdout)
|
private_class_method def self.handle_file_value(filename, dash_writes_to_stdout)
|
||||||
if filename != "-"
|
if filename != "-"
|
||||||
filename
|
filename
|
||||||
|
@ -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"
|
||||||
@ -8,6 +8,17 @@ module Homebrew
|
|||||||
module Bundle
|
module Bundle
|
||||||
module Commands
|
module Commands
|
||||||
module Install
|
module Install
|
||||||
|
sig {
|
||||||
|
params(
|
||||||
|
global: T::Boolean,
|
||||||
|
file: T.nilable(String),
|
||||||
|
no_lock: T::Boolean,
|
||||||
|
no_upgrade: T::Boolean,
|
||||||
|
verbose: T::Boolean,
|
||||||
|
force: T::Boolean,
|
||||||
|
quiet: T::Boolean,
|
||||||
|
).void
|
||||||
|
}
|
||||||
def self.run(global: false, file: nil, no_lock: false, no_upgrade: false, verbose: false, force: false,
|
def self.run(global: false, file: nil, no_lock: false, no_upgrade: false, verbose: false, force: false,
|
||||||
quiet: false)
|
quiet: false)
|
||||||
@dsl = Brewfile.read(global:, file:)
|
@dsl = Brewfile.read(global:, file:)
|
||||||
@ -17,7 +28,9 @@ module Homebrew
|
|||||||
) || exit(1)
|
) || exit(1)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
sig { returns(T.nilable(Dsl)) }
|
||||||
def self.dsl
|
def self.dsl
|
||||||
|
@dsl ||= T.let(nil, T.nilable(Dsl))
|
||||||
@dsl
|
@dsl
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# typed: true # rubocop:todo Sorbet/StrictSigil
|
# typed: strict
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require "hardware"
|
require "hardware"
|
||||||
@ -29,17 +29,19 @@ module Homebrew
|
|||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
sig { params(tap_name: String).void }
|
||||||
def tap_failed!(tap_name)
|
def tap_failed!(tap_name)
|
||||||
@failed_taps ||= []
|
@failed_taps ||= T.let([], T.nilable(T::Array[String]))
|
||||||
@failed_taps << tap_name
|
@failed_taps << tap_name
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
sig { returns(T::Hash[Symbol, T::Array[String]]) }
|
||||||
def skipped_entries
|
def skipped_entries
|
||||||
return @skipped_entries if @skipped_entries
|
return @skipped_entries if @skipped_entries
|
||||||
|
|
||||||
@skipped_entries = {}
|
@skipped_entries ||= T.let({}, T.nilable(T::Hash[Symbol, T::Array[String]]))
|
||||||
[:brew, :cask, :mas, :tap, :whalebrew].each do |type|
|
[:brew, :cask, :mas, :tap, :whalebrew].each do |type|
|
||||||
@skipped_entries[type] =
|
@skipped_entries[type] =
|
||||||
ENV["HOMEBREW_BUNDLE_#{type.to_s.upcase}_SKIP"]&.split
|
ENV["HOMEBREW_BUNDLE_#{type.to_s.upcase}_SKIP"]&.split
|
||||||
|
Loading…
x
Reference in New Issue
Block a user