Sha256: 07277a4dcf20dab06c34b457450f8fd9aa7a5e675a7f729402a9f7a6d64b0aac

Contents?: true

Size: 1.81 KB

Versions: 27

Compression:

Stored size: 1.81 KB

Contents

# ------------------------------------------------------------------------------
#  ~/_plugins/symlink_watcher
#  jekyll-watch extension to listen for changes in symlinked folders
#
#  Product/Info:
#  https://github.com/willnorris/willnorris.com/tree/master/src/_plugins/
#  https://jekyll-one.com
#
#  Copyright (C) 2002-2014 Will Norris
#  Copyright (C) 2019 Juergen Adams
#
#  symlink_watcher is licensed under the  MIT license
#  See: https://github.com/willnorris/willnorris.com/blob/master/LICENSE
#  J1 Template is licensed under the MIT License.
#  See: https://github.com/jekyll-one/j1_template_mde/blob/master/LICENSE
#
# ------------------------------------------------------------------------------
# NOTE:
# The symlink_watcher plugin extends jekyll-watch to also listen for changes in
# any symlinked sub-directories.
#
# For example, my _drafts directory is a symlink to a directory elsewhere on my
# filesystem.  This plugin will cause jekyll to regenerate my site when any
# files in my drafts folder change.
# ------------------------------------------------------------------------------

require "find"
require "jekyll-watch"

module Jekyll
  module Watcher
    def build_listener_with_symlinks(site, options)
      src = options["source"]
      dirs = [src]
      Find.find(src).each do |f|
        next if f == "#{src}/_drafts" and not options["show_drafts"]
        # TODO: willnorris, filter ignored files
        dirs << f if File.directory?(f) and File.symlink?(f)
      end

      require "listen"
      Listen.to(
        *dirs,
        :ignore => listen_ignore_paths(options),
        :force_polling => options['force_polling'],
        &(listen_handler(site))
      )
    end

    alias_method :build_listener_without_symlinks, :build_listener
    alias_method :build_listener, :build_listener_with_symlinks
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
j1_template_mde-2018.4.36 lib/starter_web/_plugins/symlink_watcher.rb
j1_template_mde-2018.4.35 lib/starter_web/_plugins/symlink_watcher.rb
j1_template_mde-2018.4.34 lib/starter_web/_plugins/symlink_watcher.rb
j1_template_mde-2018.4.33 lib/starter_web/_plugins/symlink_watcher.rb
j1_template_mde-2018.4.32 lib/starter_web/_plugins/symlink_watcher.rb
j1_template_mde-2018.4.31 lib/starter_web/_plugins/symlink_watcher.rb
j1_template_mde-2018.4.30 lib/starter_web/_plugins/symlink_watcher.rb
j1_template_mde-2018.4.29 lib/starter_web/_plugins/symlink_watcher.rb
j1_template_mde-2018.4.28 lib/starter_web/_plugins/symlink_watcher.rb
j1_template_mde-2018.4.27 lib/starter_web/_plugins/symlink_watcher.rb
j1_template_mde-2018.4.26 lib/starter_web/_plugins/symlink_watcher.rb
j1_template_mde-2018.4.25 lib/starter_web/_plugins/symlink_watcher.rb
j1_template_mde-2018.4.24 lib/starter_web/_plugins/symlink_watcher.rb
j1_template_mde-2018.4.23 lib/starter_web/_plugins/symlink_watcher.rb
j1_template_mde-2018.4.22 lib/starter_web/_plugins/symlink_watcher.rb
j1_template_mde-2018.4.21 lib/starter_web/_plugins/symlink_watcher.rb
j1_template_mde-2018.4.20 lib/starter_web/_plugins/symlink_watcher.rb
j1_template_mde-2018.4.19 lib/starter_web/_plugins/symlink_watcher.rb
j1_template_mde-2018.4.18 lib/starter_web/_plugins/symlink_watcher.rb
j1_template_mde-2018.4.17 lib/starter_web/_plugins/symlink_watcher.rb