Class: GitGuts::Autocommit

Inherits:
Thor::GitGroup show all
Defined in:
lib/git_guts/autocommit.rb

Constant Summary collapse

WORKING_DIRECTORY =
Dir.getwd

Constants inherited from Thor::GitGroup

Thor::GitGroup::BASENAME

Instance Method Summary collapse

Methods inherited from Thor::GitGroup

basename, namespace

Instance Method Details

#autocommitObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/git_guts/autocommit.rb', line 11

def autocommit
  begin
    Git.open(WORKING_DIRECTORY)
    guard_file = "      guard 'git'\#{\",:exclusive => true\" if options[:exclusive]} do\n        watch(%r{^\#{files.join('|')}$})\n      end\n    EOF\n    Guard.start(:guardfile_contents => guard_file)\n    while Guard.running do\n      sleep 0.5\n    end\n  rescue ArgumentError\n    puts \"Could open repository. Is it a valid git repository ?\"\n  end\nend\n"