Class: TapConfig

Inherits:
Object
  • Object
show all
Defined in:
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



639
640
641
# File 'Library/Homebrew/tap.rb', line 639

def initialize(tap)
  @tap = tap
end

Instance Attribute Details

#tapObject (readonly)

Returns the value of attribute tap



637
638
639
# File 'Library/Homebrew/tap.rb', line 637

def tap
  @tap
end

Instance Method Details

#[](key) ⇒ Object



643
644
645
646
647
648
649
650
# File 'Library/Homebrew/tap.rb', line 643

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

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

#[]=(key, value) ⇒ Object



652
653
654
655
656
657
658
659
# File 'Library/Homebrew/tap.rb', line 652

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