Skip to content

Commit

Permalink
Move gems to Gemfile and improve rubocop config
Browse files Browse the repository at this point in the history
  • Loading branch information
mwolman committed Sep 25, 2023
1 parent b259f2a commit dc4a9fc
Show file tree
Hide file tree
Showing 10 changed files with 326 additions and 390 deletions.
28 changes: 16 additions & 12 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
require:
- rubocop-factory_bot
- rubocop-rspec

AllCops:
NewCops: enable
TargetRubyVersion: 2.7

Metrics/BlockLength:
Exclude:
- app/admin/**/*
- config/**/*
- spec/**/*
Gemspec/RequireMFA:
Enabled: false

Metrics/MethodLength:
Max: 12

Style/StringLiteralsInInterpolation:
Enabled: true
EnforcedStyle: double_quotes
RSpec/MultipleMemoizedHelpers:
Max: 7

Layout/LineLength:
Max: 120
RSpec/NestedGroups:
Max: 4

Layout/MultilineMethodCallIndentation:
EnforcedStyle: indented
Style/Documentation:
Enabled: false
13 changes: 10 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ source 'https://rubygems.org'

gemspec

group :test do
gem 'database_cleaner-active_record', '~> 2.0'
end
gem 'byebug', '~> 11.1.3'
gem 'database_cleaner-active_record', '~> 2.0'
gem 'pg', '~> 1.5.4'
gem 'pry-rails', '~> 0.3.9'
gem 'reek', '~> 6.1.4'
gem 'rspec', '~> 3.0'
gem 'rubocop', '~> 1.56.3', require: false
gem 'rubocop-rspec', '~> 2.24.0', require: false
gem 'simplecov', '~> 0.22.0'
gem 'sqlite3', '1.4.2'
13 changes: 11 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ PATH
remote: .
specs:
active_outbox (0.0.2)
rails (~> 7.0)
rails (~> 7.0.8)

GEM
remote: https://rubygems.org/
Expand Down Expand Up @@ -114,7 +114,7 @@ GEM
net-protocol
net-protocol (0.2.1)
timeout
net-smtp (0.3.3)
net-smtp (0.4.0)
net-protocol
nio4r (2.5.9)
nokogiri (1.15.4)
Expand Down Expand Up @@ -201,6 +201,14 @@ GEM
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.29.0)
parser (>= 3.2.1.0)
rubocop-capybara (2.19.0)
rubocop (~> 1.41)
rubocop-factory_bot (2.24.0)
rubocop (~> 1.33)
rubocop-rspec (2.24.0)
rubocop (~> 1.33)
rubocop-capybara (~> 2.17)
rubocop-factory_bot (~> 2.22)
ruby-progressbar (1.13.0)
simplecov (0.22.0)
docile (~> 1.1)
Expand Down Expand Up @@ -234,6 +242,7 @@ DEPENDENCIES
reek (~> 6.1.4)
rspec (~> 3.0)
rubocop (~> 1.56.3)
rubocop-rspec (~> 2.24.0)
simplecov (~> 0.22.0)
sqlite3 (= 1.4.2)

Expand Down
36 changes: 12 additions & 24 deletions active_outbox.gemspec
Original file line number Diff line number Diff line change
@@ -1,29 +1,17 @@
# frozen_string_literal: true

Gem::Specification.new do |s|
s.name = 'active_outbox'
s.version = '0.0.2'
s.summary = 'ActiveOutbox'
s.description = 'A Transactional Outbox implementation for ActiveRecord'
s.authors = ['Guillermo Aguirre']
s.email = '[email protected]'
s.files = Dir['LICENSE.txt', 'README.md', 'lib/**/*', 'lib/active_outbox.rb']
s.executables = ['outbox']
s.homepage =
'https://rubygems.org/gems/active_outbox'
s.license = 'MIT'
s.required_ruby_version = '>= 2.7.0'
Gem::Specification.new do |spec|
spec.authors = ['Guillermo Aguirre']
spec.files = Dir['LICENSE.txt', 'README.md', 'lib/**/*', 'lib/active_outbox.rb']
spec.name = 'active_outbox'
spec.summary = 'A Transactional Outbox implementation for ActiveRecord'
spec.version = '0.0.2'

# Dependencies
s.add_dependency 'rails', '~> 7.0'
spec.email = '[email protected]'
spec.executables = ['outbox']
spec.homepage = 'https://rubygems.org/gems/active_outbox'
spec.license = 'MIT'
spec.required_ruby_version = '>= 2.7.0'

# Development dependencies
s.add_development_dependency 'byebug', '~> 11.1.3'
s.add_development_dependency 'pg', '~> 1.5.4'
s.add_development_dependency 'pry-rails', '~> 0.3.9'
s.add_development_dependency 'reek', '~> 6.1.4'
s.add_development_dependency 'rspec', '~> 3.0'
s.add_development_dependency 'rubocop', '~> 1.56.3'
s.add_development_dependency 'simplecov', '~> 0.22.0'
s.add_development_dependency 'sqlite3', '1.4.2'
spec.add_dependency 'rails', '~> 7.0.8'
end
2 changes: 1 addition & 1 deletion lib/active_outbox/generators/active_outbox_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class ActiveOutboxGenerator < ActiveRecord::Generators::Base
class_option :root_components_path, type: :string, default: Rails.root

def create_migration_files
migration_path = "#{options["root_components_path"]}/db/migrate"
migration_path = "#{options['root_components_path']}/db/migrate"
migration_template(
'migration.rb',
"#{migration_path}/outbox_create_#{table_name}.rb",
Expand Down
2 changes: 1 addition & 1 deletion lib/active_outbox/outboxable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module Outboxable
const_name = "#{klass}_#{value}"

unless module_parent::Events.const_defined?(const_name)
module_parent::Events.const_set(const_name, "#{const_name}#{namespace.blank? ? "" : "."}#{namespace}")
module_parent::Events.const_set(const_name, "#{const_name}#{namespace.blank? ? '' : '.'}#{namespace}")
end

event_name = module_parent::Events.const_get(const_name)
Expand Down
Loading

0 comments on commit dc4a9fc

Please sign in to comment.