solid_errors 0.2.4 → 0.2.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2b217c4f9bb72282db398685b1e5152f709f6d2b17476d096b5d4db30ba36724
4
- data.tar.gz: fa004229fca23f20fce73294ca971d1465fafc022c6c8803be1edf21a0dcd8b9
3
+ metadata.gz: e69dbe088ff461a32c395c79dff5d4d6ccfef5d3afebd2edd32cad153f7e8a02
4
+ data.tar.gz: 205c26874a40a3e4427051709e0217b5dd6c5d8bf32abc343150754b69b13d31
5
5
  SHA512:
6
- metadata.gz: 1576b20fe13fcb3a40edca8f9f672d5f84b6e87707147eee254e180508b2942b243a49662a402c1cd45e3cddd8da0906e89114767672e89a8eb422e268d25bd3
7
- data.tar.gz: 14d720a8e037f7ee0cbd1683790049fa6ca0e5d9230b4bf8692dcddc192bde8962defb6f64e4768b542f79d01fa90da5fc7e95c61e1da67ed59800e8cdbc3c9c
6
+ metadata.gz: 07ac740b18e82c3f8cbe0a0df520e0b48daa5cd3db100b39787c78e9c87b17e7e0a139b799aa9111d13613e96b1f6af67ce7dc9cacb90fb2333175aca03f5216
7
+ data.tar.gz: 2c89cb709d53fc8cbbdff2e1f9db2d3ade809e206a747a8d2c2bbfdc2144f394d4c8f731c6f6fa94979359a0f6a8690f23f305ed6714ca2f657fcc3f1667ade4
@@ -0,0 +1,4 @@
1
+ module SolidErrors
2
+ class ApplicationController < ActionController::Base
3
+ end
4
+ end
@@ -1,5 +1,7 @@
1
1
  module SolidErrors
2
2
  class Error < Record
3
+ self.table_name = "solid_errors"
4
+
3
5
  SEVERITY_TO_EMOJI = {
4
6
  error: "🔥",
5
7
  warning: "⚠️",
@@ -1,13 +1,32 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class SolidErrors::InstallGenerator < Rails::Generators::Base
4
- source_root File.expand_path("templates", __dir__)
3
+ require 'rails/generators'
4
+ require 'rails/generators/active_record'
5
5
 
6
- class_option :skip_migrations, type: :boolean, default: nil, desc: "Skip migrations"
6
+ module SolidErrors
7
+ #
8
+ # Rails generator used for setting up SolidErrors in a Rails application.
9
+ # Run it with +bin/rails g solid_errors:install+ in your console.
10
+ #
11
+ class InstallGenerator < Rails::Generators::Base
12
+ include ActiveRecord::Generators::Migration
7
13
 
8
- def create_migrations
9
- unless options[:skip_migrations]
10
- rails_command "railties:install:migrations FROM=solid_errors", inline: true
14
+ source_root File.expand_path("templates", __dir__)
15
+
16
+ class_option :database, type: :string, aliases: %i(--db), desc: "The database for your migration. By default, the current environment's primary database is used."
17
+ class_option :skip_migrations, type: :boolean, default: nil, desc: "Skip migrations"
18
+
19
+ # Generates monolithic migration file that contains all database changes.
20
+ def create_migration_file
21
+ return if options[:skip_migrations]
22
+
23
+ migration_template 'create_solid_errors_tables.rb.erb', File.join(db_migrate_path, "create_solid_errors_tables.rb")
24
+ end
25
+
26
+ private
27
+
28
+ def migration_version
29
+ "[#{ActiveRecord::VERSION::STRING.to_f}]"
11
30
  end
12
31
  end
13
32
  end
@@ -1,6 +1,8 @@
1
- class CreateSolidErrorsTables < ActiveRecord::Migration[7.1]
1
+ # frozen_string_literal: true
2
+
3
+ class CreateSolidErrorsTables < ActiveRecord::Migration<%= migration_version %>
2
4
  def change
3
- create_table :errors do |t|
5
+ create_table :solid_errors do |t|
4
6
  t.string :exception_class, null: false
5
7
  t.string :message, null: false
6
8
  t.string :severity, null: false
@@ -12,7 +14,7 @@ class CreateSolidErrorsTables < ActiveRecord::Migration[7.1]
12
14
  t.index [:exception_class, :message, :severity, :source], unique: true
13
15
  end
14
16
 
15
- create_table :occurrences do |t|
17
+ create_table :solid_errors_occurrences do |t|
16
18
  t.belongs_to :error, null: false, foreign_key: true
17
19
  t.text :backtrace
18
20
  t.json :context
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SolidErrors
4
- VERSION = "0.2.4"
4
+ VERSION = "0.2.6"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solid_errors
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen Margheim
@@ -33,6 +33,7 @@ extra_rdoc_files: []
33
33
  files:
34
34
  - README.md
35
35
  - Rakefile
36
+ - app/controllers/solid_errors/application_controller.rb
36
37
  - app/controllers/solid_errors/errors_controller.rb
37
38
  - app/models/solid_errors/error.rb
38
39
  - app/models/solid_errors/occurrence.rb
@@ -45,9 +46,9 @@ files:
45
46
  - app/views/solid_errors/occurrences/_collection.html.erb
46
47
  - app/views/solid_errors/occurrences/_occurrence.html.erb
47
48
  - config/routes.rb
48
- - db/migrate/20240112191645_create_solid_errors_tables.rb
49
49
  - lib/generators/solid_errors/install/USAGE
50
50
  - lib/generators/solid_errors/install/install_generator.rb
51
+ - lib/generators/solid_errors/install/templates/create_solid_errors_tables.rb.erb
51
52
  - lib/solid_errors.rb
52
53
  - lib/solid_errors/backtrace.rb
53
54
  - lib/solid_errors/backtrace_line.rb