simplecov-html 0.11.0.beta1 → 0.11.0.beta2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +3 -3
- data/assets/javascripts/application.js +29 -18
- data/lib/simplecov-html.rb +8 -3
- data/lib/simplecov-html/version.rb +1 -1
- data/public/application.js +26 -18
- data/views/layout.erb +6 -6
- data/views/source_file.erb +3 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5a029a180a134f18ccae22b1a9040b22258c5aefa763147873a95c9c1ba46e09
|
4
|
+
data.tar.gz: a0eded12611371f636eb5680438797ea0fc3f9c674e878fc298bbcb5ddd9ae50
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98a6a8af89ec6e73d74322a7097ecc36b83adfc21560d1596c15d0d4ea84e275b8bb05b7ef1b2393c237b42d59417691dddda60b53876279fba3e6f6a5089b9b
|
7
|
+
data.tar.gz: fd852fe6346d84284b435095bab0ecabe488fe53a8b87483706856aa858cdac14bf764ffbc79c652f912caa3333049885bba02bad4bdfefff97414d27e261978
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
simplecov-html (0.11.0.
|
4
|
+
simplecov-html (0.11.0.beta2)
|
5
5
|
|
6
6
|
PATH
|
7
7
|
remote: /home/tobi/github/simplecov
|
8
8
|
specs:
|
9
|
-
simplecov (0.18.0.
|
9
|
+
simplecov (0.18.0.beta2)
|
10
10
|
docile (~> 1.1)
|
11
|
-
simplecov-html (~> 0.11.0.
|
11
|
+
simplecov-html (~> 0.11.0.beta2)
|
12
12
|
|
13
13
|
GEM
|
14
14
|
remote: https://rubygems.org/
|
@@ -2,25 +2,36 @@
|
|
2
2
|
//= require_directory ./plugins/
|
3
3
|
//= require_self
|
4
4
|
|
5
|
-
$(document).ready(function() {
|
5
|
+
$(document).ready(function () {
|
6
|
+
branchCoverageActivated = $("body").data("branch-coverage") == true;
|
7
|
+
|
6
8
|
// Configuration for fancy sortable tables for source file groups
|
9
|
+
// For what these columns are, cecl out file_list.erb - null basically
|
10
|
+
// does normal/number style sorting which fine for hit/missed lines only
|
11
|
+
// percentages like "covered percent" need special sorting arguments.
|
12
|
+
lineColumns = [null, { "sType": "percent" }, null, null, null, null, null];
|
13
|
+
branchColumns = [{ "sType": "percent" }, null, null, null];
|
14
|
+
|
15
|
+
dataColumns = branchCoverageActivated ? lineColumns.concat(branchColumns) : lineColumns;
|
16
|
+
|
7
17
|
$('.file_list').dataTable({
|
8
|
-
"aaSorting": [[
|
18
|
+
"aaSorting": [[1, "asc"]],
|
9
19
|
"bPaginate": false,
|
10
|
-
"bJQueryUI": true
|
20
|
+
"bJQueryUI": true,
|
21
|
+
"aoColumns": dataColumns
|
11
22
|
});
|
12
23
|
|
13
24
|
// Syntax highlight all files up front - deactivated
|
14
25
|
// $('.source_table pre code').each(function(i, e) {hljs.highlightBlock(e, ' ')});
|
15
26
|
|
16
27
|
// Syntax highlight source files on first toggle of the file view popup
|
17
|
-
$("a.src_link").click(function() {
|
28
|
+
$("a.src_link").click(function () {
|
18
29
|
// Get the source file element that corresponds to the clicked element
|
19
30
|
var source_table = $($(this).attr('href'));
|
20
31
|
|
21
32
|
// If not highlighted yet, do it!
|
22
33
|
if (!source_table.hasClass('highlighted')) {
|
23
|
-
source_table.find('pre code').each(function(i, e) {hljs.highlightBlock(e, ' ')});
|
34
|
+
source_table.find('pre code').each(function (i, e) { hljs.highlightBlock(e, ' ') });
|
24
35
|
source_table.addClass('highlighted');
|
25
36
|
};
|
26
37
|
});
|
@@ -35,14 +46,14 @@ $(document).ready(function() {
|
|
35
46
|
opacity: 1,
|
36
47
|
width: "95%",
|
37
48
|
height: "95%",
|
38
|
-
onLoad: function() {
|
49
|
+
onLoad: function () {
|
39
50
|
prev_anchor = curr_anchor ? curr_anchor : jQuery.url.attr('anchor');
|
40
51
|
curr_anchor = this.href.split('#')[1];
|
41
52
|
window.location.hash = curr_anchor;
|
42
53
|
},
|
43
|
-
onCleanup: function() {
|
54
|
+
onCleanup: function () {
|
44
55
|
if (prev_anchor && prev_anchor != curr_anchor) {
|
45
|
-
$('a[href="#'+prev_anchor+'"]').click();
|
56
|
+
$('a[href="#' + prev_anchor + '"]').click();
|
46
57
|
curr_anchor = prev_anchor;
|
47
58
|
} else {
|
48
59
|
$('.group_tabs a:first').click();
|
@@ -53,13 +64,13 @@ $(document).ready(function() {
|
|
53
64
|
}
|
54
65
|
});
|
55
66
|
|
56
|
-
window.onpopstate = function(event){
|
57
|
-
if (location.hash.substring(0,2) == "#_") {
|
67
|
+
window.onpopstate = function (event) {
|
68
|
+
if (location.hash.substring(0, 2) == "#_") {
|
58
69
|
$.colorbox.close();
|
59
70
|
curr_anchor = jQuery.url.attr('anchor');
|
60
71
|
} else {
|
61
72
|
if ($('#colorbox').is(':hidden')) {
|
62
|
-
$('a.src_link[href="'+location.hash+'"]').colorbox({ open: true });
|
73
|
+
$('a.src_link[href="' + location.hash + '"]').colorbox({ open: true });
|
63
74
|
}
|
64
75
|
}
|
65
76
|
};
|
@@ -69,23 +80,23 @@ $(document).ready(function() {
|
|
69
80
|
$('.file_list_container').hide();
|
70
81
|
|
71
82
|
// Add tabs based upon existing file_list_containers
|
72
|
-
$('.file_list_container h2').each(function(){
|
83
|
+
$('.file_list_container h2').each(function () {
|
73
84
|
var container_id = $(this).parent().attr('id');
|
74
85
|
var group_name = $(this).find('.group_name').first().html();
|
75
86
|
var covered_percent = $(this).find('.covered_percent').first().html();
|
76
87
|
|
77
|
-
$('.group_tabs').append('<li><a href="#' + container_id + '">' + group_name + ' ('+ covered_percent +')</a></li>');
|
88
|
+
$('.group_tabs').append('<li><a href="#' + container_id + '">' + group_name + ' (' + covered_percent + ')</a></li>');
|
78
89
|
});
|
79
90
|
|
80
|
-
$('.group_tabs a').each(
|
91
|
+
$('.group_tabs a').each(function () {
|
81
92
|
$(this).addClass($(this).attr('href').replace('#', ''));
|
82
93
|
});
|
83
94
|
|
84
95
|
// Make sure tabs don't get ugly focus borders when active
|
85
|
-
$('.group_tabs a').live('focus', function() { $(this).blur(); });
|
96
|
+
$('.group_tabs a').live('focus', function () { $(this).blur(); });
|
86
97
|
|
87
98
|
var favicon_path = $('link[rel="shortcut icon"]').attr('href');
|
88
|
-
$('.group_tabs a').live('click', function(){
|
99
|
+
$('.group_tabs a').live('click', function () {
|
89
100
|
if (!$(this).parent().hasClass('active')) {
|
90
101
|
$('.group_tabs a').parent().removeClass('active');
|
91
102
|
$(this).parent().addClass('active');
|
@@ -96,7 +107,7 @@ $(document).ready(function() {
|
|
96
107
|
// Force favicon reload - otherwise the location change containing anchor would drop the favicon...
|
97
108
|
// Works only on firefox, but still... - Anyone know a better solution to force favicon on local file?
|
98
109
|
$('link[rel="shortcut icon"]').remove();
|
99
|
-
$('head').append('<link rel="shortcut icon" type="image/png" href="'+ favicon_path +'" />');
|
110
|
+
$('head').append('<link rel="shortcut icon" type="image/png" href="' + favicon_path + '" />');
|
100
111
|
};
|
101
112
|
return false;
|
102
113
|
});
|
@@ -106,7 +117,7 @@ $(document).ready(function() {
|
|
106
117
|
if (anchor.length == 40) {
|
107
118
|
$('a.src_link[href=#' + anchor + ']').click();
|
108
119
|
} else {
|
109
|
-
$('.group_tabs a.'+anchor.replace('_', '')).click();
|
120
|
+
$('.group_tabs a.' + anchor.replace('_', '')).click();
|
110
121
|
}
|
111
122
|
} else {
|
112
123
|
$('.group_tabs a:first').click();
|
data/lib/simplecov-html.rb
CHANGED
@@ -16,6 +16,10 @@ end
|
|
16
16
|
module SimpleCov
|
17
17
|
module Formatter
|
18
18
|
class HTMLFormatter
|
19
|
+
def initialize
|
20
|
+
@branchable_result = SimpleCov.branch_coverage?
|
21
|
+
end
|
22
|
+
|
19
23
|
def format(result)
|
20
24
|
Dir[File.join(File.dirname(__FILE__), "../public/*")].each do |path|
|
21
25
|
FileUtils.cp_r(path, asset_output_path)
|
@@ -31,10 +35,11 @@ module SimpleCov
|
|
31
35
|
"Coverage report generated for #{result.command_name} to #{output_path}. #{result.covered_lines} / #{result.total_lines} LOC (#{result.covered_percent.round(2)}%) covered."
|
32
36
|
end
|
33
37
|
|
34
|
-
# Check if branchable results supported or not
|
35
|
-
# Try used here to escape exceptions
|
36
38
|
def branchable_result?
|
37
|
-
|
39
|
+
# cached in initialize because we truly look it up a whole bunch of times
|
40
|
+
# and it's easier to cache here then in SimpleCov because there we might
|
41
|
+
# still enable/disable branch coverage criterion
|
42
|
+
@branchable_result
|
38
43
|
end
|
39
44
|
|
40
45
|
def line_status?(source_file, line)
|
data/public/application.js
CHANGED
@@ -1582,25 +1582,33 @@ jQuery.url = function()
|
|
1582
1582
|
|
1583
1583
|
|
1584
1584
|
|
1585
|
-
$(document).ready(function() {
|
1585
|
+
$(document).ready(function () {
|
1586
|
+
branchCoverageActivated = $("body").data("branch-coverage") == true;
|
1587
|
+
|
1586
1588
|
// Configuration for fancy sortable tables for source file groups
|
1589
|
+
lineColumns = [null, { "sType": "percent" }, null, null, null, null, null];
|
1590
|
+
branchColumns = [{ "sType": "percent" }, null, null, null];
|
1591
|
+
|
1592
|
+
dataColumns = branchCoverageActivated ? lineColumns.concat(branchColumns) : lineColumns;
|
1593
|
+
|
1587
1594
|
$('.file_list').dataTable({
|
1588
|
-
"aaSorting": [[
|
1595
|
+
"aaSorting": [[1, "asc"]],
|
1589
1596
|
"bPaginate": false,
|
1590
|
-
"bJQueryUI": true
|
1597
|
+
"bJQueryUI": true,
|
1598
|
+
"aoColumns": dataColumns
|
1591
1599
|
});
|
1592
1600
|
|
1593
1601
|
// Syntax highlight all files up front - deactivated
|
1594
1602
|
// $('.source_table pre code').each(function(i, e) {hljs.highlightBlock(e, ' ')});
|
1595
1603
|
|
1596
1604
|
// Syntax highlight source files on first toggle of the file view popup
|
1597
|
-
$("a.src_link").click(function() {
|
1605
|
+
$("a.src_link").click(function () {
|
1598
1606
|
// Get the source file element that corresponds to the clicked element
|
1599
1607
|
var source_table = $($(this).attr('href'));
|
1600
1608
|
|
1601
1609
|
// If not highlighted yet, do it!
|
1602
1610
|
if (!source_table.hasClass('highlighted')) {
|
1603
|
-
source_table.find('pre code').each(function(i, e) {hljs.highlightBlock(e, ' ')});
|
1611
|
+
source_table.find('pre code').each(function (i, e) { hljs.highlightBlock(e, ' ') });
|
1604
1612
|
source_table.addClass('highlighted');
|
1605
1613
|
};
|
1606
1614
|
});
|
@@ -1615,14 +1623,14 @@ $(document).ready(function() {
|
|
1615
1623
|
opacity: 1,
|
1616
1624
|
width: "95%",
|
1617
1625
|
height: "95%",
|
1618
|
-
onLoad: function() {
|
1626
|
+
onLoad: function () {
|
1619
1627
|
prev_anchor = curr_anchor ? curr_anchor : jQuery.url.attr('anchor');
|
1620
1628
|
curr_anchor = this.href.split('#')[1];
|
1621
1629
|
window.location.hash = curr_anchor;
|
1622
1630
|
},
|
1623
|
-
onCleanup: function() {
|
1631
|
+
onCleanup: function () {
|
1624
1632
|
if (prev_anchor && prev_anchor != curr_anchor) {
|
1625
|
-
$('a[href="#'+prev_anchor+'"]').click();
|
1633
|
+
$('a[href="#' + prev_anchor + '"]').click();
|
1626
1634
|
curr_anchor = prev_anchor;
|
1627
1635
|
} else {
|
1628
1636
|
$('.group_tabs a:first').click();
|
@@ -1633,13 +1641,13 @@ $(document).ready(function() {
|
|
1633
1641
|
}
|
1634
1642
|
});
|
1635
1643
|
|
1636
|
-
window.onpopstate = function(event){
|
1637
|
-
if (location.hash.substring(0,2) == "#_") {
|
1644
|
+
window.onpopstate = function (event) {
|
1645
|
+
if (location.hash.substring(0, 2) == "#_") {
|
1638
1646
|
$.colorbox.close();
|
1639
1647
|
curr_anchor = jQuery.url.attr('anchor');
|
1640
1648
|
} else {
|
1641
1649
|
if ($('#colorbox').is(':hidden')) {
|
1642
|
-
$('a.src_link[href="'+location.hash+'"]').colorbox({ open: true });
|
1650
|
+
$('a.src_link[href="' + location.hash + '"]').colorbox({ open: true });
|
1643
1651
|
}
|
1644
1652
|
}
|
1645
1653
|
};
|
@@ -1649,23 +1657,23 @@ $(document).ready(function() {
|
|
1649
1657
|
$('.file_list_container').hide();
|
1650
1658
|
|
1651
1659
|
// Add tabs based upon existing file_list_containers
|
1652
|
-
$('.file_list_container h2').each(function(){
|
1660
|
+
$('.file_list_container h2').each(function () {
|
1653
1661
|
var container_id = $(this).parent().attr('id');
|
1654
1662
|
var group_name = $(this).find('.group_name').first().html();
|
1655
1663
|
var covered_percent = $(this).find('.covered_percent').first().html();
|
1656
1664
|
|
1657
|
-
$('.group_tabs').append('<li><a href="#' + container_id + '">' + group_name + ' ('+ covered_percent +')</a></li>');
|
1665
|
+
$('.group_tabs').append('<li><a href="#' + container_id + '">' + group_name + ' (' + covered_percent + ')</a></li>');
|
1658
1666
|
});
|
1659
1667
|
|
1660
|
-
$('.group_tabs a').each(
|
1668
|
+
$('.group_tabs a').each(function () {
|
1661
1669
|
$(this).addClass($(this).attr('href').replace('#', ''));
|
1662
1670
|
});
|
1663
1671
|
|
1664
1672
|
// Make sure tabs don't get ugly focus borders when active
|
1665
|
-
$('.group_tabs a').live('focus', function() { $(this).blur(); });
|
1673
|
+
$('.group_tabs a').live('focus', function () { $(this).blur(); });
|
1666
1674
|
|
1667
1675
|
var favicon_path = $('link[rel="shortcut icon"]').attr('href');
|
1668
|
-
$('.group_tabs a').live('click', function(){
|
1676
|
+
$('.group_tabs a').live('click', function () {
|
1669
1677
|
if (!$(this).parent().hasClass('active')) {
|
1670
1678
|
$('.group_tabs a').parent().removeClass('active');
|
1671
1679
|
$(this).parent().addClass('active');
|
@@ -1676,7 +1684,7 @@ $(document).ready(function() {
|
|
1676
1684
|
// Force favicon reload - otherwise the location change containing anchor would drop the favicon...
|
1677
1685
|
// Works only on firefox, but still... - Anyone know a better solution to force favicon on local file?
|
1678
1686
|
$('link[rel="shortcut icon"]').remove();
|
1679
|
-
$('head').append('<link rel="shortcut icon" type="image/png" href="'+ favicon_path +'" />');
|
1687
|
+
$('head').append('<link rel="shortcut icon" type="image/png" href="' + favicon_path + '" />');
|
1680
1688
|
};
|
1681
1689
|
return false;
|
1682
1690
|
});
|
@@ -1686,7 +1694,7 @@ $(document).ready(function() {
|
|
1686
1694
|
if (anchor.length == 40) {
|
1687
1695
|
$('a.src_link[href=#' + anchor + ']').click();
|
1688
1696
|
} else {
|
1689
|
-
$('.group_tabs a.'+anchor.replace('_', '')).click();
|
1697
|
+
$('.group_tabs a.' + anchor.replace('_', '')).click();
|
1690
1698
|
}
|
1691
1699
|
} else {
|
1692
1700
|
$('.group_tabs a:first').click();
|
data/views/layout.erb
CHANGED
@@ -3,13 +3,13 @@
|
|
3
3
|
<head>
|
4
4
|
<title>Code coverage for <%= SimpleCov.project_name %></title>
|
5
5
|
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
6
|
-
<script src='<%= assets_path('application.js') %>' type='text/javascript'></script>
|
6
|
+
<script src='<%= assets_path('application.js') %>' type='text/javascript'></script>
|
7
7
|
<link href='<%= assets_path('application.css') %>' media='screen, projection, print' rel='stylesheet' type='text/css'>
|
8
8
|
<link rel="shortcut icon" type="image/png" href="<%= assets_path("favicon_#{coverage_css_class(result.source_files.covered_percent)}.png") %>" />
|
9
9
|
<link rel="icon" type="image/png" href="<%= assets_path('favicon.png') %>" />
|
10
10
|
</head>
|
11
|
-
|
12
|
-
<body
|
11
|
+
|
12
|
+
<body<%= ' data-branch-coverage=true' if branchable_result? %>>
|
13
13
|
<div id="loading">
|
14
14
|
<img src="<%= assets_path('loading.gif') %>" alt="loading"/>
|
15
15
|
</div>
|
@@ -24,13 +24,13 @@
|
|
24
24
|
<%= formatted_file_list(name, files) %>
|
25
25
|
<% end %>
|
26
26
|
</div>
|
27
|
-
|
27
|
+
|
28
28
|
<div id="footer">
|
29
|
-
Generated by <a href="http://github.com/colszowka/simplecov">simplecov</a> v<%= SimpleCov::VERSION %>
|
29
|
+
Generated by <a href="http://github.com/colszowka/simplecov">simplecov</a> v<%= SimpleCov::VERSION %>
|
30
30
|
and simplecov-html v<%= SimpleCov::Formatter::HTMLFormatter::VERSION %><br/>
|
31
31
|
using <%= result.command_name %>
|
32
32
|
</div>
|
33
|
-
|
33
|
+
|
34
34
|
<div class="source_files">
|
35
35
|
<% result.source_files.each do |source_file| %>
|
36
36
|
<%= formatted_source_file(source_file) %>
|
data/views/source_file.erb
CHANGED
@@ -42,10 +42,9 @@
|
|
42
42
|
<% if line.skipped? %><span class="hits">skipped</span><% end %>
|
43
43
|
|
44
44
|
<% if branchable_result? %>
|
45
|
-
<% source_file.branches_for_line(line.number).each do |
|
46
|
-
|
47
|
-
|
48
|
-
<%= hit_count %>, <%= indicator %>
|
45
|
+
<% source_file.branches_for_line(line.number).each do |branch_type, hit_count| %>
|
46
|
+
<span class="hits" title="<%= branch_type%> branch hit <%= hit_count %> times">
|
47
|
+
<%= branch_type %>: <%= hit_count %>
|
49
48
|
</span>
|
50
49
|
<% end %>
|
51
50
|
<% end %>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simplecov-html
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.0.
|
4
|
+
version: 0.11.0.beta2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christoph Olszowka
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-01-
|
11
|
+
date: 2020-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Default HTML formatter for SimpleCov code coverage tool for ruby 2.4+
|
14
14
|
email:
|