Skip to content

Conversation

@martinemde
Copy link
Contributor

What was the end-user or developer problem that led to this PR?

Discussion in #8901 made it clear that we need to move to deprecate gem sources --add because it is the less desirable way to add sources and is more likely to cause confusion. We want to steer people toward --prepend and the best way to do that is to make them pay attention to the new choices.

What is your fix for the problem, implemented in this PR?

This PR builds on the --prepend PR to add --append without changing the behavior of --add (besides a deprecation warning).

We can discuss what other changes we want to push right now. I currently have this set up with the intention of removing --add in rubygems 4.0.

Make sure the following tasks are checked

martinemde and others added 2 commits August 6, 2025 09:09
The preferred way to add sources is usually `--prepend` despite the long
term behavior of `--add` appending. Deprecating before 4.0 will allow us
to break usage of the less desireable --add behavior and encourage
prepend instead.

source.load_specs :released
Gem.sources.delete(source) if was_present
Gem.sources << source
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we code the source dance into Gem::SourceList#append and Gem::SourceList#prepend, and then DRY up both methods in to a single add_source method? We could rename current add_source to deprecated_add_source or something.

Also thinking about naming, should we instead use something like ensure_first or ensure_last? What people normally understands from append or prepend in other classes does not involve moving elements around, just appending or prepending.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. I'll get that.

@martinemde martinemde changed the base branch from master to martinemde/prepend-gem-sources August 21, 2025 15:01
@martinemde
Copy link
Contributor Author

closing, I'm going to merge these two PRs into a single one that does all the sources changes at once.

@martinemde martinemde closed this Aug 21, 2025
@martinemde martinemde deleted the martinemde/append-gem-sources branch August 21, 2025 15:29
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