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.

Returns:

  • (Boolean)


25
26
27
28
29
30
31
32
# File 'bundle/cask_dumper.rb', line 25

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_namesObject

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.



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

def self.cask_names
  @cask_names ||= casks.map(&:to_s)
end

.cask_oldnamesObject

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.



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'bundle/cask_dumper.rb', line 42

def self.cask_oldnames
  return @cask_oldnames if @cask_oldnames

  @cask_oldnames = {}
  casks.each do |c|
    oldnames = c.old_tokens
    next if oldnames.blank?

    oldnames.each do |oldname|
      @cask_oldnames[oldname] = c.full_name
      if c.full_name.include? "/" # tap cask
        tap_name = c.full_name.rpartition("/").first
        @cask_oldnames["#{tap_name}/#{oldname}"] = c.full_name
      end
    end
  end
  @cask_oldnames
end

.dump(describe: false) ⇒ Object

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.



34
35
36
37
38
39
40
# File 'bundle/cask_dumper.rb', line 34

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) ⇒ Object

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.



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

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_namesObject

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.



18
19
20
21
22
23
# File 'bundle/cask_dumper.rb', line 18

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

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

.reset!Object

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.



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

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