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) ⇒ Pathname private
- .read(global: false, file: nil) ⇒ Dsl private
Class Method Details
.path(dash_writes_to_stdout: false, 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.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'bundle/brewfile.rb', line 16 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) ⇒ Dsl
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.
47 48 49 50 51 |
# File 'bundle/brewfile.rb', line 47 def self.read(global: false, file: nil) Homebrew::Bundle::Dsl.new(Brewfile.path(global:, file:)) rescue Errno::ENOENT raise "No Brewfile found" end |