stoplight-sentry 0.1.0 → 0.2.0
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.
- checksums.yaml +4 -4
- data/README.md +8 -6
- data/lib/stoplight/sentry/notifier.rb +1 -1
- data/lib/stoplight/sentry/version.rb +1 -1
- metadata +18 -35
- data/spec/spec_helper.rb +0 -15
- data/spec/stoplight/sentry/notifier_spec.rb +0 -62
- data/spec/stoplight/sentry_spec.rb +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 216e5cf5caa64afb6275b71f9c1bbd6d234c253eddaba28e9e67ec463ce4cc2f
|
4
|
+
data.tar.gz: 4c7202447924df8602462398c0b9819ea28487e0717055d3d7019097a92a1b2b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 398519fb1a514c7cdfc2d4ef05265e9b562ac4337de0148ea3a10b1661dfa5b3160153e8951655be05ca0883f1ee41a234c032d754f41d96c039896fbda7aab2
|
7
|
+
data.tar.gz: 1472510779c70c53ea762e07ddee41e1c854593931b61f90aa1f837b34612eb944b503b522e4a46eed4a9bb2d3e0940eb4e9419af8de67123725734bd6298906
|
data/README.md
CHANGED
@@ -26,18 +26,20 @@ Make sure you have the [sentry-ruby] gem installed before configuring Stoplight.
|
|
26
26
|
require 'sentry-ruby'
|
27
27
|
|
28
28
|
notifier = Stoplight::Sentry::Notifier.new(Sentry)
|
29
|
-
|
30
|
-
Stoplight
|
31
|
-
|
29
|
+
|
30
|
+
Stoplight.configure do |config|
|
31
|
+
config.notifiers += [notifier]
|
32
|
+
end
|
32
33
|
```
|
33
34
|
|
34
35
|
you can configure notifier to add custom option to the notification:
|
35
36
|
|
36
37
|
```ruby
|
37
38
|
notifier = Stoplight::Sentry::Notifier.new(Sentry, tags: {foo: 'bar'})
|
38
|
-
|
39
|
-
Stoplight
|
40
|
-
|
39
|
+
|
40
|
+
Stoplight.configure do |config|
|
41
|
+
config.notifiers += [notifier]
|
42
|
+
end
|
41
43
|
```
|
42
44
|
|
43
45
|
## Development
|
@@ -35,7 +35,7 @@ module Stoplight
|
|
35
35
|
# @param error []StandardError]
|
36
36
|
# @return [String]
|
37
37
|
def notify(light, from_color, to_color, error)
|
38
|
-
formatter.(light, from_color, to_color, error).tap do |message|
|
38
|
+
formatter.call(light, from_color, to_color, error).tap do |message|
|
39
39
|
options.merge(backtrace: error&.backtrace).then do |sentry_options|
|
40
40
|
sentry.capture_message(message, **sentry_options)
|
41
41
|
end
|
metadata
CHANGED
@@ -1,57 +1,48 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stoplight-sentry
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tëma Bolshakov
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: stoplight
|
15
14
|
requirement: !ruby/object:Gem::Requirement
|
16
15
|
requirements:
|
17
|
-
- - "
|
16
|
+
- - ">="
|
18
17
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
18
|
+
version: '4.0'
|
20
19
|
type: :runtime
|
21
20
|
prerelease: false
|
22
21
|
version_requirements: !ruby/object:Gem::Requirement
|
23
22
|
requirements:
|
24
|
-
- - "
|
23
|
+
- - ">="
|
25
24
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
25
|
+
version: '4.0'
|
27
26
|
- !ruby/object:Gem::Dependency
|
28
27
|
name: sentry-ruby
|
29
28
|
requirement: !ruby/object:Gem::Requirement
|
30
29
|
requirements:
|
31
|
-
- - "
|
30
|
+
- - ">="
|
32
31
|
- !ruby/object:Gem::Version
|
33
|
-
version: '5
|
32
|
+
version: '5'
|
33
|
+
- - "<"
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '6.0'
|
34
36
|
type: :runtime
|
35
37
|
prerelease: false
|
36
38
|
version_requirements: !ruby/object:Gem::Requirement
|
37
39
|
requirements:
|
38
|
-
- - "
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '5.7'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: ruby_coding_standard
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - '='
|
40
|
+
- - ">="
|
46
41
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
48
|
-
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - '='
|
42
|
+
version: '5'
|
43
|
+
- - "<"
|
53
44
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
45
|
+
version: '6.0'
|
55
46
|
description: Sentry notifier for Stoplight
|
56
47
|
email:
|
57
48
|
- either.free@gmail.com
|
@@ -64,9 +55,6 @@ files:
|
|
64
55
|
- lib/stoplight/sentry.rb
|
65
56
|
- lib/stoplight/sentry/notifier.rb
|
66
57
|
- lib/stoplight/sentry/version.rb
|
67
|
-
- spec/spec_helper.rb
|
68
|
-
- spec/stoplight/sentry/notifier_spec.rb
|
69
|
-
- spec/stoplight/sentry_spec.rb
|
70
58
|
homepage: https://github.com/bolshakov/stoplight-sentry
|
71
59
|
licenses:
|
72
60
|
- MIT
|
@@ -74,7 +62,6 @@ metadata:
|
|
74
62
|
homepage_uri: https://github.com/bolshakov/stoplight-sentry
|
75
63
|
source_code_uri: https://github.com/bolshakov/stoplight-sentry
|
76
64
|
changelog_uri: https://github.com/bolshakov/stoplight-sentry/releases
|
77
|
-
post_install_message:
|
78
65
|
rdoc_options: []
|
79
66
|
require_paths:
|
80
67
|
- lib
|
@@ -82,18 +69,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
82
69
|
requirements:
|
83
70
|
- - ">="
|
84
71
|
- !ruby/object:Gem::Version
|
85
|
-
version: '2
|
72
|
+
version: '3.2'
|
86
73
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
74
|
requirements:
|
88
75
|
- - ">="
|
89
76
|
- !ruby/object:Gem::Version
|
90
77
|
version: '0'
|
91
78
|
requirements: []
|
92
|
-
rubygems_version: 3.
|
93
|
-
signing_key:
|
79
|
+
rubygems_version: 3.6.9
|
94
80
|
specification_version: 4
|
95
81
|
summary: Sentry notifier for Stoplight
|
96
|
-
test_files:
|
97
|
-
- spec/spec_helper.rb
|
98
|
-
- spec/stoplight/sentry/notifier_spec.rb
|
99
|
-
- spec/stoplight/sentry_spec.rb
|
82
|
+
test_files: []
|
data/spec/spec_helper.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "stoplight/sentry"
|
4
|
-
|
5
|
-
RSpec.configure do |config|
|
6
|
-
# Enable flags like --only-failures and --next-failure
|
7
|
-
config.example_status_persistence_file_path = ".rspec_status"
|
8
|
-
|
9
|
-
# Disable RSpec exposing methods globally on `Module` and `main`
|
10
|
-
config.disable_monkey_patching!
|
11
|
-
|
12
|
-
config.expect_with :rspec do |c|
|
13
|
-
c.syntax = :expect
|
14
|
-
end
|
15
|
-
end
|
@@ -1,62 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "securerandom"
|
4
|
-
|
5
|
-
RSpec.describe Stoplight::Sentry::Notifier do
|
6
|
-
subject(:notify) { notifier.notify(light, from_color, to_color, error) }
|
7
|
-
|
8
|
-
let(:notifier) { described_class.new(sentry, formatter, **options) }
|
9
|
-
let(:sentry) { class_double(Sentry) }
|
10
|
-
let(:light) { instance_double(Stoplight::Light, name: "light-name") }
|
11
|
-
let(:from_color) { Stoplight::Color::GREEN }
|
12
|
-
let(:to_color) { Stoplight::Color::RED }
|
13
|
-
let(:error) { StandardError.new("something went wrong").tap { _1.set_backtrace(backtrace) } }
|
14
|
-
let(:backtrace) { ["foo", "bar"] }
|
15
|
-
let(:options) { {} }
|
16
|
-
|
17
|
-
context "when formatter is provided" do
|
18
|
-
let(:formatter) { instance_double(Proc) }
|
19
|
-
let(:message) { SecureRandom.uuid }
|
20
|
-
|
21
|
-
before do
|
22
|
-
expect(formatter).to receive(:call).with(light, from_color, to_color, error) { message }
|
23
|
-
end
|
24
|
-
|
25
|
-
it "notifies sentry" do
|
26
|
-
expect(sentry).to receive(:capture_message).with(message, backtrace: backtrace)
|
27
|
-
|
28
|
-
expect(notify).to eq(message)
|
29
|
-
end
|
30
|
-
|
31
|
-
context "with custom options" do
|
32
|
-
let(:options) { { tags: { foo: "bar" }} }
|
33
|
-
|
34
|
-
it "notifies sentry" do
|
35
|
-
expect(sentry).to receive(:capture_message).with(message, backtrace: backtrace, tags: { foo: "bar" })
|
36
|
-
|
37
|
-
expect(notify).to eq(message)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
context "when formatter is not provided" do
|
43
|
-
let(:formatter) { nil }
|
44
|
-
let(:message) { "Switching light-name from green to red because StandardError something went wrong" }
|
45
|
-
|
46
|
-
it "notifies sentry" do
|
47
|
-
expect(sentry).to receive(:capture_message).with(message, backtrace: backtrace)
|
48
|
-
|
49
|
-
notify
|
50
|
-
end
|
51
|
-
|
52
|
-
context "with custom options" do
|
53
|
-
let(:options) { { tags: { foo: "bar" }} }
|
54
|
-
|
55
|
-
it "notifies sentry" do
|
56
|
-
expect(sentry).to receive(:capture_message).with(message, backtrace: backtrace, tags: { foo: "bar" })
|
57
|
-
|
58
|
-
expect(notify).to eq(message)
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|