File: watcher.rb

package info (click to toggle)
ruby-guard 2.18.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,344 kB
  • sloc: ruby: 9,256; makefile: 6
file content (27 lines) | stat: -rw-r--r-- 784 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
require "guard/config"
fail "Deprecations disabled (strict mode)" if Guard::Config.new.strict?

module Guard
  module Deprecated
    module Watcher
      def self.add_deprecated(klass)
        klass.send(:extend, ClassMethods)
      end

      module ClassMethods
        MATCH_GUARDFILE = <<-EOS.gsub(/^\s*/, "")
          Starting with Guard 2.8.3 this method is deprecated.
        EOS

        def match_guardfile?(files)
          require "guard/guardfile/evaluator"
          UI.deprecation(MATCH_GUARDFILE)
          options = ::Guard.state.session.evaluator_options
          evaluator = ::Guard::Guardfile::Evaluator.new(options)
          path = evaluator.guardfile_path
          files.any? { |file| File.expand_path(file) == path }
        end
      end
    end
  end
end