Skip to content

Fix rv ruby list JSON parsing for rv 0.6.0 - #8

Merged
indirect merged 1 commit into
spinel-coop:mainfrom
eirvandelden:fix-rv-0.6.0-ruby-list-format
Jun 16, 2026
Merged

indirect merged 1 commit into
spinel-coop:mainfrom
eirvandelden:fix-rv-0.6.0-ruby-list-format

Conversation

@eirvandelden

@eirvandelden eirvandelden commented Jun 16, 2026 •

Copy link
Copy Markdown
Contributor

What changed

rv 0.6.0 changed the output format of rv ruby list --format json (#615, #637). The version field is now nested under an "Installed" or "Remote" key instead of being at the top level:

Before (rv 0.5.x):

[{ "version": "ruby-3.4.9", "active": true, ... }]

After (rv 0.6.0+):

[{ "Installed": { "version": "ruby-3.4.9", ... }, "active": true }]

This caused action.sh's jq expression to receive null for .version, making sub() fail with:

jq: error (at <stdin>:42): null (null) cannot be matched, as it is not a string

Fix

Change the jq expression from:

.[] | select(.active == true) | .version | sub("^ruby-"; "")

to:

.[] | select(.active == true) | (.Installed.version // .version) | sub("^ruby-"; "")

The // alternative operator makes this work with both rv 0.6.0+ (version nested under Installed) and older rv versions (version at top level).

Fixes #7


This fix was written with AI assistance (Claude), steered and reviewed by @eirvandelden.

rv 0.6.0 changed the output format of `rv ruby list --format json`:
version is now nested under an `Installed` or `Remote` key rather
than at the top level.

Use `(.Installed.version // .version)` so the expression works with
both rv 0.6.0+ (new format) and older rv versions (old flat format).

Fixes spinel-coop#7
@indirect

Copy link
Copy Markdown
Member

Thanks!

@indirect
indirect added this pull request to the merge queue Jun 16, 2026
@indirect
indirect removed this pull request from the merge queue due to a manual request Jun 16, 2026
@indirect
indirect merged commit 789f430 into spinel-coop:main Jun 16, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

setup-rv@main breaks with rv 0.6.0: rv ruby list --format json output format changed

2 participants