bugsify 1.0.3 → 1.0.6

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: 14517552fa77ab0f3223d16146a1f73bee88cdf16acad2385891c5df0c9db362
4
- data.tar.gz: 4641664b93a5d12434cad5e3033f528ba02997d08415e6f1777b26da18dec322
3
+ metadata.gz: 838dd41504e18f406fae5acd2ca9d503ffa57a9c7a17f0ac9ee80f5f4cca0e55
4
+ data.tar.gz: 8938abe6fe325774366e97adc7aa384508c66f2b58c06fba02b4f23b0c4e9945
5
5
  SHA512:
6
- metadata.gz: e1dc9c90d6619196ccddc86eb05ec5f555b6996c9e66a0e32b746f884f02c8e64260bdf8859aa249a82f256ac45d44424e50d20c34ac49931a60195c8819b477
7
- data.tar.gz: 1197180e153c21b48d318fa0af21883dfa6cb9e42787b0d560d6931cf338ce641fc38e12f34ba1540676d4e5f395e6e28d4c15c90d3b9807dda7c4a28efbdf76
6
+ metadata.gz: de161b06733c2e74c76826884e062e51e6b35227f408155a7c76b5c33f6f3d130acced17cde511cdf4387934966cd09497f7879e35f16388bfb509c137aa3df3
7
+ data.tar.gz: c5ff82ea0f5faf8a403b24f2add50c233c2945b2dc8e5347b51971a270b1c3831255cd96568100d1d27180edca8b42f39a7b7fca386d3e08e06c0754e7fdfab2
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bugsify (1.0.2)
4
+ bugsify (1.0.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -1,4 +1,6 @@
1
- # bugsify_ruby
1
+ # bugsify-ruby
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/bugsify.svg)](https://badge.fury.io/rb/bugsify)
2
4
 
3
5
  ## Error monitoring & exception reporter for Ruby
4
6
 
data/SECURITY.md ADDED
@@ -0,0 +1,21 @@
1
+ # Security Policy
2
+
3
+ ## Supported Versions
4
+
5
+ Use this section to tell people about which versions of your project are
6
+ currently being supported with security updates.
7
+
8
+ | Version | Supported |
9
+ | ------- | ------------------ |
10
+ | 5.1.x | :white_check_mark: |
11
+ | 5.0.x | :x: |
12
+ | 4.0.x | :white_check_mark: |
13
+ | < 4.0 | :x: |
14
+
15
+ ## Reporting a Vulnerability
16
+
17
+ Use this section to tell people how to report a vulnerability.
18
+
19
+ Tell them where to go, how often they can expect to get an update on a
20
+ reported vulnerability, what to expect if the vulnerability is accepted or
21
+ declined, etc.
data/bugsify.gemspec CHANGED
@@ -1,22 +1,22 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "lib/bugsify/version"
3
+ require_relative "lib/bugsify/config/config"
4
4
 
5
5
  Gem::Specification.new do |spec|
6
- spec.name = "bugsify"
7
- spec.version = Bugsify::VERSION
8
- spec.authors = ["Aleksandar Popovic"]
9
- spec.email = ["aleksandar.popovic@hotmail.com"]
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 = "Ruby notifier for bugsify.io"
12
- spec.description = "Bugsify error monitoring & exception reporter for Ruby"
13
- spec.homepage = "https://github.com/bugsify/bugsify_ruby"
14
- spec.license = "MIT"
15
- spec.required_ruby_version = ">= 2.6.0"
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"] = "https://github.com/bugsify/bugsify_ruby"
19
- spec.metadata["changelog_uri"] = "https://github.com/bugsify/bugsify_ruby/blob/main/CHANGELOG.md"
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|
@@ -12,7 +12,7 @@ module Bugsify
12
12
  # rubocop:disable Metrics/AbcSize
13
13
  # rubocop:disable Metrics/MethodLength
14
14
  def request(uri, method, body = nil)
15
- uri = URI.parse("https://api.bugsify.io/v1/#{uri}")
15
+ uri = URI.parse("https://server.codepop.co.rs/collectors/#{uri}")
16
16
  http = Net::HTTP.new(uri.host, uri.port)
17
17
  http.use_ssl = true
18
18
 
@@ -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.6",
31
+ authors: ["Aleksandar Popovic"],
32
+ email: ["aleksandar.popovic@hotmail.com"],
33
+ summary: "Ruby notifier for codepop.co.rs",
34
+ description: "Bugsify error monitoring & exception reporter for Ruby",
35
+ homepage: "https://github.com/CodepopTechnology/BugsifyRuby",
36
+ license: "MIT",
37
+ required_ruby_version: ">= 2.6.0",
38
+ source_code_uri: "https://github.com/CodepopTechnology/BugsifyRuby",
39
+ changelog_uri: "https://github.com/CodepopTechnology/BugsifyRuby/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 Bugsify::Middleware::Rails
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,18 @@
3
3
  module Bugsify
4
4
  # Error
5
5
  module Notifier
6
+ include Client
7
+
8
+ def capture_exception(exception)
9
+ raise "Argument #{exception} is not exception" unless exception.is_a?(Exception)
10
+
11
+ manual(exception)
12
+ end
13
+
14
+ private
15
+
6
16
  # rubocop:disable Metrics/MethodLength
7
- def auto_notify(args = {})
17
+ def auto_capture_exception(args = {})
8
18
  params = {
9
19
  errorClass: args[:errorClass],
10
20
  errorBacktrace: args[:errorBacktrace],
@@ -13,8 +23,8 @@ module Bugsify
13
23
  applicationEnvironment: args[:applicationEnvironment]
14
24
  }
15
25
 
16
- Bugsify::Client::Api.new.request(
17
- "collectors/ruby",
26
+ Api.new.request(
27
+ "ruby",
18
28
  "Post",
19
29
  params,
20
30
  &method(:parse)
@@ -22,8 +32,6 @@ module Bugsify
22
32
  end
23
33
  # rubocop:enable Metrics/MethodLength
24
34
 
25
- private
26
-
27
35
  def parse(response)
28
36
  puts response
29
37
  end
@@ -0,0 +1,55 @@
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
+ payload = {
35
+ error_class: e.class,
36
+ error_backtrace: e,
37
+ runtime_version: runtime_version
38
+ }
39
+ report(payload)
40
+ raise e
41
+ end
42
+
43
+ private
44
+
45
+ def runtime_version
46
+ {
47
+ ruby_version: RUBY_VERSION,
48
+ ruby_release_date: RUBY_RELEASE_DATE,
49
+ ruby_platform: RUBY_PLATFORM,
50
+ load_path: $LOAD_PATH,
51
+ env: ENV
52
+ }
53
+ end
54
+ end
55
+ 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/version"
4
- require "bugsify/config"
5
- require "bugsify/client"
6
- require "bugsify/notifier"
7
- require "bugsify/engines/bugsify" if Gem.loaded_specs.key?("rails")
8
- require "bugsify/middlewares/rails" if Gem.loaded_specs.key?("rails")
9
- require "bugsify/middlewares/sinatra" if Gem.loaded_specs.key?("sinatra")
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.3
4
+ version: 1.0.6
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-09 00:00:00.000000000 Z
11
+ date: 2023-02-27 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Bugsify error monitoring & exception reporter for Ruby
14
14
  email:
@@ -30,27 +30,24 @@ files:
30
30
  - Makefile
31
31
  - README.md
32
32
  - Rakefile
33
+ - SECURITY.md
33
34
  - bugsify.gemspec
34
35
  - lib/bugsify.rb
35
- - lib/bugsify/client.rb
36
- - lib/bugsify/config.rb
37
- - lib/bugsify/engines/bugsify.rb
38
- - lib/bugsify/middlewares/padrino.rb
39
- - lib/bugsify/middlewares/rails.rb
40
- - lib/bugsify/middlewares/sinatra.rb
41
- - lib/bugsify/notifier.rb
42
- - lib/bugsify/reporters/rack.rb
43
- - lib/bugsify/reporters/rails.rb
44
- - lib/bugsify/version.rb
36
+ - lib/bugsify/client/client.rb
37
+ - lib/bugsify/config/config.rb
38
+ - lib/bugsify/engine/bugsify.rb
39
+ - lib/bugsify/middleware/middleware.rb
40
+ - lib/bugsify/notifier/notifier.rb
41
+ - lib/bugsify/parser/parser.rb
42
+ - lib/bugsify/reporter/reporter.rb
45
43
  - lib/generators/bugsify/install_generator.rb
46
- - sig/bugsify.rbs
47
- homepage: https://github.com/bugsify/bugsify_ruby
44
+ homepage: https://github.com/CodepopTechnology/BugsifyRuby
48
45
  licenses:
49
46
  - MIT
50
47
  metadata:
51
- homepage_uri: https://github.com/bugsify/bugsify_ruby
52
- source_code_uri: https://github.com/bugsify/bugsify_ruby
53
- changelog_uri: https://github.com/bugsify/bugsify_ruby/blob/main/CHANGELOG.md
48
+ homepage_uri: https://github.com/CodepopTechnology/BugsifyRuby
49
+ source_code_uri: https://github.com/CodepopTechnology/BugsifyRuby
50
+ changelog_uri: https://github.com/CodepopTechnology/BugsifyRuby/blob/main/CHANGELOG.md
54
51
  rubygems_mfa_required: 'true'
55
52
  post_install_message:
56
53
  rdoc_options: []
@@ -70,5 +67,5 @@ requirements: []
70
67
  rubygems_version: 3.3.7
71
68
  signing_key:
72
69
  specification_version: 4
73
- summary: Ruby notifier for bugsify.io
70
+ summary: Ruby notifier for codepop.co.rs
74
71
  test_files: []
@@ -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
@@ -1,5 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Bugsify
4
- VERSION = "1.0.3"
5
- end
data/sig/bugsify.rbs DELETED
@@ -1,4 +0,0 @@
1
- module Bugsify
2
- VERSION: String
3
- # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
- end