class Guard::Reek::Runner

This class runs `reek` command, retrieves result and notifies. An instance of this class is intended to invoke `reek` only once in its lifetime.

Attributes

notifier[R]
result[R]
ui[R]

Public Class Methods

new(options) click to toggle source
# File lib/guard/reek/runner.rb, line 10
def initialize(options)
  @cli = options[:cli]
  @all = options[:all] || '*'
  @notifier = options[:notifier] || Notifier
  @ui = options[:ui] || UI
end

Public Instance Methods

run(paths = []) click to toggle source
# File lib/guard/reek/runner.rb, line 38
def run(paths = [])
  result = run_reek_cmd(paths)

  if result
    notifier.notify('Reek Results', title: 'Passed', image: :success)
  else
    notifier.notify('Reek Results', title: 'Failed', image: :failed)
  end
end

Private Instance Methods

reek_cmd() click to toggle source
# File lib/guard/reek/runner.rb, line 58
def reek_cmd
  ['reek', @cli].compact
end
run_reek_cmd(paths) click to toggle source
# File lib/guard/reek/runner.rb, line 50
def run_reek_cmd(paths)
  runner_paths = Paths.new(paths, @all)
  ui.info("Guard::Reek is running on #{runner_paths}")

  command = reek_cmd.concat(runner_paths)
  Kernel.system(command.join(' '))
end