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.
66 67 68 69 |
# File 'bundle/dumper.rb', line 66 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.
28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'bundle/dumper.rb', line 28 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 content = [] Homebrew::Bundle.dump_package_types.select(&:dump_supported?).each do |package_type| next unless selected_package_types.fetch(package_type.type, false) content << package_type.dump_output(describe:, no_restart:) 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.
55 56 57 58 59 60 61 62 63 |
# File 'bundle/dumper.rb', line 55 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.
77 78 79 80 81 |
# File 'bundle/dumper.rb', line 77 def self.write_file(file, content) Bundle.exchange_uid_if_needed! do file.open("w") { |io| io.write content } end end |