File: evaluate_only.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 (35 lines) | stat: -rw-r--r-- 980 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
require "guard"

module Guard
  module Cli
    module Environments
      class EvaluateOnly
        def initialize(options)
          @options = options
        end

        def evaluate
          # TODO: check bundler setup first?
          #
          # TODO: it should be easier to pass options created with init
          # directly to evaluator
          #
          # TODO: guardfile/DSL should interact only with a given object, and
          # not global Guard object (setting global state only needed before
          # start() is called)
          #
          Guard.init(@options)
          session = Guard.state.session
          Guardfile::Evaluator.new(session.evaluator_options).evaluate
        rescue \
          Dsl::Error,
          Guardfile::Evaluator::NoPluginsError,
          Guardfile::Evaluator::NoGuardfileError,
          Guardfile::Evaluator::NoCustomGuardfile => e
          UI.error(e.message)
          abort
        end
      end
    end
  end
end