Sha256: cedc1d227e20338d20d3a2ca0fef4efd7519e6dac45f167d5efbdcc58fe0810e

Contents?: true

Size: 729 Bytes

Versions: 17

Compression:

Stored size: 729 Bytes

Contents

module Lookbook
  class FileWatcher
    class << self
      def new(...)
        if evented?
          Lookbook.logger.debug "Using `EventedFileUpdateChecker` for file watching"
        else
          Lookbook.logger.debug "The 'listen' gem was not found. Using `FileUpdateChecker` for file watching"
        end

        file_watcher.new(...)
      end

      def evented?
        !(file_watcher <= ActiveSupport::FileUpdateChecker)
      end

      protected

      def file_watcher
        @_file_watcher ||= begin
          require_relative "./support/evented_file_update_checker"

          EventedFileUpdateChecker
        rescue LoadError
          ActiveSupport::FileUpdateChecker
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
lookbook-2.0.3 lib/lookbook/file_watcher.rb
lookbook-2.0.2 lib/lookbook/file_watcher.rb
lookbook-2.0.1 lib/lookbook/file_watcher.rb
lookbook-2.0.0 lib/lookbook/file_watcher.rb
lookbook-2.0.0.rc.3 lib/lookbook/file_watcher.rb
lookbook-2.0.0.rc.2 lib/lookbook/file_watcher.rb
lookbook-2.0.0.rc.1 lib/lookbook/file_watcher.rb
lookbook-2.0.0.beta.9 lib/lookbook/file_watcher.rb
lookbook-2.0.0.beta.8 lib/lookbook/file_watcher.rb
lookbook-2.0.0.beta.7 lib/lookbook/file_watcher.rb
lookbook-2.0.0.beta.6 lib/lookbook/file_watcher.rb
lookbook-2.0.0.beta.5 lib/lookbook/file_watcher.rb
lookbook-2.0.0.beta.4 lib/lookbook/file_watcher.rb
lookbook-2.0.0.beta.3 lib/lookbook/file_watcher.rb
lookbook-2.0.0.beta.2 lib/lookbook/file_watcher.rb
lookbook-2.0.0.beta.1 lib/lookbook/file_watcher.rb
lookbook-2.0.0.beta.0 lib/lookbook/file_watcher.rb