Skip to content

Commit

Permalink
Initial
Browse files Browse the repository at this point in the history
  • Loading branch information
tvdeyen committed Jan 27, 2022
0 parents commit b6eea45
Show file tree
Hide file tree
Showing 11 changed files with 139 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/.bundle/
/doc/
/log/*.log
/pkg/
/tmp/
/test/dummy/db/*.sqlite3
/test/dummy/db/*.sqlite3-*
/test/dummy/log/*.log
/test/dummy/storage/
/test/dummy/tmp/
.byebug_history
Gemfile.lock
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
source "https://rubygems.org"
gemspec
20 changes: 20 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Copyright 2022 Thomas von Deyen

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Alchemy::Sentry
Sentry error reporting extension for AlchemyCMS.

## Installation
Add this line to your application's Gemfile:

```ruby
gem 'alchemy-sentry'
```

And then execute:
```bash
$ bundle
```
15 changes: 15 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
require "bundler/setup"

load "rails/tasks/statistics.rake"

require "bundler/gem_tasks"

require "rake/testtask"

Rake::TestTask.new(:test) do |t|
t.libs << "test"
t.pattern = "test/**/*_test.rb"
t.verbose = false
end

task default: :test
22 changes: 22 additions & 0 deletions alchemy-sentry.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
require_relative "lib/alchemy/sentry/version"

Gem::Specification.new do |spec|
spec.name = "alchemy-sentry"
spec.version = Alchemy::Sentry::VERSION
spec.authors = ["Thomas von Deyen"]
spec.email = ["[email protected]"]
spec.homepage = "https://alchemy-cms.com"
spec.summary = "Alchemy Sentry error notifier."
spec.description = "Adds a Sentry error notifier to AlchemyCMS."
spec.license = "MIT"

spec.metadata["homepage_uri"] = spec.homepage
spec.metadata["source_code_uri"] = "https://github.com/AlchemyCMS/alchemy-sentry"
spec.metadata["changelog_uri"] = "https://github.com/AlchemyCMS/alchemy-sentry/tree/main/CHANGELOG.md"

spec.files = Dir["{lib}/**/*", "LICENSE", "Rakefile", "README.md"]

spec.add_dependency "alchemy_cms", ">= 4.6.7", "< 7"
spec.add_dependency "sentry-ruby", "~> 5.0"
spec.add_dependency "sentry-rails", "~> 5.0"
end
14 changes: 14 additions & 0 deletions bin/rails
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env ruby
# This command will automatically be run when you run "rails" with Rails gems
# installed from the root of your application.

ENGINE_ROOT = File.expand_path("..", __dir__)
ENGINE_PATH = File.expand_path("../lib/alchemy/sentry/engine", __dir__)
APP_PATH = File.expand_path("../test/dummy/config/application", __dir__)

# Set up gems listed in the Gemfile.
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"])

require "rails/all"
require "rails/engine/commands"
9 changes: 9 additions & 0 deletions lib/alchemy/airbrake.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
require "sentry"
require "alchemy_cms"
require "alchemy/sentry/engine"

module Alchemy
module Sentry
# Your code goes here...
end
end
15 changes: 15 additions & 0 deletions lib/alchemy/error_tracking/sentry_handler.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# frozen_string_literal: true

require "alchemy/error_tracking"

module Alchemy
module ErrorTracking
class SentryHandler < BaseHandler
def self.call(exception)
return if ["development", "test"].include?(Rails.env)

Sentry.capture_exception(exception)
end
end
end
end
11 changes: 11 additions & 0 deletions lib/alchemy/sentry/engine.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
require_relative "../error_tracking/sentry_handler"

module Alchemy
module Sentry
class Engine < ::Rails::Engine
initializer "alchemy.sentry" do
Alchemy::ErrorTracking.notification_handler = Alchemy::ErrorTracking::SentryHandler
end
end
end
end
5 changes: 5 additions & 0 deletions lib/alchemy/sentry/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module Alchemy
module Sentry
VERSION = "0.1.0"
end
end

0 comments on commit b6eea45

Please sign in to comment.