bug_bot 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 +51 -25
- data/lib/bug_bot.rb +6 -4
- data/lib/bug_bot/adapter.rb +2 -2
- data/lib/bug_bot/adapters/airbrake.rb +4 -2
- data/lib/bug_bot/adapters/bugsnag.rb +4 -2
- data/lib/bug_bot/identity.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 170ae14d120c32b4569474cbcf74203fe552c348c896e0809486b68b08212d0b
|
|
4
|
+
data.tar.gz: 2dac4f4f4dcc618eded809f4aca2de48f7e5afe739f31f4c6452e917fa677691
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e1dd284537652ada0085a796a0d08ab48977c97335103b0747f42699d98d6dea40c291bc88b70d4167f66237b352121d66498df5a534af30b3ad3b350eb97c65
|
|
7
|
+
data.tar.gz: 788dfe83cea3ac4c4d1ab745fe5e6224b02a467f441ff9da5c0470ee730b921ee5b74ed736ce3c48cb79d09b0013175edfcf854b5a2b809dc4986f50730c9a52
|
data/README.md
CHANGED
|
@@ -2,49 +2,73 @@
|
|
|
2
2
|
|
|
3
3
|
[](http://badge.fury.io/rb/bug_bot)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
BugBot is a simple error monitoring gem that abstracts multiple reporting tools in one.
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## Features
|
|
8
|
+
- Easily switch error monitoring provider by changing config only
|
|
9
|
+
- Supported adapters
|
|
10
|
+
- [Airbrake](https://github.com/airbrake/airbrake-ruby)
|
|
11
|
+
- [Bugsnag](https://github.com/bugsnag/bugsnag-ruby)
|
|
12
|
+
- Upcoming features
|
|
13
|
+
- Support for custom payloads and metadata
|
|
14
|
+
- Aditional adapters for [Sentry](https://github.com/getsentry/raven-ruby) and [Rollbar](https://github.com/rollbar/rollbar-gem)
|
|
15
|
+
- Advanced configuration
|
|
8
16
|
|
|
9
|
-
|
|
10
|
-
- [Screencasts](#screencasts)
|
|
11
|
-
- [Requirements](#requirements)
|
|
12
|
-
- [Setup](#setup)
|
|
13
|
-
- [Usage](#usage)
|
|
14
|
-
- [Tests](#tests)
|
|
15
|
-
- [Versioning](#versioning)
|
|
16
|
-
- [Contributions](#contributions)
|
|
17
|
-
- [License](#license)
|
|
18
|
-
- [History](#history)
|
|
19
|
-
- [Credits](#credits)
|
|
17
|
+
## Getting started
|
|
20
18
|
|
|
21
|
-
|
|
19
|
+
To install, run:
|
|
22
20
|
|
|
23
|
-
|
|
21
|
+
gem install bug_bot
|
|
24
22
|
|
|
25
|
-
|
|
23
|
+
Add the following to your Gemfile:
|
|
26
24
|
|
|
27
|
-
|
|
25
|
+
gem "bug_bot", '~> 0.1.0'
|
|
28
26
|
|
|
29
|
-
|
|
27
|
+
After you've added the `bug_bot` gem, please install one of the gems for the monitoring platform you want to use.
|
|
28
|
+
To accomplish that, you can use one of the following installation guides:
|
|
30
29
|
|
|
31
|
-
|
|
30
|
+
- [Airbrake](https://github.com/airbrake/airbrake-ruby#installation)
|
|
31
|
+
- [Bugsnag](https://docs.bugsnag.com/platforms/ruby/rails/#installation)
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
## Usage
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
### Reporting exceptions
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
After installing one of the supported gems, reporting of unhandled exceptions should happen automatically and be visible for you in their respective monitoring dashboard.
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
Report handled exceptions of errors can be done with:
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
```ruby
|
|
42
|
+
begin
|
|
43
|
+
raise 'Robots are taking over!'
|
|
44
|
+
rescue => exception
|
|
45
|
+
BugBot.notify(exception)
|
|
46
|
+
end
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
#### Custom payload
|
|
50
|
+
If you need to add custom payload to the error report you can do this by providing a an options hash.
|
|
51
|
+
|
|
52
|
+
```ruby
|
|
53
|
+
begin
|
|
54
|
+
raise 'Robots are taking over!'
|
|
55
|
+
rescue => exception
|
|
56
|
+
BugBot.notify(exception, {
|
|
57
|
+
foo: {
|
|
58
|
+
bar: 'baz'
|
|
59
|
+
}
|
|
60
|
+
})
|
|
61
|
+
end
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Changing the provider
|
|
65
|
+
Changing of the monitoring provider should be easily achieved just by installing/configuring the other gem.
|
|
42
66
|
|
|
43
67
|
## Tests
|
|
44
68
|
|
|
45
69
|
To test, run:
|
|
46
70
|
|
|
47
|
-
bundle exec
|
|
71
|
+
bundle exec rspec
|
|
48
72
|
|
|
49
73
|
## Versioning
|
|
50
74
|
|
|
@@ -63,4 +87,6 @@ Read [CONTRIBUTING](CONTRIBUTING.md) for details.
|
|
|
63
87
|
Copyright 2018 []().
|
|
64
88
|
Read [LICENSE](LICENSE.md) for details.
|
|
65
89
|
|
|
90
|
+
## History
|
|
66
91
|
|
|
92
|
+
Read [CHANGES](CHANGES.md) for details.
|
data/lib/bug_bot.rb
CHANGED
|
@@ -25,6 +25,10 @@ module BugBot
|
|
|
25
25
|
|
|
26
26
|
alias adapter= use_adapter
|
|
27
27
|
|
|
28
|
+
def notify(exception, options = {})
|
|
29
|
+
adapter.notify(exception, options)
|
|
30
|
+
end
|
|
31
|
+
|
|
28
32
|
def default_adapter
|
|
29
33
|
return :airbrake if defined?(::Airbrake)
|
|
30
34
|
return :bugsnag if defined?(::Bugsnag)
|
|
@@ -37,13 +41,11 @@ module BugBot
|
|
|
37
41
|
# TODO: Return default adapter here
|
|
38
42
|
end
|
|
39
43
|
|
|
44
|
+
private
|
|
45
|
+
|
|
40
46
|
def load_adapter(name)
|
|
41
47
|
require "bug_bot/adapters/#{name.downcase}"
|
|
42
48
|
|
|
43
49
|
BugBot::Adapters.const_get(name.capitalize)
|
|
44
50
|
end
|
|
45
|
-
|
|
46
|
-
def notify(exception, &block)
|
|
47
|
-
adapter.notify(exception, &block)
|
|
48
|
-
end
|
|
49
51
|
end
|
data/lib/bug_bot/adapter.rb
CHANGED
|
@@ -4,8 +4,10 @@ require 'bug_bot/adapter'
|
|
|
4
4
|
module BugBot
|
|
5
5
|
module Adapters
|
|
6
6
|
class Airbrake < Adapter
|
|
7
|
-
def notify(exception,
|
|
8
|
-
::Airbrake.notify(exception
|
|
7
|
+
def notify(exception, options = {})
|
|
8
|
+
::Airbrake.notify(exception) do |report|
|
|
9
|
+
report[:params].merge!(options)
|
|
10
|
+
end
|
|
9
11
|
end
|
|
10
12
|
end
|
|
11
13
|
end
|
|
@@ -4,8 +4,10 @@ require 'bug_bot/adapter'
|
|
|
4
4
|
module BugBot
|
|
5
5
|
module Adapters
|
|
6
6
|
class Bugsnag < Adapter
|
|
7
|
-
def notify(exception,
|
|
8
|
-
::Bugsnag.notify(exception
|
|
7
|
+
def notify(exception, options = {})
|
|
8
|
+
::Bugsnag.notify(exception) do |report|
|
|
9
|
+
report.meta_data = options
|
|
10
|
+
end
|
|
9
11
|
end
|
|
10
12
|
end
|
|
11
13
|
end
|
data/lib/bug_bot/identity.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bug_bot
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Amir Mujkic
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2018-12-
|
|
11
|
+
date: 2018-12-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: pry
|
|
@@ -122,7 +122,7 @@ files:
|
|
|
122
122
|
- lib/bug_bot/adapters/airbrake.rb
|
|
123
123
|
- lib/bug_bot/adapters/bugsnag.rb
|
|
124
124
|
- lib/bug_bot/identity.rb
|
|
125
|
-
homepage:
|
|
125
|
+
homepage: https://github.com/amirmujkic/bug_bot
|
|
126
126
|
licenses:
|
|
127
127
|
- MIT
|
|
128
128
|
metadata:
|
|
@@ -146,5 +146,5 @@ rubyforge_project:
|
|
|
146
146
|
rubygems_version: 2.7.6
|
|
147
147
|
signing_key:
|
|
148
148
|
specification_version: 4
|
|
149
|
-
summary:
|
|
149
|
+
summary: A simple gem that abstracts error monitoring
|
|
150
150
|
test_files: []
|