Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Comments

feat(gem-backend): use gem command for backend operations#6650

Merged
jdx merged 4 commits intojdx:mainfrom
andrewthauer:gem-command-for-backend-ops
Nov 13, 2025
Merged

feat(gem-backend): use gem command for backend operations#6650
jdx merged 4 commits intojdx:mainfrom
andrewthauer:gem-command-for-backend-ops

Conversation

@andrewthauer
Copy link
Contributor

@andrewthauer andrewthauer commented Oct 13, 2025

Initial draft POC in relation to #5325. Switches from using the rubygems API directly to the gem command in order to leverage the ~/.gemrc gem sources configuration.


Note

Replaces Rubygems API calls with gem info for remote version listing (respecting configured sources), adds a parser and tests, and removes related HTTP/URL code.

  • Gem Backend:
    • Remote version listing:
      • Replace Rubygems API/HTTP with gem info --remote --all --exact using dependency_env.
      • Add parse_gem_versions to extract versions from gem info output.
      • Add tests covering typical, empty, and single-version outputs.
    • Remove HTTP_FETCH, URL handling, and GemVersion struct no longer needed.

Written by Cursor Bugbot for commit fa8aa27. This will update automatically on new commits. Configure here.

@jdx jdx closed this Nov 12, 2025
@andrewthauer
Copy link
Contributor Author

@jdx - Is this something you would be willing to consider as a contribution? If so, what are you looking for to move something forward here?

@jdx
Copy link
Owner

jdx commented Nov 12, 2025

I think this was fine, I just closed a bunch of old PRs so idk if it wasn't passing tests or something

@jdx jdx reopened this Nov 12, 2025
@jdx jdx marked this pull request as ready for review November 13, 2025 00:12
Copilot AI review requested due to automatic review settings November 13, 2025 00:12
@jdx jdx merged commit 7b57d2a into jdx:main Nov 13, 2025
26 checks passed
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR replaces the Ruby gems API-based version listing with a gem command-based approach to respect user-configured gem sources and mirrors from ~/.gemrc. The change switches from HTTP API calls to rubygems.org to using the gem info command for listing remote versions.

Key Changes:

  • Replace HTTP API calls with gem info command execution to respect gem source configurations
  • Add parsing logic for gem info output format
  • Add comprehensive test coverage for the new parsing function

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Ok(versions)
async fn _list_remote_versions(&self, config: &Arc<Config>) -> eyre::Result<Vec<String>> {
// Use `gem info` to list versions, which respects configured gem sources/mirrors
let env = self.dependency_env(config).await.unwrap_or_default();
Copy link

Copilot AI Nov 13, 2025

Choose a reason for hiding this comment

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

Using unwrap_or_default() silently swallows errors from dependency_env(). If the environment setup fails, this could lead to unexpected behavior when executing the gem command. Consider propagating the error or logging a warning when dependency_env() fails.

Suggested change
let env = self.dependency_env(config).await.unwrap_or_default();
let env = self.dependency_env(config).await?;

Copilot uses AI. Check for mistakes.
Ok(versions)
async fn _list_remote_versions(&self, config: &Arc<Config>) -> eyre::Result<Vec<String>> {
// Use `gem info` to list versions, which respects configured gem sources/mirrors
let env = self.dependency_env(config).await.unwrap_or_default();
Copy link

Choose a reason for hiding this comment

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

Bug: Inconsistent Error Handling Hides Problems

The dependency_env call uses .unwrap_or_default() which silently swallows errors, while install_version_ at line 74 propagates them with ?. This inconsistency means configuration errors are hidden during version listing but surfaced during installation, causing confusing behavior. Other backends consistently propagate dependency_env errors.

Fix in Cursor Fix in Web

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.

2 participants