module Mini::Guard

Constants

VERSION

Public Class Methods

run() click to toggle source
# 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