checker_jobs 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 407540f61ad36263f771cc0493b8675c23037ed6887227ebc73d2ef2d49fb25a
4
- data.tar.gz: e2151498b71791a6065bf1e951b18e6d000c0c05bd287c1e1cbe6862c09bf3d7
3
+ metadata.gz: be30cf913e5e2aa877d31a6f6d356395e7190c321319b9a723120994a4ba28b9
4
+ data.tar.gz: 01b5908f3436abcb4f32292ff0142d659f47af87ec1b6c2b1623244dcd3a725f
5
5
  SHA512:
6
- metadata.gz: 8da268fd3e0e20148297bafeb4f6ffe2aca570d957520ba4d90f25b9b6cb3c228ef3dd2a0ac47307c5ff2f1e837ce7194ab12d6369b1d3b079374081c3e3ccec
7
- data.tar.gz: 4715cf8a236d1c19a6234a9b0234c53104a5a8ee9c238aadeed993fa709a8f4c4a5a1f7391a81d7562ac98925daa6a36fcb4b47653363f1d9abf59cbe9d574be
6
+ metadata.gz: 2c44695a2344d051520dd246556af6c871e93e98bdcec6ad440c6b01bf6cc127fa30784071410443cdc1e13e81ca5c0594f02c80b95f849dab3d55eebcdb357f
7
+ data.tar.gz: 713167b5959eb3b326581f411fac1458eb7c91b57eb5a702f6665f188f889d80820a2b3a3b2d2f3fafebf4a95bcd1609567f55e6ee6d1d2f7d518331e59b47a4
@@ -33,6 +33,9 @@ Style/TrailingCommaInArrayLiteral:
33
33
  Style/TrailingCommaInHashLiteral:
34
34
  EnforcedStyleForMultiline: comma
35
35
 
36
+ Style/TrailingCommaInArguments:
37
+ EnforcedStyleForMultiline: comma
38
+
36
39
  #
37
40
  # Disabled cops
38
41
  #
@@ -1,36 +1,36 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- checker_jobs (1.1.1)
4
+ checker_jobs (1.2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- actionmailer (5.1.4)
10
- actionpack (= 5.1.4)
11
- actionview (= 5.1.4)
12
- activejob (= 5.1.4)
9
+ actionmailer (5.2.1)
10
+ actionpack (= 5.2.1)
11
+ actionview (= 5.2.1)
12
+ activejob (= 5.2.1)
13
13
  mail (~> 2.5, >= 2.5.4)
14
14
  rails-dom-testing (~> 2.0)
15
- actionpack (5.1.4)
16
- actionview (= 5.1.4)
17
- activesupport (= 5.1.4)
15
+ actionpack (5.2.1)
16
+ actionview (= 5.2.1)
17
+ activesupport (= 5.2.1)
18
18
  rack (~> 2.0)
19
19
  rack-test (>= 0.6.3)
20
20
  rails-dom-testing (~> 2.0)
21
21
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
22
- actionview (5.1.4)
23
- activesupport (= 5.1.4)
22
+ actionview (5.2.1)
23
+ activesupport (= 5.2.1)
24
24
  builder (~> 3.1)
25
25
  erubi (~> 1.4)
26
26
  rails-dom-testing (~> 2.0)
27
27
  rails-html-sanitizer (~> 1.0, >= 1.0.3)
28
- activejob (5.1.4)
29
- activesupport (= 5.1.4)
28
+ activejob (5.2.1)
29
+ activesupport (= 5.2.1)
30
30
  globalid (>= 0.3.6)
31
- activesupport (5.1.4)
31
+ activesupport (5.2.1)
32
32
  concurrent-ruby (~> 1.0, >= 1.0.2)
33
- i18n (~> 0.7)
33
+ i18n (>= 0.7, < 2)
34
34
  minitest (~> 5.1)
35
35
  tzinfo (~> 1.1)
36
36
  addressable (2.5.2)
@@ -38,32 +38,33 @@ GEM
38
38
  ast (2.4.0)
39
39
  bugsnag (5.4.1)
40
40
  builder (3.2.3)
41
- byebug (9.1.0)
41
+ byebug (10.0.2)
42
42
  coderay (1.1.2)
43
43
  concurrent-ruby (1.0.5)
44
- connection_pool (2.2.1)
44
+ connection_pool (2.2.2)
45
45
  crass (1.0.4)
46
46
  daemons (1.2.6)
47
47
  diff-lcs (1.3)
48
- docile (1.1.5)
49
- erubi (1.7.0)
48
+ docile (1.3.1)
49
+ erubi (1.7.1)
50
50
  eventmachine (1.2.5)
51
- faraday (0.14.0)
51
+ faraday (0.15.3)
52
52
  multipart-post (>= 1.2, < 3)
53
- gitlab (4.3.0)
54
- httparty
55
- terminal-table
53
+ gitlab (4.5.0)
54
+ httparty (>= 0.14.0)
55
+ terminal-table (>= 1.5.1)
56
56
  globalid (0.4.1)
57
57
  activesupport (>= 4.2.0)
58
58
  haml (5.0.4)
59
59
  temple (>= 0.8.0)
60
60
  tilt
61
- httparty (0.15.6)
61
+ httparty (0.16.2)
62
62
  multi_xml (>= 0.5.2)
63
- i18n (0.9.3)
63
+ i18n (1.1.0)
64
64
  concurrent-ruby (~> 1.0)
65
+ jaro_winkler (1.5.1)
65
66
  json (2.1.0)
66
- loofah (2.2.2)
67
+ loofah (2.2.3)
67
68
  crass (~> 1.0.2)
68
69
  nokogiri (>= 1.5.9)
69
70
  mail (2.7.0)
@@ -85,14 +86,14 @@ GEM
85
86
  multi_xml (0.6.0)
86
87
  multipart-post (2.0.0)
87
88
  mustermann (1.0.2)
88
- nokogiri (1.8.2)
89
+ nokogiri (1.8.5)
89
90
  mini_portile2 (~> 2.3.0)
90
- octokit (4.8.0)
91
+ octokit (4.12.0)
91
92
  sawyer (~> 0.8.0, >= 0.5.3)
92
93
  parallel (1.12.1)
93
- parser (2.5.0.5)
94
+ parser (2.5.1.2)
94
95
  ast (~> 2.4.0)
95
- powerpack (0.1.1)
96
+ powerpack (0.1.2)
96
97
  pronto (0.9.5)
97
98
  gitlab (~> 4.0, >= 4.0.0)
98
99
  httparty (>= 0.13.7)
@@ -100,20 +101,20 @@ GEM
100
101
  rainbow (~> 2.1)
101
102
  rugged (~> 0.24, >= 0.23.0)
102
103
  thor (~> 0.19.0)
103
- pronto-rubocop (0.9.0)
104
+ pronto-rubocop (0.9.1)
104
105
  pronto (~> 0.9.0)
105
- rubocop (~> 0.38, >= 0.35.0)
106
+ rubocop (~> 0.50, >= 0.49.1)
106
107
  pry (0.11.3)
107
108
  coderay (~> 1.1.0)
108
109
  method_source (~> 0.9.0)
109
- pry-byebug (3.5.1)
110
- byebug (~> 9.1)
110
+ pry-byebug (3.6.0)
111
+ byebug (~> 10.0)
111
112
  pry (~> 0.10)
112
- public_suffix (3.0.1)
113
- rack (2.0.5)
113
+ public_suffix (3.0.3)
114
+ rack (2.0.6)
114
115
  rack-protection (2.0.3)
115
116
  rack
116
- rack-test (0.8.2)
117
+ rack-test (1.1.0)
117
118
  rack (>= 1.0, < 3)
118
119
  rails-dom-testing (2.0.3)
119
120
  activesupport (>= 4.2.0)
@@ -122,42 +123,42 @@ GEM
122
123
  loofah (~> 2.2, >= 2.2.2)
123
124
  rainbow (2.2.2)
124
125
  rake
125
- rake (10.5.0)
126
- redis (4.0.1)
127
- rspec (3.7.0)
128
- rspec-core (~> 3.7.0)
129
- rspec-expectations (~> 3.7.0)
130
- rspec-mocks (~> 3.7.0)
131
- rspec-core (3.7.1)
132
- rspec-support (~> 3.7.0)
133
- rspec-expectations (3.7.0)
126
+ rake (12.3.1)
127
+ redis (4.0.3)
128
+ rspec (3.8.0)
129
+ rspec-core (~> 3.8.0)
130
+ rspec-expectations (~> 3.8.0)
131
+ rspec-mocks (~> 3.8.0)
132
+ rspec-core (3.8.0)
133
+ rspec-support (~> 3.8.0)
134
+ rspec-expectations (3.8.1)
134
135
  diff-lcs (>= 1.2.0, < 2.0)
135
- rspec-support (~> 3.7.0)
136
- rspec-mocks (3.7.0)
136
+ rspec-support (~> 3.8.0)
137
+ rspec-mocks (3.8.0)
137
138
  diff-lcs (>= 1.2.0, < 2.0)
138
- rspec-support (~> 3.7.0)
139
- rspec-support (3.7.1)
140
- rubocop (0.53.0)
139
+ rspec-support (~> 3.8.0)
140
+ rspec-support (3.8.0)
141
+ rubocop (0.59.2)
142
+ jaro_winkler (~> 1.5.1)
141
143
  parallel (~> 1.10)
142
- parser (>= 2.5)
144
+ parser (>= 2.5, != 2.5.1.1)
143
145
  powerpack (~> 0.1)
144
146
  rainbow (>= 2.2.2, < 4.0)
145
147
  ruby-progressbar (~> 1.7)
146
148
  unicode-display_width (~> 1.0, >= 1.0.1)
147
- rubocop-rspec (1.22.1)
148
- rubocop (>= 0.52.1)
149
- ruby-progressbar (1.9.0)
150
- rugged (0.26.0)
149
+ rubocop-rspec (1.29.1)
150
+ rubocop (>= 0.58.0)
151
+ ruby-progressbar (1.10.0)
152
+ rugged (0.27.4)
151
153
  sawyer (0.8.1)
152
154
  addressable (>= 2.3.5, < 2.6)
153
155
  faraday (~> 0.8, < 1.0)
154
- sidekiq (5.0.5)
155
- concurrent-ruby (~> 1.0)
156
- connection_pool (~> 2.2, >= 2.2.0)
156
+ sidekiq (5.2.3)
157
+ connection_pool (~> 2.2, >= 2.2.2)
157
158
  rack-protection (>= 1.5.0)
158
- redis (>= 3.3.4, < 5)
159
- simplecov (0.15.1)
160
- docile (~> 1.1.0)
159
+ redis (>= 3.3.5, < 5)
160
+ simplecov (0.16.1)
161
+ docile (~> 1.1)
161
162
  json (>= 1.8, < 3)
162
163
  simplecov-html (~> 0.10.0)
163
164
  simplecov-html (0.10.2)
@@ -182,9 +183,9 @@ GEM
182
183
  thor (0.19.4)
183
184
  thread_safe (0.3.6)
184
185
  tilt (2.0.8)
185
- tzinfo (1.2.4)
186
+ tzinfo (1.2.5)
186
187
  thread_safe (~> 0.1)
187
- unicode-display_width (1.3.0)
188
+ unicode-display_width (1.4.0)
188
189
 
189
190
  PLATFORMS
190
191
  ruby
@@ -198,7 +199,7 @@ DEPENDENCIES
198
199
  pronto
199
200
  pronto-rubocop
200
201
  pry-byebug
201
- rake (~> 10.0)
202
+ rake (~> 12.3)
202
203
  rspec (~> 3.7)
203
204
  rubocop
204
205
  rubocop-rspec
@@ -206,4 +207,4 @@ DEPENDENCIES
206
207
  simplecov
207
208
 
208
209
  BUNDLED WITH
209
- 1.16.1
210
+ 1.17.0
data/README.md CHANGED
@@ -84,6 +84,10 @@ require "checker_jobs"
84
84
  CheckerJobs.configure do |c|
85
85
  c.jobs_processor = :sidekiq
86
86
 
87
+ c.notifier :bugsnag do |options|
88
+ options[:formatter_class] = CheckerJobs::Notifiers::BugsnagDefaultFormatter
89
+ end
90
+
87
91
  c.notifier :email do |options|
88
92
  options[:formatter_class] = CheckerJobs::Notifiers::EmailDefaultFormatter
89
93
  options[:email_options] = {
@@ -119,7 +123,7 @@ PRs are appreciated 🙏
119
123
 
120
124
  We support different kind of notifiers, as of today we have the following:
121
125
 
122
- - `:bugsnag`: uses `Bugsnag` to send notifications. It takes the global configuration.
126
+ - `:bugsnag`: uses `Bugsnag` to send notifications. It takes the global Bugsnag configuration.
123
127
  - `:email`: uses `ActionMailer` to send emails. You can pass it any `ActionMailer` options.
124
128
  - `:logger`: Uses `Logger` to output inconsitencies in the log. Takes the following params:
125
129
  - `logdev`: The log device. This is a filename (String) or IO object (typically STDOUT, STDERR, or an open file).
@@ -155,7 +159,7 @@ fired through ActionMailer to `oss@drivy.com`.
155
159
  Once you have checker jobs, you'll need to run them. There are many task
156
160
  schedulers out there and it isn't really relevant what you'll be using.
157
161
 
158
- You have to enqueue you job as often as you like and that's it.
162
+ You have to enqueue your job as often as you like and that's it.
159
163
 
160
164
  ``` ruby
161
165
  UserChecker.perform_async
@@ -170,3 +174,7 @@ You'll find out that the CI is setup to run test coverage and linting.
170
174
  ## License
171
175
 
172
176
  The gem is available as open source under the terms of the [MIT License][licence].
177
+
178
+ [licence]: https://github.com/drivy/checker_jobs/blob/master/LICENSE.txt
179
+ [d-jobs]: https://drivy.engineering/jobs/
180
+ [gh-sidekiq]: https://github.com/mperham/sidekiq
@@ -1,8 +1,8 @@
1
- lib = File.expand_path("../lib", __FILE__)
1
+ lib = File.expand_path("lib", __dir__)
2
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
  require "checker_jobs/version"
4
4
 
5
- Gem::Specification.new do |spec|
5
+ Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength
6
6
  spec.name = "checker_jobs"
7
7
  spec.version = CheckerJobs::VERSION
8
8
  spec.authors = ["Drivy", "Nicolas Zermati"]
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
27
27
  spec.add_development_dependency "pronto"
28
28
  spec.add_development_dependency "pronto-rubocop"
29
29
  spec.add_development_dependency "pry-byebug"
30
- spec.add_development_dependency "rake", "~> 10.0"
30
+ spec.add_development_dependency "rake", "~> 12.3"
31
31
  spec.add_development_dependency "rspec", "~> 3.7"
32
32
  spec.add_development_dependency "rubocop"
33
33
  spec.add_development_dependency "rubocop-rspec"
@@ -21,6 +21,10 @@ CheckerJobs.configure do |config|
21
21
 
22
22
  config.jobs_processor = :sidekiq
23
23
 
24
+ config.notifier :bugsnag do |options|
25
+ options[:formatter_class] = CheckerJobs::Notifiers::EmailDefaultFormatter
26
+ end
27
+
24
28
  config.notifier :email do |options|
25
29
  options[:formatter_class] = CheckerJobs::Notifiers::EmailDefaultFormatter
26
30
  options[:email_options] = {
@@ -7,6 +7,8 @@ class CheckerJobs::Checks::EnsureNo < CheckerJobs::Checks::Base
7
7
  notify(count: result) unless result.zero?
8
8
  when Enumerable
9
9
  notify(count: result.size, entries: result) unless result.empty?
10
+ when TrueClass, FalseClass
11
+ notify(count: 1) if result
10
12
  else
11
13
  raise ArgumentError, "Unsupported result: '#{result.class.name}' for 'ensure_no'"
12
14
  end
@@ -25,8 +25,8 @@ class CheckerJobs::Configuration
25
25
  end
26
26
 
27
27
  def notifier(notifier_symbol)
28
- options = {}
29
- yield(options)
28
+ options = default_options_for(notifier_symbol)
29
+ yield options
30
30
  @notifiers_options[notifier_symbol] = options
31
31
  end
32
32
 
@@ -45,4 +45,11 @@ class CheckerJobs::Configuration
45
45
  end
46
46
  Object.const_get(notifier_class_name)
47
47
  end
48
+
49
+ private
50
+
51
+ def default_options_for(notifier_symbol)
52
+ klass = notifier_class(notifier_symbol)
53
+ klass.respond_to?(:default_options) ? klass.default_options : {}
54
+ end
48
55
  end
@@ -43,11 +43,13 @@ module CheckerJobs::DSL
43
43
 
44
44
  def notifier
45
45
  raise CheckerJobs::MissingNotifier, self.class unless defined?(@notifier)
46
+
46
47
  @notifier
47
48
  end
48
49
 
49
50
  def notifier_options
50
51
  raise CheckerJobs::MissingNotifier, self.class unless defined?(@notifier)
52
+
51
53
  @notifier_options
52
54
  end
53
55
 
@@ -60,7 +62,7 @@ module CheckerJobs::DSL
60
62
  end
61
63
 
62
64
  def checks
63
- @check ||= {}
65
+ @checks ||= {}
64
66
  end
65
67
 
66
68
  def add_check(klass, name, options, block)
@@ -1,7 +1,9 @@
1
1
  module CheckerJobs::Notifiers
2
- autoload :Bugsnag, "checker_jobs/notifiers/bugsnag"
3
- autoload :Email, "checker_jobs/notifiers/email"
4
- autoload :EmailDefaultFormatter, "checker_jobs/notifiers/email_default_formatter"
5
- autoload :FormatterHelpers, "checker_jobs/notifiers/formatter_helpers"
6
- autoload :Logger, "checker_jobs/notifiers/logger"
2
+ autoload :Base, "checker_jobs/notifiers/base"
3
+ autoload :Bugsnag, "checker_jobs/notifiers/bugsnag"
4
+ autoload :BugsnagDefaultFormatter, "checker_jobs/notifiers/bugsnag_default_formatter"
5
+ autoload :Email, "checker_jobs/notifiers/email"
6
+ autoload :EmailDefaultFormatter, "checker_jobs/notifiers/email_default_formatter"
7
+ autoload :FormatterHelpers, "checker_jobs/notifiers/formatter_helpers"
8
+ autoload :Logger, "checker_jobs/notifiers/logger"
7
9
  end
@@ -0,0 +1,22 @@
1
+ class CheckerJobs::Notifiers::Base
2
+ def initialize(check, _count, _entries)
3
+ @check = check
4
+ end
5
+
6
+ def notify
7
+ raise NotImplementedError
8
+ end
9
+
10
+ def self.default_options
11
+ raise NotImplementedError
12
+ end
13
+
14
+ private
15
+
16
+ def notifier_options
17
+ CheckerJobs.configuration.notifiers_options.fetch(
18
+ @check.klass.notifier,
19
+ self.class.default_options,
20
+ )
21
+ end
22
+ end
@@ -1,29 +1,30 @@
1
- require "action_mailer"
2
-
3
- class CheckerJobs::Notifiers::Bugsnag
4
- include CheckerJobs::Notifiers::FormatterHelpers
5
-
1
+ class CheckerJobs::Notifiers::Bugsnag < CheckerJobs::Notifiers::Base
6
2
  class Error < StandardError; end
7
3
 
8
4
  def initialize(check, count, entries)
9
- @check = check
10
- @metadata = {
11
- klass: @check.klass,
12
- name: @check.name,
13
- count: count,
14
- entries: entries&.map { |entry| format_entry(entry) },
15
- source_code_url: repository_url,
16
- }
5
+ super
6
+
7
+ @formatter = formatter_class.new(check, count, entries)
17
8
  end
18
9
 
19
10
  def notify
20
- raise Error, "(#{@check.klass}) #{human_check_name} was triggered!"
11
+ raise @formatter.base_error
21
12
  rescue Error => error
22
- ::Bugsnag.notify(error, {
23
- severity: "warning",
24
- context: "checker_jobs",
25
- grouping_hash: error.message,
26
- triggered_check: @metadata,
27
- })
13
+ ::Bugsnag.notify(error) do |notification|
14
+ notification.severity = @formatter.severity
15
+ notification.context = @formatter.context
16
+ notification.grouping_hash = @formatter.grouping_hash
17
+ notification.add_tab(*@formatter.tab_infos)
18
+ end
19
+ end
20
+
21
+ def self.default_options
22
+ { formatter_class: CheckerJobs::Notifiers::BugsnagDefaultFormatter }
23
+ end
24
+
25
+ private
26
+
27
+ def formatter_class
28
+ notifier_options.fetch(:formatter_class)
28
29
  end
29
30
  end
@@ -0,0 +1,45 @@
1
+ class CheckerJobs::Notifiers::BugsnagDefaultFormatter
2
+ include CheckerJobs::Notifiers::FormatterHelpers
3
+
4
+ def initialize(check, count, entries)
5
+ @check = check
6
+ @count = count
7
+ @entries = entries
8
+ end
9
+
10
+ def base_error
11
+ CheckerJobs::Notifiers::Bugsnag::Error.new(error_message)
12
+ end
13
+
14
+ def severity
15
+ "warning"
16
+ end
17
+
18
+ def context
19
+ "checker_jobs"
20
+ end
21
+
22
+ def grouping_hash
23
+ error_message
24
+ end
25
+
26
+ def tab_infos
27
+ ["triggered_check", triggered_check]
28
+ end
29
+
30
+ private
31
+
32
+ def triggered_check
33
+ {
34
+ klass: @check.klass,
35
+ name: @check.name,
36
+ count: @count,
37
+ entries: @entries&.map { |entry| format_entry(entry) },
38
+ source_code_url: repository_url,
39
+ }
40
+ end
41
+
42
+ def error_message
43
+ "(#{@check.klass}) #{human_check_name} was triggered!"
44
+ end
45
+ end
@@ -1,8 +1,9 @@
1
1
  require "action_mailer"
2
2
 
3
- class CheckerJobs::Notifiers::Email
3
+ class CheckerJobs::Notifiers::Email < CheckerJobs::Notifiers::Base
4
4
  def initialize(check, count, entries)
5
- @check = check
5
+ super
6
+
6
7
  @formatter = formatter_class.new(check, count, entries)
7
8
  @defaults = { subject: @formatter.subject }
8
9
 
@@ -10,27 +11,34 @@ class CheckerJobs::Notifiers::Email
10
11
  end
11
12
 
12
13
  def notify
13
- Mailer.notify(@formatter.body, options).deliver!
14
+ Mailer.notify(@formatter.body, mailer_options).deliver!
15
+ end
16
+
17
+ def self.default_options
18
+ {
19
+ formatter_class: CheckerJobs::Notifiers::EmailDefaultFormatter,
20
+ email_options: {},
21
+ }
14
22
  end
15
23
 
16
24
  private
17
25
 
18
26
  def valid?
19
- options[:to].is_a?(String)
27
+ mailer_options[:to].is_a?(String)
20
28
  end
21
29
 
22
- def options
23
- @options ||= @defaults.
24
- merge(notifier_options[:email_options]).
25
- merge(@check.klass.notifier_options)
30
+ def mailer_options
31
+ @mailer_options ||= @defaults.
32
+ merge(email_options).
33
+ merge(@check.klass.notifier_options)
26
34
  end
27
35
 
28
- def formatter_class
29
- notifier_options[:formatter_class] || CheckerJobs::Notifiers::EmailDefaultFormatter
36
+ def email_options
37
+ notifier_options[:email_options]
30
38
  end
31
39
 
32
- def notifier_options
33
- CheckerJobs.configuration.notifiers_options[@check.klass.notifier]
40
+ def formatter_class
41
+ notifier_options[:formatter_class]
34
42
  end
35
43
 
36
44
  # Simple mailer class based on ActionMailer to send HTML emails while reusing
@@ -1,13 +1,11 @@
1
1
  require "logger"
2
2
 
3
- class CheckerJobs::Notifiers::Logger
3
+ class CheckerJobs::Notifiers::Logger < CheckerJobs::Notifiers::Base
4
4
  include CheckerJobs::Notifiers::FormatterHelpers
5
5
 
6
- DEFAULT_LEVEL = Logger::INFO
7
- DEFAULT_LOGDEV = STDOUT
8
-
9
6
  def initialize(check, count, _entries)
10
- @check = check
7
+ super
8
+
11
9
  @count = count
12
10
  raise CheckerJobs::InvalidNotifierOptions unless valid?
13
11
 
@@ -19,13 +17,20 @@ class CheckerJobs::Notifiers::Logger
19
17
  @logger.add(level, format, human_check_name)
20
18
  end
21
19
 
20
+ def self.default_options
21
+ {
22
+ logdev: STDOUT,
23
+ level: Logger::INFO,
24
+ }
25
+ end
26
+
27
+ private
28
+
22
29
  # override this
23
30
  def format
24
31
  "found #{@count} entries"
25
32
  end
26
33
 
27
- private
28
-
29
34
  def valid?
30
35
  (logdev.is_a?(String) || logdev.is_a?(IO)) &&
31
36
  [
@@ -35,18 +40,10 @@ class CheckerJobs::Notifiers::Logger
35
40
  end
36
41
 
37
42
  def level
38
- @level ||= @check.klass.notifier_options[:level] ||
39
- notifier_options[:level] ||
40
- DEFAULT_LEVEL
43
+ @level ||= @check.klass.notifier_options[:level] || notifier_options[:level]
41
44
  end
42
45
 
43
46
  def logdev
44
- @logdev ||= @check.klass.notifier_options[:logdev] ||
45
- notifier_options[:logdev] ||
46
- DEFAULT_LOGDEV
47
- end
48
-
49
- def notifier_options
50
- CheckerJobs.configuration.notifiers_options[@check.klass.notifier]
47
+ @logdev ||= @check.klass.notifier_options[:logdev] || notifier_options[:logdev]
51
48
  end
52
49
  end
@@ -1,3 +1,3 @@
1
1
  module CheckerJobs
2
- VERSION = "1.1.1".freeze
2
+ VERSION = "1.2.0".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: checker_jobs
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Drivy
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2018-08-03 00:00:00.000000000 Z
12
+ date: 2018-11-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionmailer
@@ -115,14 +115,14 @@ dependencies:
115
115
  requirements:
116
116
  - - "~>"
117
117
  - !ruby/object:Gem::Version
118
- version: '10.0'
118
+ version: '12.3'
119
119
  type: :development
120
120
  prerelease: false
121
121
  version_requirements: !ruby/object:Gem::Requirement
122
122
  requirements:
123
123
  - - "~>"
124
124
  - !ruby/object:Gem::Version
125
- version: '10.0'
125
+ version: '12.3'
126
126
  - !ruby/object:Gem::Dependency
127
127
  name: rspec
128
128
  requirement: !ruby/object:Gem::Requirement
@@ -227,7 +227,9 @@ files:
227
227
  - lib/checker_jobs/jobs_processors.rb
228
228
  - lib/checker_jobs/jobs_processors/sidekiq.rb
229
229
  - lib/checker_jobs/notifiers.rb
230
+ - lib/checker_jobs/notifiers/base.rb
230
231
  - lib/checker_jobs/notifiers/bugsnag.rb
232
+ - lib/checker_jobs/notifiers/bugsnag_default_formatter.rb
231
233
  - lib/checker_jobs/notifiers/email.rb
232
234
  - lib/checker_jobs/notifiers/email_default_formatter.rb
233
235
  - lib/checker_jobs/notifiers/formatter_helpers.rb
@@ -253,7 +255,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
253
255
  version: '0'
254
256
  requirements: []
255
257
  rubyforge_project:
256
- rubygems_version: 2.7.6
258
+ rubygems_version: 2.7.7
257
259
  signing_key:
258
260
  specification_version: 4
259
261
  summary: Regression tests for data