Skip to content

Instantly share code, notes, and snippets.

@mtsmfm
Created April 22, 2013 08:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mtsmfm/5433333 to your computer and use it in GitHub Desktop.
Save mtsmfm/5433333 to your computer and use it in GitHub Desktop.
require "spring/watcher/abstract"
require "spring/watcher/listen"
require "spring/watcher/polling"
module Spring
class << self
attr_accessor :watch_interval
attr_writer :watcher
end
self.watch_interval = 0.2
def self.watcher
@watcher ||= watcher_class.new(Spring.application_root_path, watch_interval)
end
def self.watcher_class
#if Watcher::Listen.available?
# Watcher::Listen
#else
# Watcher::Polling
#end
Watcher::Polling
end
def self.watch(*items)
watcher.add *items
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment