coverband 4.2.0 → 4.2.4

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.
Files changed (108) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +29 -10
  3. data/.travis.yml +16 -8
  4. data/CODE_OF_CONDUCT.md +76 -0
  5. data/Gemfile +3 -1
  6. data/Gemfile.rails4 +1 -0
  7. data/README.md +108 -59
  8. data/Rakefile +19 -3
  9. data/changes.md +85 -10
  10. data/coverband.gemspec +3 -5
  11. data/lib/coverband/adapters/base.rb +64 -45
  12. data/lib/coverband/adapters/file_store.rb +15 -9
  13. data/lib/coverband/adapters/hash_redis_store.rb +190 -0
  14. data/lib/coverband/adapters/redis_store.rb +35 -11
  15. data/lib/coverband/at_exit.rb +2 -11
  16. data/lib/coverband/collectors/coverage.rb +35 -41
  17. data/lib/coverband/collectors/delta.rb +34 -28
  18. data/lib/coverband/collectors/view_tracker.rb +157 -0
  19. data/lib/coverband/configuration.rb +115 -33
  20. data/lib/coverband/integrations/background.rb +12 -4
  21. data/lib/coverband/integrations/{middleware.rb → background_middleware.rb} +2 -6
  22. data/lib/coverband/integrations/bundler.rb +8 -0
  23. data/lib/coverband/integrations/report_middleware.rb +15 -0
  24. data/lib/coverband/integrations/resque.rb +3 -5
  25. data/lib/coverband/reporters/base.rb +40 -16
  26. data/lib/coverband/reporters/console_report.rb +1 -0
  27. data/lib/coverband/reporters/html_report.rb +31 -27
  28. data/lib/coverband/reporters/web.rb +63 -18
  29. data/lib/coverband/utils/absolute_file_converter.rb +47 -0
  30. data/lib/coverband/utils/file_hasher.rb +16 -0
  31. data/lib/coverband/utils/file_list.rb +16 -5
  32. data/lib/coverband/utils/html_formatter.rb +45 -8
  33. data/lib/coverband/utils/lines_classifier.rb +5 -0
  34. data/lib/coverband/utils/railtie.rb +28 -10
  35. data/lib/coverband/utils/relative_file_converter.rb +41 -0
  36. data/lib/coverband/utils/result.rb +6 -39
  37. data/lib/coverband/utils/results.rb +51 -0
  38. data/lib/coverband/utils/s3_report.rb +2 -3
  39. data/lib/coverband/utils/source_file.rb +34 -8
  40. data/lib/coverband/utils/tasks.rb +10 -10
  41. data/lib/coverband/version.rb +5 -1
  42. data/lib/coverband.rb +49 -27
  43. data/lua/install.sh +15 -0
  44. data/lua/lib/persist-coverage.lua +28 -0
  45. data/lua/test/bootstrap.lua +5 -0
  46. data/lua/test/harness.lua +19 -0
  47. data/lua/test/redis-call.lua +55 -0
  48. data/lua/test/test-persist-coverage.lua +132 -0
  49. data/public/application.css +14 -6
  50. data/public/application.js +27 -0
  51. data/test/benchmarks/benchmark.rake +167 -73
  52. data/test/benchmarks/init_rails.rake +10 -0
  53. data/test/coverband/adapters/base_test.rb +73 -42
  54. data/test/coverband/adapters/file_store_test.rb +48 -37
  55. data/test/coverband/adapters/hash_redis_store_test.rb +195 -0
  56. data/test/coverband/adapters/redis_store_test.rb +102 -59
  57. data/test/coverband/at_exit_test.rb +0 -2
  58. data/test/coverband/collectors/coverage_test.rb +71 -13
  59. data/test/coverband/collectors/delta_test.rb +36 -6
  60. data/test/coverband/collectors/view_tracker_test.rb +113 -0
  61. data/test/coverband/configuration_test.rb +47 -7
  62. data/test/coverband/coverband_test.rb +14 -2
  63. data/test/coverband/integrations/background_middleware_test.rb +44 -0
  64. data/test/coverband/integrations/background_test.rb +11 -3
  65. data/test/coverband/integrations/report_middleware_test.rb +44 -0
  66. data/test/coverband/integrations/resque_worker_test.rb +5 -6
  67. data/test/coverband/integrations/test_resque_job.rb +3 -1
  68. data/test/coverband/reporters/base_test.rb +5 -81
  69. data/test/coverband/reporters/console_test.rb +3 -10
  70. data/test/coverband/reporters/html_test.rb +71 -21
  71. data/test/coverband/reporters/web_test.rb +0 -10
  72. data/test/coverband/utils/absolute_file_converter_test.rb +56 -0
  73. data/test/coverband/utils/file_groups_test.rb +11 -5
  74. data/test/coverband/utils/file_hasher_test.rb +29 -0
  75. data/test/coverband/utils/file_list_test.rb +5 -5
  76. data/test/coverband/utils/html_formatter_test.rb +41 -0
  77. data/test/coverband/utils/relative_file_converter_test.rb +39 -0
  78. data/test/coverband/utils/result_test.rb +6 -47
  79. data/test/coverband/utils/results_test.rb +54 -0
  80. data/test/coverband/utils/s3_report_test.rb +2 -0
  81. data/test/coverband/utils/source_file_test.rb +54 -0
  82. data/test/dog.rb.erb +12 -0
  83. data/test/forked/rails_full_stack_test.rb +106 -0
  84. data/test/forked/rails_rake_full_stack_test.rb +58 -0
  85. data/test/integration/full_stack_test.rb +15 -16
  86. data/test/rails4_dummy/Rakefile +6 -0
  87. data/test/rails4_dummy/config/application.rb +8 -9
  88. data/test/rails4_dummy/config/coverband.rb +3 -11
  89. data/test/rails4_dummy/config/coverband_missing_redis.rb +3 -0
  90. data/test/rails5_dummy/Rakefile +6 -0
  91. data/test/rails5_dummy/config/application.rb +6 -10
  92. data/test/rails5_dummy/config/coverband.rb +7 -3
  93. data/test/rails5_dummy/config/coverband_missing_redis.rb +15 -0
  94. data/test/rails_test_helper.rb +22 -5
  95. data/test/test_helper.rb +52 -11
  96. data/test/unique_files.rb +17 -9
  97. data/views/data.erb +1 -0
  98. data/views/file_list.erb +13 -12
  99. data/views/gem_list.erb +10 -1
  100. data/views/layout.erb +6 -18
  101. data/views/nav.erb +36 -0
  102. data/views/source_file.erb +20 -4
  103. data/views/source_file_loader.erb +1 -1
  104. data/views/view_tracker.erb +52 -0
  105. metadata +71 -12
  106. data/lib/coverband/utils/file_path_helper.rb +0 -57
  107. data/test/coverband/integrations/middleware_test.rb +0 -96
  108. data/test/integration/rails_full_stack_test.rb +0 -95
data/views/file_list.erb CHANGED
@@ -21,25 +21,26 @@
21
21
  <table class="file_list">
22
22
  <thead>
23
23
  <tr>
24
- <th>File</th>
25
- <th>% covered</th>
26
- <th>% runtime</th>
27
- <th>Lines</th>
28
- <th>Relevant Lines</th>
29
- <th>Lines covered</th>
30
- <th>Lines runtime</th>
31
- <th>Lines missed</th>
32
- <th>Avg. Hits / Line</th>
24
+ <th title="The source file name">File</th>
25
+ <th title="Percentage of relavent lines covered (load & runtime)">% covered</th>
26
+ <th title="Runtime Percentage of relavent lines covered">% runtime</th>
27
+ <th title="The total line number count for the file">Lines</th>
28
+ <th title="Line number count excluding comments, whitespace, etc...">Relevant Lines</th>
29
+ <th title="The number of lines covered (load & runtime)">Lines covered</th>
30
+ <th title="The number of lines covered (runtime only)">Lines runtime</th>
31
+ <th title="Lines not covered (load & runtime)">Lines missed</th>
32
+ <th title="Avg hits per line in file (load & runtime)">Avg. Hits / Line</th>
33
33
  </tr>
34
34
  </thead>
35
35
  <tbody>
36
36
  <% source_files.each do |source_file| %>
37
37
  <tr>
38
- <td class="strong">
38
+ <% source_class = source_file.never_loaded ? 'strong red' : 'strong'%>
39
+ <td class="<%= source_class %>">
39
40
  <%= link_to_source_file(source_file) %>
40
41
  </td>
41
42
  <td class="<%= coverage_css_class(source_file.covered_percent) %> strong"><%= source_file.covered_percent.round(2).to_s %> %</td>
42
- <% runtime_percentage = result.file_with_type(source_file, Coverband::RUNTIME_TYPE).try(:covered_percent).try(:round, 2) %>
43
+ <% runtime_percentage = result.runtime_relevant_coverage(source_file) %>
43
44
  <td class="<%= "#{coverage_css_class(runtime_percentage)}" %> strong">
44
45
  <%= "#{runtime_percentage || '0'} %" %>
45
46
  </td>
@@ -47,7 +48,7 @@
47
48
  <td><%= source_file.covered_lines.count + source_file.missed_lines.count %></td>
48
49
  <td><%= source_file.covered_lines.count %></td>
49
50
  <td>
50
- <%= result.file_with_type(source_file, Coverband::RUNTIME_TYPE).try(:covered_lines).try(:count) || 0 %>
51
+ <%= result.file_with_type(source_file, Coverband::RUNTIME_TYPE)&.covered_lines_count || 0 %>
51
52
  </td>
52
53
  <td><%= source_file.missed_lines.count %></td>
53
54
  <td><%= source_file.covered_strength %></td>
data/views/gem_list.erb CHANGED
@@ -20,8 +20,10 @@
20
20
  <tr>
21
21
  <th>Gem</th>
22
22
  <th>% covered</th>
23
+ <th>% runtime</th>
23
24
  <th>Relevant Lines</th>
24
25
  <th>Lines covered</th>
26
+ <th>Lines runtime</th>
25
27
  <th>Lines missed</th>
26
28
  <th>Avg. Hits / Line</th>
27
29
  </tr>
@@ -37,10 +39,17 @@
37
39
  <% end %>
38
40
  </td>
39
41
  <td class="<%= coverage_css_class(source_file.covered_percent) %> strong"><%= source_file.covered_percent.round(2).to_s %> %</td>
42
+ <% runtime_percentage = result.group_file_list_with_type(title, source_file, Coverband::RUNTIME_TYPE)&.formatted_covered_percent %>
43
+ <td class="<%= "#{coverage_css_class(runtime_percentage)}" %> strong">
44
+ <%= "#{runtime_percentage || '0'} %" %>
45
+ </td>
40
46
  <td><%= source_file.covered_lines + source_file.missed_lines %></td>
41
47
  <td><%= source_file.covered_lines %></td>
48
+ <td>
49
+ <%= result.group_file_list_with_type(title, source_file, Coverband::RUNTIME_TYPE)&.covered_lines || 0 %>
50
+ </td>
42
51
  <td><%= source_file.missed_lines %></td>
43
- <td><%= source_file.covered_strength %></td>
52
+ <td><%= source_file.covered_strength.round(1) %></td>
44
53
  </tr>
45
54
  <% end %>
46
55
  </tbody>
data/views/layout.erb CHANGED
@@ -15,23 +15,7 @@
15
15
  <img src="<%= assets_path('loading.gif') %>" alt="loading"/>
16
16
  </div>
17
17
  <div id="wrapper" style="display:none;">
18
- <div id="header">
19
- <a href='<%= base_path %>'>Coverband Admin</a> &nbsp;
20
- <a href='<%= base_path %>settings'>Info</a> &nbsp;
21
- <%= button("#{base_path}collect_coverage", 'force coverage collection') %> &nbsp;
22
- <%= button("#{base_path}reload_files", 'reload Coverband files') %> &nbsp;
23
- <% if Coverband.configuration.web_enable_clear %>
24
- <%= button("#{base_path}clear", 'clear coverage report', delete: true) %>
25
- <% end %>
26
- <% if Coverband.configuration.web_debug %>
27
- <a href='<%= base_path %>debug_data'>Debug Data</a> &nbsp;
28
- <% end %>
29
- </div>
30
- <% if notice.to_s.length > 0 %>
31
- <div class="notice"><%= notice %></div>
32
- <% end %>
33
- <div class="timestamp">Generated <%= timeago(Time.now) %></div>
34
- <ul class="group_tabs"></ul>
18
+ <%= display_nav %>
35
19
 
36
20
  <div id="content">
37
21
  <%= formatted_file_list("All Files", result, result.source_files) unless view_gems? %>
@@ -48,7 +32,11 @@
48
32
  <div class="source_files">
49
33
  <% result.source_files.each do |source_file| %>
50
34
  <% if (!source_file.gem? || (view_gems? && gem_details? && source_file.gem? )) %>
51
- <%= formatted_source_file_loader(result, source_file) %>
35
+ <% if static_html? %>
36
+ <%= formatted_source_file(result, source_file) %>
37
+ <% else %>
38
+ <%= formatted_source_file_loader(result, source_file) %>
39
+ <% end %>
52
40
  <% end %>
53
41
  <% end %>
54
42
  </div>
data/views/nav.erb ADDED
@@ -0,0 +1,36 @@
1
+
2
+ <div id="header">
3
+ <a href='<%= base_path %>'>Coverband Admin</a> &nbsp;
4
+ <a href='<%= base_path %>settings'>Info</a> &nbsp;
5
+ <% if Coverband.configuration.web_enable_clear %>
6
+ <%= button("#{base_path}clear", 'clear coverage report', delete: true) %>
7
+ <% end %>
8
+ <% if Coverband.configuration.web_debug %>
9
+ <a href='<%= base_path %>debug_data'>Debug Data</a> &nbsp;
10
+ <a href='<%= base_path %>enriched_debug_data'>Coverage Data</a> &nbsp;
11
+ <% end %>
12
+ </div>
13
+ <% if notice.to_s.length > 0 %>
14
+ <div class="notice"><%= notice %></div>
15
+ <% end %>
16
+ <div class="timestamp">Generated <%= timeago(Time.now) %></div>
17
+ <br/>
18
+ <% if defined?(result) %>
19
+ <div class="timestamp">
20
+ Coverage Recording Started: <%= timeago(result.source_files.first_seen_at) %>
21
+ </div>
22
+ <% end %>
23
+
24
+ <ul class="group_tabs">
25
+ </ul>
26
+
27
+ <ul class="extra_tabs">
28
+ <% if nav_options[:show_coverage_link] %>
29
+ <li><a href='<%= base_path %>'>Coverage</a></li>
30
+ <% end %>
31
+ <% if Coverband.configuration.track_views %>
32
+ <li class='<%= nav_options[:show_coverage_link] ? 'active' : '' %>'>
33
+ <a href='<%= base_path %>view_tracker'>Views Tracker</a>
34
+ </li>
35
+ <% end %>
36
+ </ul>
@@ -2,14 +2,30 @@
2
2
  <div class="header">
3
3
  <h3><%= shortened_filename source_file %></h3>
4
4
  <h4>
5
- <span class="<%= coverage_css_class(source_file.covered_percent) %>"><%= source_file.covered_percent.round(2).to_s %> %</span>
6
- covered
5
+ <span class="<%= coverage_css_class(source_file.covered_percent) %>">
6
+ <%= source_file.covered_percent.round(2).to_s %> %
7
+ </span>
8
+ covered,
9
+
10
+ <span class="<%= coverage_css_class(source_file.covered_percent) %>">
11
+ <%= result.runtime_relevant_coverage(source_file) %> %
12
+ </span>
13
+ runtime covered
14
+
7
15
  <% if Coverband.configuration.web_enable_clear %>
8
16
  <%= button("#{base_path}clear_file?filename=#{source_file.relative_path}", 'clear file coverage') %> &nbsp;
9
17
  <% end %>
18
+
19
+ <% if source_file.never_loaded %>
20
+ <br/>
21
+ <span class="red">
22
+ <strong>This file was never loaded during app runtime or loading (or was loaded before Coverband loaded)!</strong>
23
+ </span>
24
+ <% end %>
10
25
  </h4>
11
26
  <div>
12
27
  <b><%= source_file.lines_of_code %></b> relevant lines.
28
+ <b><%= result.runtime_relavent_lines(source_file) %></b> runtime relevant lines.
13
29
  <span class="green"><b><%= source_file.covered_lines.count %></b> lines covered</span> and
14
30
  <span class="red"><b><%= source_file.missed_lines.count %></b> lines missed.</span>
15
31
  </div>
@@ -25,9 +41,9 @@
25
41
  <li class="<%= line.status %>" data-hits="<%= line.coverage ? line.coverage : '' %>" data-linenumber="<%= line.number %>">
26
42
  <% if line.covered? %><span class="hits">
27
43
  load:
28
- <%= result.file_with_type(source_file, Coverband::EAGER_TYPE).try(:lines).try(:[], index).try(:coverage) || 0 %>,
44
+ <%= result.file_with_type(source_file, Coverband::EAGER_TYPE)&.line_coverage(index) || 0 %>,
29
45
  runtime:
30
- <%= result.file_with_type(source_file, Coverband::RUNTIME_TYPE).try(:lines).try(:[], index).try(:coverage) || 0 %>
46
+ <%= result.file_with_type(source_file, Coverband::RUNTIME_TYPE)&.line_coverage(index) || 0 %>
31
47
  all: <%= line.coverage %>
32
48
  </span><% end %>
33
49
  <% if line.skipped? %><span class="hits">skipped</span><% end %>
@@ -1,6 +1,6 @@
1
1
  <div class="source_table" id="<%= id source_file %>" data-loader-url="<%= base_path %>load_file_details?filename=<%= source_file.filename %>">
2
2
  <div class='loader'>
3
- loading...
3
+ loading source data...
4
4
  <br/>
5
5
  <img src="<%= assets_path('loading.gif') %>" alt="loading"/>
6
6
  </div>
@@ -0,0 +1,52 @@
1
+ <!DOCTYPE html>
2
+ <html xmlns='http://www.w3.org/1999/xhtml'>
3
+ <head>
4
+ <title>Coverband Info: <%= Coverband::VERSION %></title>
5
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
6
+ <script src='<%= assets_path('dependencies.js') %>' type='text/javascript'></script>
7
+ <script src='<%= assets_path('application.js') %>' type='text/javascript'></script>
8
+ <link href='<%= assets_path('application.css') %>' media='screen, projection, print' rel='stylesheet' type='text/css'>
9
+ <link rel="icon" type="image/png" href="<%= assets_path('favicon.png') %>" />
10
+ </head>
11
+
12
+ <body>
13
+ <div id="wrapper" style="">
14
+ <%= display_nav(show_coverage_link: true) %>
15
+ <div id="content">
16
+ <% tracker = Coverband::Collectors::ViewTracker.new(store: Coverband.configuration.store) %>
17
+ <h4>
18
+ <% if Coverband.configuration.web_enable_clear %>
19
+ <%= button("#{base_path}clear_view_tracking", 'reset view tracker', delete: true) %>
20
+ <% end %>
21
+ <% if Coverband.configuration.web_debug %>
22
+ <a href='<%= "#{base_path}view_tracker_data" %>'>view tracker data</a>
23
+ <% end %>
24
+ </h4>
25
+ <h2>Unused Views: (<%= tracker.unused_views.length %>)</h2>
26
+ <p>These views have not been rendered since recording started at <%= tracker.tracking_since %></p>
27
+ <ul>
28
+ <% tracker.unused_views.each do |view_file| %>
29
+ <li><%= view_file %></li>
30
+ <% end %>
31
+ </ul>
32
+
33
+ <h2>Used Views: (<%= tracker.used_views.length %>)</h2>
34
+ <p>These views have been rendered at least once</p>
35
+ <ul>
36
+ <% tracker.used_views.each_pair do |view_file, time_at| %>
37
+ <li>
38
+ <%= view_file %>
39
+ <span class="last_seen_at">last activity recorded <%= Time.at(time_at.to_i)%></span>
40
+ <% if Coverband.configuration.web_enable_clear %>
41
+ <%= button("#{base_path}clear_view_tracking_file?filename=#{view_file}", 'reset tracked file', delete: true) %>
42
+ <% end %>
43
+ </li>
44
+ <% end %>
45
+ </ul>
46
+ </div>
47
+ <div id="footer">
48
+ Generated by <a href="http://github.com/danmayer/coverband">Coverband</a> v<%= Coverband::VERSION %>
49
+ </div>
50
+ </div>
51
+ </body>
52
+ </html>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coverband
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.0
4
+ version: 4.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Mayer
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-04-24 00:00:00.000000000 Z
12
+ date: 2019-12-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aws-sdk-s3
@@ -95,6 +95,20 @@ dependencies:
95
95
  - - ">="
96
96
  - !ruby/object:Gem::Version
97
97
  version: '0'
98
+ - !ruby/object:Gem::Dependency
99
+ name: minitest-fork_executor
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ type: :development
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
98
112
  - !ruby/object:Gem::Dependency
99
113
  name: mocha
100
114
  requirement: !ruby/object:Gem::Requirement
@@ -166,7 +180,7 @@ dependencies:
166
180
  - !ruby/object:Gem::Version
167
181
  version: '0'
168
182
  - !ruby/object:Gem::Dependency
169
- name: minitest-reporters
183
+ name: rubocop
170
184
  requirement: !ruby/object:Gem::Requirement
171
185
  requirements:
172
186
  - - ">="
@@ -180,7 +194,7 @@ dependencies:
180
194
  - !ruby/object:Gem::Version
181
195
  version: '0'
182
196
  - !ruby/object:Gem::Dependency
183
- name: classifier-reborn
197
+ name: rubocop-performance
184
198
  requirement: !ruby/object:Gem::Requirement
185
199
  requirements:
186
200
  - - ">="
@@ -259,6 +273,7 @@ files:
259
273
  - ".gitignore"
260
274
  - ".rubocop.yml"
261
275
  - ".travis.yml"
276
+ - CODE_OF_CONDUCT.md
262
277
  - Gemfile
263
278
  - Gemfile.rails4
264
279
  - LICENSE
@@ -271,32 +286,44 @@ files:
271
286
  - lib/coverband.rb
272
287
  - lib/coverband/adapters/base.rb
273
288
  - lib/coverband/adapters/file_store.rb
289
+ - lib/coverband/adapters/hash_redis_store.rb
274
290
  - lib/coverband/adapters/redis_store.rb
275
291
  - lib/coverband/at_exit.rb
276
292
  - lib/coverband/collectors/coverage.rb
277
293
  - lib/coverband/collectors/delta.rb
294
+ - lib/coverband/collectors/view_tracker.rb
278
295
  - lib/coverband/configuration.rb
279
296
  - lib/coverband/integrations/background.rb
280
- - lib/coverband/integrations/middleware.rb
297
+ - lib/coverband/integrations/background_middleware.rb
298
+ - lib/coverband/integrations/bundler.rb
281
299
  - lib/coverband/integrations/rack_server_check.rb
300
+ - lib/coverband/integrations/report_middleware.rb
282
301
  - lib/coverband/integrations/resque.rb
283
302
  - lib/coverband/reporters/base.rb
284
303
  - lib/coverband/reporters/console_report.rb
285
304
  - lib/coverband/reporters/html_report.rb
286
305
  - lib/coverband/reporters/web.rb
306
+ - lib/coverband/utils/absolute_file_converter.rb
287
307
  - lib/coverband/utils/file_groups.rb
308
+ - lib/coverband/utils/file_hasher.rb
288
309
  - lib/coverband/utils/file_list.rb
289
- - lib/coverband/utils/file_path_helper.rb
290
310
  - lib/coverband/utils/gem_list.rb
291
311
  - lib/coverband/utils/html_formatter.rb
292
312
  - lib/coverband/utils/lines_classifier.rb
293
313
  - lib/coverband/utils/railtie.rb
314
+ - lib/coverband/utils/relative_file_converter.rb
294
315
  - lib/coverband/utils/result.rb
295
316
  - lib/coverband/utils/results.rb
296
317
  - lib/coverband/utils/s3_report.rb
297
318
  - lib/coverband/utils/source_file.rb
298
319
  - lib/coverband/utils/tasks.rb
299
320
  - lib/coverband/version.rb
321
+ - lua/install.sh
322
+ - lua/lib/persist-coverage.lua
323
+ - lua/test/bootstrap.lua
324
+ - lua/test/harness.lua
325
+ - lua/test/redis-call.lua
326
+ - lua/test/test-persist-coverage.lua
300
327
  - public/application.css
301
328
  - public/application.js
302
329
  - public/colorbox/border.png
@@ -328,32 +355,42 @@ files:
328
355
  - test/benchmarks/coverage_fork.sh
329
356
  - test/benchmarks/dog.rb
330
357
  - test/benchmarks/graph_bench.sh
358
+ - test/benchmarks/init_rails.rake
331
359
  - test/coverband/adapters/base_test.rb
332
360
  - test/coverband/adapters/file_store_test.rb
361
+ - test/coverband/adapters/hash_redis_store_test.rb
333
362
  - test/coverband/adapters/redis_store_test.rb
334
363
  - test/coverband/at_exit_test.rb
335
364
  - test/coverband/collectors/coverage_test.rb
336
365
  - test/coverband/collectors/delta_test.rb
366
+ - test/coverband/collectors/view_tracker_test.rb
337
367
  - test/coverband/configuration_test.rb
338
368
  - test/coverband/coverband_test.rb
369
+ - test/coverband/integrations/background_middleware_test.rb
339
370
  - test/coverband/integrations/background_test.rb
340
- - test/coverband/integrations/middleware_test.rb
341
371
  - test/coverband/integrations/rack_server_check_test.rb
372
+ - test/coverband/integrations/report_middleware_test.rb
342
373
  - test/coverband/integrations/resque_worker_test.rb
343
374
  - test/coverband/integrations/test_resque_job.rb
344
375
  - test/coverband/reporters/base_test.rb
345
376
  - test/coverband/reporters/console_test.rb
346
377
  - test/coverband/reporters/html_test.rb
347
378
  - test/coverband/reporters/web_test.rb
379
+ - test/coverband/utils/absolute_file_converter_test.rb
348
380
  - test/coverband/utils/file_groups_test.rb
381
+ - test/coverband/utils/file_hasher_test.rb
349
382
  - test/coverband/utils/file_list_test.rb
350
383
  - test/coverband/utils/gem_list_test.rb
384
+ - test/coverband/utils/html_formatter_test.rb
351
385
  - test/coverband/utils/lines_classifier_test.rb
386
+ - test/coverband/utils/relative_file_converter_test.rb
352
387
  - test/coverband/utils/result_test.rb
388
+ - test/coverband/utils/results_test.rb
353
389
  - test/coverband/utils/s3_report_test.rb
354
390
  - test/coverband/utils/source_file_line_test.rb
355
391
  - test/coverband/utils/source_file_test.rb
356
392
  - test/dog.rb
393
+ - test/dog.rb.erb
357
394
  - test/fake_app/basic_rack.rb
358
395
  - test/fixtures/app/controllers/sample_controller.rb
359
396
  - test/fixtures/app/models/user.rb
@@ -362,33 +399,41 @@ files:
362
399
  - test/fixtures/skipped.rb
363
400
  - test/fixtures/skipped_and_executed.rb
364
401
  - test/fixtures/utf-8.rb
402
+ - test/forked/rails_full_stack_test.rb
403
+ - test/forked/rails_rake_full_stack_test.rb
365
404
  - test/integration/full_stack_test.rb
366
- - test/integration/rails_full_stack_test.rb
405
+ - test/rails4_dummy/Rakefile
367
406
  - test/rails4_dummy/app/controllers/dummy_controller.rb
368
407
  - test/rails4_dummy/config.ru
369
408
  - test/rails4_dummy/config/application.rb
370
409
  - test/rails4_dummy/config/boot.rb
371
410
  - test/rails4_dummy/config/coverband.rb
411
+ - test/rails4_dummy/config/coverband_missing_redis.rb
372
412
  - test/rails4_dummy/config/environment.rb
373
413
  - test/rails4_dummy/config/routes.rb
374
414
  - test/rails4_dummy/config/secrets.yml
375
415
  - test/rails4_dummy/tmp/.keep
416
+ - test/rails5_dummy/Rakefile
376
417
  - test/rails5_dummy/app/controllers/dummy_controller.rb
377
418
  - test/rails5_dummy/config.ru
378
419
  - test/rails5_dummy/config/application.rb
379
420
  - test/rails5_dummy/config/coverband.rb
421
+ - test/rails5_dummy/config/coverband_missing_redis.rb
380
422
  - test/rails5_dummy/config/environment.rb
381
423
  - test/rails5_dummy/config/routes.rb
382
424
  - test/rails5_dummy/tmp/.keep
383
425
  - test/rails_test_helper.rb
384
426
  - test/test_helper.rb
385
427
  - test/unique_files.rb
428
+ - views/data.erb
386
429
  - views/file_list.erb
387
430
  - views/gem_list.erb
388
431
  - views/layout.erb
432
+ - views/nav.erb
389
433
  - views/settings.erb
390
434
  - views/source_file.erb
391
435
  - views/source_file_loader.erb
436
+ - views/view_tracker.erb
392
437
  homepage: https://github.com/danmayer/coverband
393
438
  licenses:
394
439
  - MIT
@@ -408,8 +453,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
408
453
  - !ruby/object:Gem::Version
409
454
  version: '0'
410
455
  requirements: []
411
- rubyforge_project:
412
- rubygems_version: 2.7.8
456
+ rubygems_version: 3.0.3
413
457
  signing_key:
414
458
  specification_version: 4
415
459
  summary: Rack middleware to help measure production code usage (LOC runtime usage)
@@ -419,32 +463,42 @@ test_files:
419
463
  - test/benchmarks/coverage_fork.sh
420
464
  - test/benchmarks/dog.rb
421
465
  - test/benchmarks/graph_bench.sh
466
+ - test/benchmarks/init_rails.rake
422
467
  - test/coverband/adapters/base_test.rb
423
468
  - test/coverband/adapters/file_store_test.rb
469
+ - test/coverband/adapters/hash_redis_store_test.rb
424
470
  - test/coverband/adapters/redis_store_test.rb
425
471
  - test/coverband/at_exit_test.rb
426
472
  - test/coverband/collectors/coverage_test.rb
427
473
  - test/coverband/collectors/delta_test.rb
474
+ - test/coverband/collectors/view_tracker_test.rb
428
475
  - test/coverband/configuration_test.rb
429
476
  - test/coverband/coverband_test.rb
477
+ - test/coverband/integrations/background_middleware_test.rb
430
478
  - test/coverband/integrations/background_test.rb
431
- - test/coverband/integrations/middleware_test.rb
432
479
  - test/coverband/integrations/rack_server_check_test.rb
480
+ - test/coverband/integrations/report_middleware_test.rb
433
481
  - test/coverband/integrations/resque_worker_test.rb
434
482
  - test/coverband/integrations/test_resque_job.rb
435
483
  - test/coverband/reporters/base_test.rb
436
484
  - test/coverband/reporters/console_test.rb
437
485
  - test/coverband/reporters/html_test.rb
438
486
  - test/coverband/reporters/web_test.rb
487
+ - test/coverband/utils/absolute_file_converter_test.rb
439
488
  - test/coverband/utils/file_groups_test.rb
489
+ - test/coverband/utils/file_hasher_test.rb
440
490
  - test/coverband/utils/file_list_test.rb
441
491
  - test/coverband/utils/gem_list_test.rb
492
+ - test/coverband/utils/html_formatter_test.rb
442
493
  - test/coverband/utils/lines_classifier_test.rb
494
+ - test/coverband/utils/relative_file_converter_test.rb
443
495
  - test/coverband/utils/result_test.rb
496
+ - test/coverband/utils/results_test.rb
444
497
  - test/coverband/utils/s3_report_test.rb
445
498
  - test/coverband/utils/source_file_line_test.rb
446
499
  - test/coverband/utils/source_file_test.rb
447
500
  - test/dog.rb
501
+ - test/dog.rb.erb
448
502
  - test/fake_app/basic_rack.rb
449
503
  - test/fixtures/app/controllers/sample_controller.rb
450
504
  - test/fixtures/app/models/user.rb
@@ -453,21 +507,26 @@ test_files:
453
507
  - test/fixtures/skipped.rb
454
508
  - test/fixtures/skipped_and_executed.rb
455
509
  - test/fixtures/utf-8.rb
510
+ - test/forked/rails_full_stack_test.rb
511
+ - test/forked/rails_rake_full_stack_test.rb
456
512
  - test/integration/full_stack_test.rb
457
- - test/integration/rails_full_stack_test.rb
513
+ - test/rails4_dummy/Rakefile
458
514
  - test/rails4_dummy/app/controllers/dummy_controller.rb
459
515
  - test/rails4_dummy/config.ru
460
516
  - test/rails4_dummy/config/application.rb
461
517
  - test/rails4_dummy/config/boot.rb
462
518
  - test/rails4_dummy/config/coverband.rb
519
+ - test/rails4_dummy/config/coverband_missing_redis.rb
463
520
  - test/rails4_dummy/config/environment.rb
464
521
  - test/rails4_dummy/config/routes.rb
465
522
  - test/rails4_dummy/config/secrets.yml
466
523
  - test/rails4_dummy/tmp/.keep
524
+ - test/rails5_dummy/Rakefile
467
525
  - test/rails5_dummy/app/controllers/dummy_controller.rb
468
526
  - test/rails5_dummy/config.ru
469
527
  - test/rails5_dummy/config/application.rb
470
528
  - test/rails5_dummy/config/coverband.rb
529
+ - test/rails5_dummy/config/coverband_missing_redis.rb
471
530
  - test/rails5_dummy/config/environment.rb
472
531
  - test/rails5_dummy/config/routes.rb
473
532
  - test/rails5_dummy/tmp/.keep
@@ -1,57 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- ####
4
- # Helper functions for shared logic related to file path manipulation
5
- ####
6
- module Coverband
7
- module Utils
8
- module FilePathHelper
9
- ###
10
- # Takes a full path and converts to a relative path
11
- ###
12
- def full_path_to_relative(full_path)
13
- relative_filename = full_path
14
- Coverband.configuration.all_root_paths.each do |root|
15
- relative_filename = relative_filename.gsub(/^#{root}/, './')
16
- # once we have a relative path break out of the loop
17
- break if relative_filename.start_with? './'
18
- end
19
- relative_filename
20
- end
21
-
22
- ###
23
- # relative_path_to_full code takes:
24
- # relative_path: which is a full path the same as reported by Coverage
25
- # roots: if a collection of all possible full app paths
26
- # EX: [Coverband.configuration.root_paths, "#{current_root}/"]
27
- # The LAST item should be the current file system root
28
- # it expands that expands and adds a '/' as that isn't there from Dir.pwd
29
- #
30
- # NOTEs on configuration.root_paths usage
31
- # strings: matching is pretty simple for full string paths
32
- # regex: to get regex to work for changing deploy directories
33
- # the regex must be double escaped in double quotes
34
- # (if using \d for example)
35
- # or use single qoutes
36
- # example: '/box/apps/app_name/releases/\d+/'
37
- # example: '/var/local/company/company.d/[0-9]*/'
38
- ###
39
- def relative_path_to_full(relative_path, roots)
40
- relative_filename = relative_path
41
- local_filename = relative_filename
42
- roots.each do |root|
43
- relative_filename = relative_filename.gsub(/^#{root}/, './')
44
- end
45
- # the filename for our reports is expected to be a full path.
46
- # roots.last should be roots << current_root}/
47
- # a fully expanded path of config.root
48
- # filename = filename.gsub('./', roots.last)
49
- # above only works for app files
50
- # we need to rethink some of this logic
51
- # gems aren't at project root and can have multiple locations
52
- local_root = roots.find { |root| File.exist?(relative_filename.gsub('./', root)) }
53
- local_root ? relative_filename.gsub('./', local_root) : local_filename
54
- end
55
- end
56
- end
57
- end