From c6e22d8cd165a1eec528e513a8df454eca428031 Mon Sep 17 00:00:00 2001 From: Muhammad Nawzad Date: Sun, 18 Jan 2026 09:50:02 +0300 Subject: [PATCH 1/2] Update gem dependencies, refactor minor code patterns, and adjust Rubocop configuration. --- .rubocop.yml | 7 +- Gemfile | 8 +- Gemfile.lock | 122 +++++++++++++++------------- lib/puma/plugin/rabbit_carrots.rb | 5 +- lib/rabbit_carrots/configuration.rb | 4 +- lib/rabbit_carrots/connection.rb | 1 + lib/rabbit_carrots/core.rb | 2 +- rabbit_carrots.gemspec | 2 +- 8 files changed, 81 insertions(+), 70 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 8fac6d2..d87abcd 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,11 +1,12 @@ -require: rubocop-rails +plugins: + - rubocop-rails AllCops: NewCops: enable SuggestExtensions: false Layout/SpaceBeforeBrackets: # (new in 1.7) Enabled: true -Layout/LineLength: +Layout/LineLength: Max: 350 Lint/AmbiguousAssignment: # (new in 1.7) Enabled: true @@ -110,4 +111,4 @@ Metrics/MethodLength: Metrics/CyclomaticComplexity: Max: 15 Metrics/PerceivedComplexity: - Max: 15 \ No newline at end of file + Max: 15 diff --git a/Gemfile b/Gemfile index 1c72b0d..01f8567 100644 --- a/Gemfile +++ b/Gemfile @@ -5,10 +5,10 @@ source 'https://rubygems.org' # Specify your gem's dependencies in rabbit_carrots.gemspec gemspec -gem 'rake', '~> 13.1' +gem 'rake', '~> 13.3.1' -gem 'rspec', '~> 3.12' +gem 'rspec', '~> 3.13.2' -gem 'rubocop', '~> 1.58' +gem 'rubocop', '~> 1.82.1' -gem 'rubocop-rails', '~> 2.22' +gem 'rubocop-rails', '~> 2.34.3' diff --git a/Gemfile.lock b/Gemfile.lock index a92a166..f3056ec 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,102 +1,112 @@ PATH remote: . specs: - rabbit_carrots (1.0.4) + rabbit_carrots (1.0.6) bunny (>= 2.22) - connection_pool (~> 2.4) + connection_pool (>= 2.4) GEM remote: https://rubygems.org/ specs: - activesupport (7.1.2) + activesupport (8.1.2) base64 bigdecimal - concurrent-ruby (~> 1.0, >= 1.0.2) + concurrent-ruby (~> 1.0, >= 1.3.1) connection_pool (>= 2.2.5) drb i18n (>= 1.6, < 2) + json + logger (>= 1.4.2) minitest (>= 5.1) - mutex_m - tzinfo (~> 2.0) - amq-protocol (2.3.4) - ast (2.4.2) - base64 (0.2.0) - bigdecimal (3.1.4) + securerandom (>= 0.3) + tzinfo (~> 2.0, >= 2.0.5) + uri (>= 0.13.1) + amq-protocol (2.5.0) + ast (2.4.3) + base64 (0.3.0) + bigdecimal (4.0.1) bunny (2.24.0) amq-protocol (~> 2.3) sorted_set (~> 1, >= 1.0.2) - concurrent-ruby (1.2.2) - connection_pool (2.4.1) - diff-lcs (1.5.0) - drb (2.2.0) - ruby2_keywords - i18n (1.14.1) + concurrent-ruby (1.3.6) + connection_pool (3.0.2) + diff-lcs (1.6.2) + drb (2.2.3) + i18n (1.14.8) concurrent-ruby (~> 1.0) - json (2.7.1) - language_server-protocol (3.17.0.3) - minitest (5.20.0) - mutex_m (0.2.0) - parallel (1.23.0) - parser (3.2.2.4) + json (2.18.0) + language_server-protocol (3.17.0.5) + lint_roller (1.1.0) + logger (1.7.0) + minitest (6.0.1) + prism (~> 1.5) + parallel (1.27.0) + parser (3.3.10.1) ast (~> 2.4.1) racc - racc (1.7.3) - rack (3.0.8) + prism (1.8.0) + racc (1.8.1) + rack (3.2.4) rainbow (3.1.1) - rake (13.1.0) + rake (13.3.1) rbtree (0.4.6) - regexp_parser (2.8.3) - rexml (3.2.6) - rspec (3.12.0) - rspec-core (~> 3.12.0) - rspec-expectations (~> 3.12.0) - rspec-mocks (~> 3.12.0) - rspec-core (3.12.0) - rspec-support (~> 3.12.0) - rspec-expectations (3.12.0) + regexp_parser (2.11.3) + rspec (3.13.2) + rspec-core (~> 3.13.0) + rspec-expectations (~> 3.13.0) + rspec-mocks (~> 3.13.0) + rspec-core (3.13.6) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.5) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.12.0) - rspec-mocks (3.12.0) + rspec-support (~> 3.13.0) + rspec-mocks (3.13.7) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.12.0) - rspec-support (3.12.0) - rubocop (1.58.0) + rspec-support (~> 3.13.0) + rspec-support (3.13.6) + rubocop (1.82.1) json (~> 2.3) - language_server-protocol (>= 3.17.0) + language_server-protocol (~> 3.17.0.2) + lint_roller (~> 1.1.0) parallel (~> 1.10) - parser (>= 3.2.2.4) + parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 1.8, < 3.0) - rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.30.0, < 2.0) + regexp_parser (>= 2.9.3, < 3.0) + rubocop-ast (>= 1.48.0, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.30.0) - parser (>= 3.2.1.0) - rubocop-rails (2.22.2) + unicode-display_width (>= 2.4.0, < 4.0) + rubocop-ast (1.49.0) + parser (>= 3.3.7.2) + prism (~> 1.7) + rubocop-rails (2.34.3) activesupport (>= 4.2.0) + lint_roller (~> 1.1) rack (>= 1.1) - rubocop (>= 1.33.0, < 2.0) - rubocop-ast (>= 1.30.0, < 2.0) + rubocop (>= 1.75.0, < 2.0) + rubocop-ast (>= 1.44.0, < 2.0) ruby-progressbar (1.13.0) - ruby2_keywords (0.0.5) + securerandom (0.4.1) set (1.1.2) sorted_set (1.0.3) rbtree set (~> 1.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - unicode-display_width (2.5.0) + unicode-display_width (3.2.0) + unicode-emoji (~> 4.1) + unicode-emoji (4.2.0) + uri (1.1.1) PLATFORMS + arm64-darwin-25 x86_64-linux DEPENDENCIES rabbit_carrots! - rake (~> 13.1) - rspec (~> 3.12) - rubocop (~> 1.58) - rubocop-rails (~> 2.22) + rake (~> 13.3.1) + rspec (~> 3.13.2) + rubocop (~> 1.82.1) + rubocop-rails (~> 2.34.3) BUNDLED WITH 2.3.26 diff --git a/lib/puma/plugin/rabbit_carrots.rb b/lib/puma/plugin/rabbit_carrots.rb index 3344c16..79fd20f 100644 --- a/lib/puma/plugin/rabbit_carrots.rb +++ b/lib/puma/plugin/rabbit_carrots.rb @@ -1,4 +1,5 @@ # rabbit_carrots.rb +require 'English' require 'puma/plugin' require 'rabbit_carrots' @@ -7,7 +8,7 @@ Puma::Plugin.create do def start(launcher) @log_writer = launcher.log_writer - @puma_pid = $$ + @puma_pid = $PROCESS_ID @core_service = RabbitCarrots::Core.new(logger: log_writer) @@ -57,7 +58,7 @@ Puma::Plugin.create do loop do if send(process_dead) log message - Process.kill('TERM', $$) + Process.kill('TERM', $PROCESS_ID) break end sleep 2 diff --git a/lib/rabbit_carrots/configuration.rb b/lib/rabbit_carrots/configuration.rb index 29a2fd6..c72714c 100644 --- a/lib/rabbit_carrots/configuration.rb +++ b/lib/rabbit_carrots/configuration.rb @@ -24,8 +24,6 @@ module RabbitCarrots @orm ||= :activerecord end - def orm=(value) - @orm = value - end + attr_writer :orm end end diff --git a/lib/rabbit_carrots/connection.rb b/lib/rabbit_carrots/connection.rb index 81dfc95..032d0dd 100644 --- a/lib/rabbit_carrots/connection.rb +++ b/lib/rabbit_carrots/connection.rb @@ -3,6 +3,7 @@ require 'singleton' module RabbitCarrots class Connection include ::Singleton + attr_reader :connection def initialize diff --git a/lib/rabbit_carrots/core.rb b/lib/rabbit_carrots/core.rb index 43059d1..ffe7f98 100644 --- a/lib/rabbit_carrots/core.rb +++ b/lib/rabbit_carrots/core.rb @@ -1,5 +1,5 @@ module RabbitCarrots - class Core + class Core # rubocop:disable Metrics/ClassLength attr_reader :logger @database_agnostic_not_null_violation = nil diff --git a/rabbit_carrots.gemspec b/rabbit_carrots.gemspec index 706e5ce..dfcc2a9 100644 --- a/rabbit_carrots.gemspec +++ b/rabbit_carrots.gemspec @@ -33,7 +33,7 @@ Gem::Specification.new do |spec| # Uncomment to register a new dependency of your gem spec.add_dependency 'bunny', '>= 2.22' - spec.add_dependency 'connection_pool', '~> 2.4' + spec.add_dependency 'connection_pool', '>= 2.4' # For more information and examples about making a new gem, check out our # guide at: https://bundler.io/guides/creating_gem.html From cdf3e42f350005aa06105165b3c5194ae46ae6a2 Mon Sep 17 00:00:00 2001 From: Muhammad Nawzad Date: Sun, 18 Jan 2026 09:52:07 +0300 Subject: [PATCH 2/2] chore: Update Ruby version to 4.0.1 in GitHub Actions workflows. --- .github/workflows/main.yml | 2 +- .github/workflows/release.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 47fd776..8db20f7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,7 +14,7 @@ jobs: strategy: matrix: ruby: - - '3.1.2' + - '4.0.1' steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1c8cb96..3e98a59 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,7 +14,7 @@ jobs: - uses: actions/checkout@v2 - uses: ruby/setup-ruby@v1 with: - ruby-version: 3.1.2 + ruby-version: 4.0.1 - name: publish gem run: |