If BUNDLE_PATH is configured to a symlinked path, installing gems with
symlinks would crash with an error like this:
```
Gem::Package::SymlinkError: installing symlink 'man/man0/README.markdown' pointing to parent path /usr/home/stevewi/srv/mail/lib/tools/.vendor/ruby/3.1.0/gems/binman-5.1.0/README.markdown of /srv/mail/lib/tools/.vendor/ruby/3.1.0/gems/binman-5.1.0 is not allowed
```
This commit fixes the problem by changing the bundle path to be the
realpath of the configured value, right after we're sure the path has
been created.
3cd3dd142a
We have two representations of a source. Once used for sorting, which
should not depend on the source's state, but solely on its static
information, like remotes. Another one used for error and informational
messages, which should properly inform about the exact state of the
source when the message is printed.
This commit makes the latter be the default implementation of `to_s`, so
that error and informational messages are more accurate by default.
b5f2b88957
Rescuing all errors here might end up hiding other errors if the
deletion of the cached gem itself raises an error for some reason. Let's
be more conservative.
3d80dfba08
Previously, it was maintained in sync with the standard cache. That was
less efficient, and it caused some error messages to point to non
existent files.
931f8cb8a9
We can skip most stuff in `Gem::RemoteFetcher#download`, and use
`Gem::RemoteFetcher#update_cache_path` directly.
This has the benefit of allowing us to remove some workarounds to
support several rubygems versions, but also allows us to pass the target
folder where the gem should be downloaded directly and skip the logic
inside `Gem::RemoteFetcher#download` to infer the cache path. This will
be useful later to fix some issues with the `global_gem_cache` feature
flag.
8fe74a77e4
Extract final cache path to a variable and pass that to `download_gem`.
It actually fits better the parameters documentation since it's the
final directory where the downloaded gem will be placed.
1429db6a04
The other way, in particular matching a substring in the gemspec
summary, is brittle and no longer used since Ruby 2.0.
This needed rewriting the specs that depended on that way.
059dbfa971
The glob information was not specified in the string representation for
a source, which led to non-deterministic behaviour when generating the
lockfile, since sources are sorted by this value.
493b880abc
As part of a recent bug fix where bundler was accidentally hitting the
network when not supposed to, I made some refactoring, and the commit I'm
reverting here
(d74830d00b)
was some cleanup that those refactorings allowed according to "past me".
That was completely wrong, `bundle check` should never consider cached
gems, only installed gems, so the code that was removed was necessary.
5483e98305
When printing sources inside these error messages, it's useful to only
consider the current state of the source. For example, when requiring
`bundler/setup`, the source shouldn't be configured to be able to hit
the network, so the error message should only mention "locally installed
gems" to make that more clear.
30eb14f853
This method is created to tell whether any remote exist in the object or not and it will be used by `Bundler:SourceList` to tell if a global source has been defined implicitly or not.
47e3ff0e47