Method: Blogdoor::Watcher#start

Defined in:
lib/blogdoor/watcher.rb

#startObject



16
17
18
19
20
21
22
23
24
# File 'lib/blogdoor/watcher.rb', line 16

def start
  listener = Listen.to(@root_path.to_s, only: /\.md$/) do |modified, added|
    [modified, added].flatten.each do |file_path|
      build(Pathname.new(file_path))
    end
  end
  trap(:INT) { listener.stop }
  listener.start
end