Skip to content

Commit 813e04e

Browse files
compwronclaude
andauthored
upgrade: ruby 4.0.2 → 4.0.3 and fix devcontainer base image (#6928)
* upgrade: ruby from 4.0.2 to 4.0.3 and fix devcontainer base image The devcontainer base (ruby:dev-3.3-bookworm) shipped Ruby 3.3 while the project pinned 4.0.2, so bundle install failed in codespaces. Bump the base to dev-4.0-bookworm and align the project to 4.0.3 so codespace builds don't need a slow rvm compile. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * pin bundler to 4.0.6 in bin/setup and Gemfile.lock bin/setup previously installed whatever bundler version was latest and then rewrote BUNDLED WITH via 'bundle update --bundler', so the lockfile silently drifted whenever a developer ran setup. Pin to 4.0.6 — the version Heroku supports for our Ruby — and drop the auto-rewrite step. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 47d17ca commit 813e04e

13 files changed

Lines changed: 43 additions & 27 deletions

File tree

.devcontainer/Dockerfile

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,16 @@
1-
FROM mcr.microsoft.com/devcontainers/ruby:dev-3.3-bookworm
1+
FROM mcr.microsoft.com/devcontainers/ruby:dev-4.0-bookworm
22
RUN apt-get update && apt-get install -y vim curl gpg postgresql postgresql-contrib tzdata imagemagick
3+
4+
# The dev-4.0 tag tracks the latest Ruby 4.0.x patch, which may not match the
5+
# exact version pinned in .ruby-version. If it doesn't, install the pinned
6+
# version via rvm so Bundler is happy. When patch versions align, this is a
7+
# no-op and the build stays fast.
8+
USER vscode
9+
COPY --chown=vscode:vscode .ruby-version /tmp/.ruby-version
10+
RUN /bin/bash -lc '\
11+
pinned="$(cat /tmp/.ruby-version)"; \
12+
if ! ruby -v | grep -q "ruby $pinned"; then \
13+
rvm install "$pinned" && rvm --default use "$pinned"; \
14+
fi' \
15+
&& rm /tmp/.ruby-version
16+
USER root

.devcontainer/post-create.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ RUBY_VERSION="$(cat .ruby-version | tr -d '\n')"
33
# copy the file only if it doesn't already exist
44
cp -n .devcontainer/.env.codespaces .env
55

6-
# If the project's required ruby version changes from 4.0.2, this command
6+
# If the project's required ruby version changes from 4.0.3, this command
77
# will download and compile the correct version, but it will take a long time.
8-
if [ "$RUBY_VERSION" != "4.0.2" ]; then
8+
if [ "$RUBY_VERSION" != "4.0.3" ]; then
99
rvm install $RUBY_VERSION
1010
rvm use $RUBY_VERSION
1111
echo "Ruby $RUBY_VERSION installed"

.ruby-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4.0.2
1+
4.0.3

.tool-versions

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
ruby 4.0.2
1+
ruby 4.0.3
22
nodejs 24.13.0

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ ARG ROOT=/usr/src/app/
44

55
FROM node:24-alpine AS node-source
66

7-
FROM ruby:4.0.2-alpine AS build
7+
FROM ruby:4.0.3-alpine AS build
88
ARG ROOT
99
WORKDIR $ROOT
1010

@@ -22,7 +22,7 @@ RUN bundle config set force_ruby_platform true
2222
COPY Gemfile* $ROOT
2323
RUN bundle install
2424

25-
FROM ruby:4.0.2-alpine
25+
FROM ruby:4.0.3-alpine
2626
ARG ROOT
2727
WORKDIR $ROOT
2828

Gemfile

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

33
source "https://rubygems.org"
44

5-
ruby "4.0.2"
5+
ruby "4.0.3"
66
gem "rails", "~> 7.2"
77

88
gem "after_party" # Post-deployment tasks

Gemfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,7 @@ DEPENDENCIES
802802
wicked
803803

804804
RUBY VERSION
805-
ruby 4.0.2
805+
ruby 4.0.3
806806

807807
BUNDLED WITH
808-
4.0.9
808+
4.0.6

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ The complete [role description of a CASA volunteer](https://pgcasa.org/volunteer
9393

9494
| Technology | Version |
9595
|---|---|
96-
| Ruby | 4.0.2 (see `.ruby-version`) |
96+
| Ruby | 4.0.3 (see `.ruby-version`) |
9797
| Rails | 7.2 |
9898
| PostgreSQL | 14+ |
9999
| Node.js | LTS/Krypton (see `.nvmrc`) |
@@ -131,7 +131,7 @@ Key libraries: [Hotwire Turbo](https://turbo.hotwired.dev/), [Stimulus](https://
131131

132132
**Ruby**
133133
1. Install a ruby version manager: [rvm](https://rvm.io/) or [rbenv](https://github.com/rbenv/rbenv)
134-
1. when you cd into the project directory, let your version manager install the ruby version in `.ruby-version`. Right now that's Ruby 4.0.2
134+
1. when you cd into the project directory, let your version manager install the ruby version in `.ruby-version`. Right now that's Ruby 4.0.3
135135
1. `gem install bundler`
136136

137137
**node.js**

bin/setup

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@ FileUtils.chdir APP_ROOT do
2121

2222
puts "\n== Installing dependencies =="
2323
system! 'gem install foreman'
24-
system! 'gem install bundler --conservative'
25-
system!('bundle update --bundler --verbose')
24+
# Pin bundler to a version Heroku supports for our Ruby. Match Heroku's
25+
# supported Ruby/Bundler pairings as they evolve:
26+
# https://devcenter.heroku.com/articles/ruby-support-reference#supported-ruby-versions
27+
system! 'gem install bundler -v 4.0.6 --conservative'
2628
system!('bundle check') || system!('bundle install')
2729

2830
# puts '\n== Copying sample files =='

doc/LINUX_SETUP.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ git clone https://github.com/rbenv/rbenv.git ~/.rbenv
8484
# fetch list of ruby versions
8585
git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build
8686
87-
rbenv install 4.0.2
87+
rbenv install 4.0.3
8888
```
8989

9090
If you would like RVM instead of rbenv
@@ -95,9 +95,9 @@ gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703
9595
\curl -sSL https://get.rvm.io | bash
9696
. ./.bashrc
9797
rvm get head
98-
rvm install 4.0.2
99-
rvm alias create ruby 4.0.2
100-
rvm alias create default ruby-4.0.2
98+
rvm install 4.0.3
99+
rvm alias create ruby 4.0.3
100+
rvm alias create default ruby-4.0.3
101101
```
102102

103103
```# Download the Chrome browser (for RSpec testing):

0 commit comments

Comments
 (0)