coverband 4.2.5.rc.1 → 4.2.5.rc.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 57a58a71386b69f1d6ccea984e9950649a95a8618e6716149f3a890725cc23ff
4
- data.tar.gz: 1b027835c1bf84f630626c32305ac57b7589c79bb785f7486f1a5446aab103fd
3
+ metadata.gz: 7734de548f4503a5ec663eb6c405c44253d7e4ccf6c19c012557a38da536c454
4
+ data.tar.gz: 0d3ac1454066178d86a42cece14d4e48228a19aca8bf21a2d4e67cf1a11ea85c
5
5
  SHA512:
6
- metadata.gz: 359c975e792a4b640dd35881ff6c413eb1252e9842cf662a458ce8d0e135e1b29e4a1d41166628a4bab5826ea360e3005557be6c6539b521b322127d441a54f3
7
- data.tar.gz: e3b6acc540519877792d1779a3ade69e08f3ef7957a4bd9077984ccd89cbfcbb6dfec5076ce2273997992129f34006907b02e48f44dc5cdb9f94d0df88a2dd82
6
+ metadata.gz: a204ea8bdc1eccfeadbfd91538950d217e873e7ec581344b601cb95bae2564027e8217c19a1196dccde5f715de3d417f8ba6ef02e8f05cf8ebd526b5428e46c4
7
+ data.tar.gz: 86d38f60ed3d4a22da93f239b6a86000e15ea83c3368585286e10068aa621ee90e35f6db009b163ff00e4d8a07f3e13827f43c96aa83de185269ff6dc0d6f613
@@ -0,0 +1 @@
1
+ debug.fullTrace=true
@@ -3,11 +3,11 @@ AllCops:
3
3
  Exclude:
4
4
  - vendor/bundle/**/*
5
5
  - docs/**/*
6
- - test/rails4_dummy/**/*
6
+ - test/rails6_dummy/**/*
7
7
  - test/rails5_dummy/**/*
8
8
  - test/fixtures/**/*
9
9
  # Get the code passing first then we will enable for tests
10
- - test/**/*
10
+ - test/**/*
11
11
  Documentation:
12
12
  Enabled: false
13
13
  Metrics/MethodLength:
@@ -46,6 +46,10 @@ Style/ClassVars:
46
46
  Enabled: false
47
47
  Style/MultilineBlockChain:
48
48
  Enabled: false
49
+ Style/StringLiterals:
50
+ Enabled: false
51
+ Style/IfInsideElse:
52
+ Enabled: false
49
53
  Style/FrozenStringLiteralComment:
50
54
  Enabled: true
51
55
  Style/GuardClause:
@@ -58,6 +62,8 @@ Style/NumericLiteralPrefix:
58
62
  Enabled: false
59
63
  Style/ClassAndModuleChildren:
60
64
  Enabled: false
65
+ Style/SymbolArray:
66
+ Enabled: false
61
67
  Style/SymbolProc:
62
68
  Enabled: false
63
69
  Style/RegexpLiteral:
@@ -4,14 +4,33 @@ rvm:
4
4
  - "2.4"
5
5
  - "2.5"
6
6
  - "2.6.1"
7
- # - "2.7" #disable until I can detect and exclude rails for on Ruby 2.7
7
+ - "2.7"
8
+ - jruby-9.2.6.0
9
+ gemfile:
10
+ - Gemfile
11
+ - Gemfile.rails4
12
+ - Gemfile.rails6
13
+ env:
14
+ global:
15
+ # --dev improves JRuby startup time
16
+ # See https://github.com/jruby/jruby/wiki/Improving-startup-time
17
+ - JRUBY_OPTS="--dev"
18
+
19
+ jobs:
20
+ exclude:
21
+ - rvm: "2.3"
22
+ gemfile: Gemfile.rails6
23
+ - rvm: "2.4"
24
+ gemfile: Gemfile.rails6
25
+ - rvm: "2.7"
26
+ gemfile: Gemfile.rails4
27
+ - rvm: jruby-9.2.6.0
28
+ gemfile: Gemfile.rails4
29
+
8
30
  cache:
9
31
  bundler: true
10
32
  directories:
11
33
  - $HOME/lua51
12
- gemfile:
13
- - Gemfile
14
- - Gemfile.rails4
15
34
  services:
16
35
  - redis-server
17
36
  script:
data/Gemfile CHANGED
@@ -4,6 +4,16 @@ source 'https://rubygems.org'
4
4
 
5
5
  # Specify your gem's dependencies in coverband.gemspec
6
6
  gemspec
7
+
8
+ # add when debugging
9
+ # require 'byebug'; byebug
10
+ if ENV['CI']
11
+ # skipping pry-byebug as it has issues on Ruby 2.3 on travis
12
+ # and we don't really need it on CI
13
+ else
14
+ gem 'pry-byebug', platforms: [:mri, :mingw, :x64_mingw]
15
+ end
16
+
7
17
  gem 'rails', '~>5'
8
18
  # these gems are used for testing gem tracking
9
19
  gem 'irb', require: false
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in coverband.gemspec
6
+ gemspec
7
+ gem 'rails', '~>6'
8
+ # this is used for testing gem tracking
9
+ gem 'rainbow', require: false
10
+ gem 'pundit'
data/README.md CHANGED
@@ -7,7 +7,6 @@
7
7
  [![Maintainability](https://api.codeclimate.com/v1/badges/1e6682f9540d75f26da7/maintainability)](https://codeclimate.com/github/danmayer/coverband/maintainability)
8
8
  [![Discord Shield](https://img.shields.io/discord/609509533999562753)](https://discord.gg/KAH38EV)
9
9
 
10
-
11
10
  <p align="center">
12
11
  <a href="#key-features">Key Features</a> •
13
12
  <a href="#installation">Installation</a> •
@@ -116,6 +115,17 @@ The web endpoint is a barebones endpoint that you can either expose direct (afte
116
115
  - View individual file details
117
116
  - **clear individual file coverage:** This will clear the details of the file you are looking at. This is helpful if you don't want to lose all Coverage data but made a change that you expect would impact a particular file.
118
117
 
118
+ ### JRuby Support
119
+
120
+ Coverband is compatible with JRuby. If you want to run on JRuby note that I haven't benchmarked and I believe the perf impact on oldre versions of JRuby could be significant, improved Coverage support is in [JRuby master](https://github.com/jruby/jruby/pull/6180), and will be in the next release.
121
+
122
+ * older versions of JRuby need tracing enabled to work (and this could cause bad performance)
123
+ * run Jruby with the `--debug` option
124
+ * add into your `.jrubyrc` the `debug.fullTrace=true` setting
125
+ * For best performance the `oneshot_lines` is recommended, and in the latest releases should have very low overhead
126
+ * See JRuby support in a Rails app configured to run via JRuby, in [Coverband Demo](https://github.com/coverband-service/coverband_demo)
127
+ * JRuby is tested via CI against Rails 5 and 6
128
+
119
129
  ### Rake Tasks
120
130
 
121
131
  The rake task generates a report locally and opens a browser pointing to `coverage/index.html`.
@@ -182,7 +192,7 @@ end
182
192
 
183
193
  ### Working with environment variables
184
194
 
185
- Do you use figaro, mc-settings, dotenv or something else to inject environment variables into your app? If so ensure you have that done BEFORE coverband is required.
195
+ Do you use figaro, mc-settings, dotenv or something else to inject environment variables into your app? If so ensure you have that done BEFORE coverband is required.
186
196
 
187
197
  For example if you use dotenv, you need to do this, see https://github.com/bkeepers/dotenv#note-on-load-order
188
198
 
@@ -206,7 +216,7 @@ config.ignore += ['config/application.rb',
206
216
  'lib/tasks/*']
207
217
  ```
208
218
 
209
- __Ignoring Custom Gem Locations:__ Note, if you have your gems in a custom location under your app folder you likely want to add them to `config.ignore`. For example, if you have your gems not in a default ignored location of `app/vendor` but have them in `app/gems` you would need to add `gems/*` to your ignore list.
219
+ **Ignoring Custom Gem Locations:** Note, if you have your gems in a custom location under your app folder you likely want to add them to `config.ignore`. For example, if you have your gems not in a default ignored location of `app/vendor` but have them in `app/gems` you would need to add `gems/*` to your ignore list.
210
220
 
211
221
  ### View Tracking
212
222
 
@@ -264,7 +274,7 @@ end
264
274
 
265
275
  ### Avoiding Cache Stampede
266
276
 
267
- If you have many servers and they all hit Redis at the same time you can see spikes in your Redis CPU, and memory. This is do to a concept called [cache stampede](https://en.wikipedia.org/wiki/Cache_stampede). It is better to spread out the reporting across your servers. A simple way to do this is to add a random wiggle on your background reporting. This configuration option allows a wiggle. The right amount of wiggle depends on the numbers of servers you have and how willing you are to have delays in your coverage reporting. I would recommend at least 1 second per server.
277
+ If you have many servers and they all hit Redis at the same time you can see spikes in your Redis CPU, and memory. This is do to a concept called [cache stampede](https://en.wikipedia.org/wiki/Cache_stampede). It is better to spread out the reporting across your servers. A simple way to do this is to add a random wiggle on your background reporting. This configuration option allows a wiggle. The right amount of wiggle depends on the numbers of servers you have and how willing you are to have delays in your coverage reporting. I would recommend at least 1 second per server.
268
278
 
269
279
  Add a wiggle (in seconds) to the background thread to avoid all your servers reporting at the same time:
270
280
 
@@ -272,11 +282,11 @@ Add a wiggle (in seconds) to the background thread to avoid all your servers rep
272
282
 
273
283
  ### Redis Hash Store
274
284
 
275
- Coverband on very high volume sites with many server processes reporting can have a race condition. To resolve the race condition and reduce Ruby memory overhead we have introduced a new Redis storage option. This moves the some of the work from the Ruby processes to Redis. It is worth noting because of this, it has a larger demands on the Redis server. So adjust your Redis instance accordingly. To help reduce the extra redis load you can also change the background reporting time period.
285
+ Coverband on very high volume sites with many server processes reporting can have a race condition. To resolve the race condition and reduce Ruby memory overhead we have introduced a new Redis storage option. This moves the some of the work from the Ruby processes to Redis. It is worth noting because of this, it has a larger demands on the Redis server. So adjust your Redis instance accordingly. To help reduce the extra redis load you can also change the background reporting time period.
276
286
 
277
- * set the new Redis store: `config.store = Coverband::Adapters::HashRedisStore.new(Redis.new(url: redis_url))`
278
- * adjust from default 30s reporting `config.background_reporting_sleep_seconds = 120`
279
- * reminder it is recommended to have a unique Redis per workload (background jobs, caching, Coverband), for this store, it may be more important to have a dedicated Redis.
287
+ - set the new Redis store: `config.store = Coverband::Adapters::HashRedisStore.new(Redis.new(url: redis_url))`
288
+ - adjust from default 30s reporting `config.background_reporting_sleep_seconds = 120`
289
+ - reminder it is recommended to have a unique Redis per workload (background jobs, caching, Coverband), for this store, it may be more important to have a dedicated Redis.
280
290
 
281
291
  ### Clear Coverage
282
292
 
@@ -314,7 +324,7 @@ rake coverband:coverage # report runtime coverband code coverage
314
324
 
315
325
  ### Collecting Gem / Library Usage
316
326
 
317
- __WARNING:__ Gem Tracking is still in experimental stages and not recommended for production. We have some performance issues when view reports on large applications. Gem tracing also during background thread data collection has HIGH memory requirements, during report merging (seemingly around 128mb of extra memory, which is crazy). We recommend deploying WITHOUT `track_gems` first and only enabling it after confirming that Coverband is working and performing well.
327
+ **WARNING:** Gem Tracking is still in experimental stages and not recommended for production. We have some performance issues when view reports on large applications. Gem tracing also during background thread data collection has HIGH memory requirements, during report merging (seemingly around 128mb of extra memory, which is crazy). We recommend deploying WITHOUT `track_gems` first and only enabling it after confirming that Coverband is working and performing well.
318
328
 
319
329
  Gem usage can be tracked by enabling the `track_gems` config.
320
330
 
@@ -378,7 +388,7 @@ If you are trying to debug locally wondering what code is being run during a req
378
388
 
379
389
  ### Ruby and Rails Version Support
380
390
 
381
- We will match Heroku & Ruby's support lifetime, supporting the last 3 major Ruby releases. For details see [supported runtimes](https://devcenter.heroku.com/articles/ruby-support#supported-runtimes).
391
+ We will match Heroku & Ruby's support lifetime, supporting the last 3 major Ruby releases. For details see [supported runtimes](https://devcenter.heroku.com/articles/ruby-support#supported-runtimes).
382
392
 
383
393
  For Rails, we will follow the policy of the [Rails team maintenance policy](https://guides.rubyonrails.org/maintenance_policy.html). We officially support the last two major release versions, while providing minimal support (major bugs / security fixes) for an additional version. This means at the moment we primaryly target Rails 6.x, 5.x, and will try to keep current functionality working for Rails 4.x but may release new features that do not work on that target.
384
394
 
@@ -399,7 +409,7 @@ If you submit a change please make sure the tests and benchmarks are passing.
399
409
 
400
410
  - run tests:
401
411
  - `bundle exec rake`
402
- - `BUNDLE_GEMFILE=Gemfile.rails4 bundle exec rake` (Same tests using rails 4 instead of 5)
412
+ - `BUNDLE_GEMFILE=Gemfile.rails6 bundle exec rake` (Same tests using rails 6 instead of 5)
403
413
  - view test coverage: `open coverage/index.html`
404
414
  - run the benchmarks before and after your change to see impact
405
415
  - `rake benchmarks`
@@ -410,7 +420,7 @@ If you submit a change please make sure the tests and benchmarks are passing.
410
420
  - **total fail** on front end code, for line for line coverage, because of the precompiled template step basically coverage doesn't work well for `erb`, `slim`, and the like.
411
421
  - related it will try to report something, but the line numbers reported for `ERB` files are often off and aren't considered useful. I recommend filtering out .erb using the `config.ignore` option. The default configuration excludes these files
412
422
  - **NOTE:** We now have file level coverage for view files, but don't support line level detail
413
- - The view file detection doesn't workf or mailers at the moment only for web related views / JSON templates. This is due to how Rails active mailer notifications work.
423
+ - The view file detection doesn't workf or mailers at the moment only for web related views / JSON templates. This is due to how Rails active mailer notifications work.
414
424
 
415
425
  ### Debugging Redis Store
416
426
 
data/Rakefile CHANGED
@@ -22,9 +22,13 @@ Rake::TestTask.new(:test) do |test|
22
22
  end
23
23
 
24
24
  Rake::TestTask.new(:forked_tests) do |test|
25
- test.libs << 'lib' << 'test'
26
- test.test_files = FileList['test/forked/**/*_test.rb']
27
- test.verbose = true
25
+ if RUBY_PLATFORM == 'java'
26
+ puts 'forked tests not supported on JRuby'
27
+ else
28
+ test.libs << 'lib' << 'test'
29
+ test.test_files = FileList['test/forked/**/*_test.rb']
30
+ test.verbose = true
31
+ end
28
32
  end
29
33
 
30
34
  desc 'load irb with this gem'
@@ -9,8 +9,8 @@ Gem::Specification.new do |spec|
9
9
  spec.version = Coverband::VERSION
10
10
  spec.authors = ['Dan Mayer', 'Karl Baum']
11
11
  spec.email = ['dan@mayerdan.com']
12
- spec.description = 'Rack middleware to help measure production code usage (LOC runtime usage)'
13
- spec.summary = 'Rack middleware to help measure production code usage (LOC runtime usage)'
12
+ spec.description = 'Rack middleware to measure production code usage (LOC runtime usage)'
13
+ spec.summary = 'Rack middleware to measure production code usage (LOC runtime usage)'
14
14
  spec.homepage = 'https://github.com/danmayer/coverband'
15
15
  spec.license = 'MIT'
16
16
 
@@ -38,10 +38,6 @@ Gem::Specification.new do |spec|
38
38
  spec.add_development_dependency 'rubocop-performance'
39
39
 
40
40
  spec.add_development_dependency 'coveralls'
41
- # add when debugging
42
- # require 'byebug'; byebug
43
- spec.add_development_dependency 'pry-byebug'
44
-
45
41
  spec.add_development_dependency 'minitest-profile'
46
42
 
47
43
  # TODO: Remove when other production adapters exist
@@ -100,6 +100,7 @@ module Coverband
100
100
  end
101
101
  unless ENV['COVERBAND_DISABLE_AUTO_START']
102
102
  begin
103
+ require 'coverband/utils/jruby_ext' if RUBY_PLATFORM == 'java'
103
104
  # Coverband should be setup as early as possible
104
105
  # to capture usage of things loaded by initializers or other Rails engines
105
106
  configure
@@ -89,12 +89,17 @@ module Coverband
89
89
  raise NotImplementedError, 'Coverage needs Ruby > 2.3.0' if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.3.0')
90
90
 
91
91
  require 'coverage'
92
- if Coverage.ruby_version_greater_than_or_equal_to?('2.6.0')
93
- ::Coverage.start(oneshot_lines: Coverband.configuration.use_oneshot_lines_coverage) unless ::Coverage.running?
94
- elsif Coverage.ruby_version_greater_than_or_equal_to?('2.5.0')
95
- ::Coverage.start unless ::Coverage.running?
92
+ if defined?(SimpleCov) && defined?(Rails) && defined?(Rails.env) && Rails.env.test?
93
+ puts "Coverband: detected SimpleCov in test Env, allowing it to start Coverage"
94
+ puts "Coverband: to ensure no error logs or missing Coverage call `SimpleCov.start` prior to requiring Coverband"
96
95
  else
97
- ::Coverage.start
96
+ if Coverage.ruby_version_greater_than_or_equal_to?('2.6.0')
97
+ ::Coverage.start(oneshot_lines: Coverband.configuration.use_oneshot_lines_coverage) unless ::Coverage.running?
98
+ elsif Coverage.ruby_version_greater_than_or_equal_to?('2.5.0')
99
+ ::Coverage.start unless ::Coverage.running?
100
+ else
101
+ ::Coverage.start
102
+ end
98
103
  end
99
104
  reset_instance
100
105
  end
@@ -44,11 +44,17 @@ module Coverband
44
44
  private
45
45
 
46
46
  def generate
47
+ # TODO: if we filtered before doing this we would avoid calculating the line diff on a ton of files
48
+ # This would be a fairly noticeable perf win
47
49
  current_coverage.each_with_object({}) do |(file, line_counts), new_results|
50
+ # This handles Coverage branch support, setup by default in
51
+ # simplecov 0.18.x
52
+ arr_line_counts = line_counts.is_a?(Hash) ? line_counts[:lines] : line_counts
48
53
  new_results[file] = if @@previous_coverage && @@previous_coverage[file]
49
- array_diff(line_counts, @@previous_coverage[file])
54
+ prev_line_counts = @@previous_coverage[file].is_a?(Hash) ? @@previous_coverage[file][:lines] : @@previous_coverage[file]
55
+ array_diff(arr_line_counts, prev_line_counts)
50
56
  else
51
- line_counts
57
+ arr_line_counts
52
58
  end
53
59
  end
54
60
  end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ ####
4
+ # This exists in CRuby, but not in JRuby, so add it
5
+ #
6
+ # Taken from: https://github.com/ruby/ruby/blob/c5eb24349a4535948514fe765c3ddb0628d81004/ext/coverage/lib/coverage.rb
7
+ ####
8
+ module Coverage
9
+ def self.line_stub(file)
10
+ lines = File.foreach(file).map { nil }
11
+ iseqs = [RubyVM::InstructionSequence.compile_file(file)]
12
+ until iseqs.empty?
13
+ iseq = iseqs.pop
14
+ iseq.trace_points.each { |n, type| lines[n - 1] = 0 if type == :line }
15
+ iseq.each_child { |child| iseqs << child }
16
+ end
17
+ lines
18
+ end
19
+ end
@@ -5,5 +5,5 @@
5
5
  # use format '4.2.1.rc.1' ~> 4.2.1.rc to prerelease versions like v4.2.1.rc.2 and v4.2.1.rc.3
6
6
  ###
7
7
  module Coverband
8
- VERSION = '4.2.5.rc.1'
8
+ VERSION = '4.2.5.rc.2'
9
9
  end
@@ -247,7 +247,7 @@ namespace :benchmarks do
247
247
 
248
248
  desc 'checks memory of collector'
249
249
  task memory_check: [:setup] do
250
- require 'pry-byebug'
250
+ # require 'pry-byebug'
251
251
  require 'objspace'
252
252
  puts 'memory load check'
253
253
  puts(ObjectSpace.memsize_of_all / 2**20)
@@ -337,7 +337,7 @@ namespace :benchmarks do
337
337
  require 'memory_profiler'
338
338
  require './test/unique_files'
339
339
 
340
- 4000.times { |index| require_unique_file('dog.rb.erb', dog_number: index) }
340
+ 4000.times { |index| require_unique_file('big_dog.rb.erb', dog_number: index) }
341
341
  # warmup
342
342
  3.times { Coverband.report_coverage }
343
343
  dogs = 400.times.map { |index| Object.const_get("Dog#{index}") }
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Dog<%=dog_number%>
4
+
5
+ def self.bark
6
+ new.bark
7
+ end
8
+
9
+ def bark
10
+ 'woof'
11
+ end
12
+ end
@@ -49,6 +49,21 @@ class CollectorsDeltaTest < Minitest::Test
49
49
  assert_equal(current_coverage, results)
50
50
  end
51
51
 
52
+ test 'Coverage has branching enabled and has gone up' do
53
+ current_coverage = {
54
+ 'car.rb' => { lines: [nil, 1, 5, 1] }
55
+ }
56
+ ::Coverage.expects(:peek_result).returns(current_coverage)
57
+ results = Coverband::Collectors::Delta.results
58
+
59
+ current_coverage = {
60
+ 'car.rb' => { lines: [nil, 1, 7, 1] }
61
+ }
62
+ ::Coverage.expects(:peek_result).returns(current_coverage)
63
+ results = Coverband::Collectors::Delta.results
64
+ assert_equal({ 'car.rb' => [nil, 0, 2, 0] }, results)
65
+ end
66
+
52
67
  if Coverband.configuration.one_shot_coverage_implemented_in_ruby_version?
53
68
  test 'oneshot coverage calls clear' do
54
69
  Coverband.configuration.stubs(:use_oneshot_lines_coverage).returns(true)
@@ -35,7 +35,13 @@ class ResqueWorkerTest < Minitest::Test
35
35
  Coverband.runtime_coverage!
36
36
  report = Coverband.configuration.store.get_coverage_report
37
37
 
38
- assert_equal 0, report[Coverband::EAGER_TYPE][relative_job_file]['data'][6]
39
- assert_equal 1, report[Coverband::RUNTIME_TYPE][relative_job_file]['data'][6]
38
+ if RUBY_PLATFORM == 'java'
39
+ # NOTE: the todo test only issue seems to be slightly different in JRuby
40
+ # were nothing is showing up as runtime Coverage... This appears to be a test only issue
41
+ assert_equal 1, report[Coverband::EAGER_TYPE][relative_job_file]['data'][6]
42
+ else
43
+ assert_equal 0, report[Coverband::EAGER_TYPE][relative_job_file]['data'][6]
44
+ assert_equal 1, report[Coverband::RUNTIME_TYPE][relative_job_file]['data'][6]
45
+ end
40
46
  end
41
47
  end
@@ -1,11 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Dog<%=dog_number%>
4
-
5
- def self.bark
6
- new.bark
7
- end
8
-
9
4
  def bark
10
5
  'woof'
11
6
  end
@@ -0,0 +1,14 @@
1
+ require 'coverage'
2
+
3
+ Coverage.start
4
+
5
+ require './test/dog.rb'
6
+
7
+ puts Coverage.peek_result
8
+
9
+ puts Dog.new.bark
10
+
11
+ puts Coverage.peek_result
12
+
13
+ puts "done"
14
+
@@ -0,0 +1,6 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require_relative 'config/application'
5
+
6
+ Rails.application.load_tasks
@@ -0,0 +1,5 @@
1
+ class DummyController < ActionController::Base
2
+ def show
3
+ render plain: "I am no dummy"
4
+ end
5
+ end
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Rails.application
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require File.expand_path('boot', __dir__)
4
+
5
+ require 'rails'
6
+ require 'action_controller/railtie'
7
+ require 'coverband'
8
+ Bundler.require(*Rails.groups)
9
+
10
+ module Rails6Dummy
11
+ class Application < Rails::Application
12
+ config.eager_load = true
13
+ end
14
+ end
@@ -0,0 +1,3 @@
1
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
2
+
3
+ require 'bundler/setup' # Set up gems listed in the Gemfile.
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../rails5_dummy/config/coverband'
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../rails5_dummy/config/coverband_missing_redis'
@@ -0,0 +1,5 @@
1
+ # Load the Rails application.
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the Rails application.
5
+ Rails.application.initialize!
@@ -0,0 +1,4 @@
1
+ Rails.application.routes.draw do
2
+ get 'dummy/show'
3
+ mount Coverband::Reporters::Web.new, at: '/coverage'
4
+ end
@@ -0,0 +1,3 @@
1
+ test:
2
+ secret_key_base: 8080f2894307a3dcf72127c0a279a729c58c7c10c11a15de761c8e16017e0e478647d1a7ac11bf143730cac7b6901fa000428c6b4873d9298250f8ca4657b5c6
3
+
File without changes
@@ -15,7 +15,7 @@ require 'ostruct'
15
15
  require 'json'
16
16
  require 'redis'
17
17
  require 'resque'
18
- require 'pry-byebug' unless ENV['CI'] # Ruby 2.3 on CI crashes on pry
18
+ # require 'pry-byebug' unless ENV['CI'] # Ruby 2.3 on CI crashes on pry & JRuby doesn't support it
19
19
  require_relative 'unique_files'
20
20
  $VERBOSE = original_verbosity
21
21
 
@@ -20,6 +20,12 @@ def require_unique_file(file = 'dog.rb', variables = {})
20
20
  Coverband::Utils::RelativeFileConverter.convert(File.expand_path(temp_file))
21
21
  end
22
22
 
23
+ @@dogs = 0
24
+ def require_class_unique_file
25
+ @@dogs +=1
26
+ require_unique_file('dog.rb.erb', dog_number: @@dogs)
27
+ end
28
+
23
29
  def remove_unique_files
24
30
  FileUtils.rm_r(UNIQUE_FILES_DIR) if File.exist?(UNIQUE_FILES_DIR)
25
31
  end
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.5.rc.1
4
+ version: 4.2.5.rc.2
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: 2020-03-28 00:00:00.000000000 Z
12
+ date: 2020-04-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aws-sdk-s3
@@ -221,20 +221,6 @@ dependencies:
221
221
  - - ">="
222
222
  - !ruby/object:Gem::Version
223
223
  version: '0'
224
- - !ruby/object:Gem::Dependency
225
- name: pry-byebug
226
- requirement: !ruby/object:Gem::Requirement
227
- requirements:
228
- - - ">="
229
- - !ruby/object:Gem::Version
230
- version: '0'
231
- type: :development
232
- prerelease: false
233
- version_requirements: !ruby/object:Gem::Requirement
234
- requirements:
235
- - - ">="
236
- - !ruby/object:Gem::Version
237
- version: '0'
238
224
  - !ruby/object:Gem::Dependency
239
225
  name: minitest-profile
240
226
  requirement: !ruby/object:Gem::Requirement
@@ -263,7 +249,7 @@ dependencies:
263
249
  - - ">="
264
250
  - !ruby/object:Gem::Version
265
251
  version: '0'
266
- description: Rack middleware to help measure production code usage (LOC runtime usage)
252
+ description: Rack middleware to measure production code usage (LOC runtime usage)
267
253
  email:
268
254
  - dan@mayerdan.com
269
255
  executables: []
@@ -271,11 +257,13 @@ extensions: []
271
257
  extra_rdoc_files: []
272
258
  files:
273
259
  - ".gitignore"
260
+ - ".jrubyrc"
274
261
  - ".rubocop.yml"
275
262
  - ".travis.yml"
276
263
  - CODE_OF_CONDUCT.md
277
264
  - Gemfile
278
265
  - Gemfile.rails4
266
+ - Gemfile.rails6
279
267
  - LICENSE
280
268
  - LICENSE.txt
281
269
  - README.md
@@ -309,6 +297,7 @@ files:
309
297
  - lib/coverband/utils/file_list.rb
310
298
  - lib/coverband/utils/gem_list.rb
311
299
  - lib/coverband/utils/html_formatter.rb
300
+ - lib/coverband/utils/jruby_ext.rb
312
301
  - lib/coverband/utils/lines_classifier.rb
313
302
  - lib/coverband/utils/railtie.rb
314
303
  - lib/coverband/utils/relative_file_converter.rb
@@ -356,6 +345,7 @@ files:
356
345
  - test/benchmarks/dog.rb
357
346
  - test/benchmarks/graph_bench.sh
358
347
  - test/benchmarks/init_rails.rake
348
+ - test/big_dog.rb.erb
359
349
  - test/coverband/adapters/base_test.rb
360
350
  - test/coverband/adapters/file_store_test.rb
361
351
  - test/coverband/adapters/hash_redis_store_test.rb
@@ -402,6 +392,7 @@ files:
402
392
  - test/forked/rails_full_stack_test.rb
403
393
  - test/forked/rails_rake_full_stack_test.rb
404
394
  - test/integration/full_stack_test.rb
395
+ - test/jruby_check.rb
405
396
  - test/rails4_dummy/Rakefile
406
397
  - test/rails4_dummy/app/controllers/dummy_controller.rb
407
398
  - test/rails4_dummy/config.ru
@@ -422,6 +413,17 @@ files:
422
413
  - test/rails5_dummy/config/environment.rb
423
414
  - test/rails5_dummy/config/routes.rb
424
415
  - test/rails5_dummy/tmp/.keep
416
+ - test/rails6_dummy/Rakefile
417
+ - test/rails6_dummy/app/controllers/dummy_controller.rb
418
+ - test/rails6_dummy/config.ru
419
+ - test/rails6_dummy/config/application.rb
420
+ - test/rails6_dummy/config/boot.rb
421
+ - test/rails6_dummy/config/coverband.rb
422
+ - test/rails6_dummy/config/coverband_missing_redis.rb
423
+ - test/rails6_dummy/config/environment.rb
424
+ - test/rails6_dummy/config/routes.rb
425
+ - test/rails6_dummy/config/secrets.yml
426
+ - test/rails6_dummy/tmp/.keep
425
427
  - test/rails_test_helper.rb
426
428
  - test/test_helper.rb
427
429
  - test/unique_files.rb
@@ -456,7 +458,7 @@ requirements: []
456
458
  rubygems_version: 3.0.3
457
459
  signing_key:
458
460
  specification_version: 4
459
- summary: Rack middleware to help measure production code usage (LOC runtime usage)
461
+ summary: Rack middleware to measure production code usage (LOC runtime usage)
460
462
  test_files:
461
463
  - test/benchmarks/.gitignore
462
464
  - test/benchmarks/benchmark.rake
@@ -464,6 +466,7 @@ test_files:
464
466
  - test/benchmarks/dog.rb
465
467
  - test/benchmarks/graph_bench.sh
466
468
  - test/benchmarks/init_rails.rake
469
+ - test/big_dog.rb.erb
467
470
  - test/coverband/adapters/base_test.rb
468
471
  - test/coverband/adapters/file_store_test.rb
469
472
  - test/coverband/adapters/hash_redis_store_test.rb
@@ -510,6 +513,7 @@ test_files:
510
513
  - test/forked/rails_full_stack_test.rb
511
514
  - test/forked/rails_rake_full_stack_test.rb
512
515
  - test/integration/full_stack_test.rb
516
+ - test/jruby_check.rb
513
517
  - test/rails4_dummy/Rakefile
514
518
  - test/rails4_dummy/app/controllers/dummy_controller.rb
515
519
  - test/rails4_dummy/config.ru
@@ -530,6 +534,17 @@ test_files:
530
534
  - test/rails5_dummy/config/environment.rb
531
535
  - test/rails5_dummy/config/routes.rb
532
536
  - test/rails5_dummy/tmp/.keep
537
+ - test/rails6_dummy/Rakefile
538
+ - test/rails6_dummy/app/controllers/dummy_controller.rb
539
+ - test/rails6_dummy/config.ru
540
+ - test/rails6_dummy/config/application.rb
541
+ - test/rails6_dummy/config/boot.rb
542
+ - test/rails6_dummy/config/coverband.rb
543
+ - test/rails6_dummy/config/coverband_missing_redis.rb
544
+ - test/rails6_dummy/config/environment.rb
545
+ - test/rails6_dummy/config/routes.rb
546
+ - test/rails6_dummy/config/secrets.yml
547
+ - test/rails6_dummy/tmp/.keep
533
548
  - test/rails_test_helper.rb
534
549
  - test/test_helper.rb
535
550
  - test/unique_files.rb