File: evaluator.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 (39 lines) | stat: -rw-r--r-- 1,044 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
28
29
30
31
32
33
34
35
36
37
38
39
require "guard/config"
fail "Deprecations disabled (strict mode)" if Guard::Config.new.strict?

require "guard/ui"

module Guard
  module Deprecated
    module Evaluator
      def self.add_deprecated(klass)
        klass.send(:include, self)
      end

      EVALUATE_GUARDFILE = <<-EOS.gsub(/^\s*/, "")
        Starting with Guard 2.8.3 'Guard::Evaluator#evaluate_guardfile' is
        deprecated in favor of '#evaluate'.
      EOS

      REEVALUATE_GUARDFILE = <<-EOS.gsub(/^\s*/, "")
        Starting with Guard 2.8.3 'Guard::Evaluator#reevaluate_guardfile' is
        deprecated in favor of '#reevaluate'.

        NOTE: this method no longer does anything since it could not be
        implemented reliably.
      EOS

      def evaluate_guardfile
        UI.deprecation(EVALUATE_GUARDFILE)
        evaluate
      end

      def reevaluate_guardfile
        # require guard only when needed, because
        # guard's deprecations require us
        require "guard"
        UI.deprecation(REEVALUATE_GUARDFILE)
      end
    end
  end
end