Module: Guard::Compat

Defined in:
lib/guard/compat.rb,
lib/guard/compat/plugin.rb,
lib/guard/compat/version.rb,
lib/guard/compat/test/template.rb

Defined Under Namespace

Modules: Test, UI

Constant Summary collapse

VERSION =
'1.1.0'

Class Method Summary collapse

Class Method Details

.matching_files(plugin, files) ⇒ Object

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



27
28
29
30
31
32
33
34
35
36
37
# 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_directoriesObject



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/guard/compat/plugin.rb', line 39

def self.watched_directories
  unless Guard.const_defined?('CLI')
    msg = 'either Guard has not been required or you did not' \
      ' stub this method in your plugin tests'
    fail NotImplementedError, msg
  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