Skip to content

Commit e5c1d01

Browse files
committed
Merge branch 'feat/DEX-2733/support-rails-8' into 'master'
Resolve DEX-2733 "Feat//support rails 8" Closes DEX-2733 See merge request nstmrt/rubygems/outbox!108
2 parents f2fd66c + 43d89f6 commit e5c1d01

File tree

10 files changed

+53
-17
lines changed

10 files changed

+53
-17
lines changed

.gitlab-ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,17 @@ include:
66
lint:
77
stage: test
88
image: ${BUILD_CONF_HARBOR_REGISTRY}/dhub/library/ruby:3.3
9+
tags:
10+
- paas-stage
911
script:
1012
- bundle install
1113
- bundle exec rubocop
1214

1315
tests:
1416
stage: test
1517
image: ${BUILD_CONF_HARBOR_REGISTRY}/dhub/library/ruby:$RUBY_VERSION
18+
tags:
19+
- paas-medium
1620
parallel:
1721
matrix:
1822
- RUBY_VERSION: ['2.7', '3.0', '3.1', '3.2', '3.3']

.rubocop.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ inherit_mode:
88

99
AllCops:
1010
TargetRubyVersion: 2.7
11-
TargetRailsVersion: 5.2
11+
TargetRailsVersion: 6.0
1212
NewCops: enable
1313
SuggestExtensions: false
1414

@@ -56,8 +56,3 @@ RSpec/MultipleMemoizedHelpers:
5656
RSpec/DescribeClass:
5757
Exclude:
5858
- spec/lib/sbmt/outbox/tasks/*
59-
60-
RSpec/InstanceVariable:
61-
Exclude:
62-
# TODO: Remove this when changing the minimum Rails version to 5.1
63-
- spec/lib/sbmt/outbox/worker_spec.rb

Appraisals

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44

55
versions_map = {
66
"6.0" => %w[2.7],
7-
"6.1" => %w[3.0 3.1],
8-
"7.0" => %w[3.2],
9-
"7.1" => %w[3.3]
7+
"6.1" => %w[3.0],
8+
"7.0" => %w[3.1],
9+
"7.1" => %w[3.2],
10+
"7.2" => %w[3.3],
11+
"8.0" => %w[3.3]
1012
}
1113

1214
current_ruby_version = RUBY_VERSION.split(".").first(2).join(".")

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,16 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1313

1414
### Fixed
1515

16+
## [6.11.0] - 2024-12-23
17+
18+
### Added
19+
20+
- Add support of Rails 8.0
21+
22+
### Changed
23+
24+
- Dropped support of Rails 5.2
25+
1626
## [6.10.5] - 2024-11-05
1727

1828
### Fixed

app/jobs/sbmt/outbox/base_delete_stale_items_job.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def postgres_delete_in_batches(waterline)
134134
def mysql_delete_in_batches(waterline)
135135
loop do
136136
deleted_count = item_class
137-
.where("created_at < ?", waterline)
137+
.where(created_at: ...waterline)
138138
.limit(BATCH_SIZE)
139139
.delete_all
140140

app/models/sbmt/outbox/base_item.rb

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
# frozen_string_literal: true
22

3+
require_relative "../../../../lib/sbmt/outbox/enum_refinement"
4+
35
module Sbmt
46
module Outbox
57
class BaseItem < Outbox.active_record_base_class
8+
# For compatibility with rails < 7
9+
# Remove when drop support of Rails < 7
10+
using EnumRefinement
11+
612
self.abstract_class = true
713

814
class << self
@@ -26,8 +32,8 @@ def config
2632

2733
def calc_bucket_partitions(count)
2834
(0...count).to_a
29-
.each_with_object({}) do |x, m|
30-
m[x] = (0...config.bucket_size).to_a
35+
.index_with do |x|
36+
(0...config.bucket_size).to_a
3137
.select { |p| p % count == x }
3238
end
3339
end
@@ -46,7 +52,7 @@ def bucket_partitions
4652
end
4753
end
4854

49-
enum status: {
55+
enum :status, {
5056
pending: 0,
5157
failed: 1,
5258
delivered: 2,

dip.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ interaction:
3535
subcommands:
3636
all:
3737
command: bundle exec appraisal rspec
38-
rails-5.2:
39-
command: bundle exec appraisal rails-5.2 rspec
4038
rails-6.0:
4139
command: bundle exec appraisal rails-6.0 rspec
4240
rails-6.1:
@@ -45,6 +43,10 @@ interaction:
4543
command: bundle exec appraisal rails-7.0 rspec
4644
rails-7.1:
4745
command: bundle exec appraisal rails-7.1 rspec
46+
rails-7.2:
47+
command: bundle exec appraisal rails-7.2 rspec
48+
rails-8.0:
49+
command: bundle exec appraisal rails-8.0 rspec
4850

4951
rubocop:
5052
description: Run Ruby linter

lib/sbmt/outbox/enum_refinement.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# frozen_string_literal: true
2+
3+
module Sbmt
4+
module Outbox
5+
module EnumRefinement
6+
refine ActiveRecord::Base.singleton_class do
7+
def enum(name, values = nil)
8+
if Rails::VERSION::MAJOR >= 7
9+
super
10+
else
11+
super(name => values)
12+
end
13+
end
14+
end
15+
end
16+
end
17+
end

lib/sbmt/outbox/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
module Sbmt
44
module Outbox
5-
VERSION = "6.10.5"
5+
VERSION = "6.11.0"
66
end
77
end

sbmt-outbox.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Gem::Specification.new do |s|
3535
s.add_dependency "dry-initializer", "~> 3.0"
3636
s.add_dependency "dry-monads", "~> 1.3"
3737
s.add_dependency "exponential-backoff", "~> 0.0"
38-
s.add_dependency "rails", ">= 5.2", "< 8"
38+
s.add_dependency "rails", ">= 6.0", "< 8.1"
3939
s.add_dependency "yabeda", "~> 0.8"
4040
s.add_dependency "thor", ">= 0.20", "< 2"
4141
s.add_dependency "redlock", "> 1.0", "< 3.0"

0 commit comments

Comments
 (0)