Module: Jekyll::Watcher

Extended by:
Watcher
Included in:
Watcher
Defined in:
lib/octopress-ink/watch.rb

Instance Method Summary collapse

Instance Method Details

#build_listener(site, options) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/octopress-ink/watch.rb', line 10

def build_listener(site, options)
  require 'listen'
  paths = [options['source']].concat(ink_watch_paths(site)).compact
  Listen.to(
    *paths,
    :ignore => listen_ignore_paths(options),
    :force_polling => options['force_polling'],
    &(listen_handler(site))
  )
end

#ink_watch_paths(site) ⇒ Object



21
22
23
24
25
26
27
28
29
# File 'lib/octopress-ink/watch.rb', line 21

def ink_watch_paths(site)
  if plugins = site.config['ink_watch']
    if plugins == 'all' 
      Octopress::Ink.plugins.dup.map(&:asset_paths)
    else
      plugin_paths Array(plugins)
    end
  end
end

#plugin_paths(plugins) ⇒ Object



31
32
33
34
35
36
37
# File 'lib/octopress-ink/watch.rb', line 31

def plugin_paths(plugins)
  plugins.dup.map do |plugin|
    if plugin = Octopress::Ink.plugin(plugin)
      plugin.assets_path
    end
  end.compact
end