Class: Kettle::Family::GitStatus
- Inherits:
-
Object
- Object
- Kettle::Family::GitStatus
- Defined in:
- lib/kettle/family/git_status.rb
Class Method Summary collapse
Class Method Details
.dirty?(root) ⇒ Boolean
8 9 10 11 |
# File 'lib/kettle/family/git_status.rb', line 8 def self.dirty?(root) stdout, _stderr, status = Open3.capture3("git", "status", "--short", chdir: root) status.success? && !stdout.empty? end |
.dirty_paths(root) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/kettle/family/git_status.rb', line 13 def self.dirty_paths(root) stdout, _stderr, status = Open3.capture3("git", "status", "--short", chdir: root) return [] unless status.success? stdout.lines.map(&:chomp).reject(&:empty?) end |
.path_from_status_line(status_line) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/kettle/family/git_status.rb', line 20 def self.path_from_status_line(status_line) line = status_line.to_s path = (line.length >= 3 && line[2] == " ") ? line[3..] : line path = path.to_s.strip path.include?(" -> ") ? path.split(" -> ", 2).last : path end |