These changes were included when adding bundler plugin hooks for
`Bundler.require`, but they seem completely unrelated to that feature,
and have caused several issues.
8d56551dcf
This commit switches out the full gemspec validation for a partial one
which only performs resolution related checks. This will allow gem
authors to run `bundle` commands immediately after creating a new gem
with Bundler, rather than having to fix metadata validation issues in
the default gemspec.
d5aa9cae9d
For backwards compatibility, make sure default gems are still used as a
last resort when materializing, in case no remote, cached, or installed
specs are found.
93788f689f
We should make sure Bundler does not trigger RubyGems require logic for
gem activation until it had the chance to register its own monkeypatches
to RubyGems.
fbd2ff86b9
If a gem is specified in the Gemfile (or resolved as a transitive
dependency), it's always resolved from remote/installed sources. Default
gems are only used as a fallback for gems not included in the bundle.
I believe this leads to more consistent behavior and more portable apps,
since all gems will be installed to the configured bundle path,
regardless of whether they are default gems or not.
091b4fcf2b
Gem::RemoteFetcher uses Gem::Request, which adds the RubyGems UA.
Gem::RemoteFetcher is used to download gems, as well as the full index.
We would like the bundler UA to be used whenever bundler is making
requests.
This PR also avoids unsafely mutating the headers hash on the shared
`Gem::RemoteFetcher.fetcher` instance, which could cause corruption or
incorrect headers when making parallel requests. Instead, we create one
remote fetcher per rubygems remote, which is similar to the connection
segregation bundler is already doing
f0e8dacdec
Closes https://github.com/rubygems/rubygems/issues/7076
Bundler will now use the same (shared) remote fetcher instance that
RubyGems uses.
This will allow installs to use a shared connection pool, which
represents a significant performance improvement on a clean install.
cd87b40fe1
We have this code that started failing on 3.3.0-dev recently:
```
irb(main):002> require File.join(RbConfig::CONFIG["rubylibdir"], "observer.rb")
/opt/rubies/3.3.0-dev-09-29/lib/ruby/3.3.0+0/bundled_gems.rb:86:in `<': comparison of String with nil failed (ArgumentError)
end + " which #{RUBY_VERSION < SINCE[gem] ? "will be" : "is"} not part of the default gems since Ruby #{SINCE[gem]}"
^^^^^^^^^^
from /opt/rubies/3.3.0-dev-09-29/lib/ruby/3.3.0+0/bundled_gems.rb:86:in `warning?'
from /opt/rubies/3.3.0-dev-09-29/lib/ruby/3.3.0+0/bundled_gems.rb:92:in `block in <module:BUNDLED_GEMS>'
from <internal:/opt/rubies/3.3.0-dev-09-29/lib/ruby/3.3.0+0/rubygems/core_ext/kernel_require.rb>:42:in `block in require'
from <internal:/opt/rubies/3.3.0-dev-09-29/lib/ruby/3.3.0+0/rubygems/core_ext/kernel_require.rb>:39:in `synchronize'
from <internal:/opt/rubies/3.3.0-dev-09-29/lib/ruby/3.3.0+0/rubygems/core_ext/kernel_require.rb>:39:in `require'
from (irb):2:in `<main>'
from <internal:kernel>:187:in `loop'
from /opt/rubies/3.3.0-dev-09-29/lib/ruby/gems/3.3.0+0/gems/irb-1.8.1/exe/irb:9:in `<top (required)>'
from /Users/byroot/.gem/ruby/3.3.0/bin/irb:25:in `load'
from /Users/byroot/.gem/ruby/3.3.0/bin/irb:25:in `<main>'
```
d67eddb295
The dedicated method `File.path` to deal with pathname-like objects
has been provided since ruby 1.9.0.
Also adds a test for rubygems/rubygems#6837.
258c6eda80