diff --git a/Gemfile b/Gemfile index f184cfb..ea5dd37 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ source "https://rubygems.org" -# Specify your gem's dependencies in error_notifier.gemspec +# Specify your gem's dependencies in dlnk_error_notifier.gemspec gemspec gem "rake", "~> 13.0" diff --git a/bin/console b/bin/console index 96d0884..56e21b5 100755 --- a/bin/console +++ b/bin/console @@ -2,7 +2,7 @@ # frozen_string_literal: true require "bundler/setup" -require "error_notifier" +require "dlnk_error_notifier" # You can add fixtures and/or initialization code here to make experimenting # with your gem easier. You can also use a different console, if you like. diff --git a/dlnk_error_notifier-0.1.0.gem b/dlnk_error_notifier-0.1.0.gem new file mode 100644 index 0000000..35ca987 Binary files /dev/null and b/dlnk_error_notifier-0.1.0.gem differ diff --git a/error_notifier.gemspec b/dlnk_error_notifier.gemspec similarity index 93% rename from error_notifier.gemspec rename to dlnk_error_notifier.gemspec index 65396e5..67a92ba 100644 --- a/error_notifier.gemspec +++ b/dlnk_error_notifier.gemspec @@ -1,10 +1,10 @@ # frozen_string_literal: true -require_relative "lib/error_notifier/version" +require_relative "lib/dlnk_error_notifier/version" Gem::Specification.new do |spec| spec.name = "dlnk_error_notifier" - spec.version = ErrorNotifier::VERSION + spec.version = DlnkErrorNotifier::VERSION spec.authors = ["dalink"] spec.email = ["cyril@dalink.fr"] diff --git a/error_notifier-0.1.0.gem b/error_notifier-0.1.0.gem deleted file mode 100644 index 25ce6b1..0000000 Binary files a/error_notifier-0.1.0.gem and /dev/null differ diff --git a/lib/dlnk_error_notifier.rb b/lib/dlnk_error_notifier.rb new file mode 100644 index 0000000..a95a32a --- /dev/null +++ b/lib/dlnk_error_notifier.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +require "dlnk_error_notifier/version" +require_relative "dlnk_error_notifier/middleware" +require "dlnk_error_notifier/jobs/http_post_job" + +module DlnkErrorNotifier + class Error < StandardError; end + # Your code goes here... +end diff --git a/lib/error_notifier/jobs/http_post_job.rb b/lib/dlnk_error_notifier/jobs/http_post_job.rb similarity index 83% rename from lib/error_notifier/jobs/http_post_job.rb rename to lib/dlnk_error_notifier/jobs/http_post_job.rb index 12d08aa..95874e1 100644 --- a/lib/error_notifier/jobs/http_post_job.rb +++ b/lib/dlnk_error_notifier/jobs/http_post_job.rb @@ -3,13 +3,13 @@ require "active_job" require "httparty" -module ErrorNotifier +module DlnkErrorNotifier # HttpPostJob is an ActiveJob that performs an HTTP POST request. # This job is enqueued to run in the background, preventing the main thread # from being blocked by the HTTP request. # # @example Enqueue the job - # ErrorNotifier::HttpPostJob.perform_later('https://your-webhook-url.com', { key: 'value' }.to_json) + # DlnkErrorNotifier::HttpPostJob.perform_later('https://your-webhook-url.com', { key: 'value' }.to_json) # # @param url [String] the URL to which the POST request is sent # @param body [String] the body of the POST request, typically in JSON format diff --git a/lib/error_notifier/middleware.rb b/lib/dlnk_error_notifier/middleware.rb similarity index 89% rename from lib/error_notifier/middleware.rb rename to lib/dlnk_error_notifier/middleware.rb index bc1da7a..6074348 100644 --- a/lib/error_notifier/middleware.rb +++ b/lib/dlnk_error_notifier/middleware.rb @@ -1,9 +1,9 @@ # frozen_string_literal: true require "rack/request" -require "error_notifier/jobs/http_post_job" +require "dlnk_error_notifier/jobs/http_post_job" -module ErrorNotifier +module DlnkErrorNotifier # Middleware to catch exceptions and send them to a webhook class Middleware def initialize(app) @@ -37,7 +37,7 @@ def notify_error(env, exception) end def send_webhook(error_details) - ErrorNotifier::HttpPostJob.perform_later( + DlnkErrorNotifier::HttpPostJob.perform_later( ENV["WEBHOOK_URL"] || "http://localhost:3000/webhook", error_details.to_json ) diff --git a/lib/error_notifier/version.rb b/lib/dlnk_error_notifier/version.rb similarity index 100% rename from lib/error_notifier/version.rb rename to lib/dlnk_error_notifier/version.rb diff --git a/lib/error_notifier.rb b/lib/error_notifier.rb deleted file mode 100644 index cb3b391..0000000 --- a/lib/error_notifier.rb +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: true - -require "error_notifier/version" -require_relative "error_notifier/middleware" -require "error_notifier/jobs/http_post_job" - -module ErrorNotifier - class Error < StandardError; end - # Your code goes here... -end diff --git a/sig/error_notifier.rbs b/sig/dlnk_error_notifier.rbs similarity index 78% rename from sig/error_notifier.rbs rename to sig/dlnk_error_notifier.rbs index 3bf08fd..8523061 100644 --- a/sig/error_notifier.rbs +++ b/sig/dlnk_error_notifier.rbs @@ -1,4 +1,4 @@ -module ErrorNotifier +module DlnkErrorNotifier VERSION: String # See the writing guide of rbs: https://github.com/ruby/rbs#guides end diff --git a/test/test_error_notifier.rb b/test/test_dlnk_error_notifier.rb similarity index 64% rename from test/test_error_notifier.rb rename to test/test_dlnk_error_notifier.rb index 6baf405..98554a1 100644 --- a/test/test_error_notifier.rb +++ b/test/test_dlnk_error_notifier.rb @@ -2,9 +2,9 @@ require "test_helper" -class TestErrorNotifier < Minitest::Test +class TestDlnkErrorNotifier < Minitest::Test def test_that_it_has_a_version_number - refute_nil ::ErrorNotifier::VERSION + refute_nil ::DlnkErrorNotifier::VERSION end def test_it_does_something_useful diff --git a/test/test_helper.rb b/test/test_helper.rb index e678262..93e947f 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true $LOAD_PATH.unshift File.expand_path("../lib", __dir__) -require "error_notifier" +require "dlnk_error_notifier" require "minitest/autorun"