Module: Homebrew::Bundle::Dumper Private

Defined in:
bundle/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

.brewfile_path(global: false, file: nil) ⇒ 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.



42
43
44
45
# File 'bundle/dumper.rb', line 42

def self.brewfile_path(global: false, file: nil)
  require "bundle/brewfile"
  Brewfile.path(dash_writes_to_stdout: true, global:, file:)
end

.build_brewfile(describe:, no_restart:, brews:, taps:, casks:, mas:, whalebrew:, vscode:) ⇒ 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.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'bundle/dumper.rb', line 16

def self.build_brewfile(describe:, no_restart:, brews:, taps:, casks:, mas:, whalebrew:, vscode:)
  require "bundle/tap_dumper"
  require "bundle/brew_dumper"
  require "bundle/cask_dumper"
  require "bundle/mac_app_store_dumper"
  require "bundle/whalebrew_dumper"
  require "bundle/vscode_extension_dumper"

  content = []
  content << TapDumper.dump if taps
  content << BrewDumper.dump(describe:, no_restart:) if brews
  content << CaskDumper.dump(describe:) if casks
  content << MacAppStoreDumper.dump if mas
  content << WhalebrewDumper.dump if whalebrew
  content << VscodeExtensionDumper.dump if vscode
  "#{content.reject(&:empty?).join("\n")}\n"
end

.dump_brewfile(global:, file:, describe:, force:, no_restart:, brews:, taps:, casks:, mas:, whalebrew:, vscode:) ⇒ 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/dumper.rb', line 34

def self.dump_brewfile(global:, file:, describe:, force:, no_restart:, brews:, taps:, casks:, mas:, whalebrew:,
                       vscode:)
  path = brewfile_path(global:, file:)
  can_write_to_brewfile?(path, force:)
  content = build_brewfile(describe:, no_restart:, taps:, brews:, casks:, mas:, whalebrew:, vscode:)
  write_file path, content
end

.write_file(file, content) ⇒ 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.



51
52
53
54
55
# File 'bundle/dumper.rb', line 51

def self.write_file(file, content)
  Bundle.exchange_uid_if_needed! do
    file.open("w") { |io| io.write content }
  end
end