Skip to content
Snippets Groups Projects
Commit 09e020d9 authored by Dean Lovett's avatar Dean Lovett
Browse files

fix: code quality fixes

parent 764cf2cd
No related branches found
Tags 0.3.0
No related merge requests found
Pipeline #20737 failed
......@@ -9,3 +9,5 @@
/.gem
/spec/lib/tmp
*.gem
results/rubocop.html
# frozen_string_literal: true
source 'https://rubygems.org'
# Specify your gem's dependencies in cqrs-core.gemspec
......
PATH
remote: .
specs:
nexus_cqrs (0.0.8)
nexus_cqrs (0.3.0)
generator_spec
ibsciss-middleware
thread_safe
GEM
remote: https://rubygems.org/
specs:
actionpack (6.0.3.2)
actionview (= 6.0.3.2)
activesupport (= 6.0.3.2)
rack (~> 2.0, >= 2.0.8)
actionpack (6.1.4.1)
actionview (= 6.1.4.1)
activesupport (= 6.1.4.1)
rack (~> 2.0, >= 2.0.9)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actionview (6.0.3.2)
activesupport (= 6.0.3.2)
actionview (6.1.4.1)
activesupport (= 6.1.4.1)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activesupport (6.0.3.2)
activesupport (6.1.4.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
zeitwerk (~> 2.2, >= 2.2.2)
ast (2.4.1)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
ast (2.4.2)
builder (3.2.4)
concurrent-ruby (1.1.7)
concurrent-ruby (1.1.9)
crass (1.0.6)
diff-lcs (1.4.4)
erubi (1.9.0)
erubi (1.10.0)
generator_spec (0.9.4)
activesupport (>= 3.0.0)
railties (>= 3.0.0)
i18n (1.8.5)
i18n (1.8.11)
concurrent-ruby (~> 1.0)
ibsciss-middleware (0.4.2)
loofah (2.6.0)
loofah (2.12.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
method_source (1.0.0)
mini_portile2 (2.4.0)
minitest (5.14.1)
nokogiri (1.10.10)
mini_portile2 (~> 2.4.0)
parallel (1.19.2)
parser (2.7.1.4)
mini_portile2 (2.6.1)
minitest (5.14.4)
nokogiri (1.12.5)
mini_portile2 (~> 2.6.1)
racc (~> 1.4)
parallel (1.21.0)
parser (3.0.2.0)
ast (~> 2.4.1)
racc (1.6.0)
rack (2.2.3)
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.3.0)
rails-html-sanitizer (1.4.2)
loofah (~> 2.3)
railties (6.0.3.2)
actionpack (= 6.0.3.2)
activesupport (= 6.0.3.2)
railties (6.1.4.1)
actionpack (= 6.1.4.1)
activesupport (= 6.1.4.1)
method_source
rake (>= 0.8.7)
thor (>= 0.20.3, < 2.0)
rake (>= 0.13)
thor (~> 1.0)
rainbow (3.0.0)
rake (13.0.1)
regexp_parser (1.7.1)
rexml (3.2.4)
rspec (3.9.0)
rspec-core (~> 3.9.0)
rspec-expectations (~> 3.9.0)
rspec-mocks (~> 3.9.0)
rspec-core (3.9.2)
rspec-support (~> 3.9.3)
rspec-expectations (3.9.2)
rake (13.0.6)
regexp_parser (2.1.1)
rexml (3.2.5)
rspec (3.10.0)
rspec-core (~> 3.10.0)
rspec-expectations (~> 3.10.0)
rspec-mocks (~> 3.10.0)
rspec-core (3.10.1)
rspec-support (~> 3.10.0)
rspec-expectations (3.10.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-mocks (3.9.1)
rspec-support (~> 3.10.0)
rspec-mocks (3.10.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-support (3.9.3)
rubocop (0.86.0)
rspec-support (~> 3.10.0)
rspec-support (3.10.3)
rubocop (1.22.3)
parallel (~> 1.10)
parser (>= 2.7.0.1)
parser (>= 3.0.0.0)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.7)
regexp_parser (>= 1.8, < 3.0)
rexml
rubocop-ast (>= 0.0.3, < 1.0)
rubocop-ast (>= 1.12.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 2.0)
rubocop-ast (0.3.0)
parser (>= 2.7.1.4)
rubocop-shopify (1.0.4)
rubocop (>= 0.85, < 0.87)
ruby-progressbar (1.10.1)
thor (1.0.1)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.13.0)
parser (>= 3.0.1.1)
rubocop-shopify (1.0.7)
rubocop (~> 1.4)
ruby-progressbar (1.11.0)
thor (1.1.0)
thread_safe (0.3.6)
tzinfo (1.2.7)
thread_safe (~> 0.1)
unicode-display_width (1.7.0)
zeitwerk (2.4.0)
tzinfo (2.0.4)
concurrent-ruby (~> 1.0)
unicode-display_width (2.1.0)
zeitwerk (2.5.1)
PLATFORMS
ruby
......
# frozen_string_literal: true
require "bundler/gem_tasks"
require 'bundler/gem_tasks'
task(default: :spec)
#!/usr/bin/env ruby
# frozen_string_literal: true
require 'bundler/setup'
require 'cqrs/core'
......
# frozen_string_literal: true
Rails.configuration.to_prepare do
middleware_stack = Middleware::Builder.new do |b|
b.use(NexusCqrsAuth::AuthMiddleware)
end
......
......@@ -7,16 +7,15 @@ module NexusCqrs
end
def autoregister(base_class, dir = 'app/domain/commands', ignore_strings = ['.rb', 'app/domain/'])
# Iterate over the director passed and find all ruby files, removing unwanted parts of the string.
Dir["#{dir}/*.rb"].each do |file|
ignore_strings.each { |i|
ignore_strings.each do |i|
file.slice!(i)
}
end
begin
# Constantize class name to constant to force rails to autoload this class
file.camelize.constantize
rescue NameError => e
rescue NameError
puts "WARN: Tried to autoregister #{file.camelize} but class could not be found"
end
end
......@@ -25,15 +24,19 @@ module NexusCqrs
handler_name = (c.to_s + "Handler")
begin
handler = handler_name.constantize.new
rescue NameError => e
Rails.logger.error "WARN: A command/query called `#{c}` tried to autoregister `#{handler_name}` but the class was not found"
rescue NameError
Rails.logger.error(
"WARN: A command `#{c}` tried to autoregister `#{handler_name}` but the class was not found"
)
next
end
if handler.respond_to?(:call)
register_command(c, handler)
else
Rails.logger.error "WARN: A command/query called `#{c}` tried to autoregister `#{handler_name}` but the class did not have a `call` method"
Rails.logger.error(
"WARN: A command `#{c}` tried to autoregister `#{handler_name}` but `call` method did not exist"
)
end
end
end
......
# frozen_string_literal: true
require_relative 'lib/nexus_cqrs/version'
Gem::Specification.new do |spec|
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment