Class: NeetoCompliance::SidekiqQueuesVerifier
- Inherits:
-
Base
- Object
- Base
- NeetoCompliance::SidekiqQueuesVerifier
show all
- Defined in:
- lib/neeto_compliance/verifiers/sidekiq_queues_verifier.rb
Instance Method Summary
collapse
Methods inherited from Base
#app_is_exception?, #app_name, #apps_exception_list, #audit, #auto_correct!, #error_message, #print_description, #process, #verifier_name
Instance Method Details
#autofix_command ⇒ Object
32
33
34
|
# File 'lib/neeto_compliance/verifiers/sidekiq_queues_verifier.rb', line 32
def autofix_command
"perl -p -i -e 's/queues:/queues:\n - #{@missing_queues.join("\n - ")}/g' config/sidekiq.yml"
end
|
#autofix_suggestion ⇒ Object
28
29
30
|
# File 'lib/neeto_compliance/verifiers/sidekiq_queues_verifier.rb', line 28
def autofix_suggestion
@errors.join("\n").yellow
end
|
#local_copy ⇒ Object
5
6
7
|
# File 'lib/neeto_compliance/verifiers/sidekiq_queues_verifier.rb', line 5
def local_copy
"config/sidekiq.yml"
end
|
#queues ⇒ Object
9
10
11
|
# File 'lib/neeto_compliance/verifiers/sidekiq_queues_verifier.rb', line 9
def queues
@_queues ||= ["auth", "urgent", "default", "low"]
end
|
#valid? ⇒ Boolean
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/neeto_compliance/verifiers/sidekiq_queues_verifier.rb', line 13
def valid?
@errors = []
@missing_queues = []
sidekiq_yml = YAML.load(File.open(local_copy), aliases: true)
local_queues = sidekiq_yml["queues"] || []
queues.map do |queue|
unless local_queues.include?(queue)
@missing_queues << queue
@errors << "Add #{queue} to queues in #{local_copy}"
end
end
@errors.length == 0
end
|