Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Improve rubygems switcher #7464

Merged
4 commits merged into from Dec 1, 2019
Merged

Improve rubygems switcher #7464

4 commits merged into from Dec 1, 2019

Conversation

deivid-rodriguez
Copy link
Member

@deivid-rodriguez deivid-rodriguez commented Dec 1, 2019

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

The problem was we have some code in our tests to make sure that the ENV["RGV"] variable we use to set the rubygems version we want to test bundler against is always respected, including every subprocess our tests start. However:

  • The code was overly complicated.
  • It didn't support custom branches, for example, RGV=lazily_load_uri. This is a feature I find very useful when a PR you're working on also need some changes in the rubygems side, like it happened to me at Vendor uri library #7460.

What was your diagnosis of the problem?

My diagnosis was that all the code needs to do is:

  • Set up the location of the rubygems code we'll test bundler against, be it a path, a branch, or a released version.
  • Modify RUBYOPT to include that location in the LOAD_PATH, so that rubygems is always loaded from there instead of the system's version.

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

My fix is to do just that, remove all the stuff that wasn't needed, and do a bit of renaming to improve readability.

Previous version was overly complicated and brittle, and didn't support,
for example, using custom branches in rubygems inside the `RGV`
environment variable.

Now the `RGV` env variable supports:

* Local paths.
* Arbitrary tags or branches in rubygems repo.
* Released rubygems versions.
Since it's always a tag, not a version number.
This is usually provided as an `ENV` variable but that's completely
transparent to this class. Also, this is not always a version number. I
think something like "source" is a better fit.
I don't think "unrequire" is a good name for what this method does.
@deivid-rodriguez
Copy link
Member Author

@bundlerbot merge

ghost pushed a commit that referenced this pull request Dec 1, 2019
7464: Improve rubygems switcher r=deivid-rodriguez a=deivid-rodriguez

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

The problem was we have some code in our tests to make sure that the `ENV["RGV"]` variable we use to set the rubygems version we want to test bundler against is always respected, including every subprocess our tests start. However:

* The code was overly complicated.
* It didn't support custom branches, for example, `RGV=lazily_load_uri`. This is a feature I find very useful when a PR you're working on also need some changes in the rubygems side, like it happened to me at #7460.

### What was your diagnosis of the problem?

My diagnosis was that all the code needs to do is:

* Set up the location of the rubygems code we'll test bundler against, be it a path, a branch, or a released version.
* Modify `RUBYOPT` to include that location in the LOAD_PATH, so that `rubygems` is always loaded from there instead of the system's version.

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

My fix is to do just that, remove all the stuff that wasn't needed, and do a bit of renaming to improve readability.

Co-authored-by: David Rodríguez <deivid.rodriguez@riseup.net>
@ghost
Copy link

ghost commented Dec 1, 2019

Build succeeded

@ghost ghost merged commit 0fad18f into master Dec 1, 2019
@ghost ghost deleted the improve_rubygems_switcher branch December 1, 2019 17:08
@deivid-rodriguez deivid-rodriguez modified the milestones: 2.1.0.rc, 2.1.0 Dec 13, 2019
deivid-rodriguez pushed a commit that referenced this pull request Dec 13, 2019
7464: Improve rubygems switcher r=deivid-rodriguez a=deivid-rodriguez

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

The problem was we have some code in our tests to make sure that the `ENV["RGV"]` variable we use to set the rubygems version we want to test bundler against is always respected, including every subprocess our tests start. However:

* The code was overly complicated.
* It didn't support custom branches, for example, `RGV=lazily_load_uri`. This is a feature I find very useful when a PR you're working on also need some changes in the rubygems side, like it happened to me at #7460.

### What was your diagnosis of the problem?

My diagnosis was that all the code needs to do is:

* Set up the location of the rubygems code we'll test bundler against, be it a path, a branch, or a released version.
* Modify `RUBYOPT` to include that location in the LOAD_PATH, so that `rubygems` is always loaded from there instead of the system's version.

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

My fix is to do just that, remove all the stuff that wasn't needed, and do a bit of renaming to improve readability.

Co-authored-by: David Rodríguez <deivid.rodriguez@riseup.net>
(cherry picked from commit 0cb5192)
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant