Class: TapConfig

Inherits:
Object
  • Object
show all
Defined in:
brew/Library/Homebrew/tap.rb

Overview

Permanent configuration per Tap using git-config(1).

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tap) ⇒ TapConfig

Returns a new instance of TapConfig



721
722
723
# File 'brew/Library/Homebrew/tap.rb', line 721

def initialize(tap)
  @tap = tap
end

Instance Attribute Details

#tapObject (readonly)

Returns the value of attribute tap



719
720
721
# File 'brew/Library/Homebrew/tap.rb', line 719

def tap
  @tap
end

Instance Method Details

#[](key) ⇒ Object



725
726
727
728
729
730
731
732
# File 'brew/Library/Homebrew/tap.rb', line 725

def [](key)
  return unless tap.git?
  return unless Utils.git_available?

  tap.path.cd do
    Utils.popen_read("git", "config", "--local", "--get", "homebrew.#{key}").chomp.presence
  end
end

#[]=(key, value) ⇒ Object



734
735
736
737
738
739
740
741
# File 'brew/Library/Homebrew/tap.rb', line 734

def []=(key, value)
  return unless tap.git?
  return unless Utils.git_available?

  tap.path.cd do
    safe_system "git", "config", "--local", "--replace-all", "homebrew.#{key}", value.to_s
  end
end