Module: Homebrew::Bundle::CaskDumper Private

Defined in:
bundle/cask_dumper.rb

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

Class Method Summary collapse

Class Method Details

.cask_is_outdated_using_greedy?(cask_name) ⇒ Boolean

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.

Parameters:

Returns:

  • (Boolean)


28
29
30
31
32
33
34
35
# File 'bundle/cask_dumper.rb', line 28

def self.cask_is_outdated_using_greedy?(cask_name)
  return false unless Bundle.cask_installed?

  cask = casks.find { |c| c.to_s == cask_name }
  return false if cask.nil?

  cask.outdated?(greedy: true)
end

.cask_namesArray<String>

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:



15
16
17
# File 'bundle/cask_dumper.rb', line 15

def self.cask_names
  @cask_names ||= T.let(casks.map(&:to_s), T.nilable(T::Array[String]))
end

.cask_oldnamesHash{String => String}

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:



47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'bundle/cask_dumper.rb', line 47

def self.cask_oldnames
  @cask_oldnames ||= T.let(casks.each_with_object({}) do |c, hash|
    oldnames = c.old_tokens
    next if oldnames.blank?

    oldnames.each do |oldname|
      hash[oldname] = c.full_name
      if c.full_name.include? "/" # tap cask
        tap_name = c.full_name.rpartition("/").first
        hash["#{tap_name}/#{oldname}"] = c.full_name
      end
    end
  end, T.nilable(T::Hash[String, String]))
end

.dump(describe: false) ⇒ String

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.

Parameters:

  • describe (Boolean) (defaults to: false)

Returns:



38
39
40
41
42
43
44
# File 'bundle/cask_dumper.rb', line 38

def self.dump(describe: false)
  casks.map do |cask|
    description = "# #{cask.desc}\n" if describe && cask.desc.present?
    config = ", args: { #{explicit_s(cask.config)} }" if cask.config.present? && cask.config.explicit.present?
    "#{description}cask \"#{cask}\"#{config}"
  end.join("\n")
end

.formula_dependencies(cask_list) ⇒ Array<String>

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.

Parameters:

Returns:



63
64
65
66
67
68
69
70
71
72
# File 'bundle/cask_dumper.rb', line 63

def self.formula_dependencies(cask_list)
  return [] unless Bundle.cask_installed?
  return [] if cask_list.blank?

  casks.flat_map do |cask|
    next unless cask_list.include?(cask.to_s)

    cask.depends_on[:formula]
  end.compact
end

.outdated_cask_namesArray<String>

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:



20
21
22
23
24
25
# File 'bundle/cask_dumper.rb', line 20

def self.outdated_cask_names
  return [] unless Bundle.cask_installed?

  casks.select { |c| c.outdated?(greedy: false) }
       .map(&:to_s)
end

.reset!void

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.



8
9
10
11
12
# File 'bundle/cask_dumper.rb', line 8

def self.reset!
  @casks = nil
  @cask_names = nil
  @cask_oldnames = nil
end