Sha256: e7ac8c8902aa703e029770a0e872e046465b78ca4af6aa86e8b6f1d52070ed90

Contents?: true

Size: 634 Bytes

Versions: 1

Compression:

Stored size: 634 Bytes

Contents

$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../lib')
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../ext')
require 'fsevent'

class Restart < FSEvent
  def on_change(directories)
    puts "Detected change in: #{directories.inspect}"
    unless @restarted
      self.stop
      @restarted = true
      self.watch_directories "#{Dir.pwd}/spec"
      self.start
    end
  end

  def start
    puts "watching #{registered_directories.join(", ")} for changes"
    super
  end
end

Signal.trap("INT"){ puts "\nCustom INT handler called."; exit }

restarter = Restart.new
restarter.watch_directories "#{Dir.pwd}/examples"
restarter.start

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruby-fsevent-0.2.0 examples/restart.rb