ruby / ruby/rubygems

Feature request: `gem sources --add` should write new source without hitting the URL first.

Open
#1,607 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

category: command status: ready type: feature request
Dominant language
Ruby
Stars
4k
Forks
1.9k
Avg merge
1d 2h
Merged PRs (30d)
81

Description

I'm having a problem or would like to suggest a feature.

My current problem is gem sources requiring authentication cannot be added using gem sources --add without including the user:pass authentication components in the URL. This writes private authentication information to ~/.gemrc.

This issue is related to:

  • Network problems
  • Installing a library
  • Publishing a library
  • The command line gem
  • Other

Here are my current environment details:

$ gem env version
2.2.2

I will abide by the code of conduct.

I much prefer to keep the authentication information outside of .gemrc by using bundle config (or more specifically, the BUNDLER_* env vars). Which means the gem source needs to be added to .gemrc without the authentication components. However, doing gem sources --add <source_url_without_auth> fails because the unauthenticated URL returns a 401. I propose that gem sources --add either:

  1. add a flag to disable the preflight check
  2. write the source to .gemrc first and then hit the url, emitting an error message as appropriate and returning the proper error code.

My vote is for option 2.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the implementation of the gem sources --add command and trace its .gemrc write and URL preflight behavior. Compare the proposed alternatives, then verify that an unauthenticated source can be written without exposing credentials while the command still reports URL errors and returns the proper status.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.