class TOTS::Watcher

File changes watcher

Public Class Methods

check() click to toggle source
# File lib/tots/watcher.rb, line 10
def self.check
  return if ! @paths

  TOTS::Printer.watching(true)

  setup; @watching = true if !@watching
end
setup() click to toggle source
# File lib/tots/watcher.rb, line 18
def self.setup
  require 'rb-fsevent'

  fsevent = FSEvent.new
  fsevent.watch Dir.pwd do |directories|
    TOTS::Printer.watching(false)

    puts "Detected change inside: #{directories.inspect}\n"

    TOTS::Runner.start
  end

  fsevent.run
end
watch(paths) click to toggle source
# File lib/tots/watcher.rb, line 6
def self.watch(paths)
  @paths = paths
end