Module: Homebrew::Settings Private

Extended by:
T::Sig
Defined in:
brew/Library/Homebrew/settings.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Helper functions for reading and writing settings.

Class Method Summary collapse

Class Method Details

.delete(setting, repo: HOMEBREW_REPOSITORY) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Parameters:



32
33
34
35
36
37
38
39
# File 'brew/Library/Homebrew/settings.rb', line 32

def delete(setting, repo: HOMEBREW_REPOSITORY)
  return unless (repo/".git/config").exist?
  return if read(setting, repo: repo).blank?

  repo.cd do
    safe_system "git", "config", "--unset-all", "homebrew.#{setting}"
  end
end

.read(setting, repo: HOMEBREW_REPOSITORY) ⇒ String?

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

Returns:



14
15
16
17
18
19
20
# File 'brew/Library/Homebrew/settings.rb', line 14

def read(setting, repo: HOMEBREW_REPOSITORY)
  return unless (repo/".git/config").exist?

  repo.cd do
    Utils.popen_read("git", "config", "--get", "homebrew.#{setting}").chomp.presence
  end
end

.write(setting, value, repo: HOMEBREW_REPOSITORY) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Parameters:



23
24
25
26
27
28
29
# File 'brew/Library/Homebrew/settings.rb', line 23

def write(setting, value, repo: HOMEBREW_REPOSITORY)
  return unless (repo/".git/config").exist?

  repo.cd do
    safe_system "git", "config", "--replace-all", "homebrew.#{setting}", value.to_s
  end
end