class TailorHook::GitRepo

Public Class Methods

new(path) click to toggle source
# File lib/tailor-hook/git_repo.rb, line 3
def initialize(path)
  @path = File.expand_path path
end

Public Instance Methods

staged_ruby_files() click to toggle source
# File lib/tailor-hook/git_repo.rb, line 7
def staged_ruby_files
  staged_files.find_all { |f| f.match /\.rb$/ }
end

Private Instance Methods

staged_files() click to toggle source
# File lib/tailor-hook/git_repo.rb, line 13
def staged_files
  files = `cd #{@path} ; git diff --name-only --staged`.split

  # filter deleted files
  files.map { |p| File.expand_path(p) }.find_all { |p| File.exists? p }
end