Class: Soapstone::GitCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/soapstone/core/git_command.rb

Class Method Summary collapse

Class Method Details

.current_branchObject



16
17
18
# File 'lib/soapstone/core/git_command.rb', line 16

def self.current_branch
  `git rev-parse --abbrev-ref HEAD`.strip
end

.in_git_repository?Boolean

Returns:

  • (Boolean)


4
5
6
# File 'lib/soapstone/core/git_command.rb', line 4

def self.in_git_repository?
  system("git rev-parse --git-dir > /dev/null 2>&1")
end

.staged_diffObject



12
13
14
# File 'lib/soapstone/core/git_command.rb', line 12

def self.staged_diff
  `git diff --cached`.strip
end

.staged_filesObject



8
9
10
# File 'lib/soapstone/core/git_command.rb', line 8

def self.staged_files
  `git diff --cached --name-status`.strip
end