Module: Coveralls
- Defined in:
- lib/coveralls.rb,
lib/coveralls/api.rb,
lib/coveralls/output.rb,
lib/coveralls/command.rb,
lib/coveralls/version.rb,
lib/coveralls/rake/task.rb,
lib/coveralls/simplecov.rb,
lib/coveralls/configuration.rb
Defined Under Namespace
Modules: Configuration, Output, SimpleCov
Classes: API, CommandLine, NilFormatter, RakeTask
Constant Summary
collapse
- VERSION =
'0.28.0'
Class Attribute Summary collapse
Class Method Summary
collapse
Class Attribute Details
.adapter ⇒ Object
Returns the value of attribute adapter.
11
12
13
|
# File 'lib/coveralls.rb', line 11
def adapter
@adapter
end
|
.noisy ⇒ Object
Returns the value of attribute noisy.
11
12
13
|
# File 'lib/coveralls.rb', line 11
def noisy
@noisy
end
|
.run_locally ⇒ Object
Returns the value of attribute run_locally.
11
12
13
|
# File 'lib/coveralls.rb', line 11
def run_locally
@run_locally
end
|
.testing ⇒ Object
Returns the value of attribute testing.
11
12
13
|
# File 'lib/coveralls.rb', line 11
def testing
@testing
end
|
Class Method Details
.noisy? ⇒ Boolean
103
104
105
|
# File 'lib/coveralls.rb', line 103
def noisy?
ENV['COVERALLS_NOISY'] || (defined?(@noisy) && @noisy)
end
|
.push! ⇒ Object
32
33
34
35
36
|
# File 'lib/coveralls.rb', line 32
def push!
require 'simplecov'
result = ::SimpleCov::ResultMerger.merged_result
Coveralls::SimpleCov::Formatter.new.format result
end
|
.setup! ⇒ Object
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
# File 'lib/coveralls.rb', line 38
def setup!
@adapter = nil
if defined?(::SimpleCov)
@adapter = :simplecov
else
begin
require 'simplecov'
@adapter = :simplecov if defined?(::SimpleCov)
rescue StandardError => e
puts e.message
end
end
if @adapter == :simplecov
::SimpleCov.formatter = Coveralls::SimpleCov::Formatter
Coveralls::Output.puts('[Coveralls] Set up the SimpleCov formatter.', color: 'green')
else
Coveralls::Output.puts("[Coveralls] Couldn't find an appropriate adapter.", color: 'red')
end
end
|
.should_run? ⇒ Boolean
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
# File 'lib/coveralls.rb', line 83
def should_run?
unless will_run?
Coveralls::Output.puts('[Coveralls] Outside the CI environment, not sending data.', color: 'yellow')
return false
end
if ENV['COVERALLS_RUN_LOCALLY'] || (defined?(@run_locally) && @run_locally)
Coveralls::Output.puts('[Coveralls] Creating a new job on Coveralls from local coverage results.', color: 'cyan')
end
true
end
|
.start!(simplecov_setting = 'test_frameworks', &block) ⇒ Object
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
# File 'lib/coveralls.rb', line 62
def start!(simplecov_setting = 'test_frameworks', &block)
return unless @adapter == :simplecov
::SimpleCov.add_filter 'vendor'
if simplecov_setting
Coveralls::Output.puts("[Coveralls] Using SimpleCov's '#{simplecov_setting}' settings.", color: 'green')
if block
::SimpleCov.start(simplecov_setting) { instance_eval(&block) }
else
::SimpleCov.start(simplecov_setting)
end
elsif block
Coveralls::Output.puts('[Coveralls] Using SimpleCov settings defined in block.', color: 'green')
::SimpleCov.start { instance_eval(&block) }
else
Coveralls::Output.puts("[Coveralls] Using SimpleCov's default settings.", color: 'green')
::SimpleCov.start
end
end
|
.wear!(simplecov_setting = nil, &block) ⇒ Object
20
21
22
23
|
# File 'lib/coveralls.rb', line 20
def wear!(simplecov_setting = nil, &block)
setup!
start! simplecov_setting, &block
end
|
.wear_merged!(simplecov_setting = nil, &block) ⇒ Object
25
26
27
28
29
30
|
# File 'lib/coveralls.rb', line 25
def wear_merged!(simplecov_setting = nil, &block)
require 'simplecov'
@adapter = :simplecov
::SimpleCov.formatter = NilFormatter
start! simplecov_setting, &block
end
|
.will_run? ⇒ Boolean
98
99
100
101
|
# File 'lib/coveralls.rb', line 98
def will_run?
ENV['CI'] || ENV['JENKINS_URL'] || ENV['TDDIUM'] ||
ENV['COVERALLS_RUN_LOCALLY'] || (defined?(@testing) && @testing)
end
|