diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 535eece..e482104 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,8 +21,9 @@ jobs: - uses: actions/checkout@v4 - uses: ruby/setup-ruby@v1 with: - ruby-version: 2.7 + ruby-version: 3 bundler-cache: true + - name: Run rubocop run: bundle exec rubocop --format progress build: @@ -30,7 +31,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - ruby: ['2.7', '3.0', '3.1', '3.2', '3.3'] + ruby: ['3.0', '3.1', '3.2', '3.3'] steps: - uses: actions/checkout@v4 @@ -38,5 +39,6 @@ jobs: with: ruby-version: ${{ matrix.ruby }} bundler-cache: true + - name: Run tests run: bundle exec rake diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e700502..8b76609 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -10,12 +10,10 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@master - - - name: Set up Ruby 2.7 - uses: actions/setup-ruby@v1 + - uses: actions/checkout@v4 + - uses: actions/setup-ruby@v1 with: - ruby-version: 2.7.x + ruby-version: 3 - name: Publish to RubyGems run: | diff --git a/.rubocop.yml b/.rubocop.yml index de1e010..50ac415 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -7,7 +7,7 @@ AllCops: DisplayCopNames: true DisplayStyleGuide: true NewCops: enable - TargetRubyVersion: 2.7 + TargetRubyVersion: 3.0 Metrics/BlockLength: Exclude: diff --git a/lib/sidekiq/logging/argument_filter.rb b/lib/sidekiq/logging/argument_filter.rb index ba60693..d86e48b 100644 --- a/lib/sidekiq/logging/argument_filter.rb +++ b/lib/sidekiq/logging/argument_filter.rb @@ -27,7 +27,7 @@ def compiled_filter class CompiledFilter # :nodoc: def self.compile(filters) - return ->(args) { args.dup } if filters.empty? + return lambda(&:dup) if filters.empty? strings = [] regexps = [] diff --git a/lib/sidekiq/logstash.rb b/lib/sidekiq/logstash.rb index ce72193..ba12475 100644 --- a/lib/sidekiq/logstash.rb +++ b/lib/sidekiq/logstash.rb @@ -4,7 +4,6 @@ require 'sidekiq/logstash/version' require 'sidekiq/logging/logstash_formatter' require 'sidekiq/logging/argument_filter' -require 'sidekiq/logstash_job_logger' module Sidekiq # Main level module for Sidekiq::Logstash. @@ -22,6 +21,8 @@ def self.configure def self.setup(_opts = {}) # Calls Sidekiq.configure_server to inject logics Sidekiq.configure_server do |config| + require 'sidekiq/logstash_job_logger' + # Remove default, noisy error handler, # unless LogStash.configuration.keep_default_error_handler is set to true unless configuration.keep_default_error_handler diff --git a/sidekiq-logstash.gemspec b/sidekiq-logstash.gemspec index aca7d1f..791c177 100644 --- a/sidekiq-logstash.gemspec +++ b/sidekiq-logstash.gemspec @@ -19,7 +19,7 @@ Gem::Specification.new do |spec| spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } spec.require_paths = ['lib'] - spec.required_ruby_version = '>= 2.7.0' + spec.required_ruby_version = '>= 3.0.0' spec.add_dependency 'logstash-event', '~> 1.2' spec.add_dependency 'sidekiq', '~> 7.0' diff --git a/spec/sidekiq/logstash_spec.rb b/spec/sidekiq/logstash_spec.rb index e0d6702..6310298 100644 --- a/spec/sidekiq/logstash_spec.rb +++ b/spec/sidekiq/logstash_spec.rb @@ -15,7 +15,7 @@ def process(worker, params = [], encrypt: false) let(:job) { build(:job) } let(:logstash_config) { Sidekiq::Logstash::Configuration.new } let(:sidekiq_config) { Sidekiq::Config.new } - let(:processor) { ::Sidekiq::Processor.new(sidekiq_config.default_capsule) } + let(:processor) { Sidekiq::Processor.new(sidekiq_config.default_capsule) } let(:log_message) { JSON.parse(buffer.string) } let(:log_messages) { buffer.string.split("\n").map { |log| JSON.parse(log) } } let(:mock_redis) { double(:Redis) }