Skip to content

Commit d5bbb2d

Browse files
committed
updated latest_version script
1 parent c69400e commit d5bbb2d

File tree

4 files changed

+20
-27
lines changed

4 files changed

+20
-27
lines changed

.github/workflows/test.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,10 @@ jobs:
170170
ruby: '3.3'
171171
rails: '7.1.5.1'
172172

173+
- name: 'Ruby 3.4 / Rails 7.2'
174+
ruby: '3.4'
175+
rails: '7.2.2.1'
176+
173177
env:
174178
RAILS_VERSION: ${{ matrix.rails }}
175179
RUBY_VERSION: ${{ matrix.ruby }}
@@ -194,4 +198,3 @@ jobs:
194198

195199
- name: Run Rails integration tests
196200
run: bin/rails_tests
197-
b

.rubocop.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ Sorbet/StrictSigil:
8080
- 'test/**/*'
8181
- 'sorbet/**/*'
8282
- 'rails_test_app/**/*.rb'
83+
- 'scripts/**/*.rb'
8384
SuggestedStrictness: strict
8485

8586
# Require typed: true for test files
@@ -88,6 +89,7 @@ Sorbet/TrueSigil:
8889
Include:
8990
- 'test/**/*.rb'
9091
- 'rails_test_app/**/*.rb'
92+
- 'scripts/**/*.rb'
9193
SuggestedStrictness: true
9294

9395
# Don't try to validate typing on generated Sorbet RBI files

rails_test_app/create_app.rb

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,21 @@
88
# Map major.minor versions to specific patch versions
99
# This mapping will be updated by scripts/update_rails_versions.rb
1010
if rails_version.count(".") < 2
11-
case rails_version
11+
latest_version = case rails_version
1212
when "7.0"
13-
latest_version = "7.0.8.7" # Updated by update_rails_versions.rb script
13+
"7.0.8.7" # Updated by update_rails_versions script
1414
when "7.1"
15-
latest_version = "7.1.5.1" # Updated by update_rails_versions.rb script
15+
"7.1.5.1" # Updated by update_rails_versions script
16+
when "7.2"
17+
"7.2.2.1" # Updated by update_rails_versions script
1618
when "8.0"
17-
latest_version = "8.0.1" # Updated by update_rails_versions.rb script
19+
"8.0.1" # Updated by update_rails_versions script
1820
else
19-
puts "Warning: Using unrecognized Rails version #{rails_version}"
21+
raise "Unrecognized Rails version #{rails_version}"
2022
end
2123

22-
if latest_version
23-
puts "Mapping Rails #{rails_version} to #{latest_version}"
24-
rails_version = latest_version
25-
end
24+
puts "Mapping Rails #{rails_version} to #{latest_version}"
25+
rails_version = latest_version
2626
end
2727

2828
# Get currently installed Rails versions
@@ -143,18 +143,6 @@ def copy_template(file, target_path = nil)
143143
gem "drb"
144144
gem "benchmark"
145145

146-
# Add version-specific gems
147-
case rails_version
148-
when "7.0"
149-
"7.0.8.7" # Updated by update_rails_versions.rb script
150-
when "7.1"
151-
"7.1.5.1" # Updated by update_rails_versions.rb script
152-
when "8.0"
153-
"8.0.1" # Updated by update_rails_versions.rb script
154-
else
155-
puts "Warning: Using unrecognized Rails version #{rails_version}"
156-
end
157-
158146
# Add test gems
159147
test_gems = <<~GEMS
160148

scripts/update_rails_versions.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env ruby
2-
# typed: strict
2+
# typed: true
33

44
# This script fetches the latest patch versions for each supported Rails version
55
# and updates them in the codebase.
@@ -8,7 +8,7 @@
88
require "net/http"
99

1010
# Rails versions we support
11-
SUPPORTED_MAJOR_MINOR = ["7.0", "7.1", "8.0"]
11+
SUPPORTED_MAJOR_MINOR = ["7.0", "7.1", "7.2", "8.0"]
1212

1313
# Files to update
1414
CREATE_APP_SCRIPT = File.expand_path("../rails_test_app/create_app.rb", __dir__)
@@ -87,9 +87,9 @@ def update_github_workflow(versions)
8787
# Update the matrix versions
8888
versions.each do |major_minor, version|
8989
# Look for matrix entries with this major.minor version
90-
# Allow for different patch versions (e.g., .8, .8.7)
91-
if /rails:\s*'#{major_minor}[\.\d]+'/.match?(updated_content)
92-
updated_content.gsub!(/rails:\s*'#{major_minor}[\.\d]+'/, "rails: '#{version}'")
90+
# Handle both cases: with patch number (7.0.8) or without (7.2)
91+
if updated_content.match?(/rails:\s*'#{major_minor}([\.\d]*)'/)
92+
updated_content.gsub!(/rails:\s*'#{major_minor}([\.\d]*)'/, "rails: '#{version}'")
9393
puts " Updated matrix Rails #{major_minor} to version #{version}"
9494
else
9595
puts " Warning: Could not find matrix entry for Rails #{major_minor} in test.yml"

0 commit comments

Comments
 (0)