Commit graph

200 commits

Author SHA1 Message Date
David Rodríguez
853004e04d [rubygems/rubygems] Fix bundle install crash due to an incorrectly incomplete resolve
In case we have a corrupted lockfile that claims to support a platform, but
it's missing platform specific gems for it, bundler has a check that
detects the situation and forces a re-resolve. The result of this check
is kept under the `@locked_specs_incomplete_for_platformn` instance
variable in `Definition`.

The installer, however, calls `Definition#nothing_changed?` before this
instance variable has been filled, so the result of it is actually
incorrect here since it will claim that nothing has changed, but
something has changed (locked specs are incomplete for the current
platform).

The consequence of this incorrect result is that the installer thinks it
can go on without re-resolving, resulting in the incomplete resolution
from the lockfile being used, and in a crash being triggered due to
that.

The solution is to make sure the `@locked_specs_incomplete_for_platform`
instance variable is filled before `nothing_changed?` gets called.
Moving it to `initialize` makes the most sense, not because it's the
best place for it (we can refactor this later), but because all of the
other "outdated definition" checks are already set there.

708afdd789
2021-10-13 21:16:40 +09:00
David Rodriguez
0f1f95a3e3 [rubygems/rubygems] Fix bundle install to force reinstallation of deleted gems
8950631f02
2021-10-13 16:21:42 +09:00
David Rodríguez
d6627ab85c [rubygems/rubygems] Remove unnecessary code
All supported rubygems versions implement this.

2130782ef6
2021-10-13 16:21:41 +09:00
David Rodriguez
0c3ac87345 [rubygems/rubygems] Show a warning in bundle info if gem has been deleted
ff86cd7dd2
2021-10-11 19:13:16 +09:00
David Rodriguez
607efe9154 [rubygems/rubygems] Show the exact name of the gem that was deleted
If a non exact name (matched as a regexp) is passed to `bundle info`,
these strings might not match.

831edf1edf
2021-10-11 19:13:15 +09:00
David Rodriguez
62d1deb0d1 [rubygems/rubygems] Match a more exact warning message
80158e9d75
2021-10-11 19:13:15 +09:00
OKURA Masafumi
7e506716d2
Newly generated gems require Ruby 2.6.0
In 2021, Ruby 2.5 and older are EOL.
We can set the default required Ruby version to 2.6.0 to
encourage people to use newer Ruby.
If the command is executed with old Ruby, it falls back to 2.3.0.
It's still possible to create a gem for older Ruby just by changing
two lines of code (one in gemspec and another is in rubocop.yml).
2021-10-09 09:07:47 +09:00
David Rodríguez
70066196a0 [rubygems/rubygems] Fix typo
We want to update the original repo, not a fresh one.

This went undetected because the `git commit` command inside the
`update_git` method ignores failures, and in this case it was failing
because all files are untracked in the new repo.

I will fix that later but for now fix the typo.

c889f1d715
2021-10-09 08:04:48 +09:00
fiveNinePlusR
105e037fe8 [rubygems/rubygems] Fix possible malicious website to example.com
example.com is the canonical stand in for domain examples and will never have a backing website.

via https://www.rfc-editor.org/rfc/rfc2606.html

26622c81c2
2021-09-22 10:14:04 +09:00
Jose Galisteo
b45fe48fbb
[rubygems/rubygems] Trigger install command by default on remove
Closes https://github.com/rubygems/rubygems/issues/4889

2b1754479c
2021-09-17 20:46:18 +09:00
Matt Larraz
2aed061384 [rubygems/rubygems] Correctly redact credentials when using x-oauth-basic
290b6ab078
2021-08-31 19:06:14 +09:00
David Rodríguez
f6803d2411 [rubygems/rubygems] Fix bundle check showing duplicated gems
If the lockfile contains multiple platforms, `bundle check` would show
duplicated missing gems.

6ac5931783
2021-08-31 19:06:14 +09:00
David Rodríguez
3683781f53 [rubygems/rubygems] Restore working bundle check behaviour
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
2021-08-31 19:06:14 +09:00
David Rodríguez
21db5876ca [rubygems/rubygems] Respect BUNDLE_USER_HOME for global config location
58fc31442f
2021-08-31 19:06:14 +09:00
David Rodríguez
ab1edc75f8 [rubygems/rubygems] Expect the right permissions on Windows
Given Windows doesn't have executable bit.

35dc3fa845
2021-08-31 19:06:14 +09:00
David Rodríguez
8adc606271 [rubygems/rubygems] Fix git repo initialization on a path with spaces
a2d6e10192
2021-08-31 19:06:14 +09:00
David Rodríguez
199083dd15 [rubygems/rubygems] Simplify overkill usage of shared examples
36a00144b9
2021-08-31 19:06:14 +09:00
Nobuyoshi Nakada
9fc16a31d9 [rubygems/rubygems] Exclude gemspec file itself from gem
The processed YML data is included as metadata, the source gemspec
file is unused and just confusing.

f444478eac
2021-08-31 19:06:14 +09:00
Tim Sutton
d7c734a27e [rubygems/rubygems] typos in UI messages: fix a couple missing spaces between sentence breaks
5cdda53382
2021-08-31 19:06:14 +09:00
David Rodríguez
0e01ad881a [rubygems/rubygems] The --local flag to bundle install shouldn't hit the network
If the cache was missing, `bundler` would try to re-fetch it. With the
`--local` flag, it should just look at installed gems.

630d29c69e
2021-08-31 19:06:14 +09:00
David Rodríguez
0b4dbe2e6a [rubygems/rubygems] Improve "gem not found in source" errors
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
2021-08-31 19:06:14 +09:00
David Rodríguez
b17cdad2f8 [rubygems/rubygems] Remove redundant part of error message
It doesn't really add much, in my opinion. We want to be helpful, but
also concise when possible.

9d56009cf7
2021-08-31 19:06:14 +09:00
David Rodríguez
0ab160e2e0 [rubygems/rubygems] Respect BUNDLE_USER_CONFIG if set
f28ab141af
2021-08-31 19:06:14 +09:00
David Rodríguez
9e7249da4e [rubygems/rubygems] This spec can pass now on ruby 3
TSort was released as a library so we can install it, and also other
gems that are loaded by the spec. Also, Ruby on Windows apparently loads
fiddle 1.0.6, so we need to also install that to make that not fail.

2b8dcab99e
2021-08-31 19:06:14 +09:00
David Rodríguez
579dbe6ecb [rubygems/rubygems] Remove unnecessary test repository
These gems are built and installed to system directly as default gems.
There's no need to also build a remote repo.

ad9dad4c22
2021-08-31 19:06:14 +09:00
David Rodríguez
81c0643762 [rubygems/rubygems] Remove unnecessary escape sequences
Bundler formatters already take care of this.

c24415fdd5
2021-08-31 19:06:14 +09:00
Daniel Niknam
bd8daa8523
[rubygems/rubygems] Remove the warning for not defining a gem server source
Bundler has deprecated gemfiles without a global source and this feature
is now obsolete. `Bundler::Definition#has_rubygems_remotes?` is removed
because it's not used anymore.

d29dd2cb7b
2021-07-27 09:25:57 +09:00
Daniel Niknam
2f9e0cf181
[rubygems/rubygems] Explicitly define a global source for tests
This is in preparation for deprecating source-less gemfiles.

d6493fa3e2
2021-07-27 09:25:57 +09:00
David Rodríguez
9ac89fe35e
[rubygems/rubygems] The --quiet should still display warnings
The is the previous intentional behaviour until
ca0676cb1c.

In my opinion, that previous behaviour was better and should be
restored, because we want our users to always see warnings and fix them.
And the original issue that motivated the change is fixable by other
means, namely through `BUNDLE_SILENCE_ROOT_WARNING`, or through
`BUNDLE_SILENCE_DEPRECATIONS` in general. Finally, the --quiet option is
still documented as "only print errors and warnings".

So this PR essentially reverts
ca0676cb1c
for the above reasons.

35f2254dfc
2021-07-27 09:25:56 +09:00
David Rodríguez
24aca87def
[rubygems/rubygems] Make --quiet spec independent on the specific warning
We'll be removing the warning about no gem sources, so this spec will no
longer test that warnings are hidden by `--quiet`.

Test that in another way so that we don't lose the coverage when we
drop the specific warning about no gem server sources.

cce4f86d28
2021-07-27 09:25:56 +09:00
David Rodríguez
6bcedabfdd
[rubygems/rubygems] Remove gem install hint when installing a gem fails
A fresh `gem install` might not reproduce the exact `bundle install`
environment that originally caused the error. It also makes it harder
for the user to troubleshoot the error since she needs to run a separate
command.

Instead, show the original error and backtrace directly.

49c2abfec6
2021-07-27 09:25:55 +09:00
David Rodríguez
4271f4aea5
[rubygems/rubygems] Fix bundler binstub version selection
To mimic built-in rubygems behaviour, only thing that should be
approximated is the lockfile version. Other alternatives like
`BUNDLER_VERSION` should be respected exactly.

dbd667d4bc
2021-07-27 09:25:55 +09:00
David Rodríguez
227c2deff4
[rubygems/rubygems] Fix development gem unintentionally removed on an edge case
When a development dependency was duplicated inside the gemspec and
Gemfile with the same requirements, we went from printing a warning to
removing the gem altogether.

This change makes it not print a warning, but don't remove the gem
either.

8bb2488131
2021-07-16 15:40:07 +09:00
Hiroshi SHIBATA
896bbb9fad Merge RubyGems/Bundler master from 8459ebd6ad65ce3397233416dc64083ae7572bb9 2021-07-14 10:48:07 +09:00
Hiroshi SHIBATA
c082c6eb7c Sync RubyGems and Bundler with upstream 2021-07-07 15:31:52 +09:00
David Rodríguez
6e2240a2f9 Sync latest bundler & rubygems development version 2021-07-07 13:30:20 +09:00
David Rodríguez
5b0abba931 Sync bundler & rubygems 2021-05-11 11:29:41 +09:00
Kazuhiro NISHIYAMA
50f17241a3
Try to fix other failures of writing XDG_CONFIG_HOME
756591173
759073690
761341026
```
Errno::EACCES: Permission denied @ dir_s_mkdir - /home/runner/.config/irb
```
2021-04-19 21:40:29 +09:00
Kazuhiro NISHIYAMA
d953ac1139
Fix writing XDG_CONFIG_HOME in test-bundler
756591173
```
Errno::EACCES: Permission denied @ dir_s_mkdir - /home/runner/.config/irb
```
2021-04-17 11:54:10 +09:00
Hiroshi SHIBATA
ed149dbf46 Merge the master branch of Bundler 2021-04-15 15:36:15 +09:00
David Rodríguez
53468cc111 Sync latest development version of bundler & rubygems 2021-03-08 13:47:35 +09:00
Kazuhiro NISHIYAMA
f600226fb4
Fix failures with EditLine
On macOS with EditLine:
```
$ ruby -r readline -e 'Readline.readline("> "); p Readline::VERSION' < /dev/null
"EditLine wrapper"
```

On Linux with GNU readline:
```
$ ruby -r readline -e 'Readline.readline("> "); p Readline::VERSION' < /dev/null
> "8.0"
```
2021-02-03 14:38:31 +09:00
Hiroshi SHIBATA
69ed64949b Track Bundler master(2.3.0.dev) branch at 55634a8af18a52df86c4275d70fa1179118bcc20 2021-01-04 13:14:43 +09:00
Hiroshi SHIBATA
339227363c Merge RubyGems 3.2.3 and Bundler 2.2.3 2020-12-23 10:17:41 +09:00
Hiroshi SHIBATA
0e40cc9b19 Merge RubyGems 3.2.2 and Bundler 2.2.2 2020-12-18 13:33:18 +09:00
Hiroshi SHIBATA
2fa9f3c032 Prepare to release rubygems-3.2.1 and bundler-2.2.1 2020-12-15 10:54:09 +09:00
Hiroshi SHIBATA
473f9d2df0 Merge prepare version of Bundler 2.2.0 2020-12-08 17:30:02 +09:00
Hiroshi SHIBATA
d386a58f6f Merge bundler-2.2.0.rc.2 2020-10-15 17:19:02 +09:00
Steven Peckins
8863bfb1f4 [rubygems/rubygems] Move comment below shebang in bin/console template
In an executable script, the shebang line should be the first line (the
file needs to start with the bytes 0x23 0x21).  Putting a comment above
it will break the script.

(Regression test included per @deivid-rodriguez)

962e669feb
2020-09-28 14:54:22 +09:00
Kazuhiro NISHIYAMA
e4dbb91f4c
Fix typos [ci skip]
s/overriden/overridden/
2020-09-17 20:34:59 +09:00