Class: Guard::Git

Inherits:
Guard
  • Object
show all
Defined in:
lib/guard/git.rb

Constant Summary collapse

VERSION =
"0.0.1"

Instance Method Summary collapse

Instance Method Details

#run_allObject



12
13
14
# File 'lib/guard/git.rb', line 12

def run_all
  run_on_change(Watcher.match_files(self, Dir.glob('*')))
end

#run_on_change(paths) ⇒ Object



16
17
18
19
20
# File 'lib/guard/git.rb', line 16

def run_on_change(paths)
  changed_paths = paths.join(' ')
  puts %Q{Auto committing #{"all files" unless options[:exclusive]} after changes in #{changed_paths}}
  %x{git add -A #{changed_paths if options[:exclusive]} && git commit -m "Autocommit at #{Time.now.strftime("%l:%m%P, %d %h %Y")}"}
end

#startObject



8
9
10
# File 'lib/guard/git.rb', line 8

def start
  run_all if options[:all_on_start]
end