coveralls_reborn 0.9.0 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +59 -0
- data/.travis.yml +9 -4
- data/Gemfile +17 -16
- data/LICENSE +17 -18
- data/README.md +7 -1
- data/Rakefile +9 -3
- data/bin/coveralls +2 -1
- data/coveralls-ruby.gemspec +15 -13
- data/lib/coveralls/api.rb +72 -68
- data/lib/coveralls/command.rb +28 -24
- data/lib/coveralls/configuration.rb +46 -52
- data/lib/coveralls/output.rb +12 -7
- data/lib/coveralls/rake/task.rb +7 -6
- data/lib/coveralls/simplecov.rb +34 -32
- data/lib/coveralls/version.rb +3 -1
- data/lib/coveralls.rb +43 -41
- data/spec/coveralls/configuration_spec.rb +212 -160
- data/spec/coveralls/coveralls_spec.rb +41 -46
- data/spec/coveralls/fixtures/app/controllers/sample.rb +2 -0
- data/spec/coveralls/fixtures/app/models/airplane.rb +4 -2
- data/spec/coveralls/output_spec.rb +38 -51
- data/spec/coveralls/simple_cov/formatter_spec.rb +82 -0
- data/spec/spec_helper.rb +15 -18
- metadata +21 -16
- data/spec/coveralls/simplecov_spec.rb +0 -82
@@ -1,15 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'yaml'
|
2
4
|
require 'securerandom'
|
3
5
|
|
4
6
|
module Coveralls
|
5
7
|
module Configuration
|
6
|
-
|
7
8
|
def self.configuration
|
8
9
|
config = {
|
9
|
-
environment:
|
10
|
+
environment: relevant_env,
|
10
11
|
git: git
|
11
12
|
}
|
12
|
-
yml =
|
13
|
+
yml = yaml_config
|
13
14
|
if yml
|
14
15
|
config[:configuration] = yml
|
15
16
|
config[:repo_token] = yml['repo_token'] || yml['repo_secret_token']
|
@@ -17,7 +18,7 @@ module Coveralls
|
|
17
18
|
if ENV['COVERALLS_REPO_TOKEN']
|
18
19
|
config[:repo_token] = ENV['COVERALLS_REPO_TOKEN']
|
19
20
|
end
|
20
|
-
if ENV['COVERALLS_PARALLEL'] && ENV['COVERALLS_PARALLEL'] !=
|
21
|
+
if ENV['COVERALLS_PARALLEL'] && ENV['COVERALLS_PARALLEL'] != 'false'
|
21
22
|
config[:parallel] = true
|
22
23
|
end
|
23
24
|
if ENV['TRAVIS']
|
@@ -41,24 +42,24 @@ module Coveralls
|
|
41
42
|
# standardized env vars
|
42
43
|
set_standard_service_params_for_generic_ci(config)
|
43
44
|
|
44
|
-
if
|
45
|
-
config[:service_name] =
|
45
|
+
if ENV['COVERALLS_SERVICE_NAME']
|
46
|
+
config[:service_name] = ENV['COVERALLS_SERVICE_NAME']
|
46
47
|
end
|
47
48
|
|
48
49
|
config
|
49
50
|
end
|
50
51
|
|
51
52
|
def self.set_service_params_for_travis(config, service_name)
|
52
|
-
config[:service_job_id]
|
53
|
+
config[:service_job_id] = ENV['TRAVIS_JOB_ID']
|
53
54
|
config[:service_pull_request] = ENV['TRAVIS_PULL_REQUEST'] unless ENV['TRAVIS_PULL_REQUEST'] == 'false'
|
54
|
-
config[:service_name]
|
55
|
-
config[:service_branch]
|
55
|
+
config[:service_name] = service_name || 'travis-ci'
|
56
|
+
config[:service_branch] = ENV['TRAVIS_BRANCH']
|
56
57
|
end
|
57
58
|
|
58
59
|
def self.set_service_params_for_circleci(config)
|
59
60
|
config[:service_name] = 'circleci'
|
60
61
|
config[:service_number] = ENV['CIRCLE_BUILD_NUM']
|
61
|
-
config[:service_pull_request] = (ENV['CI_PULL_REQUEST'] ||
|
62
|
+
config[:service_pull_request] = (ENV['CI_PULL_REQUEST'] || '')[/(\d+)$/, 1]
|
62
63
|
config[:parallel] = ENV['CIRCLE_NODE_TOTAL'].to_i > 1
|
63
64
|
config[:service_job_number] = ENV['CIRCLE_NODE_INDEX']
|
64
65
|
end
|
@@ -70,19 +71,19 @@ module Coveralls
|
|
70
71
|
end
|
71
72
|
|
72
73
|
def self.set_service_params_for_jenkins(config)
|
73
|
-
config[:service_name]
|
74
|
-
config[:service_number]
|
75
|
-
config[:service_branch]
|
74
|
+
config[:service_name] = 'jenkins'
|
75
|
+
config[:service_number] = ENV['BUILD_NUMBER']
|
76
|
+
config[:service_branch] = ENV['BRANCH_NAME']
|
76
77
|
config[:service_pull_request] = ENV['ghprbPullId']
|
77
78
|
end
|
78
79
|
|
79
80
|
def self.set_service_params_for_appveyor(config)
|
80
|
-
config[:service_name]
|
81
|
-
config[:service_number]
|
82
|
-
config[:service_branch]
|
83
|
-
config[:commit_sha]
|
84
|
-
repo_name
|
85
|
-
config[:service_build_url]
|
81
|
+
config[:service_name] = 'appveyor'
|
82
|
+
config[:service_number] = ENV['APPVEYOR_BUILD_VERSION']
|
83
|
+
config[:service_branch] = ENV['APPVEYOR_REPO_BRANCH']
|
84
|
+
config[:commit_sha] = ENV['APPVEYOR_REPO_COMMIT']
|
85
|
+
repo_name = ENV['APPVEYOR_REPO_NAME']
|
86
|
+
config[:service_build_url] = format('https://ci.appveyor.com/project/%s/build/%s', repo_name, config[:service_number])
|
86
87
|
end
|
87
88
|
|
88
89
|
def self.set_service_params_for_tddium(config)
|
@@ -95,11 +96,11 @@ module Coveralls
|
|
95
96
|
end
|
96
97
|
|
97
98
|
def self.set_service_params_for_gitlab(config)
|
98
|
-
config[:service_name]
|
99
|
-
config[:service_job_number]
|
100
|
-
config[:service_job_id]
|
101
|
-
config[:service_branch]
|
102
|
-
config[:commit_sha]
|
99
|
+
config[:service_name] = 'gitlab-ci'
|
100
|
+
config[:service_job_number] = ENV['CI_BUILD_NAME']
|
101
|
+
config[:service_job_id] = ENV['CI_BUILD_ID']
|
102
|
+
config[:service_branch] = ENV['CI_BUILD_REF_NAME']
|
103
|
+
config[:commit_sha] = ENV['CI_BUILD_REF']
|
103
104
|
end
|
104
105
|
|
105
106
|
def self.set_service_params_for_coveralls_local(config)
|
@@ -114,17 +115,16 @@ module Coveralls
|
|
114
115
|
config[:service_job_id] ||= ENV['CI_JOB_ID']
|
115
116
|
config[:service_build_url] ||= ENV['CI_BUILD_URL']
|
116
117
|
config[:service_branch] ||= ENV['CI_BRANCH']
|
117
|
-
config[:service_pull_request] ||= (ENV['CI_PULL_REQUEST'] ||
|
118
|
+
config[:service_pull_request] ||= (ENV['CI_PULL_REQUEST'] || '')[/(\d+)$/, 1]
|
118
119
|
end
|
119
120
|
|
120
121
|
def self.yaml_config
|
121
|
-
|
122
|
-
|
123
|
-
end
|
122
|
+
return unless configuration_path && File.exist?(configuration_path)
|
123
|
+
YAML.load_file(configuration_path)
|
124
124
|
end
|
125
125
|
|
126
126
|
def self.configuration_path
|
127
|
-
File.expand_path(File.join(
|
127
|
+
File.expand_path(File.join(root, '.coveralls.yml')) if root
|
128
128
|
end
|
129
129
|
|
130
130
|
def self.root
|
@@ -136,14 +136,12 @@ module Coveralls
|
|
136
136
|
end
|
137
137
|
|
138
138
|
def self.simplecov_root
|
139
|
-
if defined?(::SimpleCov)
|
140
|
-
::SimpleCov.root
|
141
|
-
end
|
139
|
+
::SimpleCov.root if defined?(::SimpleCov)
|
142
140
|
end
|
143
141
|
|
144
142
|
def self.rails_root
|
145
143
|
Rails.root.to_s
|
146
|
-
rescue
|
144
|
+
rescue StandardError
|
147
145
|
nil
|
148
146
|
end
|
149
147
|
|
@@ -151,44 +149,41 @@ module Coveralls
|
|
151
149
|
hash = {}
|
152
150
|
|
153
151
|
Dir.chdir(root) do
|
154
|
-
|
155
152
|
hash[:head] = {
|
156
|
-
id: ENV.fetch(
|
157
|
-
author_name: ENV.fetch(
|
158
|
-
author_email: ENV.fetch(
|
159
|
-
committer_name: ENV.fetch(
|
160
|
-
committer_email: ENV.fetch(
|
161
|
-
message: ENV.fetch(
|
153
|
+
id: ENV.fetch('GIT_ID', `git log -1 --pretty=format:'%H'`),
|
154
|
+
author_name: ENV.fetch('GIT_AUTHOR_NAME', `git log -1 --pretty=format:'%aN'`),
|
155
|
+
author_email: ENV.fetch('GIT_AUTHOR_EMAIL', `git log -1 --pretty=format:'%ae'`),
|
156
|
+
committer_name: ENV.fetch('GIT_COMMITTER_NAME', `git log -1 --pretty=format:'%cN'`),
|
157
|
+
committer_email: ENV.fetch('GIT_COMMITTER_EMAIL', `git log -1 --pretty=format:'%ce'`),
|
158
|
+
message: ENV.fetch('GIT_MESSAGE', `git log -1 --pretty=format:'%s'`)
|
162
159
|
}
|
163
160
|
|
164
161
|
# Branch
|
165
|
-
hash[:branch] = ENV.fetch(
|
162
|
+
hash[:branch] = ENV.fetch('GIT_BRANCH', `git rev-parse --abbrev-ref HEAD`)
|
166
163
|
|
167
164
|
# Remotes
|
168
165
|
remotes = nil
|
169
166
|
begin
|
170
167
|
remotes = `git remote -v`.split(/\n/).map do |remote|
|
171
|
-
splits = remote.split(
|
172
|
-
{name: splits[0], url: splits[1]}
|
168
|
+
splits = remote.split(' ').compact
|
169
|
+
{ name: splits[0], url: splits[1] }
|
173
170
|
end.uniq
|
174
|
-
rescue
|
171
|
+
rescue StandardError
|
175
172
|
end
|
176
173
|
hash[:remotes] = remotes
|
177
|
-
|
178
174
|
end
|
179
175
|
|
180
176
|
hash
|
181
|
-
|
182
|
-
|
183
|
-
Coveralls::Output.puts
|
184
|
-
Coveralls::Output.puts e.to_s, color: "red"
|
177
|
+
rescue StandardError => e
|
178
|
+
Coveralls::Output.puts 'Coveralls git error:', color: 'red'
|
179
|
+
Coveralls::Output.puts e.to_s, color: 'red'
|
185
180
|
nil
|
186
181
|
end
|
187
182
|
|
188
183
|
def self.relevant_env
|
189
184
|
hash = {
|
190
|
-
pwd:
|
191
|
-
rails_root:
|
185
|
+
pwd: pwd,
|
186
|
+
rails_root: rails_root,
|
192
187
|
simplecov_root: simplecov_root,
|
193
188
|
gem_version: VERSION
|
194
189
|
}
|
@@ -225,6 +220,5 @@ module Coveralls
|
|
225
220
|
|
226
221
|
hash
|
227
222
|
end
|
228
|
-
|
229
223
|
end
|
230
224
|
end
|
data/lib/coveralls/output.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Coveralls
|
2
4
|
#
|
3
5
|
# Public: Methods for formatting strings with Term::ANSIColor.
|
@@ -32,16 +34,19 @@ module Coveralls
|
|
32
34
|
# Coveralls::Output.no_color = true
|
33
35
|
|
34
36
|
module Output
|
35
|
-
|
36
|
-
|
37
|
-
|
37
|
+
class << self
|
38
|
+
attr_accessor :silent, :no_color
|
39
|
+
attr_writer :output
|
40
|
+
end
|
41
|
+
|
42
|
+
module_function
|
38
43
|
|
39
44
|
def output
|
40
45
|
(defined?(@output) && @output) || $stdout
|
41
46
|
end
|
42
47
|
|
43
48
|
def no_color?
|
44
|
-
|
49
|
+
defined?(@no_color) && @no_color
|
45
50
|
end
|
46
51
|
|
47
52
|
# Public: Formats the given string with the specified color
|
@@ -87,7 +92,7 @@ module Coveralls
|
|
87
92
|
# Returns nil.
|
88
93
|
def puts(string, options = {})
|
89
94
|
return if silent?
|
90
|
-
(options[:output] || output).puts
|
95
|
+
(options[:output] || output).puts format(string, options)
|
91
96
|
end
|
92
97
|
|
93
98
|
# Public: Passes .format to Kernel#print
|
@@ -104,11 +109,11 @@ module Coveralls
|
|
104
109
|
# Returns nil.
|
105
110
|
def print(string, options = {})
|
106
111
|
return if silent?
|
107
|
-
(options[:output] || output).print
|
112
|
+
(options[:output] || output).print format(string, options)
|
108
113
|
end
|
109
114
|
|
110
115
|
def silent?
|
111
|
-
ENV[
|
116
|
+
ENV['COVERALLS_SILENT'] || (defined?(@silent) && @silent)
|
112
117
|
end
|
113
118
|
end
|
114
119
|
end
|
data/lib/coveralls/rake/task.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'rake'
|
2
4
|
require 'rake/tasklib'
|
3
5
|
|
@@ -5,15 +7,14 @@ module Coveralls
|
|
5
7
|
class RakeTask < ::Rake::TaskLib
|
6
8
|
include ::Rake::DSL if defined?(::Rake::DSL)
|
7
9
|
|
8
|
-
def initialize(*
|
10
|
+
def initialize(*_args)
|
9
11
|
namespace :coveralls do
|
10
|
-
desc
|
12
|
+
desc 'Push latest coverage results to Coveralls.io'
|
11
13
|
task :push do
|
12
14
|
require 'coveralls'
|
13
15
|
Coveralls.push!
|
14
16
|
end
|
15
17
|
end
|
16
|
-
end
|
17
|
-
|
18
|
-
|
19
|
-
end # module
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/coveralls/simplecov.rb
CHANGED
@@ -1,27 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Coveralls
|
2
4
|
module SimpleCov
|
3
5
|
class Formatter
|
4
|
-
|
5
6
|
def display_result(result)
|
6
7
|
# Log which files would be submitted.
|
7
|
-
if result.files.
|
8
|
-
Coveralls::Output.puts
|
8
|
+
if !result.files.empty?
|
9
|
+
Coveralls::Output.puts '[Coveralls] Some handy coverage stats:'
|
9
10
|
else
|
10
|
-
Coveralls::Output.puts
|
11
|
+
Coveralls::Output.puts '[Coveralls] There are no covered files.', color: 'yellow'
|
11
12
|
end
|
12
13
|
result.files.each do |f|
|
13
|
-
Coveralls::Output.print
|
14
|
-
Coveralls::Output.print short_filename(f.filename).to_s, color:
|
15
|
-
Coveralls::Output.print
|
14
|
+
Coveralls::Output.print ' * '
|
15
|
+
Coveralls::Output.print short_filename(f.filename).to_s, color: 'cyan'
|
16
|
+
Coveralls::Output.print ' => ', color: 'white'
|
16
17
|
cov = "#{f.covered_percent.round}%"
|
17
18
|
if f.covered_percent > 90
|
18
|
-
Coveralls::Output.print cov, color:
|
19
|
+
Coveralls::Output.print cov, color: 'green'
|
19
20
|
elsif f.covered_percent > 80
|
20
|
-
Coveralls::Output.print cov, color:
|
21
|
+
Coveralls::Output.print cov, color: 'yellow'
|
21
22
|
else
|
22
|
-
Coveralls::Output.print cov, color:
|
23
|
+
Coveralls::Output.print cov, color: 'red'
|
23
24
|
end
|
24
|
-
Coveralls::Output.puts
|
25
|
+
Coveralls::Output.puts ''
|
25
26
|
end
|
26
27
|
true
|
27
28
|
end
|
@@ -33,7 +34,7 @@ module Coveralls
|
|
33
34
|
properties = {}
|
34
35
|
|
35
36
|
# Get Source
|
36
|
-
properties[:source] = File.open(file.filename,
|
37
|
+
properties[:source] = File.open(file.filename, 'rb:utf-8').read
|
37
38
|
|
38
39
|
# Get the root-relative filename
|
39
40
|
properties[:name] = short_filename(file.filename)
|
@@ -52,50 +53,51 @@ module Coveralls
|
|
52
53
|
end
|
53
54
|
|
54
55
|
def format(result)
|
55
|
-
|
56
56
|
unless Coveralls.should_run?
|
57
|
-
if Coveralls.noisy?
|
58
|
-
display_result result
|
59
|
-
end
|
57
|
+
display_result result if Coveralls.noisy?
|
60
58
|
return
|
61
59
|
end
|
62
60
|
|
63
61
|
# Post to Coveralls.
|
64
|
-
API.post_json
|
65
|
-
|
66
|
-
|
67
|
-
|
62
|
+
API.post_json 'jobs',
|
63
|
+
source_files: get_source_files(result),
|
64
|
+
test_framework: result.command_name.downcase,
|
65
|
+
run_at: result.created_at
|
68
66
|
|
69
67
|
Coveralls::Output.puts output_message result
|
70
68
|
|
71
69
|
true
|
72
|
-
|
73
|
-
rescue Exception => e
|
70
|
+
rescue StandardError => e
|
74
71
|
display_error e
|
75
72
|
end
|
76
73
|
|
77
74
|
def display_error(e)
|
78
|
-
Coveralls::Output.puts
|
79
|
-
Coveralls::Output.puts e.class.to_s, color:
|
80
|
-
Coveralls::Output.puts e.message, color:
|
81
|
-
e.backtrace
|
82
|
-
|
83
|
-
|
75
|
+
Coveralls::Output.puts 'Coveralls encountered an exception:', color: 'red'
|
76
|
+
Coveralls::Output.puts e.class.to_s, color: 'red'
|
77
|
+
Coveralls::Output.puts e.message, color: 'red'
|
78
|
+
if e.backtrace
|
79
|
+
e.backtrace.each do |line|
|
80
|
+
Coveralls::Output.puts line, color: 'red'
|
81
|
+
end
|
82
|
+
end
|
84
83
|
if e.respond_to?(:response) && e.response
|
85
|
-
Coveralls::Output.puts e.response.to_s, color:
|
84
|
+
Coveralls::Output.puts e.response.to_s, color: 'red'
|
86
85
|
end
|
87
86
|
false
|
88
87
|
end
|
89
88
|
|
90
89
|
def output_message(result)
|
91
|
-
"Coverage is at #{
|
90
|
+
"Coverage is at #{begin
|
91
|
+
result.covered_percent.round(2)
|
92
|
+
rescue StandardError
|
93
|
+
result.covered_percent.round
|
94
|
+
end}%.\nCoverage report sent to Coveralls."
|
92
95
|
end
|
93
96
|
|
94
97
|
def short_filename(filename)
|
95
|
-
filename = filename.gsub(::SimpleCov.root, '.').gsub(
|
98
|
+
filename = filename.gsub(::SimpleCov.root, '.').gsub(%r{^\./}, '') if ::SimpleCov.root
|
96
99
|
filename
|
97
100
|
end
|
98
|
-
|
99
101
|
end
|
100
102
|
end
|
101
103
|
end
|
data/lib/coveralls/version.rb
CHANGED
data/lib/coveralls.rb
CHANGED
@@ -1,27 +1,30 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'coveralls/version'
|
4
|
+
require 'coveralls/configuration'
|
5
|
+
require 'coveralls/api'
|
6
|
+
require 'coveralls/output'
|
7
|
+
require 'coveralls/simplecov'
|
6
8
|
|
7
9
|
module Coveralls
|
8
|
-
|
10
|
+
class << self
|
11
|
+
attr_accessor :adapter, :testing, :noisy, :run_locally
|
12
|
+
end
|
9
13
|
|
10
14
|
class NilFormatter
|
11
|
-
def format(result)
|
12
|
-
end
|
15
|
+
def format(result); end
|
13
16
|
end
|
14
17
|
|
15
|
-
|
18
|
+
module_function
|
16
19
|
|
17
|
-
def wear!(simplecov_setting=nil, &block)
|
20
|
+
def wear!(simplecov_setting = nil, &block)
|
18
21
|
setup!
|
19
22
|
start! simplecov_setting, &block
|
20
23
|
end
|
21
24
|
|
22
|
-
def wear_merged!(simplecov_setting=nil, &block)
|
25
|
+
def wear_merged!(simplecov_setting = nil, &block)
|
23
26
|
require 'simplecov'
|
24
|
-
|
27
|
+
@adapter = :simplecov
|
25
28
|
::SimpleCov.formatter = NilFormatter
|
26
29
|
start! simplecov_setting, &block
|
27
30
|
end
|
@@ -34,68 +37,67 @@ module Coveralls
|
|
34
37
|
|
35
38
|
def setup!
|
36
39
|
# Try to load up SimpleCov.
|
37
|
-
|
40
|
+
@adapter = nil
|
38
41
|
if defined?(::SimpleCov)
|
39
|
-
|
42
|
+
@adapter = :simplecov
|
40
43
|
else
|
41
44
|
begin
|
42
45
|
require 'simplecov'
|
43
|
-
|
44
|
-
rescue
|
46
|
+
@adapter = :simplecov if defined?(::SimpleCov)
|
47
|
+
rescue StandardError
|
45
48
|
end
|
46
49
|
end
|
47
50
|
|
48
51
|
# Load the appropriate adapter.
|
49
|
-
if
|
52
|
+
if @adapter == :simplecov
|
50
53
|
::SimpleCov.formatter = Coveralls::SimpleCov::Formatter
|
51
|
-
Coveralls::Output.puts(
|
54
|
+
Coveralls::Output.puts('[Coveralls] Set up the SimpleCov formatter.', color: 'green')
|
52
55
|
else
|
53
|
-
Coveralls::Output.puts("[Coveralls] Couldn't find an appropriate adapter.", color:
|
56
|
+
Coveralls::Output.puts("[Coveralls] Couldn't find an appropriate adapter.", color: 'red')
|
54
57
|
end
|
55
|
-
|
56
58
|
end
|
57
59
|
|
58
60
|
def start!(simplecov_setting = 'test_frameworks', &block)
|
59
|
-
if
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
::SimpleCov.start(simplecov_setting)
|
68
|
-
end
|
69
|
-
elsif block
|
70
|
-
Coveralls::Output.puts("[Coveralls] Using SimpleCov settings defined in block.", color: "green")
|
71
|
-
::SimpleCov.start { instance_eval(&block) }
|
61
|
+
return if @adapter != :simplecov
|
62
|
+
|
63
|
+
::SimpleCov.add_filter 'vendor'
|
64
|
+
|
65
|
+
if simplecov_setting
|
66
|
+
Coveralls::Output.puts("[Coveralls] Using SimpleCov's '#{simplecov_setting}' settings.", color: 'green')
|
67
|
+
if block_given?
|
68
|
+
::SimpleCov.start(simplecov_setting) { instance_eval(&block) }
|
72
69
|
else
|
73
|
-
|
74
|
-
::SimpleCov.start
|
70
|
+
::SimpleCov.start(simplecov_setting)
|
75
71
|
end
|
72
|
+
elsif block
|
73
|
+
Coveralls::Output.puts('[Coveralls] Using SimpleCov settings defined in block.', color: 'green')
|
74
|
+
::SimpleCov.start { instance_eval(&block) }
|
75
|
+
else
|
76
|
+
Coveralls::Output.puts("[Coveralls] Using SimpleCov's default settings.", color: 'green')
|
77
|
+
::SimpleCov.start
|
76
78
|
end
|
77
79
|
end
|
78
80
|
|
79
81
|
def should_run?
|
80
82
|
# Fail early if we're not on a CI
|
81
83
|
unless will_run?
|
82
|
-
Coveralls::Output.puts(
|
84
|
+
Coveralls::Output.puts('[Coveralls] Outside the CI environment, not sending data.', color: 'yellow')
|
83
85
|
return false
|
84
86
|
end
|
85
87
|
|
86
|
-
if ENV[
|
87
|
-
Coveralls::Output.puts(
|
88
|
+
if ENV['COVERALLS_RUN_LOCALLY'] || (defined?(@run_locally) && @run_locally)
|
89
|
+
Coveralls::Output.puts('[Coveralls] Creating a new job on Coveralls from local coverage results.', color: 'cyan')
|
88
90
|
end
|
89
91
|
|
90
92
|
true
|
91
93
|
end
|
92
94
|
|
93
95
|
def will_run?
|
94
|
-
ENV[
|
95
|
-
ENV[
|
96
|
+
ENV['CI'] || ENV['JENKINS_URL'] || ENV['TDDIUM'] ||
|
97
|
+
ENV['COVERALLS_RUN_LOCALLY'] || (defined?(@testing) && @testing)
|
96
98
|
end
|
97
99
|
|
98
100
|
def noisy?
|
99
|
-
ENV[
|
101
|
+
ENV['COVERALLS_NOISY'] || (defined?(@noisy) && @noisy)
|
100
102
|
end
|
101
103
|
end
|