Sha256: 5d2b6cbe218fb890665274baf1b8d4d2135b17817f75b66aff63944e78dc3cfc

Contents?: true

Size: 621 Bytes

Versions: 4

Compression:

Stored size: 621 Bytes

Contents

require "guard/plugin"
require "guard/guardfile/evaluator"

module Guard
  class Reevaluator < Plugin
    def run_on_modifications(files)
      STDERR.puts files.inspect
      return unless ::Guard::Watcher.match_guardfile?(files)
      ::Guard.save_scope
      Guard::Guardfile::Evaluator.new.reevaluate_guardfile
    rescue ScriptError, StandardError => e
      ::Guard::UI.warning("Failed to reevaluate file: #{e}")

      options = { watchers: [::Guard::Watcher.new("Guardfile")] }
      ::Guard.add_plugin(:reevaluator, options)

      throw :task_has_failed
    ensure
      ::Guard.restore_scope
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
guard-2.10.0 lib/guard/reevaluator.rb.orig
guard-2.9.2 lib/guard/reevaluator.rb.orig
guard-2.9.1 lib/guard/reevaluator.rb.orig
guard-2.9.0 lib/guard/reevaluator.rb.orig