module Scrutinizer::Ocular

Constants

VERSION

Attributes

enabled[RW]

Public Instance Methods

create_formatter() click to toggle source
# File lib/scrutinizer/ocular.rb, line 24
def create_formatter
  if ENV['SCRUTINIZER_CC_FILE']
    return Scrutinizer::Ocular::LocalOutputFormatter
  end

  Scrutinizer::Ocular::UploadingFormatter
end
setup!() click to toggle source
# File lib/scrutinizer/ocular.rb, line 17
def setup!
  require 'simplecov'
  require "scrutinizer/ocular/formatter"

  ::SimpleCov.formatter = create_formatter
end
should_run?() click to toggle source
# File lib/scrutinizer/ocular.rb, line 44
def should_run?
  ENV["CI"] || ENV["JENKINS_URL"] || ENV["SCRUTINIZER_COVERAGE"] || ENV['SCRUTINIZER_CC_FILE'] || @enabled
end
start!(profile=nil, &block) click to toggle source
# File lib/scrutinizer/ocular.rb, line 32
def start!(profile=nil, &block)
  ::SimpleCov.add_filter 'vendor'

  if profile
    ::SimpleCov.start(profile)
  elsif block
    ::SimpleCov.start(profile) { instance_eval(block) }
  else
    ::SimpleCov.start
  end
end
watch!(profile = nil, &block) click to toggle source
# File lib/scrutinizer/ocular.rb, line 10
def watch!(profile = nil, &block)
  if self.should_run?
    setup!
    start! profile, &block
  end
end