Skip to content

Commit

Permalink
Upgrade ruby v3 3 (#4357)
Browse files Browse the repository at this point in the history
* wip

* add depracted fixnum class

* update rspec + sonarqube

* update rspec to 7.1.0

* tweak for codespaces
  • Loading branch information
martyn-w authored Nov 21, 2024
1 parent 91b7005 commit 6c7ce27
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 44 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"version": "latest"
},
"ghcr.io/devcontainers/features/ruby:1": {
"version": "3.1.4"
"version": "3.3.6"
},
"ghcr.io/devcontainers/features/node:1": {
"version": "18.16"
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1.4
3.3.6
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
terraform 1.5.4
ruby 3.1.4
ruby 3.3.6
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# To use or update to a ruby version, change BASE_RUBY_IMAGE
ARG BASE_RUBY_IMAGE=ruby:3.1.4-alpine3.18
ARG BASE_RUBY_IMAGE=ruby:3.3.6-alpine3.20

FROM ${BASE_RUBY_IMAGE} AS base

Expand Down
5 changes: 2 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,12 @@ group :development, :test do

# Testing framework
gem "knapsack"
gem "rspec-rails", "~> 6.0.3"
gem "rspec-rails", "~> 7.1.0"

# Adds support for Capybara system testing and selenium driver
gem "capybara", "~> 3.40.0"
gem "factory_bot_rails", ">= 6.2.0"
# See: https://github.com/otherguy/rspec-sonarqube-formatter/pull/63
gem "rspec-sonarqube-formatter", github: "otherguy/rspec-sonarqube-formatter", ref: "13fe436", require: false
gem "rspec-sonarqube-formatter", "~> 1.6.1", require: false
gem "simplecov"

# Linting
Expand Down
66 changes: 30 additions & 36 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,6 @@ GIT
activemodel (>= 6.0.0, < 7.1)
timeliness (>= 0.3.10, < 1)

GIT
remote: https://github.com/otherguy/rspec-sonarqube-formatter.git
revision: 13fe436921e1442a09c23d9e46055773d1511638
ref: 13fe436
specs:
rspec-sonarqube-formatter (1.0.0.pre.local)
htmlentities (~> 4.3.3)
rspec (~> 3.0)

GIT
remote: https://github.com/pkorenev/rack-page_caching.git
revision: 9ca404f7f7e4773030e75799da7ab02e27cbe9a3
Expand Down Expand Up @@ -205,7 +196,7 @@ GEM
csv (3.3.0)
declarative (0.0.20)
delegate (0.3.1)
diff-lcs (1.5.0)
diff-lcs (1.5.1)
docile (1.4.0)
dotenv (3.1.2)
dotenv-rails (3.1.2)
Expand Down Expand Up @@ -380,7 +371,7 @@ GEM
mixlib-shellout
method_source (1.1.0)
mini_mime (1.1.5)
mini_portile2 (2.8.7)
mini_portile2 (2.8.8)
minitest (5.25.1)
mixlib-cli (2.1.8)
mixlib-config (3.0.27)
Expand All @@ -400,10 +391,10 @@ GEM
net-smtp (0.5.0)
net-protocol
nio4r (2.7.3)
nokogiri (1.16.5)
nokogiri (1.16.7)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
nokogiri (1.16.5-x86_64-linux)
nokogiri (1.16.7-x86_64-linux)
racc (~> 1.4)
observer (0.1.1)
os (1.1.4)
Expand Down Expand Up @@ -497,29 +488,32 @@ GEM
rexml (3.3.3)
strscan
rinku (2.0.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)
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.2)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.3)
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.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-rails (6.0.3)
actionpack (>= 6.1)
activesupport (>= 6.1)
railties (>= 6.1)
rspec-core (~> 3.12)
rspec-expectations (~> 3.12)
rspec-mocks (~> 3.12)
rspec-support (~> 3.12)
rspec-support (~> 3.13.0)
rspec-rails (7.1.0)
actionpack (>= 7.0)
activesupport (>= 7.0)
railties (>= 7.0)
rspec-core (~> 3.13)
rspec-expectations (~> 3.13)
rspec-mocks (~> 3.13)
rspec-support (~> 3.13)
rspec-retry (0.6.2)
rspec-core (> 3.3)
rspec-support (3.12.0)
rspec-sonarqube-formatter (1.6.1)
htmlentities (~> 4.3)
rspec (~> 3.0)
rspec-support (3.13.1)
rubocop (1.64.1)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
Expand Down Expand Up @@ -638,7 +632,7 @@ GEM
websocket-extensions (0.1.5)
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (2.6.18)
zeitwerk (2.7.1)

PLATFORMS
ruby
Expand Down Expand Up @@ -706,9 +700,9 @@ DEPENDENCIES
redis-session-store (>= 0.11.4)
rexml (>= 3.2.5)
rinku
rspec-rails (~> 6.0.3)
rspec-rails (~> 7.1.0)
rspec-retry
rspec-sonarqube-formatter!
rspec-sonarqube-formatter (~> 1.6.1)
rubocop-govuk (~> 5.0.2)
secure_headers
selenium-webdriver (~> 4.21.1)
Expand All @@ -732,7 +726,7 @@ DEPENDENCIES
webmock (>= 3.14.0)

RUBY VERSION
ruby 3.1.4p223
ruby 3.3.6

BUNDLED WITH
2.3.4
3 changes: 3 additions & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)

# Patch to Rack::PageCaching::Utils to substitute Fixnum --> Integer
require_relative "../lib/patch_rack_page_caching"

module GetIntoTeachingWebsite
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
Expand Down
2 changes: 1 addition & 1 deletion config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,5 @@
config.x.dfe_analytics = true

# Allow access from Codespaces
config.hosts << /[a-z0-9-]+\.(preview\.app\.github|githubpreview)\.dev/
config.hosts << /[a-z0-9-]+\.((preview\.)?app\.github|githubpreview)\.dev/
end
19 changes: 19 additions & 0 deletions lib/patch_rack_page_caching.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# NB: we are using a very old gem (https://github.com/pkorenev/rack-page_caching)
# which requires the deprecated Fixnum class - this is a patch to switch Fixnum --> Integer

module Rack
class PageCaching
module Utils
def self.gzip_level(gzip)
case gzip
when Symbol
Zlib.const_get(gzip.to_s.upcase)
when Integer
gzip
else
false
end
end
end
end
end

0 comments on commit 6c7ce27

Please sign in to comment.