Class: GitHooksHelper::Git

Inherits:
Object
  • Object
show all
Defined in:
lib/git-hooks-helper/git.rb

Constant Summary collapse

FILES_TO_WATCH =
/(.+\.(e?rb|js|rake|prawn|haml|coffee|slim|task)|[Rr]akefile)/

Class Method Summary collapse

Class Method Details

.in_indexObject



6
7
8
9
# File 'lib/git-hooks-helper/git.rb', line 6

def in_index
  all_files = `git diff --cached --name-only --diff-filter=AM HEAD`.split("\n").map(&:chomp)
  all_files.select{|file| file =~ FILES_TO_WATCH}
end