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
|
||||
|
||||
require "bundle/dsl"
|
||||
@ -6,6 +6,13 @@ require "bundle/dsl"
|
||||
module Homebrew
|
||||
module Bundle
|
||||
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)
|
||||
env_bundle_file_global = ENV.fetch("HOMEBREW_BUNDLE_FILE_GLOBAL", nil)
|
||||
env_bundle_file = ENV.fetch("HOMEBREW_BUNDLE_FILE", nil)
|
||||
@ -36,12 +43,19 @@ module Homebrew
|
||||
Pathname.new(filename).expand_path(Dir.pwd)
|
||||
end
|
||||
|
||||
sig { params(global: T::Boolean, file: T.nilable(String)).returns(Dsl) }
|
||||
def self.read(global: false, file: nil)
|
||||
Homebrew::Bundle::Dsl.new(Brewfile.path(global:, file:))
|
||||
rescue Errno::ENOENT
|
||||
raise "No Brewfile found"
|
||||
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)
|
||||
if filename != "-"
|
||||
filename
|
||||
|
@ -1,4 +1,4 @@
|
||||
# typed: true # rubocop:todo Sorbet/StrictSigil
|
||||
# typed: strict
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "bundle/brewfile"
|
||||
@ -8,6 +8,17 @@ module Homebrew
|
||||
module Bundle
|
||||
module Commands
|
||||
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,
|
||||
quiet: false)
|
||||
@dsl = Brewfile.read(global:, file:)
|
||||
@ -17,7 +28,9 @@ module Homebrew
|
||||
) || exit(1)
|
||||
end
|
||||
|
||||
sig { returns(T.nilable(Dsl)) }
|
||||
def self.dsl
|
||||
@dsl ||= T.let(nil, T.nilable(Dsl))
|
||||
@dsl
|
||||
end
|
||||
end
|
||||
|
@ -1,4 +1,4 @@
|
||||
# typed: true # rubocop:todo Sorbet/StrictSigil
|
||||
# typed: strict
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "hardware"
|
||||
@ -29,17 +29,19 @@ module Homebrew
|
||||
true
|
||||
end
|
||||
|
||||
sig { params(tap_name: String).void }
|
||||
def tap_failed!(tap_name)
|
||||
@failed_taps ||= []
|
||||
@failed_taps ||= T.let([], T.nilable(T::Array[String]))
|
||||
@failed_taps << tap_name
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
sig { returns(T::Hash[Symbol, T::Array[String]]) }
|
||||
def 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|
|
||||
@skipped_entries[type] =
|
||||
ENV["HOMEBREW_BUNDLE_#{type.to_s.upcase}_SKIP"]&.split
|
||||
|
Loading…
x
Reference in New Issue
Block a user