airbrake-ruby 1.0.0.rc.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/airbrake-ruby.rb +292 -0
- data/lib/airbrake-ruby/async_sender.rb +90 -0
- data/lib/airbrake-ruby/backtrace.rb +75 -0
- data/lib/airbrake-ruby/config.rb +120 -0
- data/lib/airbrake-ruby/filter_chain.rb +86 -0
- data/lib/airbrake-ruby/filters.rb +10 -0
- data/lib/airbrake-ruby/filters/keys_blacklist.rb +37 -0
- data/lib/airbrake-ruby/filters/keys_filter.rb +65 -0
- data/lib/airbrake-ruby/filters/keys_whitelist.rb +37 -0
- data/lib/airbrake-ruby/notice.rb +207 -0
- data/lib/airbrake-ruby/notifier.rb +145 -0
- data/lib/airbrake-ruby/payload_truncator.rb +141 -0
- data/lib/airbrake-ruby/response.rb +53 -0
- data/lib/airbrake-ruby/sync_sender.rb +76 -0
- data/lib/airbrake-ruby/version.rb +7 -0
- data/spec/airbrake_spec.rb +177 -0
- data/spec/async_sender_spec.rb +121 -0
- data/spec/backtrace_spec.rb +77 -0
- data/spec/config_spec.rb +67 -0
- data/spec/filter_chain_spec.rb +157 -0
- data/spec/notice_spec.rb +190 -0
- data/spec/notifier_spec.rb +690 -0
- data/spec/notifier_spec/options_spec.rb +217 -0
- data/spec/payload_truncator_spec.rb +458 -0
- data/spec/spec_helper.rb +98 -0
- metadata +158 -0
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
require 'airbrake-ruby'
|
2
|
+
|
3
|
+
require 'webmock'
|
4
|
+
require 'webmock/rspec'
|
5
|
+
require 'pry'
|
6
|
+
|
7
|
+
require 'pathname'
|
8
|
+
require 'webrick'
|
9
|
+
require 'English'
|
10
|
+
require 'base64'
|
11
|
+
|
12
|
+
RSpec.configure do |c|
|
13
|
+
c.order = 'random'
|
14
|
+
c.color = true
|
15
|
+
c.disable_monkey_patching!
|
16
|
+
end
|
17
|
+
|
18
|
+
Thread.abort_on_exception = true
|
19
|
+
|
20
|
+
WebMock.disable_net_connect!(allow_localhost: true)
|
21
|
+
|
22
|
+
class AirbrakeTestError < RuntimeError
|
23
|
+
attr_reader :backtrace
|
24
|
+
|
25
|
+
def initialize(*)
|
26
|
+
super
|
27
|
+
# rubocop:disable Metrics/LineLength
|
28
|
+
@backtrace = [
|
29
|
+
"/home/kyrylo/code/airbrake/ruby/spec/spec_helper.rb:23:in `<top (required)>'",
|
30
|
+
"/opt/rubies/ruby-2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'",
|
31
|
+
"/opt/rubies/ruby-2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'",
|
32
|
+
"/home/kyrylo/code/airbrake/ruby/spec/airbrake_spec.rb:1:in `<top (required)>'",
|
33
|
+
"/home/kyrylo/.gem/ruby/2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/configuration.rb:1327:in `load'",
|
34
|
+
"/home/kyrylo/.gem/ruby/2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/configuration.rb:1327:in `block in load_spec_files'",
|
35
|
+
"/home/kyrylo/.gem/ruby/2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/configuration.rb:1325:in `each'",
|
36
|
+
"/home/kyrylo/.gem/ruby/2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/configuration.rb:1325:in `load_spec_files'",
|
37
|
+
"/home/kyrylo/.gem/ruby/2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:102:in `setup'",
|
38
|
+
"/home/kyrylo/.gem/ruby/2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:88:in `run'",
|
39
|
+
"/home/kyrylo/.gem/ruby/2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:73:in `run'",
|
40
|
+
"/home/kyrylo/.gem/ruby/2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:41:in `invoke'",
|
41
|
+
"/home/kyrylo/.gem/ruby/2.2.2/gems/rspec-core-3.3.2/exe/rspec:4:in `<main>'"
|
42
|
+
]
|
43
|
+
# rubocop:enable Metrics/LineLength
|
44
|
+
end
|
45
|
+
|
46
|
+
# rubocop:disable Style/AccessorMethodName
|
47
|
+
def set_backtrace(backtrace)
|
48
|
+
@backtrace = backtrace
|
49
|
+
end
|
50
|
+
# rubocop:enable Style/AccessorMethodName
|
51
|
+
|
52
|
+
def message
|
53
|
+
'App crashed!'
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
class JavaAirbrakeTestError < AirbrakeTestError
|
58
|
+
def initialize(*)
|
59
|
+
super
|
60
|
+
# rubocop:disable Metrics/LineLength
|
61
|
+
@backtrace = [
|
62
|
+
"org.jruby.java.invokers.InstanceMethodInvoker.call(InstanceMethodInvoker.java:26)",
|
63
|
+
"org.jruby.ir.interpreter.Interpreter.INTERPRET_EVAL(Interpreter.java:126)",
|
64
|
+
"org.jruby.RubyKernel$INVOKER$s$0$3$eval19.call(RubyKernel$INVOKER$s$0$3$eval19.gen)",
|
65
|
+
"org.jruby.RubyKernel$INVOKER$s$0$0$loop.call(RubyKernel$INVOKER$s$0$0$loop.gen)",
|
66
|
+
"org.jruby.runtime.IRBlockBody.doYield(IRBlockBody.java:139)",
|
67
|
+
"org.jruby.RubyKernel$INVOKER$s$rbCatch19.call(RubyKernel$INVOKER$s$rbCatch19.gen)",
|
68
|
+
"opt.rubies.jruby_minus_9_dot_0_dot_0_dot_0.bin.irb.invokeOther4:start(/opt/rubies/jruby-9.0.0.0/bin/irb)",
|
69
|
+
"opt.rubies.jruby_minus_9_dot_0_dot_0_dot_0.bin.irb.RUBY$script(/opt/rubies/jruby-9.0.0.0/bin/irb:13)",
|
70
|
+
"org.jruby.ir.Compiler$1.load(Compiler.java:111)",
|
71
|
+
"org.jruby.Main.run(Main.java:225)",
|
72
|
+
"org.jruby.Main.main(Main.java:197)"
|
73
|
+
]
|
74
|
+
# rubocop:enable Metrics/LineLength
|
75
|
+
end
|
76
|
+
|
77
|
+
def is_a?(*)
|
78
|
+
true
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
class Ruby21Error < RuntimeError
|
83
|
+
attr_accessor :cause
|
84
|
+
|
85
|
+
def self.raise_error(msg)
|
86
|
+
ex = new(msg)
|
87
|
+
ex.cause = $ERROR_INFO
|
88
|
+
|
89
|
+
raise ex
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
puts <<EOS
|
94
|
+
#{'#' * 80}
|
95
|
+
# RUBY_VERSION: #{RUBY_VERSION}
|
96
|
+
# RUBY_ENGINE: #{RUBY_ENGINE}
|
97
|
+
#{'#' * 80}
|
98
|
+
EOS
|
metadata
ADDED
@@ -0,0 +1,158 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: airbrake-ruby
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0.rc.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Airbrake Technologies, Inc.
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-12-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rspec
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: pry
|
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: webmock
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: benchmark-ips
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '2'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '2'
|
83
|
+
description: |
|
84
|
+
Airbrake Ruby is a plain Ruby notifier for Airbrake (https://airbrake.io), the
|
85
|
+
leading exception reporting service. Airbrake Ruby provides minimalist API that
|
86
|
+
enables the ability to send any Ruby exception to the Airbrake dashboard. The
|
87
|
+
library is extremely lightweight, contains no dependencies and perfectly suits
|
88
|
+
plain Ruby applications. For apps that are built with Rails, Sinatra or any
|
89
|
+
other Rack-compliant web framework we offer the airbrake gem
|
90
|
+
(https://github.com/airbrake/airbrake). It has additional features such as
|
91
|
+
reporting of any unhandled exceptions automatically, integrations with Resque,
|
92
|
+
Sidekiq, Delayed Job and many more.
|
93
|
+
email: support@airbrake.io
|
94
|
+
executables: []
|
95
|
+
extensions: []
|
96
|
+
extra_rdoc_files: []
|
97
|
+
files:
|
98
|
+
- lib/airbrake-ruby.rb
|
99
|
+
- lib/airbrake-ruby/async_sender.rb
|
100
|
+
- lib/airbrake-ruby/backtrace.rb
|
101
|
+
- lib/airbrake-ruby/config.rb
|
102
|
+
- lib/airbrake-ruby/filter_chain.rb
|
103
|
+
- lib/airbrake-ruby/filters.rb
|
104
|
+
- lib/airbrake-ruby/filters/keys_blacklist.rb
|
105
|
+
- lib/airbrake-ruby/filters/keys_filter.rb
|
106
|
+
- lib/airbrake-ruby/filters/keys_whitelist.rb
|
107
|
+
- lib/airbrake-ruby/notice.rb
|
108
|
+
- lib/airbrake-ruby/notifier.rb
|
109
|
+
- lib/airbrake-ruby/payload_truncator.rb
|
110
|
+
- lib/airbrake-ruby/response.rb
|
111
|
+
- lib/airbrake-ruby/sync_sender.rb
|
112
|
+
- lib/airbrake-ruby/version.rb
|
113
|
+
- spec/airbrake_spec.rb
|
114
|
+
- spec/async_sender_spec.rb
|
115
|
+
- spec/backtrace_spec.rb
|
116
|
+
- spec/config_spec.rb
|
117
|
+
- spec/filter_chain_spec.rb
|
118
|
+
- spec/notice_spec.rb
|
119
|
+
- spec/notifier_spec.rb
|
120
|
+
- spec/notifier_spec/options_spec.rb
|
121
|
+
- spec/payload_truncator_spec.rb
|
122
|
+
- spec/spec_helper.rb
|
123
|
+
homepage: https://airbrake.io
|
124
|
+
licenses:
|
125
|
+
- MIT
|
126
|
+
metadata: {}
|
127
|
+
post_install_message:
|
128
|
+
rdoc_options: []
|
129
|
+
require_paths:
|
130
|
+
- lib
|
131
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
132
|
+
requirements:
|
133
|
+
- - ">="
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: '0'
|
136
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
137
|
+
requirements:
|
138
|
+
- - ">"
|
139
|
+
- !ruby/object:Gem::Version
|
140
|
+
version: 1.3.1
|
141
|
+
requirements: []
|
142
|
+
rubyforge_project:
|
143
|
+
rubygems_version: 2.4.5
|
144
|
+
signing_key:
|
145
|
+
specification_version: 4
|
146
|
+
summary: Ruby notifier for https://airbrake.io
|
147
|
+
test_files:
|
148
|
+
- spec/notifier_spec/options_spec.rb
|
149
|
+
- spec/async_sender_spec.rb
|
150
|
+
- spec/spec_helper.rb
|
151
|
+
- spec/notifier_spec.rb
|
152
|
+
- spec/payload_truncator_spec.rb
|
153
|
+
- spec/airbrake_spec.rb
|
154
|
+
- spec/backtrace_spec.rb
|
155
|
+
- spec/notice_spec.rb
|
156
|
+
- spec/config_spec.rb
|
157
|
+
- spec/filter_chain_spec.rb
|
158
|
+
has_rdoc:
|