diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index f6b601e..16b35d8 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -12,10 +12,10 @@ jobs: image: mysql strategy: matrix: - ruby: [ '2.7', '3.0', '3.1', '3.2', '3.3', '3.4' ] + ruby: [ '3.3', '3.4', '4.0' ] task: [ 'spec' ] include: - - ruby: 2.7 # keep in sync with lowest version + - ruby: 3.3 # keep in sync with lowest version task: rubocop name: ${{ matrix.ruby }} rake ${{ matrix.task }} steps: diff --git a/.rubocop.yml b/.rubocop.yml index cb91c43..7d8926b 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -4,7 +4,7 @@ plugins: AllCops: NewCops: enable - TargetRubyVersion: 2.7 + TargetRubyVersion: 3.3 Style/StringLiterals: Enabled: false @@ -92,3 +92,12 @@ Lint/EmptyBlock: Naming/MethodParameterName: Exclude: [spec/**/*.rb] + +RSpec/Output: + Exclude: [spec/cases/*.rb] + +Style/OneClassPerFile: + Exclude: [spec/cases/*.rb] + +Naming/BlockForwarding: + EnforcedStyle: explicit diff --git a/Gemfile b/Gemfile index f3ed7b3..331dfe5 100644 --- a/Gemfile +++ b/Gemfile @@ -5,7 +5,7 @@ gemspec gem 'bump' gem 'rake' gem 'rspec' -gem 'activerecord', "~> 6.0" +gem 'activerecord' gem 'ruby-progressbar' gem 'rspec-rerun' gem 'rspec-legacy_formatters' @@ -19,4 +19,4 @@ gem 'base64' gem 'bigdecimal' gem 'mysql2', group: :mysql -gem 'sqlite3', '~> 1.4' +gem 'sqlite3' diff --git a/Gemfile.lock b/Gemfile.lock index 1ac941a..5e11f31 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -6,64 +6,76 @@ PATH GEM remote: https://rubygems.org/ specs: - activemodel (6.1.5) - activesupport (= 6.1.5) - activerecord (6.1.5) - activemodel (= 6.1.5) - activesupport (= 6.1.5) - activesupport (6.1.5) - concurrent-ruby (~> 1.0, >= 1.0.2) + activemodel (8.1.3) + activesupport (= 8.1.3) + activerecord (8.1.3) + activemodel (= 8.1.3) + activesupport (= 8.1.3) + timeout (>= 0.4.0) + activesupport (8.1.3) + base64 + bigdecimal + 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) - tzinfo (~> 2.0) - zeitwerk (~> 2.3) + securerandom (>= 0.3) + tzinfo (~> 2.0, >= 2.0.5) + uri (>= 0.13.1) ast (2.4.3) - base64 (0.2.0) - benchmark (0.4.0) - bigdecimal (3.1.9) - bigdecimal (3.1.9-java) + base64 (0.3.0) + benchmark (0.5.0) + bigdecimal (4.1.0) + bigdecimal (4.1.0-java) bump (0.10.0) - concurrent-ruby (1.1.9) - diff-lcs (1.5.0) - i18n (1.10.0) + 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.10.2) - json (2.10.2-java) - language_server-protocol (3.17.0.4) + json (2.19.3) + json (2.19.3-java) + language_server-protocol (3.17.0.5) lint_roller (1.1.0) logger (1.7.0) - mini_portile2 (2.8.7) - minitest (5.15.0) + mini_portile2 (2.8.9) + minitest (6.0.3) + drb (~> 2.0) + prism (~> 1.5) mutex_m (0.3.0) mysql2 (0.5.7) bigdecimal - parser (3.3.8.0) + parser (3.3.11.1) ast (~> 2.4.1) racc - prism (1.4.0) + prism (1.9.0) racc (1.8.1) racc (1.8.1-java) rainbow (3.1.1) - rake (13.0.6) - regexp_parser (2.10.0) - rspec (3.11.0) - rspec-core (~> 3.11.0) - rspec-expectations (~> 3.11.0) - rspec-mocks (~> 3.11.0) - rspec-core (3.11.0) - rspec-support (~> 3.11.0) - rspec-expectations (3.11.0) + rake (13.3.1) + 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.11.0) + rspec-support (~> 3.13.0) rspec-legacy_formatters (1.0.2) rspec (~> 3.0) - rspec-mocks (3.11.0) + rspec-mocks (3.13.8) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.11.0) + rspec-support (~> 3.13.0) rspec-rerun (1.1.0) rspec (~> 3.0) - rspec-support (3.11.0) - rubocop (1.75.2) + rspec-support (3.13.7) + rubocop (1.86.0) json (~> 2.3) language_server-protocol (~> 3.17.0.2) lint_roller (~> 1.1.0) @@ -71,34 +83,36 @@ GEM parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 2.9.3, < 3.0) - rubocop-ast (>= 1.44.0, < 2.0) + rubocop-ast (>= 1.49.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 4.0) - rubocop-ast (1.44.1) + rubocop-ast (1.49.1) parser (>= 3.3.7.2) - prism (~> 1.4) + prism (~> 1.7) rubocop-rake (0.7.1) lint_roller (~> 1.1) rubocop (>= 1.72.1) - rubocop-rspec (3.5.0) + rubocop-rspec (3.9.0) lint_roller (~> 1.1) - rubocop (~> 1.72, >= 1.72.1) + rubocop (~> 1.81) ruby-progressbar (1.13.0) - sqlite3 (1.7.3) + securerandom (0.4.1) + sqlite3 (2.9.2) mini_portile2 (~> 2.8.0) - tzinfo (2.0.4) + timeout (0.6.1) + tzinfo (2.0.6) concurrent-ruby (~> 1.0) - unicode-display_width (3.1.4) - unicode-emoji (~> 4.0, >= 4.0.4) - unicode-emoji (4.0.4) - zeitwerk (2.5.4) + unicode-display_width (3.2.0) + unicode-emoji (~> 4.1) + unicode-emoji (4.2.0) + uri (1.1.1) PLATFORMS java ruby DEPENDENCIES - activerecord (~> 6.0) + activerecord base64 benchmark bigdecimal @@ -115,7 +129,7 @@ DEPENDENCIES rubocop-rake rubocop-rspec ruby-progressbar - sqlite3 (~> 1.4) + sqlite3 BUNDLED WITH 2.3.12 diff --git a/lib/parallel.rb b/lib/parallel.rb index d0c3f37..ffa2076 100644 --- a/lib/parallel.rb +++ b/lib/parallel.rb @@ -255,7 +255,7 @@ def map(source, options = {}, &block) if options[:in_processes] && options[:in_threads] raise ArgumentError, "Please specify only one of `in_processes` or `in_threads`." - elsif RUBY_PLATFORM =~ (/java/) && !options[:in_processes] + elsif RUBY_PLATFORM =~ /java/ && !options[:in_processes] method = :in_threads size = options[method] || processor_count elsif options[:in_threads] @@ -621,7 +621,7 @@ def process_incoming_jobs(read, write, job_factory, options, &block) # https://github.com/rspec/rspec-support/blob/673133cdd13b17077b3d88ece8d7380821f8d7dc/lib/rspec/support.rb#L132-L140 rescue NoMemoryError, SignalException, Interrupt, SystemExit # rubocop:disable Lint/ShadowedException raise $! - rescue Exception # # rubocop:disable Lint/RescueException + rescue Exception # rubocop:disable Lint/RescueException ExceptionWrapper.new($!) end diff --git a/parallel.gemspec b/parallel.gemspec index d508190..f4ef8fe 100644 --- a/parallel.gemspec +++ b/parallel.gemspec @@ -16,5 +16,5 @@ Gem::Specification.new name, Parallel::VERSION do |s| } s.files = `git ls-files lib MIT-LICENSE.txt`.split("\n") s.license = "MIT" - s.required_ruby_version = '>= 2.7' + s.required_ruby_version = '>= 3.3' end diff --git a/spec/parallel_spec.rb b/spec/parallel_spec.rb index 8fe1b0a..5f9e6ae 100644 --- a/spec/parallel_spec.rb +++ b/spec/parallel_spec.rb @@ -4,7 +4,7 @@ describe Parallel do worker_types = ["threads"] worker_types << "processes" if Process.respond_to?(:fork) - worker_types << "ractors" if defined?(Ractor) + worker_types << "ractors" if defined?(Ractor) && RUBY_VERSION < "4.0.0" # TODO: need new code for ruby 4 ractors def time_taken t = Time.now.to_f