Class: Homebrew::Cmd::Cache Private

Inherits:
AbstractCommand show all
Includes:
Fetch
Defined in:
cmd/--cache.rb,
sorbet/rbi/dsl/homebrew/cmd/cache.rbi

This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.

Defined Under Namespace

Classes: Args

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Fetch

#fetch_bottle?

Methods inherited from AbstractCommand

command, dev_cmd?, #initialize, parser, #raise_sh_command_error!

Constructor Details

This class inherits a constructor from Homebrew::AbstractCommand

Class Method Details

.command_nameString

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:



14
# File 'cmd/--cache.rb', line 14

def self.command_name = "--cache"

Instance Method Details

#argsHomebrew::Cmd::Cache::Args

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.



10
# File 'sorbet/rbi/dsl/homebrew/cmd/cache.rbi', line 10

def args; end

#runvoid

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

This method returns an undefined value.



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'cmd/--cache.rb', line 50

def run
  if args.no_named?
    puts HOMEBREW_CACHE
    return
  end

  formulae_or_casks = args.named.to_formulae_and_casks
  os_arch_combinations = args.os_arch_combinations

  formulae_or_casks.each do |formula_or_cask|
    case formula_or_cask
    when Formula
      formula = formula_or_cask
      ref = formula.loaded_from_api? ? formula.full_name : formula.path

      os_arch_combinations.each do |os, arch|
        SimulateSystem.with(os:, arch:) do
          formula = Formulary.factory(ref)
          print_formula_cache(formula, os:, arch:)
        end
      end
    when Cask::Cask
      cask = formula_or_cask
      ref = cask.loaded_from_api? ? cask.full_name : cask.sourcefile_path

      os_arch_combinations.each do |os, arch|
        next if os == :linux

        SimulateSystem.with(os:, arch:) do
          loaded_cask = Cask::CaskLoader.load(ref)
          print_cask_cache(loaded_cask)
        end
      end
    else
      raise "Invalid type: #{formula_or_cask.class}"
    end
  end
end