simplecov-html 0.12.2 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.tool-versions +1 -1
- data/CHANGELOG.md +30 -3
- data/README.md +1 -1
- data/Rakefile +12 -3
- data/lib/simplecov-html/version.rb +1 -1
- data/lib/simplecov-html.rb +39 -11
- data/public/application.css +1 -1
- data/public/application.js +7 -7
- data/views/layout.erb +2 -3
- data/views/source_file.erb +5 -2
- metadata +7 -31
- data/.gitignore +0 -26
- data/.rubocop.yml +0 -79
- data/.travis.yml +0 -25
- data/Gemfile +0 -27
- data/Gemfile.lock +0 -68
- data/Guardfile +0 -14
- data/assets/javascripts/application.js +0 -122
- data/assets/javascripts/libraries/jquery-3.4.1.js +0 -10598
- data/assets/javascripts/plugins/highlight.pack.js +0 -1
- data/assets/javascripts/plugins/jquery.colorbox.js +0 -1105
- data/assets/javascripts/plugins/jquery.dataTables.js +0 -15008
- data/assets/javascripts/plugins/jquery.timeago.js +0 -232
- data/assets/stylesheets/application.css +0 -3
- data/assets/stylesheets/plugins/datatables.css +0 -462
- data/assets/stylesheets/plugins/highlight.css +0 -129
- data/assets/stylesheets/plugins/jquery-ui-1.8.4.custom.css +0 -295
- data/assets/stylesheets/plugins/jquery.colorbox.css +0 -52
- data/assets/stylesheets/reset.css +0 -103
- data/assets/stylesheets/screen.css.sass +0 -242
- data/simplecov-html.gemspec +0 -23
- data/test/helper.rb +0 -6
- data/test/test_simple_cov-html.rb +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 39f6a1e464a4a4dc7f8909490225ad044486055ae1cefe8978738c95651c9ad8
|
4
|
+
data.tar.gz: b406a23cdb0e57671df0e919073aabb7147b0166521c630ac39ab3c0bf659af4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9cecd560f071e8b9f37b7fa70354c49748704f69d318a35e844cfe03848fba01b01bdb4d4e973c5219d0aeda318e5f4abc143e78d4beaeca13b27e1ae94594b5
|
7
|
+
data.tar.gz: 51b3f7d1541d4a9bddb1e05a20a0c03dc6cde3885c366b914dfd4bdb4dbdea2283a26bfd648b631e1deda38acd4cd6d91d131c3271b6fafe95e4d82272328d6f
|
data/.tool-versions
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby 2.
|
1
|
+
ruby 2.7.1
|
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,33 @@
|
|
1
|
+
0.13.0 (2024-09-08)
|
2
|
+
==================
|
3
|
+
|
4
|
+
## Enhancements
|
5
|
+
* Cache erb templates when generating report. See [#114](https://github.com/simplecov-ruby/simplecov-html/pull/114) (thanks [@fatkodima](https://github.com/fatkodima)).
|
6
|
+
* Print branch coverage with line coverage. See [#103](https://github.com/simplecov-ruby/simplecov-html/pull/103) (thanks [@jeremyevans](https://github.com/jeremyevans)).
|
7
|
+
* Add line number anchors. Thanks [@jantman](https://github.com/jantman) for the proposal [#49](https://github.com/simplecov-ruby/simplecov-html/issues/49) and [@nishidayuya](https://github.com/nishidayuya) for the patch [#106](https://github.com/simplecov-ruby/simplecov-html/pull/106)!
|
8
|
+
* Add inline assets option. See [#107](https://github.com/simplecov-ruby/simplecov-html/pull/107) (thanks [@frankh](https://github.com/frankh)).
|
9
|
+
* Make close button look better. See [#140](https://github.com/simplecov-ruby/simplecov-html/pull/140) (thanks [@anthony0030](https://github.com/anthony0030)).
|
10
|
+
* Avoid "permission denied" errors by removing the destination before copying assets [#135](https://github.com/simplecov-ruby/simplecov-html/pull/135) (thanks [@tomeon](https://github.com/tomeon)).
|
11
|
+
* Improve clarity of line and branch coverage format. See [#125](https://github.com/simplecov-ruby/simplecov-html/pull/125) (thanks [@joshuapinter](https://github.com/joshuapinter)).
|
12
|
+
|
13
|
+
## Bugfixes
|
14
|
+
* Avoid loading favicon.png that does not exist. See [#123](https://github.com/simplecov-ruby/simplecov-html/pull/123) (thanks [@yyamanoi1222](https://github.com/yyamanoi1222)).
|
15
|
+
|
16
|
+
## Misc
|
17
|
+
* Reduced gem size by not including development-only files.
|
18
|
+
* Bundle jQuery 3.7.1. See [#108](https://github.com/simplecov-ruby/simplecov-html/issues/108) (thanks [@jgarland79](https://github.com/jgarland79) for reporting the issue).
|
19
|
+
|
20
|
+
0.12.3 (2020-09-23)
|
21
|
+
==================
|
22
|
+
|
23
|
+
## Bugfixes
|
24
|
+
* Relax ruby version requirement to work with Ruby 3.0 (next version, current `ruby-head`). Thanks [@byroot](https://github.com/byroot).
|
25
|
+
|
1
26
|
0.12.2 (2020-02-27)
|
2
27
|
==================
|
3
28
|
|
4
29
|
## Bugfixes
|
5
|
-
* Refreshing the page while a source file is open works again. Thanks [@HansBug](https://github.com/HansBug) for the report [#94](https://github.com/
|
30
|
+
* Refreshing the page while a source file is open works again. Thanks [@HansBug](https://github.com/HansBug) for the report [#94](https://github.com/simplecov-ruby/simplecov-html/issues/94) and [@Tietew](https://github.com/Tietew) for the fix!
|
6
31
|
|
7
32
|
0.12.1 (2020-02-23)
|
8
33
|
==================
|
@@ -30,6 +55,8 @@ Yes it looks different, no it's not a redesign - just a side effect of lots of d
|
|
30
55
|
* make sure encoding errors won't crash the formatter
|
31
56
|
* When viewing a short source file while you have a big file list you will no longer be able to scroll on after the source file has ended
|
32
57
|
|
58
|
+
|
59
|
+
|
33
60
|
0.11.0 (2020-01-28)
|
34
61
|
=======
|
35
62
|
|
@@ -65,11 +92,11 @@ Changes ruby support to 2.4+, adds branch coverage support. Meant to be used wit
|
|
65
92
|
|
66
93
|
## Bugfixes
|
67
94
|
|
68
|
-
* Allow usage with frozen-string-literal-enabled. See [#56](https://github.com/
|
95
|
+
* Allow usage with frozen-string-literal-enabled. See [#56](https://github.com/simplecov-ruby/simplecov-html/pull/56) (thanks @pat)
|
69
96
|
|
70
97
|
0.10.1 (2017-05-17)
|
71
98
|
========
|
72
99
|
|
73
100
|
## Bugfixes
|
74
101
|
|
75
|
-
* circumvent a regression that happens in the new JRuby 9.1.9.0 release. See [#53](https://github.com/
|
102
|
+
* circumvent a regression that happens in the new JRuby 9.1.9.0 release. See [#53](https://github.com/simplecov-ruby/simplecov-html/pull/53) thanks @koic
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Default HTML formatter for SimpleCov
|
2
2
|
====================================
|
3
3
|
|
4
|
-
***Note: To learn more about SimpleCov, check out the main repo at https://github.com/
|
4
|
+
***Note: To learn more about SimpleCov, check out the main repo at https://github.com/simplecov-ruby/simplecov***
|
5
5
|
|
6
6
|
Generates a nice HTML report of your SimpleCov ruby code coverage results on Ruby 2.4+ using client-side Javascript
|
7
7
|
quite extensively.
|
data/Rakefile
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
require "bundler"
|
4
4
|
Bundler::GemHelper.install_tasks
|
5
5
|
|
6
|
-
# See https://github.com/
|
6
|
+
# See https://github.com/simplecov-ruby/simplecov/issues/171
|
7
7
|
desc "Set permissions on all files so they are compatible with both user-local and system-wide installs"
|
8
8
|
task :fix_permissions do
|
9
9
|
system 'bash -c "find . -type f -exec chmod 644 {} \; && find . -type d -exec chmod 755 {} \;"'
|
@@ -27,18 +27,27 @@ rescue LoadError
|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
-
task :
|
30
|
+
task default: [:test, :rubocop]
|
31
31
|
|
32
32
|
namespace :assets do
|
33
33
|
desc "Compiles all assets"
|
34
34
|
task :compile do
|
35
35
|
puts "Compiling assets"
|
36
36
|
require "sprockets"
|
37
|
+
require "sprockets/sass_processor"
|
38
|
+
|
39
|
+
Sprockets.register_processor("text/css") do |input|
|
40
|
+
{data: input[:data].gsub(/(?<!-|_)url\(['"]?(.+?)['"]?\)/) { "asset-data-url(\"#{Regexp.last_match(1)}\")" }}
|
41
|
+
end
|
42
|
+
|
43
|
+
Sprockets.register_processor "text/css", Sprockets::ScssProcessor
|
44
|
+
|
37
45
|
assets = Sprockets::Environment.new do |env|
|
38
46
|
env.append_path "assets/javascripts"
|
39
47
|
env.append_path "assets/stylesheets"
|
48
|
+
env.append_path "public"
|
40
49
|
env.js_compressor = :uglify
|
41
|
-
env.css_compressor = :
|
50
|
+
env.css_compressor = :scss
|
42
51
|
end
|
43
52
|
assets["application.js"].write_to("public/application.js")
|
44
53
|
assets["application.css"].write_to("public/application.css")
|
data/lib/simplecov-html.rb
CHANGED
@@ -5,12 +5,13 @@ require "cgi"
|
|
5
5
|
require "fileutils"
|
6
6
|
require "digest/sha1"
|
7
7
|
require "time"
|
8
|
+
require "base64"
|
8
9
|
|
9
10
|
# Ensure we are using a compatible version of SimpleCov
|
10
11
|
major, minor, patch = SimpleCov::VERSION.scan(/\d+/).first(3).map(&:to_i)
|
11
12
|
if major < 0 || minor < 9 || patch < 0
|
12
|
-
raise "The version of SimpleCov you are using is too old. "\
|
13
|
-
|
13
|
+
raise "The version of SimpleCov you are using is too old. " \
|
14
|
+
"Please update with `gem install simplecov` or `bundle update simplecov`"
|
14
15
|
end
|
15
16
|
|
16
17
|
module SimpleCov
|
@@ -18,11 +19,16 @@ module SimpleCov
|
|
18
19
|
class HTMLFormatter
|
19
20
|
def initialize
|
20
21
|
@branchable_result = SimpleCov.branch_coverage?
|
22
|
+
@templates = {}
|
23
|
+
@inline_assets = !ENV["SIMPLECOV_INLINE_ASSETS"].nil?
|
24
|
+
@public_assets_dir = File.join(File.dirname(__FILE__), "../public/")
|
21
25
|
end
|
22
26
|
|
23
27
|
def format(result)
|
24
|
-
|
25
|
-
|
28
|
+
unless @inline_assets
|
29
|
+
Dir[File.join(@public_assets_dir, "*")].each do |path|
|
30
|
+
FileUtils.cp_r(path, asset_output_path, remove_destination: true)
|
31
|
+
end
|
26
32
|
end
|
27
33
|
|
28
34
|
File.open(File.join(output_path, "index.html"), "wb") do |file|
|
@@ -31,9 +37,7 @@ module SimpleCov
|
|
31
37
|
puts output_message(result)
|
32
38
|
end
|
33
39
|
|
34
|
-
|
35
|
-
"Coverage report generated for #{result.command_name} to #{output_path}. #{result.covered_lines} / #{result.total_lines} LOC (#{result.covered_percent.round(2)}%) covered."
|
36
|
-
end
|
40
|
+
private
|
37
41
|
|
38
42
|
def branchable_result?
|
39
43
|
# cached in initialize because we truly look it up a whole bunch of times
|
@@ -50,11 +54,16 @@ module SimpleCov
|
|
50
54
|
end
|
51
55
|
end
|
52
56
|
|
53
|
-
|
57
|
+
def output_message(result)
|
58
|
+
output = "Coverage report generated for #{result.command_name} to #{output_path}."
|
59
|
+
output += "\nLine Coverage: #{result.covered_percent.round(2)}% (#{result.covered_lines} / #{result.total_lines})"
|
60
|
+
output += "\nBranch Coverage: #{result.coverage_statistics[:branch].percent.round(2)}% (#{result.covered_branches} / #{result.total_branches})" if branchable_result?
|
61
|
+
output
|
62
|
+
end
|
54
63
|
|
55
64
|
# Returns the an erb instance for the template of given name
|
56
65
|
def template(name)
|
57
|
-
ERB.new(File.read(File.join(File.dirname(__FILE__), "../views/", "#{name}.erb")))
|
66
|
+
@templates[name] ||= ERB.new(File.read(File.join(File.dirname(__FILE__), "../views/", "#{name}.erb")))
|
58
67
|
end
|
59
68
|
|
60
69
|
def output_path
|
@@ -70,9 +79,28 @@ module SimpleCov
|
|
70
79
|
end
|
71
80
|
|
72
81
|
def assets_path(name)
|
82
|
+
return asset_inline(name) if @inline_assets
|
83
|
+
|
73
84
|
File.join("./assets", SimpleCov::Formatter::HTMLFormatter::VERSION, name)
|
74
85
|
end
|
75
86
|
|
87
|
+
# Only have a few content types, just hardcode them
|
88
|
+
CONTENT_TYPES = {
|
89
|
+
".js" => "text/javascript",
|
90
|
+
".png" => "image/png",
|
91
|
+
".gif" => "image/gif",
|
92
|
+
".css" => "text/css",
|
93
|
+
}.freeze
|
94
|
+
|
95
|
+
def asset_inline(name)
|
96
|
+
path = File.join(@public_assets_dir, name)
|
97
|
+
base64_content = Base64.strict_encode64 File.read(path)
|
98
|
+
|
99
|
+
content_type = CONTENT_TYPES[File.extname(name)]
|
100
|
+
|
101
|
+
"data:#{content_type};base64,#{base64_content}"
|
102
|
+
end
|
103
|
+
|
76
104
|
# Returns the html for the given source_file
|
77
105
|
def formatted_source_file(source_file)
|
78
106
|
template("source_file").result(binding)
|
@@ -82,11 +110,11 @@ module SimpleCov
|
|
82
110
|
|
83
111
|
# Returns a table containing the given source files
|
84
112
|
def formatted_file_list(title, source_files)
|
85
|
-
title_id = title.gsub(/^[^a-zA-Z]+/, "").gsub(/[^a-zA-Z0-9
|
113
|
+
title_id = title.gsub(/^[^a-zA-Z]+/, "").gsub(/[^a-zA-Z0-9\-_]/, "")
|
86
114
|
# Silence a warning by using the following variable to assign to itself:
|
87
115
|
# "warning: possibly useless use of a variable in void context"
|
88
116
|
# The variable is used by ERB via binding.
|
89
|
-
title_id = title_id
|
117
|
+
title_id = title_id # rubocop:disable Lint/SelfAssignment
|
90
118
|
template("file_list").result(binding)
|
91
119
|
end
|
92
120
|
|