Skip to content

Commit

Permalink
constantify @etc_var_dirs
Browse files Browse the repository at this point in the history
  • Loading branch information
dduugg committed Sep 9, 2024
1 parent dc76f80 commit 3c336f0
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions Library/Homebrew/formula_installer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ class FormulaInstaller
include FormulaCellarChecks
extend Attrable

ETC_VAR_DIRS = T.let([HOMEBREW_PREFIX/"etc", HOMEBREW_PREFIX/"var"].freeze, T::Array[Pathname])

sig { override.returns(Formula) }
attr_reader :formula

Expand Down Expand Up @@ -118,7 +120,6 @@ def initialize(
@bottle_tab_runtime_dependencies = T.let({}.freeze, T::Hash[String, T::Hash[String, String]])
@hold_locks = T.let(false, T::Boolean)
@show_summary_heading = T.let(false, T::Boolean)
@etc_var_dirs = T.let([], T::Array[Pathname])
@etc_var_preinstall = T.let([], T::Array[Pathname])
@etc_var_postinstall = T.let([], T::Array[Pathname])

Expand Down Expand Up @@ -379,9 +380,7 @@ def check_install_sanity
end

sig { params(_formula: Formula).returns(T.nilable(T::Boolean)) }
def fresh_install?(_formula)
false
end
def fresh_install?(_formula) = false

sig { void }
def install_fetch_deps
Expand All @@ -398,13 +397,12 @@ def install_fetch_deps

sig { void }
def build_bottle_preinstall
@etc_var_dirs = [HOMEBREW_PREFIX/"etc", HOMEBREW_PREFIX/"var"]
@etc_var_preinstall = Find.find(*@etc_var_dirs.select(&:directory?)).to_a
@etc_var_preinstall = Find.find(*ETC_VAR_DIRS.select(&:directory?)).to_a
end

sig { void }
def build_bottle_postinstall
@etc_var_postinstall = Find.find(*@etc_var_dirs.select(&:directory?)).to_a
@etc_var_postinstall = Find.find(*ETC_VAR_DIRS.select(&:directory?)).to_a
(@etc_var_postinstall - @etc_var_preinstall).each do |file|
Pathname.new(file).cp_path_sub(HOMEBREW_PREFIX, formula.bottle_prefix)
end
Expand Down Expand Up @@ -954,9 +952,7 @@ def sanitized_argv_options
end

sig { returns(T::Array[String]) }
def build_argv
sanitized_argv_options + options.as_flags
end
def build_argv = sanitized_argv_options + options.as_flags

sig { void }
def build
Expand Down

0 comments on commit 3c336f0

Please sign in to comment.