Module: Mini::Guard

Defined in:
lib/mini/guard.rb,
lib/mini/guard/version.rb

Defined Under Namespace

Classes: NotRailsAndSpecApp, XConfiguration, XFile, XFileCommands, XIndex

Constant Summary collapse

VERSION =
"0.1.2"

Class Method Summary collapse

Class Method Details

.runObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/mini/guard.rb', line 14

def Guard.run
  puts "Start watching files (app, views and specs) ..."
  puts "Ctrl+C to stop"

  begin
    XConfiguration.validate
    files    = XIndex.run
    listener = Listen.to('app', 'spec') do |modified, added, removed|
      new_files = XIndex.run
      XFileCommands.new(new_files - files).execute
      files = new_files
    end
    listener.start
    sleep
  rescue NotRailsAndSpecApp => ex
    puts ex.message
    puts "Exiting ..."
  rescue SystemExit, Interrupt
    puts "Exiting ..."
  end
end