defra_ruby_alert 1.0.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +8 -2
- data/Rakefile +0 -2
- data/lib/defra_ruby/alert/airbrake_runner.rb +1 -13
- data/lib/defra_ruby/alert/version.rb +1 -1
- data/spec/defra_ruby/alert/airbrake_runner_spec.rb +0 -12
- data/spec/examples.txt +10 -0
- metadata +9 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a72107fb14c719e0d2495efafc847b62471d69735498d328711253e1142bb5c7
|
4
|
+
data.tar.gz: 88f2e7e02f488cff8e8f786ca2978c8061689b7d42f9ecae0fcc7aa4dd4dc448
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f7f2af88032dd603bc196af1f295a966f64427dfe2a6a74d2656996e583a4a6cf289e4cce8e8313348b99c4b8f672c2036fafdf173ae14be933f3ccde63ea5e
|
7
|
+
data.tar.gz: 04424c5b64b3043893cf2820cfaffbf23a364bb450ad31924c48bb8e972a673f46dae23b829dbf0d4c793f1c157f14fbe4d9b925f89ee2da00145c9d0a56aee7
|
data/README.md
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# Defra Ruby Alert
|
2
2
|
|
3
3
|
[![Build Status](https://travis-ci.com/DEFRA/defra-ruby-alert.svg?branch=master)](https://travis-ci.com/DEFRA/defra-ruby-alert)
|
4
|
+
[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=DEFRA_defra-ruby-alert&metric=sqale_rating)](https://sonarcloud.io/dashboard?id=DEFRA_defra-ruby-alert)
|
5
|
+
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=DEFRA_defra-ruby-alert&metric=coverage)](https://sonarcloud.io/dashboard?id=DEFRA_defra-ruby-alert)
|
4
6
|
[![security](https://hakiri.io/github/DEFRA/defra-ruby-alert/master.svg)](https://hakiri.io/github/DEFRA/defra-ruby-alert/master)
|
5
|
-
[![Maintainability](https://api.codeclimate.com/v1/badges/071265a0d6f45606290f/maintainability)](https://codeclimate.com/github/DEFRA/defra-ruby-alert/maintainability)
|
6
|
-
[![Test Coverage](https://api.codeclimate.com/v1/badges/071265a0d6f45606290f/test_coverage)](https://codeclimate.com/github/DEFRA/defra-ruby-alert/test_coverage)
|
7
7
|
[![Gem Version](https://badge.fury.io/rb/defra_ruby_alert.svg)](https://badge.fury.io/rb/defra_ruby_alert)
|
8
8
|
[![Licence](https://img.shields.io/badge/Licence-OGLv3-blue.svg)](http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3)
|
9
9
|
|
@@ -30,6 +30,12 @@ If like the [Waste Exemptions](https://github.com/DEFRA/ruby-services-team/tree/
|
|
30
30
|
gem "defra_ruby_alert", "~> 1.0.0"
|
31
31
|
```
|
32
32
|
|
33
|
+
If you need a version of the gem that works with Ruby 2.7 and Rails 6, and has version 10.0.4 of Airbrake (latest versions at time of writing) add this line to your application's Gemfile
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
gem "defra_ruby_alert", "~> 2.0.0"
|
37
|
+
```
|
38
|
+
|
33
39
|
And then update your dependencies by calling
|
34
40
|
|
35
41
|
```bash
|
data/Rakefile
CHANGED
@@ -11,7 +11,6 @@ Bundler::GemHelper.install_tasks
|
|
11
11
|
# This is wrapped to prevent an error when rake is called in environments where
|
12
12
|
# rspec may not be available, e.g. production. As such we don't need to handle
|
13
13
|
# the error.
|
14
|
-
# rubocop:disable Lint/SuppressedException
|
15
14
|
begin
|
16
15
|
require "rspec/core/rake_task"
|
17
16
|
|
@@ -32,4 +31,3 @@ begin
|
|
32
31
|
rescue LoadError
|
33
32
|
# no changelog available
|
34
33
|
end
|
35
|
-
# rubocop:enable Lint/SuppressedException
|
@@ -9,12 +9,7 @@ module DefraRuby
|
|
9
9
|
def self.invoke
|
10
10
|
configure
|
11
11
|
|
12
|
-
if DefraRuby::Alert.configuration.enabled
|
13
|
-
# Register an `at_exit` hook that runs when the host app shuts down
|
14
|
-
at_exit { perform_at_exit }
|
15
|
-
|
16
|
-
return
|
17
|
-
end
|
12
|
+
return if DefraRuby::Alert.configuration.enabled
|
18
13
|
|
19
14
|
# Unfortunately the airbrake initializer errors if project_key is not set. The
|
20
15
|
# problem is that the initializer is fired in scenarios where we are not
|
@@ -26,13 +21,6 @@ module DefraRuby
|
|
26
21
|
Airbrake.add_filter(&:ignore!)
|
27
22
|
end
|
28
23
|
|
29
|
-
private_class_method def self.perform_at_exit
|
30
|
-
Airbrake.close
|
31
|
-
rescue StandardError => e
|
32
|
-
puts "Airbrake reported an error when closing. \
|
33
|
-
Its probaly fine and just because there were no errors to report: #{e.message}"
|
34
|
-
end
|
35
|
-
|
36
24
|
private_class_method def self.configure
|
37
25
|
Airbrake.configure do |c|
|
38
26
|
# You must set both project_id & project_key. To find your project_id and
|
@@ -41,12 +41,6 @@ module DefraRuby
|
|
41
41
|
end
|
42
42
|
|
43
43
|
context "when airbrake is enabled" do
|
44
|
-
it "registers an 'at_exit' hook" do
|
45
|
-
expect(described_class).to receive(:at_exit)
|
46
|
-
|
47
|
-
described_class.invoke
|
48
|
-
end
|
49
|
-
|
50
44
|
it "does not tell Airbrake to ignore everything" do
|
51
45
|
expect(Airbrake).not_to receive(:add_filter)
|
52
46
|
|
@@ -57,12 +51,6 @@ module DefraRuby
|
|
57
51
|
context "when airbrake is not enabled" do
|
58
52
|
let(:enabled) { false }
|
59
53
|
|
60
|
-
it "does not register an 'at_exit' hook" do
|
61
|
-
expect(described_class).to receive(:at_exit).never
|
62
|
-
|
63
|
-
described_class.invoke
|
64
|
-
end
|
65
|
-
|
66
54
|
it "tells Airbrake to ignore everything" do
|
67
55
|
expect(Airbrake).to receive(:add_filter) { |&block| expect(block).to be(&:ignore!) }
|
68
56
|
|
data/spec/examples.txt
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
example_id | status | run_time |
|
2
|
+
-------------------------------------------------------- | ------ | --------------- |
|
3
|
+
./spec/defra_ruby/alert/airbrake_runner_spec.rb[1:1:1] | passed | 0.01164 seconds |
|
4
|
+
./spec/defra_ruby/alert/airbrake_runner_spec.rb[1:1:2:1] | passed | 0.00106 seconds |
|
5
|
+
./spec/defra_ruby/alert/airbrake_runner_spec.rb[1:1:3:1] | passed | 0.00239 seconds |
|
6
|
+
./spec/defra_ruby/alert/configuration_spec.rb[1:1] | passed | 0.00357 seconds |
|
7
|
+
./spec/defra_ruby/alert_spec.rb[1:1:1] | passed | 0.00218 seconds |
|
8
|
+
./spec/defra_ruby/alert_spec.rb[1:2:1:1] | passed | 0.00068 seconds |
|
9
|
+
./spec/defra_ruby/alert_spec.rb[1:2:2:1] | passed | 0.00009 seconds |
|
10
|
+
./spec/defra_ruby/alert_spec.rb[1:3:1] | passed | 0.00032 seconds |
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: defra_ruby_alert
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Defra
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: airbrake
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: defra_ruby_style
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -171,6 +171,7 @@ files:
|
|
171
171
|
- spec/defra_ruby/alert/airbrake_runner_spec.rb
|
172
172
|
- spec/defra_ruby/alert/configuration_spec.rb
|
173
173
|
- spec/defra_ruby/alert_spec.rb
|
174
|
+
- spec/examples.txt
|
174
175
|
- spec/spec_helper.rb
|
175
176
|
- spec/support/defra_ruby_alert.rb
|
176
177
|
- spec/support/dotenv.rb
|
@@ -197,8 +198,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
197
198
|
- !ruby/object:Gem::Version
|
198
199
|
version: '0'
|
199
200
|
requirements: []
|
200
|
-
|
201
|
-
rubygems_version: 2.6.13
|
201
|
+
rubygems_version: 3.1.2
|
202
202
|
signing_key:
|
203
203
|
specification_version: 4
|
204
204
|
summary: Defra ruby on rails Alert gem
|
@@ -207,6 +207,7 @@ test_files:
|
|
207
207
|
- spec/defra_ruby/alert_spec.rb
|
208
208
|
- spec/defra_ruby/alert/configuration_spec.rb
|
209
209
|
- spec/defra_ruby/alert/airbrake_runner_spec.rb
|
210
|
+
- spec/examples.txt
|
210
211
|
- spec/support/defra_ruby_alert.rb
|
211
212
|
- spec/support/simplecov.rb
|
212
213
|
- spec/support/webmock.rb
|