bugsify 1.0.3 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/bugsify.gemspec +12 -12
- data/lib/bugsify/{client.rb → client/client.rb} +0 -0
- data/lib/bugsify/config/config.rb +44 -0
- data/lib/bugsify/{engines → engine}/bugsify.rb +1 -2
- data/lib/bugsify/middleware/middleware.rb +18 -0
- data/lib/bugsify/{notifier.rb → notifier/notifier.rb} +13 -4
- data/lib/bugsify/parser/parser.rb +56 -0
- data/lib/bugsify/reporter/reporter.rb +17 -0
- data/lib/bugsify.rb +9 -8
- metadata +9 -13
- data/lib/bugsify/config.rb +0 -27
- data/lib/bugsify/middlewares/padrino.rb +0 -39
- data/lib/bugsify/middlewares/rails.rb +0 -42
- data/lib/bugsify/middlewares/sinatra.rb +0 -39
- data/lib/bugsify/reporters/rack.rb +0 -18
- data/lib/bugsify/reporters/rails.rb +0 -26
- data/lib/bugsify/version.rb +0 -5
- data/sig/bugsify.rbs +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 85caf0bd205a532ee78258e22eb3b6b20e7079b7a413ded72837717187297cc7
|
4
|
+
data.tar.gz: 43da62d201e63ff5dc1187953bd2f81a49e2aa2f85f0859e2faee1cad1d18280
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 362505cd1565d01bc6c27d9603544641c159d2981e8e62ecd5935f79aac1948adc5754b64012d888fedc35dbf3a333a11bb7d010b678fdf95f22e6ae830a1418
|
7
|
+
data.tar.gz: 83ee8cfdee730f5b65a07c9aa431e118b5bbeed36ccd37c1a41bdc3f752a355127cbc09be9b52ab357881a942deee7fac30527abb7ecd1c0c9923d0da5231370
|
data/Gemfile.lock
CHANGED
data/bugsify.gemspec
CHANGED
@@ -1,22 +1,22 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative "lib/bugsify/
|
3
|
+
require_relative "lib/bugsify/config/config"
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
|
-
spec.name =
|
7
|
-
spec.version = Bugsify::VERSION
|
8
|
-
spec.authors =
|
9
|
-
spec.email =
|
6
|
+
spec.name = Bugsify::Config::NAME
|
7
|
+
spec.version = Bugsify::Config::VERSION
|
8
|
+
spec.authors = Bugsify::Config::AUTHORS
|
9
|
+
spec.email = Bugsify::Config::EMAIL
|
10
10
|
|
11
|
-
spec.summary =
|
12
|
-
spec.description =
|
13
|
-
spec.homepage =
|
14
|
-
spec.license =
|
15
|
-
spec.required_ruby_version =
|
11
|
+
spec.summary = Bugsify::Config::SUMMARY
|
12
|
+
spec.description = Bugsify::Config::DESCRIPTION
|
13
|
+
spec.homepage = Bugsify::Config::HOMEPAGE
|
14
|
+
spec.license = Bugsify::Config::LICENSE
|
15
|
+
spec.required_ruby_version = Bugsify::Config::REQUIRED_RUBY_VERSION
|
16
16
|
|
17
17
|
spec.metadata["homepage_uri"] = spec.homepage
|
18
|
-
spec.metadata["source_code_uri"] =
|
19
|
-
spec.metadata["changelog_uri"] =
|
18
|
+
spec.metadata["source_code_uri"] = Bugsify::Config::SOURCE_CODE_URI
|
19
|
+
spec.metadata["changelog_uri"] = Bugsify::Config::CHANGELOG_URI
|
20
20
|
|
21
21
|
spec.files = Dir.chdir(__dir__) do
|
22
22
|
`git ls-files -z`.split("\x0").reject do |f|
|
File without changes
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bugsify
|
4
|
+
# Config
|
5
|
+
module Config
|
6
|
+
def self.included(host_class)
|
7
|
+
host_class.extend ClassMethods
|
8
|
+
end
|
9
|
+
|
10
|
+
# ClassMethods
|
11
|
+
module ClassMethods
|
12
|
+
def config
|
13
|
+
@config ||= Configuration.new
|
14
|
+
end
|
15
|
+
|
16
|
+
def configure
|
17
|
+
yield config
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
extend ClassMethods
|
22
|
+
|
23
|
+
# Configuration
|
24
|
+
class Configuration
|
25
|
+
attr_accessor :api_key
|
26
|
+
end
|
27
|
+
|
28
|
+
specs = {
|
29
|
+
name: "bugsify",
|
30
|
+
version: "1.0.5",
|
31
|
+
authors: ["Aleksandar Popovic"],
|
32
|
+
email: ["aleksandar.popovic@hotmail.com"],
|
33
|
+
summary: "Ruby notifier for bugsify.io",
|
34
|
+
description: "Bugsify error monitoring & exception reporter for Ruby",
|
35
|
+
homepage: "https://github.com/bugsify/bugsify_ruby",
|
36
|
+
license: "MIT",
|
37
|
+
required_ruby_version: ">= 2.6.0",
|
38
|
+
source_code_uri: "https://github.com/bugsify/bugsify_ruby",
|
39
|
+
changelog_uri: "https://github.com/bugsify/bugsify_ruby/blob/main/CHANGELOG.md"
|
40
|
+
}
|
41
|
+
|
42
|
+
specs.each { |k, v| const_set(k.upcase, v) }
|
43
|
+
end
|
44
|
+
end
|
@@ -2,13 +2,12 @@
|
|
2
2
|
|
3
3
|
if Gem.loaded_specs.key?("rails")
|
4
4
|
require "rails"
|
5
|
-
require_relative "../middlewares/rails"
|
6
5
|
|
7
6
|
module Bugsify
|
8
7
|
# BugsifyEngine
|
9
8
|
class BugsifyEngine < Rails::Engine
|
10
9
|
initializer "bugsify_engine.add_middleware" do |app|
|
11
|
-
app.middleware.use
|
10
|
+
app.middleware.use Middleware
|
12
11
|
end
|
13
12
|
end
|
14
13
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bugsify
|
4
|
+
# Middleware
|
5
|
+
class Middleware
|
6
|
+
include Parser
|
7
|
+
|
8
|
+
def initialize(app)
|
9
|
+
@app = app
|
10
|
+
end
|
11
|
+
|
12
|
+
def call(env)
|
13
|
+
@app.call(env)
|
14
|
+
rescue Exception => e
|
15
|
+
Gem.loaded_specs.key?("rails") ? rails(e) : rack(e)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -3,8 +3,19 @@
|
|
3
3
|
module Bugsify
|
4
4
|
# Error
|
5
5
|
module Notifier
|
6
|
+
include Client
|
7
|
+
include Parser
|
8
|
+
|
9
|
+
def capture_exception(exception)
|
10
|
+
raise "Argument #{exception} is not exception" unless exception.is_a?(Exception)
|
11
|
+
|
12
|
+
manual(exception)
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
6
17
|
# rubocop:disable Metrics/MethodLength
|
7
|
-
def
|
18
|
+
def auto_capture_exception(args = {})
|
8
19
|
params = {
|
9
20
|
errorClass: args[:errorClass],
|
10
21
|
errorBacktrace: args[:errorBacktrace],
|
@@ -13,7 +24,7 @@ module Bugsify
|
|
13
24
|
applicationEnvironment: args[:applicationEnvironment]
|
14
25
|
}
|
15
26
|
|
16
|
-
|
27
|
+
Api.new.request(
|
17
28
|
"collectors/ruby",
|
18
29
|
"Post",
|
19
30
|
params,
|
@@ -22,8 +33,6 @@ module Bugsify
|
|
22
33
|
end
|
23
34
|
# rubocop:enable Metrics/MethodLength
|
24
35
|
|
25
|
-
private
|
26
|
-
|
27
36
|
def parse(response)
|
28
37
|
puts response
|
29
38
|
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "debug"
|
4
|
+
|
5
|
+
module Bugsify
|
6
|
+
# Rails
|
7
|
+
module Parser
|
8
|
+
include Reporter
|
9
|
+
|
10
|
+
def rails(e)
|
11
|
+
trace = e.backtrace.select { |l| l.start_with?(Rack::Directory.new("").root) }.join("\n ")
|
12
|
+
payload = {
|
13
|
+
error_class: e.class,
|
14
|
+
error_backtrace: "\n#{e.class}\n#{e.message}\n#{trace}",
|
15
|
+
error_full_backtrace: e.backtrace.select { |l| l }.join("\n "),
|
16
|
+
runtime_version: runtime_version
|
17
|
+
}
|
18
|
+
report(payload)
|
19
|
+
raise e
|
20
|
+
end
|
21
|
+
|
22
|
+
def rack(e)
|
23
|
+
payload = {
|
24
|
+
error_class: e.class,
|
25
|
+
error_backtrace: e,
|
26
|
+
error_full_backtrace: "\n#{e.class}\n#{e.message}\n#{e}",
|
27
|
+
runtime_version: runtime_version
|
28
|
+
}
|
29
|
+
report(payload)
|
30
|
+
raise e
|
31
|
+
end
|
32
|
+
|
33
|
+
def manual(e)
|
34
|
+
debugger
|
35
|
+
payload = {
|
36
|
+
error_class: e.class,
|
37
|
+
error_backtrace: e,
|
38
|
+
runtime_version: runtime_version
|
39
|
+
}
|
40
|
+
report(payload)
|
41
|
+
raise e
|
42
|
+
end
|
43
|
+
|
44
|
+
private
|
45
|
+
|
46
|
+
def runtime_version
|
47
|
+
{
|
48
|
+
ruby_version: RUBY_VERSION,
|
49
|
+
ruby_release_date: RUBY_RELEASE_DATE,
|
50
|
+
ruby_platform: RUBY_PLATFORM,
|
51
|
+
load_path: $LOAD_PATH,
|
52
|
+
env: ENV
|
53
|
+
}
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bugsify
|
4
|
+
# Rack
|
5
|
+
module Reporter
|
6
|
+
# @param [Object] event
|
7
|
+
def report(event)
|
8
|
+
Bugsify.send(:auto_capture_exception, {
|
9
|
+
errorClass: event[:error_class],
|
10
|
+
errorBacktrace: event[:error_backtrace],
|
11
|
+
errorFullBacktrace: event[:error_full_backtrace],
|
12
|
+
runtimeVersion: event[:runtime_version],
|
13
|
+
applicationEnvironment: ENV.fetch("RACK_ENV", nil)
|
14
|
+
})
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/bugsify.rb
CHANGED
@@ -1,17 +1,18 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "bugsify/
|
4
|
-
require "bugsify/
|
5
|
-
require "bugsify/
|
6
|
-
require "bugsify/
|
7
|
-
require "bugsify/
|
8
|
-
require "bugsify/
|
9
|
-
require "bugsify/
|
10
|
-
require "bugsify/middlewares/padrino" if Gem.loaded_specs.key?("padrino")
|
3
|
+
require "bugsify/config/config"
|
4
|
+
require "bugsify/client/client"
|
5
|
+
require "bugsify/reporter/reporter"
|
6
|
+
require "bugsify/parser/parser"
|
7
|
+
require "bugsify/middleware/middleware"
|
8
|
+
require "bugsify/notifier/notifier"
|
9
|
+
require "bugsify/engine/bugsify"
|
11
10
|
|
12
11
|
# Bugsify
|
13
12
|
module Bugsify
|
14
13
|
include Config
|
15
14
|
include Client
|
15
|
+
include Reporter
|
16
|
+
include Parser
|
16
17
|
extend Notifier
|
17
18
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bugsify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aleksandar Popovic
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-01-
|
11
|
+
date: 2023-01-10 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Bugsify error monitoring & exception reporter for Ruby
|
14
14
|
email:
|
@@ -32,18 +32,14 @@ files:
|
|
32
32
|
- Rakefile
|
33
33
|
- bugsify.gemspec
|
34
34
|
- lib/bugsify.rb
|
35
|
-
- lib/bugsify/client.rb
|
36
|
-
- lib/bugsify/config.rb
|
37
|
-
- lib/bugsify/
|
38
|
-
- lib/bugsify/
|
39
|
-
- lib/bugsify/
|
40
|
-
- lib/bugsify/
|
41
|
-
- lib/bugsify/
|
42
|
-
- lib/bugsify/reporters/rack.rb
|
43
|
-
- lib/bugsify/reporters/rails.rb
|
44
|
-
- lib/bugsify/version.rb
|
35
|
+
- lib/bugsify/client/client.rb
|
36
|
+
- lib/bugsify/config/config.rb
|
37
|
+
- lib/bugsify/engine/bugsify.rb
|
38
|
+
- lib/bugsify/middleware/middleware.rb
|
39
|
+
- lib/bugsify/notifier/notifier.rb
|
40
|
+
- lib/bugsify/parser/parser.rb
|
41
|
+
- lib/bugsify/reporter/reporter.rb
|
45
42
|
- lib/generators/bugsify/install_generator.rb
|
46
|
-
- sig/bugsify.rbs
|
47
43
|
homepage: https://github.com/bugsify/bugsify_ruby
|
48
44
|
licenses:
|
49
45
|
- MIT
|
data/lib/bugsify/config.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Bugsify
|
4
|
-
# Config
|
5
|
-
module Config
|
6
|
-
def self.included(host_class)
|
7
|
-
host_class.extend ClassMethods
|
8
|
-
end
|
9
|
-
|
10
|
-
# ClassMethods
|
11
|
-
module ClassMethods
|
12
|
-
def config
|
13
|
-
@config ||= Configuration.new
|
14
|
-
end
|
15
|
-
|
16
|
-
def configure
|
17
|
-
yield config
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
extend ClassMethods
|
22
|
-
|
23
|
-
class Configuration
|
24
|
-
attr_accessor :api_key
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
if Gem.loaded_specs.key?("padrino")
|
4
|
-
require_relative "../reporters/rack"
|
5
|
-
|
6
|
-
module Bugsify
|
7
|
-
module Middleware
|
8
|
-
# Padrino
|
9
|
-
class Padrino
|
10
|
-
include Bugsify::Reporter::Rack
|
11
|
-
|
12
|
-
def initialize(app)
|
13
|
-
@app = app
|
14
|
-
end
|
15
|
-
|
16
|
-
# rubocop:disable Metrics/MethodLength
|
17
|
-
# rubocop:disable Lint/RescueException
|
18
|
-
def call(env)
|
19
|
-
@app.call(env)
|
20
|
-
rescue Exception => e
|
21
|
-
payload = {
|
22
|
-
error_class: e.class,
|
23
|
-
error_backtrace: e,
|
24
|
-
error_full_backtrace: "\n#{e.class}\n#{e.message}\n#{e}",
|
25
|
-
runtime_version: {
|
26
|
-
padrino: Gem.loaded_specs["padrino"].version,
|
27
|
-
rack: Gem.loaded_specs["rake"].version,
|
28
|
-
ruby: RUBY_VERSION
|
29
|
-
}
|
30
|
-
}
|
31
|
-
notify(payload)
|
32
|
-
raise e
|
33
|
-
end
|
34
|
-
# rubocop:enable Metrics/MethodLength
|
35
|
-
# rubocop:enable Lint/RescueException
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
if Gem.loaded_specs.key?("rails")
|
4
|
-
require_relative "../reporters/rails"
|
5
|
-
|
6
|
-
module Bugsify
|
7
|
-
module Middleware
|
8
|
-
# Rails
|
9
|
-
class Rails
|
10
|
-
include Bugsify::Reporter::Rails
|
11
|
-
|
12
|
-
def initialize(app)
|
13
|
-
@app = app
|
14
|
-
end
|
15
|
-
|
16
|
-
# rubocop:disable Metrics/MethodLength
|
17
|
-
# rubocop:disable Lint/RescueException
|
18
|
-
# rubocop:disable Metrics/AbcSize
|
19
|
-
def call(env)
|
20
|
-
@app.call(env)
|
21
|
-
rescue Exception => e
|
22
|
-
trace = e.backtrace.select { |l| l.start_with?(Rack::Directory.new("").root) }.join("\n ")
|
23
|
-
payload = {
|
24
|
-
error_class: e.class,
|
25
|
-
error_backtrace: "\n#{e.class}\n#{e.message}\n#{trace}",
|
26
|
-
error_full_backtrace: e.backtrace.select { |l| l }.join("\n "),
|
27
|
-
runtime_version: {
|
28
|
-
rails: Gem.loaded_specs["rails"].version,
|
29
|
-
rack: Gem.loaded_specs["rake"].version,
|
30
|
-
ruby: RUBY_VERSION
|
31
|
-
}
|
32
|
-
}
|
33
|
-
notify(payload)
|
34
|
-
raise e
|
35
|
-
end
|
36
|
-
# rubocop:enable Metrics/MethodLength
|
37
|
-
# rubocop:enable Lint/RescueException
|
38
|
-
# rubocop:enable Metrics/AbcSize
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
if Gem.loaded_specs.key?("sinatra")
|
4
|
-
require_relative "../reporters/rack"
|
5
|
-
|
6
|
-
module Bugsify
|
7
|
-
module Middleware
|
8
|
-
# Sinatra
|
9
|
-
class Sinatra
|
10
|
-
include Bugsify::Reporter::Rack
|
11
|
-
|
12
|
-
def initialize(app)
|
13
|
-
@app = app
|
14
|
-
end
|
15
|
-
|
16
|
-
# rubocop:disable Metrics/MethodLength
|
17
|
-
# rubocop:disable Lint/RescueException
|
18
|
-
def call(env)
|
19
|
-
@app.call(env)
|
20
|
-
rescue Exception => e
|
21
|
-
payload = {
|
22
|
-
error_class: e.class,
|
23
|
-
error_backtrace: e,
|
24
|
-
error_full_backtrace: "\n#{e.class}\n#{e.message}\n#{e}",
|
25
|
-
runtime_version: {
|
26
|
-
padrino: Gem.loaded_specs["sinatra"].version,
|
27
|
-
rack: Gem.loaded_specs["rake"].version,
|
28
|
-
ruby: RUBY_VERSION
|
29
|
-
}
|
30
|
-
}
|
31
|
-
notify(payload)
|
32
|
-
raise e
|
33
|
-
end
|
34
|
-
# rubocop:enable Metrics/MethodLength
|
35
|
-
# rubocop:enable Lint/RescueException
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Bugsify
|
4
|
-
module Reporter
|
5
|
-
# Rack
|
6
|
-
module Rack
|
7
|
-
def notify(event)
|
8
|
-
Bugsify.auto_notify({
|
9
|
-
errorClass: event[:error_class],
|
10
|
-
errorBacktrace: event[:error_backtrace],
|
11
|
-
errorFullBacktrace: event[:error_full_backtrace],
|
12
|
-
runtimeVersion: event[:runtime_version],
|
13
|
-
applicationEnvironment: ENV["RACK_ENV"]
|
14
|
-
})
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Bugsify
|
4
|
-
module Reporter
|
5
|
-
# Rails
|
6
|
-
module Rails
|
7
|
-
# rubocop:disable Metrics/MethodLength
|
8
|
-
def notify(event)
|
9
|
-
semaphore = Thread::Mutex.new
|
10
|
-
|
11
|
-
Thread.new do
|
12
|
-
semaphore.synchronize do
|
13
|
-
Bugsify.auto_notify({
|
14
|
-
errorClass: event[:error_class],
|
15
|
-
errorBacktrace: event[:error_backtrace],
|
16
|
-
errorFullBacktrace: event[:error_full_backtrace],
|
17
|
-
runtimeVersion: event[:runtime_version],
|
18
|
-
applicationEnvironment: ENV["RACK_ENV"]
|
19
|
-
})
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
# rubocop:enable Metrics/MethodLength
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
data/lib/bugsify/version.rb
DELETED
data/sig/bugsify.rbs
DELETED