bugscriber 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 1bed29605109da40440885709e74b392615a854b84d45cd9cf37b6a704578bac
4
+ data.tar.gz: 3141fc38ca717b94e206596296cb4c75bfd75378d13e4cab9ffd5777f08532ca
5
+ SHA512:
6
+ metadata.gz: a6b64c989b5066f42c7a36f92c64b02e7e9a836359a9157920fcf6354c035e029f46cb134c64224b47728c5cf8f40c368e987fc3191ff7df4a37ca3618a1584f
7
+ data.tar.gz: 89a730011af09487df4cfacc843e022a32e2c5bba4f698daadc7ebeb49617a635f1e6a236ea2b00431bebd47b839ff47f287f2cabdb4aa475359b183e342d1d6
data/.rubocop.yml ADDED
@@ -0,0 +1,34 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ AllCops:
4
+ TargetRubyVersion: 2.7
5
+ NewCops: disable
6
+ SuggestExtensions: false
7
+
8
+ Style/StringLiterals:
9
+ Enabled: true
10
+ EnforcedStyle: single_quotes
11
+
12
+ Style/StringLiteralsInInterpolation:
13
+ Enabled: true
14
+ EnforcedStyle: single_quotes
15
+
16
+ Layout/LineLength:
17
+ Max: 120
18
+
19
+ Style/Documentation:
20
+ Enabled: false
21
+
22
+ Metrics/MethodLength:
23
+ Enabled: true
24
+ CountComments: false
25
+ Max: 30
26
+
27
+ Metrics/AbcSize:
28
+ Max: 30
29
+
30
+ Metrics/BlockLength:
31
+ Max: 30
32
+
33
+ Metrics/ParameterLists:
34
+ Max: 6
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,15 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2022-10-26 01:33:22 UTC using RuboCop version 1.37.0.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 19
10
+ # This cop supports safe autocorrection (--autocorrect).
11
+ # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
12
+ # SupportedStyles: single_quotes, double_quotes
13
+ Style/StringLiterals:
14
+ Exclude:
15
+ - 'Gemfile'
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2022-10-26
4
+
5
+ - Initial release
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at nejdetkadir.550@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/Gemfile ADDED
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in bugscriber.gemspec
6
+ gemspec
7
+
8
+ # Rake is a Make-like program implemented in Ruby [https://github.com/ruby/rake]
9
+ gem 'rake', '~> 13.0'
10
+
11
+ # Minitest provides a complete suite of testing facilities supporting [https://github.com/minitest/minitest]
12
+ gem 'minitest', '~> 5.0'
13
+
14
+ # RuboCop is a Ruby code style checking and code formatting tool [https://github.com/rubocop/rubocop]
15
+ gem 'rubocop', '~> 1.21'
16
+
17
+ # Pretty print Ruby objects with proper indentation and colors [https://github.com/awesome-print/awesome_print]
18
+ gem 'awesome_print'
19
+
20
+ # A mixin to add configuration functionality to your classes [https://github.com/dry-rb/dry-configurable]
21
+ gem 'dry-configurable', '~> 0.15.0'
22
+
23
+ # Pry is a runtime developer console and IRB alternative with powerful introspection capabilities [https://github.com/pry/pry]
24
+ gem 'pry', '~> 0.14.1'
25
+
26
+ # A toolkit of support libraries and Ruby core extensions extracted from the Rails framework [https://github.com/rails/rails]
27
+ gem 'activesupport', '>= 5.0', '>= 7.0.4'
28
+
29
+ # Ruby on Rails is a full-stack web framework optimized for programmer happiness and sustainable productivity [https://github.com/rails/rails]
30
+ gem 'rails', '>= 5.0', '>= 7.0.4'
31
+
32
+ # HTTP/REST API client library [https://github.com/lostisland/faraday]
33
+ gem 'faraday', '~> 2.6'
data/Gemfile.lock ADDED
@@ -0,0 +1,198 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ bugscriber (0.1.0)
5
+ faraday (~> 2.6)
6
+ rails (>= 7.0.4, >= 5.0)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ actioncable (7.0.4)
12
+ actionpack (= 7.0.4)
13
+ activesupport (= 7.0.4)
14
+ nio4r (~> 2.0)
15
+ websocket-driver (>= 0.6.1)
16
+ actionmailbox (7.0.4)
17
+ actionpack (= 7.0.4)
18
+ activejob (= 7.0.4)
19
+ activerecord (= 7.0.4)
20
+ activestorage (= 7.0.4)
21
+ activesupport (= 7.0.4)
22
+ mail (>= 2.7.1)
23
+ net-imap
24
+ net-pop
25
+ net-smtp
26
+ actionmailer (7.0.4)
27
+ actionpack (= 7.0.4)
28
+ actionview (= 7.0.4)
29
+ activejob (= 7.0.4)
30
+ activesupport (= 7.0.4)
31
+ mail (~> 2.5, >= 2.5.4)
32
+ net-imap
33
+ net-pop
34
+ net-smtp
35
+ rails-dom-testing (~> 2.0)
36
+ actionpack (7.0.4)
37
+ actionview (= 7.0.4)
38
+ activesupport (= 7.0.4)
39
+ rack (~> 2.0, >= 2.2.0)
40
+ rack-test (>= 0.6.3)
41
+ rails-dom-testing (~> 2.0)
42
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
43
+ actiontext (7.0.4)
44
+ actionpack (= 7.0.4)
45
+ activerecord (= 7.0.4)
46
+ activestorage (= 7.0.4)
47
+ activesupport (= 7.0.4)
48
+ globalid (>= 0.6.0)
49
+ nokogiri (>= 1.8.5)
50
+ actionview (7.0.4)
51
+ activesupport (= 7.0.4)
52
+ builder (~> 3.1)
53
+ erubi (~> 1.4)
54
+ rails-dom-testing (~> 2.0)
55
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
56
+ activejob (7.0.4)
57
+ activesupport (= 7.0.4)
58
+ globalid (>= 0.3.6)
59
+ activemodel (7.0.4)
60
+ activesupport (= 7.0.4)
61
+ activerecord (7.0.4)
62
+ activemodel (= 7.0.4)
63
+ activesupport (= 7.0.4)
64
+ activestorage (7.0.4)
65
+ actionpack (= 7.0.4)
66
+ activejob (= 7.0.4)
67
+ activerecord (= 7.0.4)
68
+ activesupport (= 7.0.4)
69
+ marcel (~> 1.0)
70
+ mini_mime (>= 1.1.0)
71
+ activesupport (7.0.4)
72
+ concurrent-ruby (~> 1.0, >= 1.0.2)
73
+ i18n (>= 1.6, < 2)
74
+ minitest (>= 5.1)
75
+ tzinfo (~> 2.0)
76
+ ast (2.4.2)
77
+ awesome_print (1.9.2)
78
+ builder (3.2.4)
79
+ coderay (1.1.3)
80
+ concurrent-ruby (1.1.10)
81
+ crass (1.0.6)
82
+ dry-configurable (0.15.0)
83
+ concurrent-ruby (~> 1.0)
84
+ dry-core (~> 0.6)
85
+ dry-core (0.9.1)
86
+ concurrent-ruby (~> 1.0)
87
+ zeitwerk (~> 2.6)
88
+ erubi (1.11.0)
89
+ faraday (2.6.0)
90
+ faraday-net_http (>= 2.0, < 3.1)
91
+ ruby2_keywords (>= 0.0.4)
92
+ faraday-net_http (3.0.1)
93
+ globalid (1.0.0)
94
+ activesupport (>= 5.0)
95
+ i18n (1.12.0)
96
+ concurrent-ruby (~> 1.0)
97
+ json (2.6.2)
98
+ loofah (2.19.0)
99
+ crass (~> 1.0.2)
100
+ nokogiri (>= 1.5.9)
101
+ mail (2.7.1)
102
+ mini_mime (>= 0.1.1)
103
+ marcel (1.0.2)
104
+ method_source (1.0.0)
105
+ mini_mime (1.1.2)
106
+ minitest (5.16.3)
107
+ net-imap (0.3.1)
108
+ net-protocol
109
+ net-pop (0.1.2)
110
+ net-protocol
111
+ net-protocol (0.1.3)
112
+ timeout
113
+ net-smtp (0.3.2)
114
+ net-protocol
115
+ nio4r (2.5.8)
116
+ nokogiri (1.13.9-arm64-darwin)
117
+ racc (~> 1.4)
118
+ parallel (1.22.1)
119
+ parser (3.1.2.1)
120
+ ast (~> 2.4.1)
121
+ pry (0.14.1)
122
+ coderay (~> 1.1)
123
+ method_source (~> 1.0)
124
+ racc (1.6.0)
125
+ rack (2.2.4)
126
+ rack-test (2.0.2)
127
+ rack (>= 1.3)
128
+ rails (7.0.4)
129
+ actioncable (= 7.0.4)
130
+ actionmailbox (= 7.0.4)
131
+ actionmailer (= 7.0.4)
132
+ actionpack (= 7.0.4)
133
+ actiontext (= 7.0.4)
134
+ actionview (= 7.0.4)
135
+ activejob (= 7.0.4)
136
+ activemodel (= 7.0.4)
137
+ activerecord (= 7.0.4)
138
+ activestorage (= 7.0.4)
139
+ activesupport (= 7.0.4)
140
+ bundler (>= 1.15.0)
141
+ railties (= 7.0.4)
142
+ rails-dom-testing (2.0.3)
143
+ activesupport (>= 4.2.0)
144
+ nokogiri (>= 1.6)
145
+ rails-html-sanitizer (1.4.3)
146
+ loofah (~> 2.3)
147
+ railties (7.0.4)
148
+ actionpack (= 7.0.4)
149
+ activesupport (= 7.0.4)
150
+ method_source
151
+ rake (>= 12.2)
152
+ thor (~> 1.0)
153
+ zeitwerk (~> 2.5)
154
+ rainbow (3.1.1)
155
+ rake (13.0.6)
156
+ regexp_parser (2.6.0)
157
+ rexml (3.2.5)
158
+ rubocop (1.37.1)
159
+ json (~> 2.3)
160
+ parallel (~> 1.10)
161
+ parser (>= 3.1.2.1)
162
+ rainbow (>= 2.2.2, < 4.0)
163
+ regexp_parser (>= 1.8, < 3.0)
164
+ rexml (>= 3.2.5, < 4.0)
165
+ rubocop-ast (>= 1.23.0, < 2.0)
166
+ ruby-progressbar (~> 1.7)
167
+ unicode-display_width (>= 1.4.0, < 3.0)
168
+ rubocop-ast (1.23.0)
169
+ parser (>= 3.1.1.0)
170
+ ruby-progressbar (1.11.0)
171
+ ruby2_keywords (0.0.5)
172
+ thor (1.2.1)
173
+ timeout (0.3.0)
174
+ tzinfo (2.0.5)
175
+ concurrent-ruby (~> 1.0)
176
+ unicode-display_width (2.3.0)
177
+ websocket-driver (0.7.5)
178
+ websocket-extensions (>= 0.1.0)
179
+ websocket-extensions (0.1.5)
180
+ zeitwerk (2.6.1)
181
+
182
+ PLATFORMS
183
+ arm64-darwin-21
184
+
185
+ DEPENDENCIES
186
+ activesupport (>= 7.0.4, >= 5.0)
187
+ awesome_print
188
+ bugscriber!
189
+ dry-configurable (~> 0.15.0)
190
+ faraday (~> 2.6)
191
+ minitest (~> 5.0)
192
+ pry (~> 0.14.1)
193
+ rails (>= 7.0.4, >= 5.0)
194
+ rake (~> 13.0)
195
+ rubocop (~> 1.21)
196
+
197
+ BUNDLED WITH
198
+ 2.3.20
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 nejdetkadir
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all 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,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,49 @@
1
+ [![Gem Version](https://badge.fury.io/rb/bugscriber.svg)](https://badge.fury.io/rb/bugscriber)
2
+ ![test](https://github.com/nejdetkadir/bugscriber/actions/workflows/test.yml/badge.svg?branch=main)
3
+ ![rubocop](https://github.com/nejdetkadir/bugscriber/actions/workflows/rubocop.yml/badge.svg?branch=main)
4
+ [![Ruby Style Guide](https://img.shields.io/badge/code_style-rubocop-brightgreen.svg)](https://github.com/rubocop/rubocop)
5
+ ![Ruby Version](https://img.shields.io/badge/ruby_version->=_2.7.0-blue.svg)
6
+
7
+ # Bugscriber
8
+
9
+ Bugscriber is an open source error monitoring and reporting software for Ruby on Rails.
10
+
11
+ ## Installation
12
+ ```ruby
13
+ gem 'bugscriber', github: 'nejdetkadir/bugscriber', branch: 'main'
14
+ ```
15
+
16
+ Install the gem and add to the application's Gemfile by executing:
17
+ ```bash
18
+ $ bundle add bugscriber
19
+ ```
20
+
21
+ If bundler is not being used to manage dependencies, install the gem by executing:
22
+ ```bash
23
+ $ gem install bugscriber
24
+ ```
25
+
26
+ Run the generator for creating database migration and copying localization files.
27
+ ```bash
28
+ $ rails g bugscriber:install
29
+ ```
30
+ ## Usage
31
+ TODO: Write usage instructions here
32
+
33
+ ## Development
34
+
35
+ 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.
36
+
37
+ 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).
38
+
39
+ ## Contributing
40
+
41
+ Bug reports and pull requests are welcome on GitHub at https://github.com/nejdetkadir/bugscriber. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/nejdetkadir/bugscriber/blob/main/CODE_OF_CONDUCT.md).
42
+
43
+ ## License
44
+
45
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
46
+
47
+ ## Code of Conduct
48
+
49
+ Everyone interacting in the Bugscriber project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/nejdetkadir/bugscriber/blob/main/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rake/testtask'
5
+
6
+ Rake::TestTask.new(:test) do |t|
7
+ t.libs << 'test'
8
+ t.libs << 'lib'
9
+ t.test_files = FileList['test/**/test_*.rb']
10
+ end
11
+
12
+ require 'rubocop/rake_task'
13
+
14
+ RuboCop::RakeTask.new
15
+
16
+ task default: %i[test rubocop]
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/bugscriber/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'bugscriber'
7
+ spec.version = Bugscriber::VERSION
8
+ spec.authors = ['nejdetkadir']
9
+ spec.email = ['nejdetkadir.550@gmail.com']
10
+
11
+ spec.summary = 'Bugscriber is an open source error monitoring and reporting software for Ruby on Rails'
12
+ spec.description = spec.summary
13
+ spec.homepage = "https://github.com/nejdetkadir/#{spec.name}"
14
+ spec.license = 'MIT'
15
+ spec.required_ruby_version = '>= 2.7.0'
16
+
17
+ spec.metadata['homepage_uri'] = spec.homepage
18
+ spec.metadata['source_code_uri'] = spec.homepage
19
+ spec.metadata['changelog_uri'] = "#{spec.homepage}/blob/main/CHANGELOG.md"
20
+
21
+ # Specify which files should be added to the gem when it is released.
22
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
23
+ spec.files = Dir.chdir(__dir__) do
24
+ `git ls-files -z`.split("\x0").reject do |f|
25
+ (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
26
+ end
27
+ end
28
+
29
+ spec.bindir = 'exe'
30
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
31
+ spec.require_paths = ['lib']
32
+
33
+ # HTTP/REST API client library [https://github.com/lostisland/faraday]
34
+ spec.add_dependency 'faraday', '~> 2.6'
35
+
36
+ # Ruby on Rails is a full-stack web framework optimized for programmer happiness and sustainable productivity [https://github.com/rails/rails]
37
+ spec.add_dependency 'rails', '>= 5.0', '>= 7.0.4'
38
+
39
+ # For more information and examples about making a new gem, check out our
40
+ # guide at: https://bundler.io/guides/creating_gem.html
41
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bugscriber
4
+ class Client
5
+ BASE_URL = 'https://bugscriber-api.herokuapp.com'
6
+ AUTHORIZATION_HEADER_KEY = 'X-API-KEY'
7
+
8
+ attr_reader :adapter, :stubs
9
+
10
+ def initialize(adapter: Faraday.default_adapter, stubs: nil)
11
+ @adapter = adapter
12
+ @stubs = stubs
13
+ end
14
+
15
+ def connection
16
+ @connection ||= Faraday.new(BASE_URL) do |conn|
17
+ conn.request :json
18
+ conn.response :json, content_type: 'application/json'
19
+ unless Bugscriber.config.logger.blank?
20
+ conn.response :logger, Bugscriber.config.logger, body: true,
21
+ bodies: { request: true, response: true }
22
+ end
23
+ conn.headers[AUTHORIZATION_HEADER_KEY] = Bugscriber.config.api_key
24
+ conn.adapter adapter, stubs
25
+ end
26
+ end
27
+
28
+ def tracks
29
+ Bugscriber::Resources::Tracks.new(self)
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bugscriber
4
+ module Decorators
5
+ class TrackDecorator
6
+ class << self
7
+ def create_body(type:, method:, started_at:, finished_at:, external_process_id:, payload:)
8
+ {
9
+ type: type,
10
+ method: method,
11
+ started_at: started_at,
12
+ finished_at: finished_at,
13
+ external_process_id: external_process_id,
14
+ payload: payload,
15
+ environment: Bugscriber.config.environment
16
+ }
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bugscriber
4
+ module Helpers
5
+ class << self
6
+ def create_track(type:, method:, started_at:, finished_at:, external_process_id:, payload:)
7
+ body = Bugscriber::Decorators::TrackDecorator.create_body(type: type,
8
+ method: method,
9
+ started_at: started_at,
10
+ finished_at: finished_at,
11
+ external_process_id: external_process_id,
12
+ payload: payload)
13
+
14
+ Bugscriber::Client.new.tracks.create(body)
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bugscriber
4
+ module Resources
5
+ class BaseResource
6
+ attr_reader :client
7
+
8
+ def initialize(client)
9
+ @client = client
10
+ end
11
+
12
+ private
13
+
14
+ def get_request(url, params: {}, headers: {})
15
+ client.connection.get(url, params, headers)
16
+ end
17
+
18
+ def post_request(url, body:, headers: {})
19
+ client.connection.post(url, body, headers)
20
+ end
21
+
22
+ def patch_request(url, body:, headers: {})
23
+ client.connection.patch(url, body, headers)
24
+ end
25
+
26
+ def put_request(url, body:, headers: {})
27
+ client.connection.put(url, body, headers)
28
+ end
29
+
30
+ def delete_request(url, params: {}, headers: {})
31
+ client.connection.delete(url, params, headers)
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bugscriber
4
+ module Resources
5
+ class Tracks < BaseResource
6
+ def create(body)
7
+ response = post_request('api/v1/tracks', body: body)
8
+
9
+ puts 'Something goes wrong while connecting to bugscriber' unless response.success?
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bugscriber
4
+ module Subscribers
5
+ extend ActiveSupport::Concern
6
+
7
+ AVAILABLE_SUBSCRIPTIONS = %w[
8
+ action_controller
9
+ action_dispatch
10
+ action_view
11
+ active_record
12
+ action_mailer
13
+ active_support
14
+ active_job
15
+ action_cable
16
+ active_storage
17
+ railties
18
+ rails
19
+ ].freeze
20
+
21
+ included do
22
+ AVAILABLE_SUBSCRIPTIONS.each do |subscription_method|
23
+ ActiveSupport::Notifications.subscribe(/#{subscription_method}/) do |name, started, finished, unique_id, data|
24
+ Bugscriber::Helpers.create_track(type: subscription_method,
25
+ method: name,
26
+ started_at: started,
27
+ finished_at: finished,
28
+ external_process_id: unique_id,
29
+ payload: data)
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bugscriber
4
+ VERSION = '0.1.0'
5
+ end
data/lib/bugscriber.rb ADDED
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'bugscriber/version'
4
+ require 'dry-configurable'
5
+ require 'active_support/all'
6
+ require 'json'
7
+ require 'bugscriber/helpers'
8
+ require 'bugscriber/subscribers'
9
+ require 'bugscriber/client'
10
+ require 'bugscriber/decorators/track_decorator'
11
+ require 'bugscriber/resources/base_resource'
12
+ require 'bugscriber/resources/tracks'
13
+ require 'faraday'
14
+
15
+ module Bugscriber
16
+ extend Dry::Configurable
17
+
18
+ setting :api_key, default: nil, reader: true
19
+ setting :logger, default: nil, reader: true
20
+ setting :environment, default: nil, reader: true
21
+ end
@@ -0,0 +1,4 @@
1
+ module Bugscriber
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,101 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bugscriber
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - nejdetkadir
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2022-10-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: faraday
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.6'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rails
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '5.0'
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: 7.0.4
37
+ type: :runtime
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: '5.0'
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 7.0.4
47
+ description: Bugscriber is an open source error monitoring and reporting software
48
+ for Ruby on Rails
49
+ email:
50
+ - nejdetkadir.550@gmail.com
51
+ executables: []
52
+ extensions: []
53
+ extra_rdoc_files: []
54
+ files:
55
+ - ".rubocop.yml"
56
+ - ".rubocop_todo.yml"
57
+ - CHANGELOG.md
58
+ - CODE_OF_CONDUCT.md
59
+ - Gemfile
60
+ - Gemfile.lock
61
+ - LICENSE.txt
62
+ - README.md
63
+ - Rakefile
64
+ - bugscriber.gemspec
65
+ - lib/bugscriber.rb
66
+ - lib/bugscriber/client.rb
67
+ - lib/bugscriber/decorators/track_decorator.rb
68
+ - lib/bugscriber/helpers.rb
69
+ - lib/bugscriber/resources/base_resource.rb
70
+ - lib/bugscriber/resources/tracks.rb
71
+ - lib/bugscriber/subscribers.rb
72
+ - lib/bugscriber/version.rb
73
+ - sig/bugscriber.rbs
74
+ homepage: https://github.com/nejdetkadir/bugscriber
75
+ licenses:
76
+ - MIT
77
+ metadata:
78
+ homepage_uri: https://github.com/nejdetkadir/bugscriber
79
+ source_code_uri: https://github.com/nejdetkadir/bugscriber
80
+ changelog_uri: https://github.com/nejdetkadir/bugscriber/blob/main/CHANGELOG.md
81
+ post_install_message:
82
+ rdoc_options: []
83
+ require_paths:
84
+ - lib
85
+ required_ruby_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: 2.7.0
90
+ required_rubygems_version: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ requirements: []
96
+ rubygems_version: 3.3.17
97
+ signing_key:
98
+ specification_version: 4
99
+ summary: Bugscriber is an open source error monitoring and reporting software for
100
+ Ruby on Rails
101
+ test_files: []