bundle/brewfile: typed: strict
This commit is contained in:
parent
12366f9c5b
commit
13af517121
@ -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
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user