Module: AIGit::Git

Defined in:
lib/ai_git/git.rb

Class Method Summary collapse

Class Method Details

.current_branchObject



13
14
15
16
# File 'lib/ai_git/git.rb', line 13

def current_branch
  result = `git rev-parse --abbrev-ref HEAD`
  result.chomp
end

.diffObject



9
10
11
# File 'lib/ai_git/git.rb', line 9

def diff
  `git diff --cached`
end

.run_command(cmd, args) ⇒ Object



18
19
20
21
# File 'lib/ai_git/git.rb', line 18

def run_command(cmd, args)
  system("#{cmd} #{args} > /dev/null 2>&1")
  raise "Command failed: #{cmd} #{args}" if $?.exitstatus != 0
end

.staged_filesObject



5
6
7
# File 'lib/ai_git/git.rb', line 5

def staged_files
  `git diff --cached --name-only`
end