Skip to content

Conversation

zharinov
Copy link
Collaborator

@zharinov zharinov commented Jul 24, 2025

Changes

Gemfile Parser

A comprehensive Ruby Gemfile parser for Renovate built with AST-grep. The parser is organized into focused modules:

  • index.ts - parseGemfile() top-level function
  • common.ts - Shared AST utilities and Ruby language loading, i.g. variable resolution
  • gem.ts - Gem name/version parsing (gem "rails", "~> 7.0")
  • git.ts - Git dependency handling (git:, github:, ref:, tag:, branch:)
  • group-scope.ts - Dependency groups and scoping (group :development do ... end)
  • ruby-version.ts - Ruby version requirements (ruby "2.7.1")
  • source-scope.ts - Registry/source URL management (source "https://..." do ... end)

Handles complex Gemfile syntax including nested groups, source blocks, variable resolution, version constraints, and edge cases.

Context

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests but ran on a real repository, or
  • Both unit tests + ran on a real repository

@zharinov zharinov added the ci:fulltest Run full test suite on all platforms label Jul 24, 2025
@zharinov zharinov marked this pull request as ready for review July 24, 2025 20:33
@zharinov zharinov marked this pull request as draft July 24, 2025 20:33
@zharinov zharinov marked this pull request as ready for review July 25, 2025 03:30
@zharinov zharinov requested review from viceice, secustor and rarkins July 25, 2025 04:16
@zharinov
Copy link
Collaborator Author

e2e and docker build failures have something to do with postinstall script whitelisting strategy of pnpm

@zharinov zharinov removed the ci:fulltest Run full test suite on all platforms label Jul 25, 2025
@zharinov zharinov requested a review from viceice July 25, 2025 17:39
Copy link
Member

@viceice viceice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

otherwise LGTM

{ depName: 'sfn_my_dep1', currentValue: '"~> 1"' },
{ depName: 'sfn_my_dep2', currentValue: '"~> 1"' },
{
currentValue: '~> 1',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interesting, we extract without quotes. you need to check the ruby versioning if it needs the quotes!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It strips them when needed

strings: TemplateStringsArray,
...values: any[]
): NapiConfig {
return parseSingleYaml<NapiConfig>(strings[0]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why so many arguments, when we only use the first string? 🤔

Copy link
Collaborator

@rarkins rarkins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's merge after v42

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.

4 participants