Module: Scrutinizer::Ocular
- Extended by:
- Ocular
- Included in:
- Ocular
- Defined in:
- lib/scrutinizer/ocular.rb,
lib/scrutinizer/ocular/output.rb,
lib/scrutinizer/ocular/version.rb,
lib/scrutinizer/ocular/formatter.rb,
lib/scrutinizer/ocular/api_client.rb,
lib/scrutinizer/ocular/repository_introspector.rb
Defined Under Namespace
Classes: ApiClient, LocalOutputFormatter, MemorizedOutput, NullOutput, RepositoryIntrospector, Serializer, StdoutOutput, UploadFailed, UploadingFormatter
Constant Summary
collapse
- VERSION =
"1.0.1"
Instance Attribute Summary collapse
Instance Method Summary
collapse
Instance Attribute Details
#enabled ⇒ Object
Returns the value of attribute enabled.
7
8
9
|
# File 'lib/scrutinizer/ocular.rb', line 7
def enabled
@enabled
end
|
Instance Method Details
24
25
26
27
28
29
30
|
# 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! ⇒ Object
17
18
19
20
21
22
|
# File 'lib/scrutinizer/ocular.rb', line 17
def setup!
require 'simplecov'
require "scrutinizer/ocular/formatter"
::SimpleCov.formatter = create_formatter
end
|
#should_run? ⇒ Boolean
44
45
46
|
# 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) ⇒ Object
32
33
34
35
36
37
38
39
40
41
42
|
# 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) ⇒ Object
10
11
12
13
14
15
|
# File 'lib/scrutinizer/ocular.rb', line 10
def watch!(profile = nil, &block)
if self.should_run?
setup!
start! profile, &block
end
end
|