Class: Git

Inherits:
Object
  • Object
show all
Defined in:
lib/gitplural.rb

Class Method Summary collapse

Class Method Details

.config(item:, value:, global: nil) ⇒ Object

Configure a Git setting

This method is the equivalent of ‘git config <item> <value>` and `–global` can be used by giving `Git.config(global: true)`



7
8
9
10
# File 'lib/gitplural.rb', line 7

def self.config(item:, value:, global: nil)
    global = "--global" if global == true
    system("git config #{global} #{item} #{value}")
end

.get_config_value(item:) ⇒ Object

Get a config item’s current value

Equivalent of running ‘git config <item>`



15
16
17
# File 'lib/gitplural.rb', line 15

def self.get_config_value(item:)
    return `git config #{item}`.chomp
end