Class: Pippi::AutoRunner

Inherits:
Object
  • Object
show all
Defined in:
lib/pippi/auto_runner.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ AutoRunner

Returns a new instance of AutoRunner.



5
6
7
8
9
10
11
12
13
# File 'lib/pippi/auto_runner.rb', line 5

def initialize(opts = {})
  checkset = opts.fetch(:checkset, 'basic')
  @io = opts.fetch(:io) { File.open('log/pippi.log', 'w') }
  @ctx = Pippi::Context.new

  @ctx.checks = Pippi::CheckLoader.new(@ctx, checkset).checks
  @ctx.checks.each(&:decorate)
  at_exit { dump }
end

Instance Attribute Details

#ctxObject (readonly)

Returns the value of attribute ctx.



3
4
5
# File 'lib/pippi/auto_runner.rb', line 3

def ctx
  @ctx
end

Instance Method Details

#dumpObject



15
16
17
18
19
20
21
22
# File 'lib/pippi/auto_runner.rb', line 15

def dump
  if @ctx.checks.one? && @ctx.checks.first.kind_of?(Pippi::Checks::MethodSequenceFinder)
    @ctx.checks.first.dump
  end
  @ctx.report.problems.each do |problem|
    @io.puts(problem.to_text)
  end
end