exception_handler 0.6.5 → 0.7.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.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +33 -33
  3. data/.rspec +3 -3
  4. data/.travis.yml +5 -5
  5. data/Gemfile +13 -13
  6. data/LICENSE.txt +22 -22
  7. data/README.md +349 -341
  8. data/Rakefile +7 -7
  9. data/app/assets/images/{favicon.ico → exception_handler.ico} +0 -0
  10. data/app/assets/images/exception_handler/alert.jpg +0 -0
  11. data/app/assets/images/exception_handler/bg.jpg +0 -0
  12. data/app/assets/images/exception_handler/favicon.ico +0 -0
  13. data/app/assets/images/exception_handler/icon.png +0 -0
  14. data/app/assets/stylesheets/exception_handler.css.erb +8 -8
  15. data/app/assets/stylesheets/styles/_base.css.erb +35 -34
  16. data/app/assets/stylesheets/styles/_exception.css.erb +105 -103
  17. data/app/assets/stylesheets/styles/_footer.css.erb +24 -27
  18. data/app/assets/stylesheets/styles/_responsive.css +5 -5
  19. data/app/controllers/exception_handler/exception_controller.rb +45 -38
  20. data/app/mailers/exception_handler/exception_mailer.rb +16 -16
  21. data/app/models/exception_handler/exception.rb +191 -191
  22. data/app/views/exception_handler/exception/show.html.erb +1 -1
  23. data/app/views/exception_handler/mailers/new_exception.erb +4 -4
  24. data/app/views/layouts/exception.html.erb +27 -21
  25. data/config/locales/exception_handler.en.yml +13 -13
  26. data/exception_handler.gemspec +80 -84
  27. data/lib/exception_handler.rb +32 -29
  28. data/lib/exception_handler/config.rb +80 -66
  29. data/lib/exception_handler/engine.rb +44 -36
  30. data/lib/generators/exception_handler/migration_generator.rb +55 -55
  31. data/lib/generators/exception_handler/views_generator.rb +42 -42
  32. data/lib/generators/templates/migration.rb.erb +16 -16
  33. data/spec/database.yml +2 -2
  34. data/spec/dummy/Rakefile +6 -6
  35. data/spec/dummy/app/assets/config/manifest.js +4 -4
  36. data/spec/dummy/app/assets/javascripts/application.js +13 -13
  37. data/spec/dummy/app/assets/javascripts/cable.coffee +11 -11
  38. data/spec/dummy/app/assets/stylesheets/application.css +15 -15
  39. data/spec/dummy/app/channels/application_cable/channel.rb +5 -5
  40. data/spec/dummy/app/channels/application_cable/connection.rb +5 -5
  41. data/spec/dummy/app/controllers/application_controller.rb +5 -5
  42. data/spec/dummy/app/helpers/application_helper.rb +2 -2
  43. data/spec/dummy/app/jobs/application_job.rb +2 -2
  44. data/spec/dummy/app/mailers/application_mailer.rb +4 -4
  45. data/spec/dummy/app/models/application_record.rb +3 -3
  46. data/spec/dummy/app/views/layouts/application.html.erb +15 -15
  47. data/spec/dummy/app/views/layouts/mailer.html.erb +13 -13
  48. data/spec/dummy/app/views/layouts/mailer.text.erb +1 -1
  49. data/spec/dummy/bin/bundle +3 -3
  50. data/spec/dummy/bin/rails +4 -4
  51. data/spec/dummy/bin/rake +4 -4
  52. data/spec/dummy/bin/setup +34 -34
  53. data/spec/dummy/bin/update +29 -29
  54. data/spec/dummy/config.ru +8 -8
  55. data/spec/dummy/config/application.rb +21 -21
  56. data/spec/dummy/config/boot.rb +5 -5
  57. data/spec/dummy/config/cable.yml +10 -10
  58. data/spec/dummy/config/database.yml +25 -25
  59. data/spec/dummy/config/environment.rb +5 -5
  60. data/spec/dummy/config/environments/development.rb +62 -62
  61. data/spec/dummy/config/environments/production.rb +87 -87
  62. data/spec/dummy/config/environments/test.rb +42 -42
  63. data/spec/dummy/config/initializers/active_record_belongs_to_required_by_default.rb +6 -6
  64. data/spec/dummy/config/initializers/application_controller_renderer.rb +6 -6
  65. data/spec/dummy/config/initializers/assets.rb +11 -11
  66. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -7
  67. data/spec/dummy/config/initializers/callback_terminator.rb +6 -6
  68. data/spec/dummy/config/initializers/cookies_serializer.rb +5 -5
  69. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -4
  70. data/spec/dummy/config/initializers/inflections.rb +16 -16
  71. data/spec/dummy/config/initializers/mime_types.rb +4 -4
  72. data/spec/dummy/config/initializers/per_form_csrf_tokens.rb +4 -4
  73. data/spec/dummy/config/initializers/request_forgery_protection.rb +4 -4
  74. data/spec/dummy/config/initializers/session_store.rb +3 -3
  75. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -14
  76. data/spec/dummy/config/locales/en.yml +23 -23
  77. data/spec/dummy/config/puma.rb +47 -47
  78. data/spec/dummy/config/routes.rb +6 -6
  79. data/spec/dummy/config/secrets.yml +22 -22
  80. data/spec/dummy/public/404.html +67 -67
  81. data/spec/dummy/public/422.html +67 -67
  82. data/spec/dummy/public/500.html +66 -66
  83. data/spec/exception_handler.rb +21 -21
  84. data/spec/exception_handler/exception_controller_spec.rb +18 -0
  85. data/spec/spec_helper.rb +54 -54
  86. metadata +11 -8
@@ -1,55 +1,55 @@
1
- ###########################################
2
-
3
- require 'rails/generators/active_record'
4
- require 'exception_handler/exception' # => ATTRS constant (for attributes)
5
-
6
- ###########################################
7
-
8
- # => Migration Generator (for adding errors table)
9
- # => Ref: https://github.com/plataformatec/devise/blob/master/lib/generators/active_record/devise_generator.rb
10
-
11
- module ExceptionHandler
12
- class MigrationGenerator < ActiveRecord::Generators::Base
13
-
14
- # => Name - from http://old.thoughtsincomputation.com/posts/cgfr3-part-3-adding-a-generator
15
- argument :name, default: "migration"
16
-
17
- # => Source of Migrations
18
- source_root File.expand_path("../../templates", __FILE__)
19
-
20
- ###########################################
21
-
22
- # => Table Name - false = off, true = errors, value = value
23
- # => Always outputs string for some reason...
24
- def table_name
25
- ExceptionHandler.config.db
26
- end
27
-
28
- ###########################################
29
-
30
- # => Create
31
- def create_errors_migration
32
- migration_template "migration.rb.erb", "db/migrate/create_#{table_name.to_s.gsub("_","")}.rb", migration_version: migration_version
33
- end
34
-
35
- ###########################################
36
-
37
- # => From Devise
38
- # => https://github.com/plataformatec/devise/blob/master/lib/generators/active_record/devise_generator.rb#L81
39
-
40
- # => Rails 5?
41
- def rails5?
42
- Rails.version.start_with? '5'
43
- end
44
-
45
- # => Migration Version
46
- def migration_version
47
- if rails5?
48
- "[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]"
49
- end
50
- end
51
-
52
- ###########################################
53
-
54
- end
55
- end
1
+ ###########################################
2
+
3
+ require 'rails/generators/active_record'
4
+ require 'exception_handler/exception' # => ATTRS constant (for attributes)
5
+
6
+ ###########################################
7
+
8
+ # => Migration Generator (for adding errors table)
9
+ # => Ref: https://github.com/plataformatec/devise/blob/master/lib/generators/active_record/devise_generator.rb
10
+
11
+ module ExceptionHandler
12
+ class MigrationGenerator < ActiveRecord::Generators::Base
13
+
14
+ # => Name - from http://old.thoughtsincomputation.com/posts/cgfr3-part-3-adding-a-generator
15
+ argument :name, default: "migration"
16
+
17
+ # => Source of Migrations
18
+ source_root File.expand_path("../../templates", __FILE__)
19
+
20
+ ###########################################
21
+
22
+ # => Table Name - false = off, true = errors, value = value
23
+ # => Always outputs string for some reason...
24
+ def table_name
25
+ ExceptionHandler.config.db
26
+ end
27
+
28
+ ###########################################
29
+
30
+ # => Create
31
+ def create_errors_migration
32
+ migration_template "migration.rb.erb", "db/migrate/create_#{table_name.to_s.gsub("_","")}.rb", migration_version: migration_version
33
+ end
34
+
35
+ ###########################################
36
+
37
+ # => From Devise
38
+ # => https://github.com/plataformatec/devise/blob/master/lib/generators/active_record/devise_generator.rb#L81
39
+
40
+ # => Rails 5?
41
+ def rails5?
42
+ Rails.version.start_with? '5'
43
+ end
44
+
45
+ # => Migration Version
46
+ def migration_version
47
+ if rails5?
48
+ "[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]"
49
+ end
50
+ end
51
+
52
+ ###########################################
53
+
54
+ end
55
+ end
@@ -1,42 +1,42 @@
1
- module ExceptionHandler
2
- class ViewsGenerator < Rails::Generators::Base
3
-
4
- #Views
5
- VIEWS = %w(views controllers models assets)
6
-
7
- #Options
8
- class_option :files, aliases: "-v", default: VIEWS, type: :array, desc: "Select file types (views, models, controllers, assets)"
9
-
10
- #Needed to reference files
11
- source_root File.expand_path("../../../../app", __FILE__)
12
-
13
- ###########################################
14
-
15
- #Files
16
- def create_files
17
- generate_files options.files
18
- end
19
-
20
- ###########################################
21
-
22
- protected
23
-
24
- #File Generator
25
- def generate_files args
26
-
27
- #Valid?
28
- return raise args.inspect unless args.nil? || (args-VIEWS).empty?
29
-
30
- #Types
31
- for arg in args do
32
- directory arg, "app/#{arg}"
33
- end
34
-
35
- #Success
36
- puts "Files transferred successfully"
37
- end
38
-
39
- ###########################################
40
-
41
- end
42
- end
1
+ module ExceptionHandler
2
+ class ViewsGenerator < Rails::Generators::Base
3
+
4
+ #Views
5
+ VIEWS = %w(views controllers models assets)
6
+
7
+ #Options
8
+ class_option :files, aliases: "-v", default: VIEWS, type: :array, desc: "Select file types (views, models, controllers, assets)"
9
+
10
+ #Needed to reference files
11
+ source_root File.expand_path("../../../../app", __FILE__)
12
+
13
+ ###########################################
14
+
15
+ #Files
16
+ def create_files
17
+ generate_files options.files
18
+ end
19
+
20
+ ###########################################
21
+
22
+ protected
23
+
24
+ #File Generator
25
+ def generate_files args
26
+
27
+ #Valid?
28
+ return raise args.inspect unless args.nil? || (args-VIEWS).empty?
29
+
30
+ #Types
31
+ for arg in args do
32
+ directory arg, "app/#{arg}"
33
+ end
34
+
35
+ #Success
36
+ puts "Files transferred successfully"
37
+ end
38
+
39
+ ###########################################
40
+
41
+ end
42
+ end
@@ -1,16 +1,16 @@
1
- class Create<%= table_name.to_s.gsub("_","").titleize %> < ActiveRecord::Migration<%= migration_version %>
2
-
3
- def self.up
4
- create_table :<%= table_name %> do |t|
5
- <% ExceptionHandler::ATTRS.each do |attr| %>
6
- t.text :<%= attr %>
7
- <% end %>
8
- t.timestamps
9
- end
10
- end
11
-
12
- def self.down
13
- drop_table :<%= table_name %>
14
- end
15
-
16
- end
1
+ class Create<%= table_name.to_s.gsub("_","").titleize %> < ActiveRecord::Migration<%= migration_version %>
2
+
3
+ def self.up
4
+ create_table :<%= table_name %> do |t|
5
+ <% ExceptionHandler::ATTRS.each do |attr| %>
6
+ t.text :<%= attr %>
7
+ <% end %>
8
+ t.timestamps
9
+ end
10
+ end
11
+
12
+ def self.down
13
+ drop_table :<%= table_name %>
14
+ end
15
+
16
+ end
@@ -1,3 +1,3 @@
1
- test:
2
- adapter: sqlite3
1
+ test:
2
+ adapter: sqlite3
3
3
  database: ":memory:" #-> https://github.com/thoughtbot/paperclip/blob/master/spec/database.yml
@@ -1,6 +1,6 @@
1
- # Add your own tasks in files placed in lib/tasks ending in .rake,
2
- # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
-
4
- require File.expand_path('../config/application', __FILE__)
5
-
6
- Rails.application.load_tasks
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+
6
+ Rails.application.load_tasks
@@ -1,4 +1,4 @@
1
-
2
- //= link_tree ../images
3
- //= link_directory ../javascripts .js
4
- //= link_directory ../stylesheets .css
1
+
2
+ //= link_tree ../images
3
+ //= link_directory ../javascripts .js
4
+ //= link_directory ../stylesheets .css
@@ -1,13 +1,13 @@
1
- // This is a manifest file that'll be compiled into application.js, which will include all the files
2
- // listed below.
3
- //
4
- // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
- // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
- //
7
- // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
- // compiled file. JavaScript code in this file should be added after the last require_* statement.
9
- //
10
- // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
- // about supported directives.
12
- //
13
- //= require_tree .
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file. JavaScript code in this file should be added after the last require_* statement.
9
+ //
10
+ // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require_tree .
@@ -1,11 +1,11 @@
1
- # Action Cable provides the framework to deal with WebSockets in Rails.
2
- # You can generate new channels where WebSocket features live using the rails generate channel command.
3
- #
4
- # Turn on the cable connection by removing the comments after the require statements (and ensure it's also on in config/routes.rb).
5
- #
6
- #= require action_cable
7
- #= require_self
8
- #= require_tree ./channels
9
- #
10
- # @App ||= {}
11
- # App.cable = ActionCable.createConsumer()
1
+ # Action Cable provides the framework to deal with WebSockets in Rails.
2
+ # You can generate new channels where WebSocket features live using the rails generate channel command.
3
+ #
4
+ # Turn on the cable connection by removing the comments after the require statements (and ensure it's also on in config/routes.rb).
5
+ #
6
+ #= require action_cable
7
+ #= require_self
8
+ #= require_tree ./channels
9
+ #
10
+ # @App ||= {}
11
+ # App.cable = ActionCable.createConsumer()
@@ -1,15 +1,15 @@
1
- /*
2
- * This is a manifest file that'll be compiled into application.css, which will include all the files
3
- * listed below.
4
- *
5
- * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
- * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
- *
8
- * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
- * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10
- * files in this directory. Styles in this file should be added after the last require_* statement.
11
- * It is generally better to create a new file per style scope.
12
- *
13
- *= require_tree .
14
- *= require_self
15
- */
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10
+ * files in this directory. Styles in this file should be added after the last require_* statement.
11
+ * It is generally better to create a new file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -1,5 +1,5 @@
1
- # Be sure to restart your server when you modify this file. Action Cable runs in a loop that does not support auto reloading.
2
- module ApplicationCable
3
- class Channel < ActionCable::Channel::Base
4
- end
5
- end
1
+ # Be sure to restart your server when you modify this file. Action Cable runs in a loop that does not support auto reloading.
2
+ module ApplicationCable
3
+ class Channel < ActionCable::Channel::Base
4
+ end
5
+ end
@@ -1,5 +1,5 @@
1
- # Be sure to restart your server when you modify this file. Action Cable runs in a loop that does not support auto reloading.
2
- module ApplicationCable
3
- class Connection < ActionCable::Connection::Base
4
- end
5
- end
1
+ # Be sure to restart your server when you modify this file. Action Cable runs in a loop that does not support auto reloading.
2
+ module ApplicationCable
3
+ class Connection < ActionCable::Connection::Base
4
+ end
5
+ end
@@ -1,5 +1,5 @@
1
- class ApplicationController < ActionController::Base
2
- # Prevent CSRF attacks by raising an exception.
3
- # For APIs, you may want to use :null_session instead.
4
- protect_from_forgery with: :exception
5
- end
1
+ class ApplicationController < ActionController::Base
2
+ # Prevent CSRF attacks by raising an exception.
3
+ # For APIs, you may want to use :null_session instead.
4
+ protect_from_forgery with: :exception
5
+ end
@@ -1,2 +1,2 @@
1
- module ApplicationHelper
2
- end
1
+ module ApplicationHelper
2
+ end
@@ -1,2 +1,2 @@
1
- class ApplicationJob < ActiveJob::Base
2
- end
1
+ class ApplicationJob < ActiveJob::Base
2
+ end
@@ -1,4 +1,4 @@
1
- class ApplicationMailer < ActionMailer::Base
2
- default from: 'from@example.com'
3
- layout 'mailer'
4
- end
1
+ class ApplicationMailer < ActionMailer::Base
2
+ default from: 'from@example.com'
3
+ layout 'mailer'
4
+ end
@@ -1,3 +1,3 @@
1
- class ApplicationRecord < ActiveRecord::Base
2
- self.abstract_class = true
3
- end
1
+ class ApplicationRecord < ActiveRecord::Base
2
+ self.abstract_class = true
3
+ end
@@ -1,15 +1,15 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>Dummy</title>
5
- <%= csrf_meta_tags %>
6
- <%= action_cable_meta_tag %>
7
-
8
- <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => 'reload' %>
9
- <%= javascript_include_tag 'application', 'data-turbolinks-track' => 'reload' %>
10
- </head>
11
-
12
- <body>
13
- <%= yield %>
14
- </body>
15
- </html>
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= csrf_meta_tags %>
6
+ <%= action_cable_meta_tag %>
7
+
8
+ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => 'reload' %>
9
+ <%= javascript_include_tag 'application', 'data-turbolinks-track' => 'reload' %>
10
+ </head>
11
+
12
+ <body>
13
+ <%= yield %>
14
+ </body>
15
+ </html>
@@ -1,13 +1,13 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
- <style>
6
- /* Email styles need to be inline */
7
- </style>
8
- </head>
9
-
10
- <body>
11
- <%= yield %>
12
- </body>
13
- </html>
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
+ <style>
6
+ /* Email styles need to be inline */
7
+ </style>
8
+ </head>
9
+
10
+ <body>
11
+ <%= yield %>
12
+ </body>
13
+ </html>