lib/jekyll/watcher.rb in jekyll-watch-1.2.1 vs lib/jekyll/watcher.rb in jekyll-watch-1.3.0
- old
+ new
@@ -1,5 +1,7 @@
+require 'listen'
+
module Jekyll
module Watcher
extend self
def watch(options)
@@ -14,18 +16,18 @@
listener.stop
puts " Halting auto-regeneration."
exit 0
end
- loop { sleep 1000 }
+ sleep_forever
end
rescue ThreadError => e
# You pressed Ctrl-C, oh my!
end
+ # TODO: shouldn't be public API
def build_listener(site, options)
- require 'listen'
Listen.to(
options['source'],
:ignore => listen_ignore_paths(options),
:force_polling => options['force_polling'],
&(listen_handler(site))
@@ -91,7 +93,10 @@
end
end
end.compact + [/\.jekyll\-metadata/]
end
+ def sleep_forever
+ loop { sleep 1000 }
+ end
end
end