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
- .brewfile_path(global: false, file: nil) ⇒ Pathname private
- .build_brewfile(describe:, no_restart:, formulae:, taps:, casks:, extension_types: {}) ⇒ String private
- .dump_brewfile(global:, file:, describe:, force:, no_restart:, formulae:, taps:, casks:, extension_types: {}) ⇒ void private
- .write_file(file, content) ⇒ void private
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.
81 82 83 84 |
# File 'bundle/dumper.rb', line 81 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:, extension_types: {}) ⇒ 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.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'bundle/dumper.rb', line 29 def self.build_brewfile(describe:, no_restart:, formulae:, taps:, casks:, extension_types: {}) selected_package_types = extension_types.dup selected_package_types[:tap] = taps selected_package_types[:brew] = formulae selected_package_types[:cask] = casks dumped_formulae = if formulae Homebrew::Bundle::Brew.formulae.filter_map { |f| f[:full_name] if f[:installed_on_request?] } else [] end dumped_casks = if casks Homebrew::Bundle::Cask.casks.map(&:full_name) else [] end content = [] Homebrew::Bundle.dump_package_types.select(&:dump_supported?).each do |package_type| next unless selected_package_types.fetch(package_type.type, false) content << if package_type == Homebrew::Bundle::Tap Homebrew::Bundle::Tap.dump(dumped_formulae:, dumped_casks:) else package_type.dump_output(describe:, no_restart:) end end "#{content.reject(&:empty?).join("\n")}\n" end |
.dump_brewfile(global:, file:, describe:, force:, no_restart:, formulae:, taps:, casks:, extension_types: {}) ⇒ 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.
70 71 72 73 74 75 76 77 78 |
# File 'bundle/dumper.rb', line 70 def self.dump_brewfile(global:, file:, describe:, force:, no_restart:, formulae:, taps:, casks:, extension_types: {}) path = brewfile_path(global:, file:) can_write_to_brewfile?(path, force:) content = build_brewfile( describe:, no_restart:, taps:, formulae:, casks:, extension_types:, ) 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.
92 93 94 95 96 |
# File 'bundle/dumper.rb', line 92 def self.write_file(file, content) Bundle.exchange_uid_if_needed! do file.open("w") { |io| io.write content } end end |