errdo 0.11.0 → 0.11.1

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.
@@ -1,4 +1,5 @@
1
1
  require 'test_helper'
2
+ require 'rake'
2
3
 
3
4
  class ErrdoTest < ActiveSupport::TestCase
4
5
 
@@ -82,6 +83,46 @@ class ErrdoTest < ActiveSupport::TestCase
82
83
  occ = Errdo::ErrorOccurrence.last
83
84
  assert_equal "...", occ.param_values[:password]
84
85
  end
86
+
87
+ # rubocop:disable Style/RescueModifier
88
+ # rubocop:disable Lint/HandleExceptions
89
+ context "rake tasks" do
90
+ setup do
91
+ load "#{Rails.root}/lib/tasks/test.rake"
92
+ end
93
+
94
+ teardown do
95
+ Rake.application['test:error'].reenable
96
+ Rake.application['test:interrupt'].reenable
97
+ end
98
+
99
+ should "create an error when a task fails" do
100
+ Errdo.log_task_exceptions = true
101
+ assert_difference 'Errdo::ErrorOccurrence.count', 1 do
102
+ Rake.application['test:error'].invoke rescue ""
103
+ end
104
+ end
105
+
106
+ should "not create an error when a task fails with an interrupt" do
107
+ Errdo.log_task_exceptions = true
108
+ load "#{Rails.root}/lib/tasks/test.rake"
109
+ assert_difference 'Errdo::ErrorOccurrence.count', 0 do
110
+ begin
111
+ Rake.application['test:interrupt'].invoke
112
+ rescue Interrupt
113
+ end
114
+ end
115
+ end
116
+
117
+ should "create not an error when a task fails when not set" do
118
+ Errdo.log_task_exceptions = false
119
+ assert_difference 'Errdo::ErrorOccurrence.count', 0 do
120
+ Rake.application['test:error'].invoke rescue ""
121
+ end
122
+ end
123
+ end
124
+ # rubocop:enable Style/RescueModifier
125
+ # rubocop:enable Lint/HandleExceptions
85
126
  end
86
127
  end
87
128
 
@@ -0,0 +1,54 @@
1
+ class ErrdoCreateErrs < ActiveRecord::Migration
2
+ def change
3
+ create_table :errs do |t|
4
+ t.string :exception_class_name
5
+ t.string :exception_message
6
+ t.string :http_method
7
+ t.string :host_name
8
+ t.string :url
9
+
10
+ t.text :backtrace
11
+
12
+ t.string :backtrace_hash
13
+ t.integer :occurrence_count, default: 0
14
+ t.datetime :last_occurred_at
15
+
16
+ t.string :last_experiencer_type
17
+ t.integer :last_experiencer_id
18
+
19
+ t.integer :status, default: 0
20
+ t.string :importance, default: "error"
21
+
22
+
23
+ t.timestamps null: false
24
+ end
25
+
26
+ create_table :err_occurrences do |t|
27
+ t.integer :err_id
28
+
29
+ t.string :experiencer_type
30
+ t.integer :experiencer_id
31
+
32
+ t.string :ip
33
+ t.string :user_agent
34
+ t.string :referer
35
+ t.string :query_string
36
+ t.text :form_values
37
+ t.text :param_values
38
+ t.text :cookie_values
39
+ t.text :header_values
40
+
41
+ t.integer :ocurrence_count, default: 1
42
+ t.timestamps null: false
43
+ end
44
+
45
+ add_index :errs, :backtrace_hash, unique: true
46
+ add_index :errs, :importance
47
+ add_index :errs, :last_experiencer_id
48
+ add_index :errs, :last_experiencer_type
49
+
50
+ add_index :err_occurrences, :experiencer_id
51
+ add_index :err_occurrences, :experiencer_type
52
+ add_index :err_occurrences, :err_id
53
+ end
54
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: errdo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - erichaydel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-08 00:00:00.000000000 Z
11
+ date: 2016-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -171,13 +171,13 @@ files:
171
171
  - lib/errdo/notifications/slack.rb
172
172
  - lib/errdo/notifications/slack/notification_adapter.rb
173
173
  - lib/errdo/notifier.rb
174
+ - lib/errdo/rake/task.rb
174
175
  - lib/errdo/version.rb
175
176
  - lib/generators/active_record/errdo_generator.rb
176
177
  - lib/generators/active_record/templates/migration.rb
177
178
  - lib/generators/errdo/errdo_generator.rb
178
179
  - lib/generators/errdo/install_generator.rb
179
180
  - lib/generators/templates/errdo.rb
180
- - lib/tasks/errdo_tasks.rake
181
181
  - test/controllers/errors_controller_test.rb
182
182
  - test/dummy/README.rdoc
183
183
  - test/dummy/Rakefile
@@ -226,6 +226,7 @@ files:
226
226
  - test/dummy/db/migrate/20161004015324_errdo_create_errors.rb
227
227
  - test/dummy/db/schema.rb
228
228
  - test/dummy/db/test.sqlite3
229
+ - test/dummy/lib/tasks/test.rake
229
230
  - test/dummy/log/development.log
230
231
  - test/dummy/log/test.log
231
232
  - test/dummy/public/404.html
@@ -1006,8 +1007,7 @@ files:
1006
1007
  - test/models/error_occurrence_test.rb
1007
1008
  - test/models/error_test.rb
1008
1009
  - test/test_helper.rb
1009
- - test/tmp/config/application.rb
1010
- - test/tmp/config/initializers/errdo.rb
1010
+ - test/tmp/db/migrate/20161020165703_errdo_create_errs.rb
1011
1011
  homepage: https://github.com/erichaydel/errdo
1012
1012
  licenses:
1013
1013
  - MIT
@@ -1034,6 +1034,7 @@ specification_version: 4
1034
1034
  summary: Errdo allows developers to keep track of their users' experience on their
1035
1035
  site, simply and easily
1036
1036
  test_files:
1037
+ - test/dummy/lib/tasks/test.rake
1037
1038
  - test/dummy/db/migrate/20161004015324_errdo_create_errors.rb
1038
1039
  - test/dummy/db/migrate/20160816202941_devise_create_users.rb
1039
1040
  - test/dummy/db/development.sqlite3
@@ -1859,8 +1860,7 @@ test_files:
1859
1860
  - test/models/error_occurrence_test.rb
1860
1861
  - test/models/errdo_test.rb
1861
1862
  - test/models/error_test.rb
1862
- - test/tmp/config/application.rb
1863
- - test/tmp/config/initializers/errdo.rb
1863
+ - test/tmp/db/migrate/20161020165703_errdo_create_errs.rb
1864
1864
  - test/generators/install_generator_test.rb
1865
1865
  - test/generators/active_record_generator_test.rb
1866
1866
  - test/generators/errdo_generator_test.rb
@@ -1,4 +0,0 @@
1
- # desc "Explaining what the task does"
2
- # task :errdo do
3
- # # Task goes here
4
- # end
@@ -1,4 +0,0 @@
1
- module Dummy
2
- class Application
3
- end
4
- end
@@ -1,50 +0,0 @@
1
- Errdo.setup do |config|
2
- # Add words to be scrubbed from the params here. By default, this is
3
- # %w(password passwd password_confirmation secret confirm_password secret_token)
4
- # So make sure you add on, not replace!
5
- # Errdo.dirty_words += ["custom_param"]
6
-
7
- ## == Authorization and Devise integration ==================
8
- # If you have the ability to track who's logged in, setting the current_user_method
9
- # will allow the logged-in user to be recorded with the error
10
- # config.current_user_method = :current_user
11
- # Some form of authentication here is basically necessary for authorization
12
- # config.authenticate_with do
13
- # warden.authenticate! scope: :user
14
- # end
15
-
16
- ## == Authorization =======================
17
- # Setup authorization to be run as a before filter
18
- # This is run inside the controller instance so you can setup any authorization you need to.
19
- # By default, there is no authorization.
20
- #
21
- # config.authorize_with do
22
- # redirect_to root_path unless warden.user.try(:is_admin?)
23
- # end
24
- #
25
- # To use an authorization adapter, pass the name of the adapter. For example,
26
- # to use with CanCanCan[https://github.com/CanCanCommunity/cancancan], pass it like this.
27
- # Currently, only cancan/cancancan is supported
28
- # config.authorize_with :cancan
29
-
30
- # This determines how the user is displayed on the table of errors
31
- # Can be any method that a user responds to, I.E. Any method that returns a string
32
- # when called on user (Default is :email)
33
- config.user_string_method = :email
34
-
35
- # Setting this will allow the user string to be linked to the show path
36
- # Default is the errdo root path
37
- # config.user_show_path = :user_path
38
-
39
- ## == Notification Integration ====================
40
- # See the github page at https://github.com/erichaydel/errdo for more info on how to set up slack
41
- # If you want to set up slack, this is the only required parameter.
42
- # The rest are totally optional, and default to the values here
43
- #
44
- # Errdo.notify_with slack: { webhook: "WEBHOOK-URL",
45
- # channel: nil
46
- # icon: ":boom:",
47
- # name: "Errdo-bot" }
48
-
49
- # For now, slack is the only integration. More coming soon!
50
- end