module Guard::Compat

Constants

VERSION

Public Class Methods

matching_files(plugin, files) click to toggle source

TODO: this is just a temporary workaround to allow plugins to use watcher patterns in run_all

# File lib/guard/compat/plugin.rb, line 27
def self.matching_files(plugin, files)
  unless Guard.const_defined?('Watcher')
    msg = 'either Guard has not been required or you did not' \
      ' stub this method in your plugin tests'
    fail NotImplementedError, msg
  end

  # TODO: uniq not tested
  # TODO: resolve symlinks and then uniq?
  Guard::Watcher.match_files(plugin, files).uniq
end
watched_directories() click to toggle source
# File lib/guard/compat/plugin.rb, line 39
def self.watched_directories
  unless Guard.const_defined?('CLI')
    fail NotImplementedError, 'either Guard has not been required or'\
      ' you did not stub this method in your plugin tests'
  end

  if Guard.respond_to?(:state)
    # TODO: the new version is temporary
    Guard.state.session.watchdirs.map { |d| Pathname(d) }
  else
    dirs = Array(Guard.options(:watchdir))
    dirs.empty? ? [Pathname.pwd] : dirs.map { |d| Pathname(d) }
  end
end