Module: Homebrew::Bundle::Brewfile Private
- Defined in:
- bundle/brewfile.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
- .path(dash_writes_to_stdout: false, global: false, file: nil) ⇒ Object private
- .read(global: false, file: nil) ⇒ Object private
Class Method Details
.path(dash_writes_to_stdout: false, 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.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'bundle/brewfile.rb', line 9 def self.path(dash_writes_to_stdout: false, global: false, file: nil) env_bundle_file_global = ENV.fetch("HOMEBREW_BUNDLE_FILE_GLOBAL", nil) env_bundle_file = ENV.fetch("HOMEBREW_BUNDLE_FILE", nil) user_config_home = ENV.fetch("HOMEBREW_USER_CONFIG_HOME", nil) filename = if global if env_bundle_file_global.present? env_bundle_file_global else raise "'HOMEBREW_BUNDLE_FILE' cannot be specified with '--global'" if env_bundle_file.present? if user_config_home && File.exist?("#{user_config_home}/Brewfile") "#{user_config_home}/Brewfile" else Bundle.exchange_uid_if_needed! do "#{Dir.home}/.Brewfile" end end end elsif file.present? handle_file_value(file, dash_writes_to_stdout) elsif env_bundle_file.present? env_bundle_file else "Brewfile" end Pathname.new(filename).(Dir.pwd) end |
.read(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.
39 40 41 42 43 |
# File 'bundle/brewfile.rb', line 39 def self.read(global: false, file: nil) Homebrew::Bundle::Dsl.new(Brewfile.path(global:, file:)) rescue Errno::ENOENT raise "No Brewfile found" end |