Class: CliTemplate::Git

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

Class Method Summary collapse

Class Method Details

.sh(command) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/cli_template/git.rb', line 12

def sh(command)
  puts "=> #{command}"
  stdout = `#{command}`
  out = stdout.strip
  puts "stdout #{stdout.inspect}"
  puts "out #{out.inspect}"
  return out if !out&.empty?
end

.user_emailObject



8
9
10
# File 'lib/cli_template/git.rb', line 8

def user_email
  sh "git config --get user.email"
end

.user_nameObject



4
5
6
# File 'lib/cli_template/git.rb', line 4

def user_name
  sh "git config --get user.name"
end