defra_ruby_alert 2.1.0 → 2.2.1

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: bd752fb4d156ca20aa6c449a7a537ccc174b2749c738f086e8f1ba3834fefbf9
4
- data.tar.gz: 8b7038c5c82b72d17c8e600de490becc8cd93686e61571c62a666493e2e1e842
3
+ metadata.gz: 3405f17d06604e4c71bfdf9617c2112434414096ed1a931679a164ea30dd3858
4
+ data.tar.gz: b7db1d0d918989e3d90cdd5aa9fa0bfbd51d82f0228088725c2df7bfb17f5f3a
5
5
  SHA512:
6
- metadata.gz: 58fb7b1763a226d9b9e17625512242f0f641256dca858959ecc1cbba6de55e32170396bcc2f2ed79aff9a1ee47a43eb03aa11de7adc8113c54c6af3bcdc39f7d
7
- data.tar.gz: 7668f51ade4c8a7debe50c56508521d984def72d73e561308d4bc1092151d2b58477445227ff7a9bd7baf18f6aeb4f057cd5f56e7a17085b3f74fc32afc3381f
6
+ metadata.gz: 6665fd599e7929ae90bdd901620909a4f068cdc8ed2c34232eab30d6d9b3065c440337deb7dafac1139def32205cf1c6a04995cef90f5435bc3b14efcf4c5d88
7
+ data.tar.gz: dfc6099e2fe16c8f6455c4a88172d3d9a2adea865eb97e30f4fa5bdb35142f08e6565dc8895d3a6d0cf835282a6fbe58ce0209d278b3d65e062202aa98727622
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Defra Ruby Alert
2
2
 
3
- [![Build Status](https://travis-ci.com/DEFRA/defra-ruby-alert.svg?branch=main)](https://travis-ci.com/DEFRA/defra-ruby-alert)
3
+ ![Build Status](https://github.com/DEFRA/defra-ruby-alert/workflows/CI/badge.svg?branch=main)
4
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
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)
6
6
  [![security](https://hakiri.io/github/DEFRA/defra-ruby-alert/main.svg)](https://hakiri.io/github/DEFRA/defra-ruby-alert/main)
@@ -64,6 +64,17 @@ module DefraRuby
64
64
  # replaced.
65
65
  # https://github.com/airbrake/airbrake-ruby#blocklist_keys
66
66
  c.blocklist_keys = DefraRuby::Alert.configuration.blocklist
67
+
68
+ # Latest versions of Airbrake support performance stats being
69
+ # automatically sent to Airbrake. We actually use Errbit at Defra
70
+ # which doesn't support this feature. So all we see is lots of 404
71
+ # errors in our logs. To prevent this we disable this feature.
72
+ # https://github.com/airbrake/airbrake-ruby#performance_stats
73
+ c.performance_stats = false
74
+
75
+ # Prevent Airbrake from trying to auto-load remote config from Airbrake servers
76
+ # as this fails (our projects are not on Airbrake) and disables Airbrake in the app
77
+ c.remote_config = false
67
78
  end
68
79
  end
69
80
  end
@@ -3,8 +3,7 @@
3
3
  module DefraRuby
4
4
  module Alert
5
5
  class Configuration
6
- attr_accessor :root_directory, :logger, :environment
7
- attr_accessor :host, :project_key, :blocklist, :enabled
6
+ attr_accessor :root_directory, :logger, :environment, :host, :project_key, :blocklist, :enabled
8
7
 
9
8
  def initialize
10
9
  @blocklist = []
@@ -2,6 +2,6 @@
2
2
 
3
3
  module DefraRuby
4
4
  module Alert
5
- VERSION = "2.1.0"
5
+ VERSION = "2.2.1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: defra_ruby_alert
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Defra
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-19 00:00:00.000000000 Z
11
+ date: 2023-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: airbrake
@@ -24,132 +24,6 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: defra_ruby_style
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: dotenv
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: github_changelog_generator
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: pry-byebug
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: rake
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
- - !ruby/object:Gem::Dependency
98
- name: rspec
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - "~>"
102
- - !ruby/object:Gem::Version
103
- version: '3.0'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - "~>"
109
- - !ruby/object:Gem::Version
110
- version: '3.0'
111
- - !ruby/object:Gem::Dependency
112
- name: rubocop
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- version: '0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - ">="
123
- - !ruby/object:Gem::Version
124
- version: '0'
125
- - !ruby/object:Gem::Dependency
126
- name: simplecov
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - "~>"
130
- - !ruby/object:Gem::Version
131
- version: 0.17.1
132
- type: :development
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - "~>"
137
- - !ruby/object:Gem::Version
138
- version: 0.17.1
139
- - !ruby/object:Gem::Dependency
140
- name: webmock
141
- requirement: !ruby/object:Gem::Requirement
142
- requirements:
143
- - - "~>"
144
- - !ruby/object:Gem::Version
145
- version: '3.4'
146
- type: :development
147
- prerelease: false
148
- version_requirements: !ruby/object:Gem::Requirement
149
- requirements:
150
- - - "~>"
151
- - !ruby/object:Gem::Version
152
- version: '3.4'
153
27
  description: Provides a single source of functionality for initialising and managing
154
28
  Alert in our apps.
155
29
  email:
@@ -168,22 +42,13 @@ files:
168
42
  - lib/defra_ruby/alert/airbrake_runner.rb
169
43
  - lib/defra_ruby/alert/configuration.rb
170
44
  - lib/defra_ruby/alert/version.rb
171
- - spec/defra_ruby/alert/airbrake_runner_spec.rb
172
- - spec/defra_ruby/alert/configuration_spec.rb
173
- - spec/defra_ruby/alert_spec.rb
174
- - spec/examples.txt
175
- - spec/spec_helper.rb
176
- - spec/support/defra_ruby_alert.rb
177
- - spec/support/dotenv.rb
178
- - spec/support/pry.rb
179
- - spec/support/simplecov.rb
180
- - spec/support/webmock.rb
181
45
  homepage: https://github.com/DEFRA/defra-ruby-alert
182
46
  licenses:
183
47
  - The Open Government Licence (OGL) Version 3
184
48
  metadata:
185
49
  allowed_push_host: https://rubygems.org
186
- post_install_message:
50
+ rubygems_mfa_required: 'true'
51
+ post_install_message:
187
52
  rdoc_options: []
188
53
  require_paths:
189
54
  - lib
@@ -191,25 +56,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
191
56
  requirements:
192
57
  - - ">="
193
58
  - !ruby/object:Gem::Version
194
- version: '0'
59
+ version: '3.1'
195
60
  required_rubygems_version: !ruby/object:Gem::Requirement
196
61
  requirements:
197
62
  - - ">="
198
63
  - !ruby/object:Gem::Version
199
64
  version: '0'
200
65
  requirements: []
201
- rubygems_version: 3.1.2
202
- signing_key:
66
+ rubygems_version: 3.3.7
67
+ signing_key:
203
68
  specification_version: 4
204
69
  summary: Defra ruby on rails Alert gem
205
- test_files:
206
- - spec/spec_helper.rb
207
- - spec/defra_ruby/alert_spec.rb
208
- - spec/defra_ruby/alert/configuration_spec.rb
209
- - spec/defra_ruby/alert/airbrake_runner_spec.rb
210
- - spec/examples.txt
211
- - spec/support/defra_ruby_alert.rb
212
- - spec/support/simplecov.rb
213
- - spec/support/webmock.rb
214
- - spec/support/pry.rb
215
- - spec/support/dotenv.rb
70
+ test_files: []
@@ -1,64 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "spec_helper"
4
-
5
- module DefraRuby
6
- module Alert
7
- RSpec.describe AirbrakeRunner do
8
- before do
9
- DefraRuby::Alert.configure do |c|
10
- c.enabled = enabled
11
- c.host = host
12
- c.project_key = project_key
13
- end
14
-
15
- allow(configuration).to receive_messages(
16
- :host= => nil,
17
- :project_key= => nil,
18
- :project_id= => nil,
19
- :root_directory= => nil,
20
- :logger= => nil,
21
- :environment= => nil,
22
- :ignore_environments= => nil,
23
- :blocklist_keys= => nil
24
- )
25
-
26
- allow(Airbrake).to receive(:configure).and_yield(configuration)
27
- end
28
-
29
- let(:configuration) { double("Configuration") }
30
-
31
- let(:enabled) { true }
32
- let(:host) { "http://localhost:8005" }
33
- let(:project_key) { "ABC123456789" }
34
-
35
- describe ".invoke" do
36
- it "configures Airbrake" do
37
- expect(configuration).to receive(:host=).with(host)
38
- expect(configuration).to receive(:project_key=).with(project_key)
39
-
40
- described_class.invoke
41
- end
42
-
43
- context "when airbrake is enabled" do
44
- it "does not tell Airbrake to ignore everything" do
45
- expect(Airbrake).not_to receive(:add_filter)
46
-
47
- described_class.invoke
48
- end
49
- end
50
-
51
- context "when airbrake is not enabled" do
52
- let(:enabled) { false }
53
-
54
- it "tells Airbrake to ignore everything" do
55
- expect(Airbrake).to receive(:add_filter) { |&block| expect(block).to be(&:ignore!) }
56
-
57
- described_class.invoke
58
- end
59
- end
60
- end
61
-
62
- end
63
- end
64
- end
@@ -1,22 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "spec_helper"
4
-
5
- module DefraRuby
6
- module Alert
7
- RSpec.describe Configuration do
8
- it "sets the appropriate default config settings" do
9
- fresh_config = described_class.new
10
-
11
- expect(fresh_config.root_directory).to be_nil
12
- expect(fresh_config.logger).to be_nil
13
- expect(fresh_config.environment).to be_nil
14
-
15
- expect(fresh_config.host).to be_nil
16
- expect(fresh_config.project_key).to be_nil
17
- expect(fresh_config.blocklist).to eq([])
18
- expect(fresh_config.enabled).to eq(false)
19
- end
20
- end
21
- end
22
- end
@@ -1,45 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "spec_helper"
4
-
5
- RSpec.describe DefraRuby::Alert do
6
- describe "VERSION" do
7
- it "is a version string in the correct format" do
8
- expect(DefraRuby::Alert::VERSION).to be_a(String)
9
- expect(DefraRuby::Alert::VERSION).to match(/\d+\.\d+\.\d+/)
10
- end
11
- end
12
-
13
- describe ".configuration" do
14
- context "when the host app has not provided configuration" do
15
- it "returns a DefraRuby::Alert::Configuration instance" do
16
- expect(described_class.configuration).to be_an_instance_of(DefraRuby::Alert::Configuration)
17
- end
18
- end
19
-
20
- context "when the host app has provided configuration" do
21
- let(:host) { "http://localhost:9012" }
22
-
23
- it "returns an DefraRuby::Alert::Configuration instance with a matching host" do
24
- described_class.configure { |config| config.host = host }
25
-
26
- expect(described_class.configuration.host).to eq(host)
27
- end
28
- end
29
- end
30
-
31
- describe ".start" do
32
- before do
33
- DefraRuby::Alert.configure do |c|
34
- c.enabled = false
35
- c.host = "http://localhost:8005"
36
- c.project_key = "ABC123456789"
37
- end
38
- end
39
- it "invokes 'AirbrakeRunner'" do
40
- expect(DefraRuby::Alert::AirbrakeRunner).to receive(:invoke)
41
-
42
- described_class.start
43
- end
44
- end
45
- end
data/spec/examples.txt DELETED
@@ -1,10 +0,0 @@
1
- example_id | status | run_time |
2
- -------------------------------------------------------- | ------ | --------------- |
3
- ./spec/defra_ruby/alert/airbrake_runner_spec.rb[1:1:1] | passed | 0.00255 seconds |
4
- ./spec/defra_ruby/alert/airbrake_runner_spec.rb[1:1:2:1] | passed | 0.00052 seconds |
5
- ./spec/defra_ruby/alert/airbrake_runner_spec.rb[1:1:3:1] | passed | 0.00062 seconds |
6
- ./spec/defra_ruby/alert/configuration_spec.rb[1:1] | passed | 0.00259 seconds |
7
- ./spec/defra_ruby/alert_spec.rb[1:1:1] | passed | 0.00304 seconds |
8
- ./spec/defra_ruby/alert_spec.rb[1:2:1:1] | passed | 0.0017 seconds |
9
- ./spec/defra_ruby/alert_spec.rb[1:2:2:1] | passed | 0.00178 seconds |
10
- ./spec/defra_ruby/alert_spec.rb[1:3:1] | passed | 0.01859 seconds |
data/spec/spec_helper.rb DELETED
@@ -1,83 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "bundler/setup"
4
-
5
- # Require and run our simplecov initializer as the very first thing we do.
6
- # This is as per its docs https://github.com/colszowka/simplecov#getting-started
7
- require "./spec/support/simplecov"
8
-
9
- # Requires supporting ruby files with custom matchers and macros, etc, in
10
- # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
11
- # run as spec files by default. This means that files in spec/support that end
12
- # in _spec.rb will both be required and run as specs, causing the specs to be
13
- # run twice. It is recommended that you do not name files matching this glob to
14
- # end with _spec.rb. You can configure this pattern with the --pattern
15
- # option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
16
- #
17
- # We make an exception for simplecov because that will already have been
18
- # required and run at the very top of spec_helper.rb
19
- support_files = Dir["./spec/support/**/*.rb"].reject { |file| file == "./spec/support/simplecov.rb" }
20
- support_files.each { |f| require f }
21
-
22
- RSpec.configure do |config|
23
- # rspec-expectations config goes here. You can use an alternate
24
- # assertion/expectation library such as wrong or the stdlib/minitest
25
- # assertions if you prefer.
26
- config.expect_with :rspec do |expectations|
27
- # This option will default to `true` in RSpec 4. It makes the `description`
28
- # and `failure_message` of custom matchers include text for helper methods
29
- # defined using `chain`, e.g.:
30
- # be_bigger_than(2).and_smaller_than(4).description
31
- # # => "be bigger than 2 and smaller than 4"
32
- # ...rather than:
33
- # # => "be bigger than 2"
34
- expectations.include_chain_clauses_in_custom_matcher_descriptions = true
35
- end
36
-
37
- # rspec-mocks config goes here. You can use an alternate test double
38
- # library (such as bogus or mocha) by changing the `mock_with` option here.
39
- config.mock_with :rspec do |mocks|
40
- # Prevents you from mocking or stubbing a method that does not exist on
41
- # a real object. This is generally recommended, and will default to
42
- # `true` in RSpec 4.
43
- mocks.verify_partial_doubles = true
44
- end
45
-
46
- # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
47
- # have no way to turn it off -- the option exists only for backwards
48
- # compatibility in RSpec 3). It causes shared context metadata to be
49
- # inherited by the metadata hash of host groups and examples, rather than
50
- # triggering implicit auto-inclusion in groups with matching metadata.
51
- config.shared_context_metadata_behavior = :apply_to_host_groups
52
-
53
- # This allows you to limit a spec run to individual examples or groups
54
- # you care about by tagging them with `:focus` metadata. When nothing
55
- # is tagged with `:focus`, all examples get run. RSpec also provides
56
- # aliases for `it`, `describe`, and `context` that include `:focus`
57
- # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
58
- config.filter_run_when_matching :focus
59
-
60
- # Allows RSpec to persist some state between runs in order to support
61
- # the `--only-failures` and `--next-failure` CLI options. We recommend
62
- # you configure your source control system to ignore this file.
63
- config.example_status_persistence_file_path = "spec/examples.txt"
64
-
65
- # Limits the available syntax to the non-monkey patched syntax that is
66
- # recommended. For more details, see:
67
- # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
68
- # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
69
- # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
70
- config.disable_monkey_patching!
71
-
72
- # Run specs in random order to surface order dependencies. If you find an
73
- # order dependency and want to debug it, you can fix the order by providing
74
- # the seed, which is printed after each run.
75
- # --seed 1234
76
- config.order = :random
77
-
78
- # Seed global randomization in this process using the `--seed` CLI option.
79
- # Setting this allows you to use `--seed` to deterministically reproduce
80
- # test failures related to randomization by passing the same `--seed` value
81
- # as the one that triggered the failure.
82
- Kernel.srand config.seed
83
- end
@@ -1,4 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Need to require our actual code files.
4
- require "defra_ruby/alert"
@@ -1,4 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Load env vars from a text file
4
- require "dotenv/load"
data/spec/support/pry.rb DELETED
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Support debugging in the tests. Add `binding.pry` wherever you want execution
4
- # to stop and the debugger to kick in.
5
- # Details on the debugging commands can be found here
6
- # https://github.com/deivid-rodriguez/pry-byebug#commands
7
- require "pry-byebug"
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "simplecov"
4
-
5
- # We start it with the rails param to ensure it includes coverage for all code
6
- # started by the rails app, and not just the files touched by our unit tests.
7
- # This gives us the most accurate assessment of our unit test coverage
8
- # https://github.com/colszowka/simplecov#getting-started
9
- SimpleCov.start do
10
- # We filter the spec folder, mainly to ensure that any dummy apps don't get
11
- # included in the coverage report. However our intent is that nothing in the
12
- # spec folder should be included
13
- add_filter "/spec/"
14
- # The version file is simply just that, so we do not feel the need to ensure
15
- # we have a test for it
16
- add_filter "lib/defra_ruby/alert/version"
17
- end
@@ -1,4 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Stubbing HTTP requests
4
- require "webmock/rspec"