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

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:

  • global (Boolean) (defaults to: false)
  • file (String, nil) (defaults to: nil)

Returns:

 75 76 77 78
# File 'bundle/dumper.rb', line 75 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:, formulae:, taps:, casks:, mas:, whalebrew:, vscode:, go:) ⇒ 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)
  • no_restart (Boolean)
  • formulae (Boolean)
  • taps (Boolean)
  • casks (Boolean)
  • mas (Boolean)
  • whalebrew (Boolean)
  • vscode (Boolean)
  • go (Boolean)

Returns:

 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
# File 'bundle/dumper.rb', line 30 def self.build_brewfile(describe:, no_restart:, formulae:, taps:, casks:, mas:, whalebrew:, vscode:, go:) require "bundle/tap_dumper" require "bundle/formula_dumper" require "bundle/cask_dumper" require "bundle/mac_app_store_dumper" require "bundle/whalebrew_dumper" require "bundle/vscode_extension_dumper" require "bundle/go_dumper" content = [] content << TapDumper.dump if taps content << FormulaDumper.dump(describe:, no_restart:) if formulae content << CaskDumper.dump(describe:) if casks content << MacAppStoreDumper.dump if mas content << WhalebrewDumper.dump if whalebrew content << VscodeExtensionDumper.dump if vscode content << GoDumper.dump if go "#{content.reject(&:empty?).join("\n")}\n" end

.dump_brewfile(global:, file:, describe:, force:, no_restart:, formulae:, taps:, casks:, mas:, whalebrew:, vscode:, go:) ⇒ 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.

Parameters:

  • global (Boolean)
  • file (String, nil)
  • describe (Boolean)
  • force (Boolean)
  • no_restart (Boolean)
  • formulae (Boolean)
  • taps (Boolean)
  • casks (Boolean)
  • mas (Boolean)
  • whalebrew (Boolean)
  • vscode (Boolean)
  • go (Boolean)
 66 67 68 69 70 71 72
# File 'bundle/dumper.rb', line 66 def self.dump_brewfile(global:, file:, describe:, force:, no_restart:, formulae:, taps:, casks:, mas:, whalebrew:, vscode:, go:) path = brewfile_path(global:, file:) can_write_to_brewfile?(path, force:) content = build_brewfile(describe:, no_restart:, taps:, formulae:, casks:, mas:, whalebrew:, vscode:, go:) write_file path, content end

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

Parameters:

 86 87 88 89 90
# File 'bundle/dumper.rb', line 86 def self.write_file(file, content) Bundle.exchange_uid_if_needed! do file.open("w") { |io| io.write content } end end