telebugs-rails 0.1.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 +7 -0
- data/.standard.yml +1 -0
- data/LICENSE.md +20 -0
- data/README.md +40 -0
- data/Rakefile +8 -0
- data/lib/generators/telebugs_generator.rb +21 -0
- data/lib/telebugs/rails/error_subscriber.rb +9 -0
- data/lib/telebugs/rails/middleware/ignore_dev_env.rb +17 -0
- data/lib/telebugs/rails/railtie.rb +25 -0
- data/lib/telebugs/rails/report_errors.rb +39 -0
- data/lib/telebugs/rails/version.rb +7 -0
- data/lib/telebugs/rails.rb +17 -0
- data/sig/telebugs/rails.rbs +6 -0
- metadata +87 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 15609190b1e309d4d65732c004d56e0e7ae5d771db1493998c6344a39635e4d0
|
4
|
+
data.tar.gz: aafe04c4d55f77bb15a1a308a8075eca723af719ec82ed2517ac0ca73d5b4f7d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1b0170dc19d1467e0159ffea1c2ab2db010a55096c19e9a333437df70ee8c2a6f338ca6c87fdc22cd5978edfa4196a5ba97e101c33eadded1b3f466fb99d7841
|
7
|
+
data.tar.gz: e5a5c3e442d8c5b1872cfa12df697bab5515ccec2937b1b1c485586255cd66699633c18cc3ff30cef2772fa9715ec0abef190915f47ebf819d7454dc57d568d8
|
data/.standard.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby_version: 3.0
|
data/LICENSE.md
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# The MIT License
|
2
|
+
|
3
|
+
Copyright © 2024 Telebugs
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the 'Software'), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# Telebugs for Rails
|
2
|
+
|
3
|
+
Simple error monitoring for developers. Monitor production errors in real-time
|
4
|
+
and get them reported to Telegram with Telebugs.
|
5
|
+
|
6
|
+
- [FAQ](https://telebugs.com/faq)
|
7
|
+
- [Telebugs News](https://t.me/TelebugsNews)
|
8
|
+
- [Telebugs Community](https://t.me/TelebugsCommunity)
|
9
|
+
|
10
|
+
## Introduction
|
11
|
+
|
12
|
+
Any Ruby on Rails application can be integrated with
|
13
|
+
[Telebugs](https://telebugs.com) using the `telebugs-rails` gem. The gem is
|
14
|
+
designed to be simple and easy to use. It integrates the `telebugs` gem with
|
15
|
+
Rails application, so that any unhandled error occurring in your app will be
|
16
|
+
reported to Telebugs.
|
17
|
+
|
18
|
+
## Installation
|
19
|
+
|
20
|
+
For the integration details, please refer to the
|
21
|
+
[Telebugs documentation](https://telebugs.com/new/docs/integrations/rails).
|
22
|
+
|
23
|
+
## Rails support policy
|
24
|
+
|
25
|
+
Telebugs for Rails supports the following Rails versions:
|
26
|
+
|
27
|
+
- Rails 6.1+
|
28
|
+
|
29
|
+
If you need support older Rails versions, please contact us at
|
30
|
+
[help@telebugs.com](mailto:help@telebugs.com).
|
31
|
+
|
32
|
+
## Development
|
33
|
+
|
34
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
35
|
+
|
36
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
37
|
+
|
38
|
+
## Contributing
|
39
|
+
|
40
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/kyrylo/telebugs-rails.
|
data/Rakefile
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class TelebugsGenerator < Rails::Generators::Base
|
4
|
+
def create_initializer_file
|
5
|
+
create_file "config/initializers/telebugs.rb", <<~RUBY
|
6
|
+
# frozen_string_literal: true
|
7
|
+
#
|
8
|
+
# Telebugs error monitoring.
|
9
|
+
#
|
10
|
+
# Rails integration guide:
|
11
|
+
# https://telebugs.com/docs/integrations/rails
|
12
|
+
#
|
13
|
+
# Telebugs library guide:
|
14
|
+
# https://telebugs.com/docs/integrations/ruby
|
15
|
+
|
16
|
+
Telebugs.configure do |c|
|
17
|
+
c.api_key = ENV["TELEBUGS_API_KEY"] || Rails.application.credentials.telebugs_api_key
|
18
|
+
end
|
19
|
+
RUBY
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Telebugs::Rails::Middleware
|
4
|
+
class IgnoreDevEnv < Telebugs::Middleware
|
5
|
+
def initialize(rails_env)
|
6
|
+
@rails_env = rails_env.to_s
|
7
|
+
end
|
8
|
+
|
9
|
+
def call(report)
|
10
|
+
report.ignored = (@rails_env == "development" || @rails_env == "test")
|
11
|
+
end
|
12
|
+
|
13
|
+
def weight
|
14
|
+
-1000
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Telebugs::Rails
|
4
|
+
class Railtie < ::Rails::Railtie
|
5
|
+
initializer "telebugs.rack_middleware" do |app|
|
6
|
+
app.config.middleware.insert_after ActionDispatch::DebugExceptions, Telebugs::Rails::ReportErrors
|
7
|
+
end
|
8
|
+
|
9
|
+
# https://guides.rubyonrails.org/error_reporting.html
|
10
|
+
initializer "telebugs.error_subscribe" do
|
11
|
+
# Error reporting is only available in Rails 7.0 and later.
|
12
|
+
next unless ::Rails.version.to_f >= 7.0
|
13
|
+
|
14
|
+
require "telebugs/rails/error_subscriber"
|
15
|
+
::Rails.error.subscribe(Telebugs::Rails::ErrorSubscriber.new)
|
16
|
+
end
|
17
|
+
|
18
|
+
initializer "telebugs.configure" do
|
19
|
+
Telebugs.configure do |c|
|
20
|
+
c.root_directory = Rails.root.to_s
|
21
|
+
c.middleware.use Middleware::IgnoreDevEnv.new(Rails.env)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Telebugs::Rails
|
4
|
+
# Telebugs middleware for Rails. Any errors raised by the upstream application
|
5
|
+
# will be delivered to Telebugs and re-raised.
|
6
|
+
class ReportErrors
|
7
|
+
def initialize(app)
|
8
|
+
@app = app
|
9
|
+
end
|
10
|
+
|
11
|
+
def call(env)
|
12
|
+
dup.call!(env)
|
13
|
+
end
|
14
|
+
|
15
|
+
def call!(env)
|
16
|
+
response = call_app(env)
|
17
|
+
|
18
|
+
# The exceptions app should be passed as a parameter on initialization of
|
19
|
+
# ShowExceptions. Every time there is an exception, ShowExceptions will
|
20
|
+
# store the exception in env["action_dispatch.exception"], rewrite the
|
21
|
+
# PATH_INFO to the exception status code, and call the Rack app.
|
22
|
+
# See: https://api.rubyonrails.org/classes/ActionDispatch/ShowExceptions.html
|
23
|
+
return response unless env["action_dispatch.exception"]
|
24
|
+
|
25
|
+
Telebugs.report(env["action_dispatch.exception"])
|
26
|
+
|
27
|
+
response
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def call_app(env)
|
33
|
+
@app.call(env)
|
34
|
+
rescue Exception => e # rubocop:disable Lint/RescueException
|
35
|
+
Telebugs.report(e)
|
36
|
+
raise
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rails"
|
4
|
+
require "telebugs"
|
5
|
+
|
6
|
+
require_relative "rails/version"
|
7
|
+
require_relative "rails/railtie"
|
8
|
+
|
9
|
+
require_relative "rails/middleware/ignore_dev_env"
|
10
|
+
require_relative "rails/report_errors"
|
11
|
+
|
12
|
+
module Telebugs
|
13
|
+
module Rails
|
14
|
+
class Error < StandardError; end
|
15
|
+
# Your code goes here...
|
16
|
+
end
|
17
|
+
end
|
metadata
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: telebugs-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Kyrylo Silin
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2024-06-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: telebugs
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.5'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.5'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: railties
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '6.1'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '6.1'
|
41
|
+
description: |
|
42
|
+
Telebugs Rails is an integration for Rails applications with Telebugs.
|
43
|
+
Telebugs is a simple error monitoring tool for developers. With Telebugs,
|
44
|
+
you can track production errors in real-time and report them to Telegram.
|
45
|
+
email:
|
46
|
+
- help@telebugs.com
|
47
|
+
executables: []
|
48
|
+
extensions: []
|
49
|
+
extra_rdoc_files: []
|
50
|
+
files:
|
51
|
+
- ".standard.yml"
|
52
|
+
- LICENSE.md
|
53
|
+
- README.md
|
54
|
+
- Rakefile
|
55
|
+
- lib/generators/telebugs_generator.rb
|
56
|
+
- lib/telebugs/rails.rb
|
57
|
+
- lib/telebugs/rails/error_subscriber.rb
|
58
|
+
- lib/telebugs/rails/middleware/ignore_dev_env.rb
|
59
|
+
- lib/telebugs/rails/railtie.rb
|
60
|
+
- lib/telebugs/rails/report_errors.rb
|
61
|
+
- lib/telebugs/rails/version.rb
|
62
|
+
- sig/telebugs/rails.rbs
|
63
|
+
homepage: https://telebugs.com
|
64
|
+
licenses: []
|
65
|
+
metadata:
|
66
|
+
homepage_uri: https://telebugs.com
|
67
|
+
source_code_uri: https://github.com/telebugs/telebugs-rails
|
68
|
+
post_install_message:
|
69
|
+
rdoc_options: []
|
70
|
+
require_paths:
|
71
|
+
- lib
|
72
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 3.0.0
|
77
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
requirements: []
|
83
|
+
rubygems_version: 3.5.3
|
84
|
+
signing_key:
|
85
|
+
specification_version: 4
|
86
|
+
summary: Report errors to Telebugs from Rails applications.
|
87
|
+
test_files: []
|