coverband 2.0.0 → 2.0.1.alpha

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
- SHA256:
3
- metadata.gz: 104227eaef7c235ff16b13a0f80c5f29fe4117deac05acbed7553e3343be7ea9
4
- data.tar.gz: dd5a621f881e955c52c1a2acf903f3bc5abd550bc015650851cb385ff76bf758
2
+ SHA1:
3
+ metadata.gz: 69453bf4b4d3273ce29f591dd5db1c45cf0f16fd
4
+ data.tar.gz: c9603b2dd9c5a736e9448711c4fae77456d7118b
5
5
  SHA512:
6
- metadata.gz: 7a2c2041a887b5ac729a540489b20e48fba117e2d70e827f3b7c5fb6da21382fa6786a093e915232771abc7a0903f78b3484713e39394fdf3bbf6cda6f8f57c9
7
- data.tar.gz: 38ed9c82a8a607d349f4edef901d7d348b128c9ff2f6ad6276df388f29ee25e98c6e9534f3e0d4d16d1902f958575f72aa6676c8499d81f6a44b72eaaef534fc
6
+ metadata.gz: 484e9b4182057196b7c6b8f4cc8c2b299d04b329d285004534bee436a24587754bcd7d181e1c6991aaf5642f9595f69d5498cf8efff791e4c624e8f7cdfed58c
7
+ data.tar.gz: 8aff2bd0a4be57763d100726596d0dea50867d35b665e26e2ad36f5655d3803a50abd594bc4c1f17c45db2a86baa20447a30f5180832fbbd71764c83009490ea
data/README.md CHANGED
@@ -57,7 +57,7 @@ Details on a example Sinatra app
57
57
 
58
58
  Follow the below section to install and configure Coverband.
59
59
 
60
- ![coverband installation](https://raw.githubusercontent.com/danmayer/coverband/feature/via_coverage/docs/coverband_install.gif?raw=true)
60
+ ![coverband installation](https://raw.githubusercontent.com/danmayer/coverband/master/docs/coverband-install-resize.gif)
61
61
 
62
62
  ## Prerequisites
63
63
 
@@ -102,6 +102,10 @@ Coverband.configure do |config|
102
102
  config.root = Dir.pwd
103
103
  config.collector = 'coverage'
104
104
  config.redis = Redis.new(url: ENV['REDIS_URL']) if defined? Redis
105
+ # TODO NOTE THIS IS A ISSUE IN THE 2.0 release you set something like redis and the store
106
+ # I need to look a bit more at this but got one bug report quickly after release
107
+ # (even though test builds didnt need)
108
+ config.store = Redis.new(url: ENV['REDIS_URL']) if defined? Redis
105
109
  config.ignore = %w[vendor .erb$ .slim$]
106
110
  # add paths that you deploy to that might be different than your local dev root path
107
111
  config.root_paths = []
@@ -212,8 +216,9 @@ bundle install
212
216
 
213
217
  # create config/coverband.rb
214
218
  # copy the config from the readme
215
- # If you don't set REDIS_URL, remove that to use default localhose
219
+ # If you don't set REDIS_URL, remove that to use default localhost
216
220
 
221
+ # Make some code so we can look at the coverage
217
222
  rails generate scaffold blogs
218
223
  bundle exec rake db:migrate
219
224
 
@@ -283,12 +288,36 @@ end
283
288
 
284
289
  ### View Coverage
285
290
 
286
- You can view the report different ways, but the easiest is the Rake task which opens the Simplecov formated HTML.
291
+ You can view the report different ways, but the easiest is the Rake task which opens the SimpleCov formatted HTML.
287
292
 
288
293
  `bundle exec rake coverband:coverage`
289
294
 
290
295
  This should auto-open in your browser, but if it doesn't the output file should be in `coverage/index.html`
291
296
 
297
+ ### Conflicting .Simplecov: Issue with Missing or 0% Coverage Report
298
+
299
+ If you use SimpleCov to generate code coverage for your tests. You might have setup a `.simplecov` file to help control and focus it's output. Often the settings you want for your test's code coverage report are different than what you want Coverband to be reporting on. Since Coverband uses the SimpleCov HTML formatter to prepare it's report.
300
+
301
+ So if you had something like this in a `.simplecov` file in the root of your project, as reported in [issue 83](https://github.com/danmayer/coverband/issues/83)
302
+
303
+ ```
304
+ require 'simplecov'
305
+
306
+ SimpleCov.start do
307
+ add_filter 'app/admin'
308
+ add_filter '/spec/'
309
+ add_filter '/config/'
310
+ add_filter '/vendor/'
311
+ add_filter 'userevents'
312
+ end
313
+ ```
314
+
315
+ You could see some confusing results... To avoid this issue Coverband has a Rake task that will ignore all Simplecov filters.
316
+
317
+ `rake coverband:coverage_no_filters`
318
+
319
+ This will build the report after disabling any `.simplecov` applied settings.
320
+
292
321
  ### Clear Coverage
293
322
 
294
323
  If your code has changed and your coverage line data doesn't seem to match run time. You probably need to clear your old line data... You will need to run this in the environment you wish to clear the data from.
@@ -313,7 +342,7 @@ Coverband::Reporter.clear_coverage(Redis.new(:host => 'target.com', :port => 678
313
342
  ```
314
343
  You can also do this with the included rake tasks.
315
344
 
316
- ### Manual configuration (for example for background jobs)
345
+ ### Manual Configuration (for example for background jobs)
317
346
 
318
347
  It is easy to use Coverband outside of a Rack environment. Make sure you configure Coverband in whatever environment you are using (such as `config/initializers/*.rb`). Then you can hook into before and after events to add coverage around background jobs, or for any non Rack code.
319
348
 
@@ -360,6 +389,83 @@ coverband.sample {
360
389
  }
361
390
  ```
362
391
 
392
+ ### Manual Configuration (for cron jobs / Raketasks)
393
+
394
+ A question about [supporting cron jobs and Rake tasks](https://github.com/danmayer/coverband/issues/106) was asked by [@ndbroadbent](https://github.com/ndbroadbent), there are a couple ways to go about it including his good suggestion.
395
+
396
+ He extended the Coverband Rake tasks by adding `lib/tasks/coverband.rake` with support to wrap all Rake tasks with coverband support.
397
+
398
+ ```
399
+ require 'coverband'
400
+ Coverband.configure
401
+ require 'coverband/tasks'
402
+
403
+ # Wrap all Rake tasks with Coverband
404
+ current_tasks = Rake.application.top_level_tasks
405
+ if current_tasks.any? && current_tasks.none? { |t| t.to_s.match?(/^coverband:/) }
406
+ current_tasks.unshift 'coverband:start'
407
+ current_tasks.push 'coverband:stop_and_save'
408
+ end
409
+
410
+ namespace :coverband do
411
+ task :start do
412
+ Coverband::Base.instance.start
413
+ end
414
+
415
+ task :stop_and_save do
416
+ Coverband::Base.instance.stop
417
+ Coverband::Base.instance.save
418
+ end
419
+ end
420
+ ```
421
+
422
+ That is a interesting approach and if you Run all your cron jobs as Rake tasks might work well for you. In a production application where we run Coverband, we run all of our Cron jobs with the `rails runner` script. We took this alternative approach which will wrap all runner jobs with Coverband recording, by creating `lib/railties/coverage_runner.rb`.
423
+
424
+ ```
425
+ require 'rails'
426
+
427
+ # Capture code coverage during our cron jobs
428
+ class CoverageRunner < ::Rails::Railtie
429
+ runner do
430
+ Coverband::Collectors::Base.instance.start
431
+ at_exit do
432
+ Coverband::Collectors::Base.instance.report_coverage
433
+ end
434
+ end
435
+ end
436
+ ```
437
+
438
+ ### safe_reload_files: Forcing Coverband to Track Coverage on Files loaded during boot
439
+
440
+ The way Coverband is built it will record and report code usage in production for anything `required` or `loaded` after calling `Coverband.start`. This means some of Rails initial files and Gems are loaded before you can generally call `Coverband.start` for example if you use the `application.rb` to initialize and start Coverband, that file will be reported as having no coverage, as it can't possibly start Coverband before the file is loaded.
441
+
442
+ The `safe_reload_files` reload option in the configuration options can help to ensure you can track any files you want regardless of them loading before Coverband. For example if I wanted to show the coverage of `config/coverband.rb` which has to be loaded before calling `Coverband.start` I could do that by adding that path to the `safe_reload_files` option.
443
+
444
+ ```
445
+ Coverband.configure do |config|
446
+ # ... a bunch of other options
447
+ # using the new safe reload to enforce files loaded
448
+ config.safe_reload_files = ['config/coverband.rb']
449
+ end
450
+ ```
451
+ By adding any files above you will get reporting on those files as part of your coverage runtime report.
452
+
453
+
454
+ ### Collecting Gem / Library Usage
455
+
456
+ By default Coverband has assumed you are trying to track your application code usage not all the supporting framework and library (Gems) code usage. There has been some good points and reasons folks want to track library usage, for example to find out which Gems they aren't actually using in production. See some of the discussion on [issue 21](https://github.com/danmayer/coverband/issues/21).
457
+
458
+ * Using the Tracepoint Collector
459
+ * just make sure to set `Coverband.configuration.include_gems = true` in your config options
460
+ * note by tracking all the additional usage this can have significant performance impacts of the Tracepoint implementation
461
+ * Using the Coverage Collector
462
+ * use the `safe_reload_files` feature to add the path of all gem files you wish to track
463
+ * --- or ---
464
+ * ensure you call `Coverband.start` before loading all your gems
465
+ * while possible this is currently hard as Rails and most environments load your whole Gemfile
466
+ * looking for an improve and easier way to support this.
467
+
468
+
363
469
  ### Verbose Debug / Development Mode
364
470
 
365
471
  Note: To debug issues getting coverband working. I recommend running in development mode, by turning verbose logging on `config.verbose = true` and passing in the Rails.logger `config.logger = Rails.logger` to the Coverband config. This makes it easy to follow in development mode. Be careful to not leave these on in production as they will affect performance.
@@ -400,6 +506,59 @@ Coverband::Reporter.report :additional_scov_data => [data]
400
506
 
401
507
  You can also pass a `:additional_scov_data => [data]` option to `Coverband::Reporter.get_current_scov_data` to write out merged data.
402
508
 
509
+ ### Writing Coverband Results to S3
510
+
511
+ If you add some additional Coverband configuration your coverage html report will be written directly to S3, update `config/coverband.rb` like below.
512
+
513
+ ```
514
+ # configure S3 integration
515
+ config.s3_bucket = 'coverband-demo'
516
+ config.s3_region = 'us-east-1'
517
+ config.s3_access_key_id = ENV['AWS_ACCESS_KEY_ID']
518
+ config.s3_secret_access_key = ENV['AWS_SECRET_ACCESS_KEY']
519
+ ```
520
+
521
+ ### Viewing / Hosting S3 Coverband results in app
522
+
523
+ Beyond writing to S3 you can host the S3 file with a build in Sintatra app in Coverband. Just configure your Rails route `config/routes.rb`
524
+
525
+ ```
526
+ Rails.application.routes.draw do
527
+ # ... lots of routes
528
+ mount Coverband::S3Web, at: '/coverage'
529
+ end
530
+ ```
531
+
532
+ __NOTE__: ADD PASSWORD PROTECTION OR YOU CAN EXPOSE ALL YOUR SOURCE CODE
533
+
534
+ It is easy to add some basic protect around the coverage data, below shows how you can use devise or basic auth, by adding a bit of code to your `config/routes.rb` file.
535
+
536
+ ```
537
+ # protect with existing Rails devise configuration
538
+ devise_constraint = lambda do |request|
539
+ request.env['warden'] && request.env['warden'].authenticate? && request.env['warden'].user.admin?
540
+ end
541
+
542
+ # protect with http basic auth
543
+ # curl --user foo:bar http://localhost:3000/coverage
544
+ basic_constraint = lambda do |request|
545
+ return true if Rails.env.development?
546
+ if ActionController::HttpAuthentication::Basic.has_basic_credentials?(request)
547
+ credentials = ActionController::HttpAuthentication::Basic.decode_credentials(request)
548
+ email, password = credentials.split(':')
549
+
550
+ email == 'foo' && password = 'bar'
551
+ end
552
+ end
553
+
554
+ Rails.application.routes.draw do
555
+ # ... lots of routes
556
+ constraints basic_constraint do
557
+ mount Coverband::S3Web, at: '/coverage'
558
+ end
559
+ end
560
+ ```
561
+
403
562
  # Contributing To Coverband
404
563
 
405
564
  If you are working on adding features, PRs, or bugfixes to Coverband this section should help get you going.
@@ -423,9 +582,9 @@ If you submit a change please make sure the tests and benchmarks are passing.
423
582
  ### Known Issues
424
583
 
425
584
  * __total fail__ on front end code, because of the precompiled template step basically coverage doesn't work well for `erb`, `slim`, and the like.
585
+ * 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.
426
586
  * If you have SimpleCov filters, you need to clear them prior to generating your coverage report. As the filters will be applied to Coverband as well and can often filter out everything we are recording.
427
- * 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.
428
- * coverage doesn't show for Rails `config/application.rb` or `config/boot.rb` as they get loaded when loading the Rake environment prior to starting to record the baseline..
587
+ * coverage doesn't show for Rails `config/application.rb` or `config/boot.rb` as they get loaded when loading the Rake environment prior to starting to record the baseline.
429
588
 
430
589
  ### Debugging Redis Store
431
590
 
@@ -496,6 +655,7 @@ Similar format to redis store, but array with integer values
496
655
 
497
656
  ### Todo
498
657
 
658
+ * Sinatra App with admin controls
499
659
  * graphite adapters (it would allow passing in date ranges on usage)
500
660
  * perf test for array vs hash
501
661
  * redis pipeline around hash (or batch get then push)
data/changes.md CHANGED
@@ -12,9 +12,21 @@ Will be the fully modern release that drops maintenance legacy support in favor
12
12
  * add built-in support for easy loading via Railties
13
13
  * expects to add safe list support to force reload files one wants coverage on that may happen outside of the standard load order
14
14
  * built in support for activejob, sidekiq, and other common frameworks
15
+ * code route tracing (entry point to all code executed for example /some_path -> code coverage of that path)
15
16
 
16
17
  # Released
17
18
 
19
+ ### 2.0.1
20
+
21
+ * add support for fine grained S3 configuration via Coverband config, thanks @a0s
22
+ * https://github.com/danmayer/coverband/pull/98
23
+ * Using the file argument to self.configure in lib/coverband.rb, thanks @ThomasOwens
24
+ * https://github.com/danmayer/coverband/pull/100
25
+ * fix warnings about duplicate method definition
26
+ * Add support for safe_reload_files based on full file path
27
+ * Add support for Sinatra admin control endpoints
28
+ * improved documentation
29
+
18
30
  ### 2.0.0
19
31
 
20
32
  Major release with various backwards compatibility breaking changes (generally related to the configuration). The 2.0 lifecycle will act as a mostly easy upgrade that supports past users looking to move to the much faster new Coverage Adapter.
Binary file
data/lib/coverband.rb CHANGED
@@ -27,14 +27,15 @@ module Coverband
27
27
  end
28
28
 
29
29
  def self.configure(file = nil)
30
+ configuration_file = file || CONFIG_FILE
31
+
30
32
  configuration
31
33
  if block_given?
32
34
  yield(configuration)
33
- elsif File.exist?(CONFIG_FILE)
34
- file ||= CONFIG_FILE
35
- require file
35
+ elsif File.exist?(configuration_file)
36
+ require configuration_file
36
37
  else
37
- raise ArgumentError, "configure requires a block or the existance of a #{CONFIG_FILE} in your project"
38
+ raise ArgumentError, "configure requires a block, the existance of a #{CONFIG_FILE} in your project, or a path to a config file passed in to configure"
38
39
  end
39
40
  end
40
41
 
@@ -7,35 +7,41 @@ module Coverband
7
7
 
8
8
  def initialize(redis, opts = {})
9
9
  @redis = redis
10
+ @ttl = opts[:ttl]
11
+ @redis_namespace = opts[:redis_namespace]
10
12
  end
11
13
 
12
14
  def clear!
13
- @redis.smembers(BASE_KEY).each { |key| @redis.del("#{BASE_KEY}.#{key}") }
14
- @redis.del(BASE_KEY)
15
+ @redis.smembers(base_key).each { |key| @redis.del("#{base_key}.#{key}") }
16
+ @redis.del(base_key)
17
+ end
18
+
19
+ def base_key
20
+ @base_key ||= [BASE_KEY, @redis_namespace].compact.join('.')
15
21
  end
16
22
 
17
23
  def save_report(report)
18
- store_array(BASE_KEY, report.keys)
24
+ store_array(base_key, report.keys)
19
25
 
20
26
  report.each do |file, lines|
21
- store_map("#{BASE_KEY}.#{file}", lines)
27
+ store_map("#{base_key}.#{file}", lines)
22
28
  end
23
29
  end
24
30
 
25
31
  def coverage
26
32
  data = {}
27
- redis.smembers(BASE_KEY).each do |key|
33
+ redis.smembers(base_key).each do |key|
28
34
  data[key] = covered_lines_for_file(key)
29
35
  end
30
36
  data
31
37
  end
32
38
 
33
39
  def covered_files
34
- redis.smembers(BASE_KEY)
40
+ redis.smembers(base_key)
35
41
  end
36
42
 
37
43
  def covered_lines_for_file(file)
38
- @redis.hgetall("#{BASE_KEY}.#{file}")
44
+ @redis.hgetall("#{base_key}.#{file}")
39
45
  end
40
46
 
41
47
  private
@@ -49,11 +55,13 @@ module Coverband
49
55
  values = Hash[values.map { |k, val| [k.to_s, val] }]
50
56
  values.merge!(existing) { |_k, old_v, new_v| old_v.to_i + new_v.to_i }
51
57
  redis.mapped_hmset(key, values)
58
+ redis.expire(key, @ttl) if @ttl
52
59
  end
53
60
  end
54
61
 
55
62
  def store_array(key, values)
56
63
  redis.sadd(key, values) unless values.empty?
64
+ redis.expire(key, @ttl) if @ttl
57
65
  values
58
66
  end
59
67
  end
@@ -116,6 +116,11 @@ module Coverband
116
116
  else
117
117
  ::Coverage.start
118
118
  end
119
+ if Coverband.configuration.safe_reload_files
120
+ Coverband.configuration.safe_reload_files.each do |safe_file|
121
+ load safe_file
122
+ end
123
+ end
119
124
  @semaphore = Mutex.new
120
125
  @@previous_results = nil
121
126
  reset_instance
@@ -5,9 +5,11 @@ module Coverband
5
5
  attr_accessor :redis, :root_paths, :root,
6
6
  :ignore, :additional_files, :percentage, :verbose,
7
7
  :reporter, :startup_delay, :memory_caching,
8
- :include_gems, :s3_bucket,
9
- :collector, :disable_on_failure_for
10
- attr_writer :logger
8
+ :include_gems, :collector, :disable_on_failure_for,
9
+ :redis_namespace, :redis_ttl,
10
+ :safe_reload_files
11
+
12
+ attr_writer :logger, :s3_region, :s3_bucket, :s3_access_key_id, :s3_secret_access_key
11
13
 
12
14
  def initialize
13
15
  @root = Dir.pwd
@@ -29,12 +31,34 @@ module Coverband
29
31
  @memory_caching = false
30
32
  @store = nil
31
33
  @disable_on_failure_for = nil
34
+ @s3_region = nil
35
+ @s3_bucket = nil
36
+ @s3_access_key_id = nil
37
+ @s3_secret_access_key = nil
38
+ @redis_namespace = nil
39
+ @redis_ttl = nil
32
40
  end
33
41
 
34
42
  def logger
35
43
  @logger ||= Logger.new(STDOUT)
36
44
  end
37
45
 
46
+ def s3_bucket
47
+ @s3_bucket || ENV['AWS_BUCKET']
48
+ end
49
+
50
+ def s3_region
51
+ @s3_region || ENV['AWS_REGION']
52
+ end
53
+
54
+ def s3_access_key_id
55
+ @s3_access_key_id || ENV['AWS_ACCESS_KEY_ID']
56
+ end
57
+
58
+ def s3_secret_access_key
59
+ @s3_secret_access_key || ENV['AWS_SECRET_ACCESS_KEY']
60
+ end
61
+
38
62
  def store
39
63
  return @store if @store
40
64
  raise 'no valid store configured'
@@ -43,8 +67,9 @@ module Coverband
43
67
  def store=(store)
44
68
  if store.is_a?(Coverband::Adapters::Base)
45
69
  @store = store
46
- elsif defined?(Redis) && store.is_a?(Redis)
47
- @store = Coverband::Adapters::RedisStore.new(redis)
70
+ elsif defined?(Redis) && redis && redis.is_a?(Redis)
71
+ @store = Coverband::Adapters::RedisStore.new(redis, ttl: Coverband.configuration.redis_ttl,
72
+ redis_namespace: Coverband.configuration.redis_namespace)
48
73
  elsif store.is_a?(String)
49
74
  @store = Coverband::Adapters::FileStore.new(coverage_file)
50
75
  end
@@ -38,7 +38,12 @@ module Coverband
38
38
  Coverband.configuration.logger.info "report is ready and viewable: open #{SimpleCov.coverage_dir}/index.html"
39
39
  end
40
40
 
41
- S3ReportWriter.new(Coverband.configuration.s3_bucket).persist! if Coverband.configuration.s3_bucket
41
+ s3_writer_options = {
42
+ region: Coverband.configuration.s3_region,
43
+ access_key_id: Coverband.configuration.s3_access_key_id,
44
+ secret_access_key: Coverband.configuration.s3_secret_access_key
45
+ }
46
+ S3ReportWriter.new(Coverband.configuration.s3_bucket, s3_writer_options).persist! if Coverband.configuration.s3_bucket
42
47
  end
43
48
  end
44
49
  end
@@ -1,8 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class S3ReportWriter
4
- def initialize(bucket_name)
4
+ def initialize(bucket_name, options = {})
5
5
  @bucket_name = bucket_name
6
+ @region = options[:region]
7
+ @access_key_id = options[:access_key_id]
8
+ @secret_access_key = options[:secret_access_key]
6
9
  begin
7
10
  require 'aws-sdk'
8
11
  rescue StandardError
@@ -29,7 +32,14 @@ class S3ReportWriter
29
32
  end
30
33
 
31
34
  def s3
32
- Aws::S3::Resource.new
35
+ client_options = {
36
+ region: @region,
37
+ access_key_id: @access_key_id,
38
+ secret_access_key: @secret_access_key
39
+ }
40
+ resource_options = { client: Aws::S3::Client.new(client_options) }
41
+ resource_options = {} if client_options.values.any?(&:nil?)
42
+ Aws::S3::Resource.new(resource_options)
33
43
  end
34
44
 
35
45
  def bucket
@@ -7,7 +7,36 @@ module Coverband
7
7
  set :public_folder, proc(){ File.expand_path('public', Gem::Specification.find_by_name('simplecov-html').full_gem_path) }
8
8
 
9
9
  get '/' do
10
- s3.get_object(bucket: Coverband.configuration.s3_bucket, key: 'coverband/index.html').body.read
10
+ html = s3.get_object(bucket: Coverband.configuration.s3_bucket, key: 'coverband/index.html').body.read
11
+ # hack the static HTML assets to account for where this was mounted
12
+ html = html.gsub("src='", "src='#{request.path}")
13
+ html = html.gsub("href='", "href='#{request.path}")
14
+ html = html.gsub("loading.gif", "#{request.path}loading.gif")
15
+ html = html.gsub("/images/", "#{request.path}/images/")
16
+ html
17
+ end
18
+
19
+ post '/update_report' do
20
+ Coverband::Reporters::SimpleCovReport.report(Coverband.configuration.store, open_report: false)
21
+ notice = "coverband coverage updated"
22
+ redirect "/?notice=#{notice}", 301
23
+ end
24
+
25
+ post '/clear' do
26
+ Coverband.configuration.store.clear!
27
+ notice = "coverband coverage cleared"
28
+ redirect "/?notice=#{notice}", 301
29
+ end
30
+
31
+ post '/reload_files' do
32
+ if Coverband.configuration.safe_reload_files
33
+ Coverband.configuration.safe_reload_files.each do |safe_file|
34
+ load safe_file
35
+ end
36
+ end
37
+ Coverband.configure
38
+ notice = "coverband files reloaded"
39
+ redirect "/?notice=#{notice}", 301
11
40
  end
12
41
 
13
42
  private
@@ -19,7 +48,15 @@ module Coverband
19
48
  Coverband.configuration.logger.error "coverband requires 'aws-sdk' in order use S3ReportWriter."
20
49
  return
21
50
  end
22
- @s3 ||= Aws::S3::Client.new
51
+ @s3 ||= begin
52
+ client_options = {
53
+ region: Coverband.configuration.s3_region,
54
+ access_key_id: Coverband.configuration.s3_access_key_id,
55
+ secret_access_key: Coverband.configuration.s3_secret_access_key
56
+ }
57
+ client_options = {} if client_options.values.any?(&:nil?)
58
+ Aws::S3::Client.new(client_options)
59
+ end
23
60
  end
24
61
  end
25
62
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Coverband
4
- VERSION = '2.0.0'
4
+ VERSION = '2.0.1.alpha'
5
5
  end
@@ -18,7 +18,13 @@ module Coverband
18
18
  File.expects(:read).at_least(0).returns("content ./assets/#{html_version}/")
19
19
  object.expects(:put).with(body: 'content ')
20
20
  Aws::S3::Resource.expects(:new).returns(s3)
21
- S3ReportWriter.new('coverage-bucket').persist!
21
+
22
+ s3_writer_options = {
23
+ region: 'us-west-1',
24
+ access_key_id: '',
25
+ secret_access_key: ''
26
+ }
27
+ S3ReportWriter.new('coverage-bucket', s3_writer_options).persist!
22
28
  end
23
29
  end
24
30
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coverband
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1.alpha
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Mayer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-23 00:00:00.000000000 Z
11
+ date: 2018-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk
@@ -208,6 +208,7 @@ files:
208
208
  - Rakefile
209
209
  - changes.md
210
210
  - coverband.gemspec
211
+ - docs/coverband-install-resize.gif
211
212
  - docs/coverband_details.png
212
213
  - docs/coverband_index.png
213
214
  - docs/coverband_install.gif
@@ -264,12 +265,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
264
265
  version: '0'
265
266
  required_rubygems_version: !ruby/object:Gem::Requirement
266
267
  requirements:
267
- - - ">="
268
+ - - ">"
268
269
  - !ruby/object:Gem::Version
269
- version: '0'
270
+ version: 1.3.1
270
271
  requirements: []
271
272
  rubyforge_project:
272
- rubygems_version: 2.7.3
273
+ rubygems_version: 2.5.1
273
274
  signing_key:
274
275
  specification_version: 4
275
276
  summary: Rack middleware to help measure production code usage (LOC runtime usage)