Module: Ronin::Core::Git

Defined in:
lib/ronin/core/git.rb

Class Method Summary collapse

Class Method Details

.config_value(name) ⇒ string?

Queries a git configuration value.

Parameters:

  • name (String)

    The configuration name.

Returns:

  • (string, nil)

    The configuration value or nil if nothing was returned.



64
65
66
67
68
69
70
# File 'lib/ronin/core/git.rb', line 64

def self.config_value(name)
  output = `git config #{name}`.chomp

  if output.empty? then nil
  else                  output
  end
end

.github_userString?

Queries the git github.user variable from ~/.gitconfig.

Returns:

  • (String, nil)

    The value of github.user or nil if it was not set.



51
52
53
# File 'lib/ronin/core/git.rb', line 51

def self.github_user
  config_value('github.user')
end

.user_emailString?

Queries the git user.email variable from ~/.gitconfig.

Returns:

  • (String, nil)

    The value of user.email or nil if it was not set.



41
42
43
# File 'lib/ronin/core/git.rb', line 41

def self.user_email
  config_value('user.email')
end

.user_nameString?

Queries the git user.name variable from ~/.gitconfig.

Returns:

  • (String, nil)

    The value of user.name or nil if it was not set.



31
32
33
# File 'lib/ronin/core/git.rb', line 31

def self.user_name
  config_value('user.name')
end