Skip to content

Commit

Permalink
Merge #3005
Browse files Browse the repository at this point in the history
3005: Lazily load `uri` r=deivid-rodriguez a=deivid-rodriguez

# Description:

The `uri` library will be a default gem on ruby 2.7. Because of this, requiring `uri` at the top of this file will cause the default `uri` gem to be activated during `bundler/setup`, and that will result in gem activation conflicts.

So, it's better to lazily load `uri` here.

I'm using this patch in rubygems/bundler#7460 to get bundler specs passing against ruby 2.7.

# Tasks:

- [x] Describe the problem / feature
- [ ] Write tests
- [x] Write code to solve the problem
- [ ] Get code review from coworkers / friends

I will abide by the [code of conduct](https://github.com/rubygems/rubygems/blob/master/CODE_OF_CONDUCT.md).


Co-authored-by: David Rodríguez <deivid.rodriguez@riseup.net>
  • Loading branch information
bundlerbot and deivid-rodriguez committed Dec 2, 2019
2 parents b89d261 + a89b5ff commit 99bca8e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rubygems/specification_policy.rb
@@ -1,4 +1,3 @@
require 'uri'
require 'rubygems/user_interaction'

class Gem::SpecificationPolicy
Expand Down Expand Up @@ -364,6 +363,7 @@ def validate_lazy_metadata

# Make sure a homepage is valid HTTP/HTTPS URI
if homepage and not homepage.empty?
require 'uri'
begin
homepage_uri = URI.parse(homepage)
unless [URI::HTTP, URI::HTTPS].member? homepage_uri.class
Expand Down

0 comments on commit 99bca8e

Please sign in to comment.