Class: Guard::Cli::Environments::EvaluateOnly

Inherits:
Object
  • Object
show all
Defined in:
lib/guard/cli/environments/evaluate_only.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ EvaluateOnly

Returns a new instance of EvaluateOnly


7
8
9
# File 'lib/guard/cli/environments/evaluate_only.rb', line 7

def initialize(options)
  @options = options
end

Instance Method Details

#evaluateObject


11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/guard/cli/environments/evaluate_only.rb', line 11

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