Commit graph

64552 commits

Author SHA1 Message Date
David Rodríguez
0d7e0eb2fa [rubygems/rubygems] Prefer tr to gsub when replacing path separators
This is not detected by the `Performance/StringReplacement` cop, I guess
because of using constants. But still seems like a good change.

Co-authored-by: MSP-Greg <MSP-Greg@users.noreply.github.com>

f862103133
2020-05-08 14:13:29 +09:00
David Rodríguez
de57d3895e [rubygems/rubygems] Shortcuit method earlier
If the class variable is set, we can skip the whole thing from the
beginning.

Co-authored-by: MSP-Greg <MSP-Greg@users.noreply.github.com>

83abf3a3d4
2020-05-08 14:13:29 +09:00
David Rodríguez
c58d69e698 [rubygems/rubygems] Condense some artificially broken lines
Co-authored-by: MSP-Greg <MSP-Greg@users.noreply.github.com>

5f390478c7
2020-05-08 14:13:29 +09:00
David Rodríguez
a49a131163 [rubygems/rubygems] Extract gem_make_out contents to a variable
Co-authored-by: MSP-Greg <MSP-Greg@users.noreply.github.com>

5f2b7474eb
2020-05-08 14:13:29 +09:00
David Rodríguez
b1541606a2 [rubygems/rubygems] Fix incorrect gem uninstall --all message
Currently `gem uninstall --all` shows the following incorrect message
after completion:

```
INFO:  Uninstalled all gems in
```

Now it shows something that actually makes sense like:

```
INFO:  Uninstalled all gems in /home/deivid/Code/rubygems/tmp/test_rubygems_6986/gemhome
```

8fa05e8f8c
2020-05-08 14:13:29 +09:00
Thomas McDonald
22030fe508 [rubygems/rubygems] Refactor duplicate metadata logic
1e5ef177ac
2020-05-08 14:13:29 +09:00
Thomas McDonald
856f2f31ff [rubygems/rubygems] Remove unnecessary code
`@host` _could_ be `nil` at this point, but only if all the conditions
above for setting `@host` were `nil`. In that case, it is guaranteed
to `default_gem_server` metadata is `nil` since it's one of the
branches in that condition. So this code would just be setting an
already `nil` variable to `nil`. Hence, not needed.

e3ccff3c5c
2020-05-08 14:13:29 +09:00
Thomas McDonald
12ac0fa939 [rubygems/rubygems] Simplify host switching logic
This block was a branch and variable heavy way of saying use the
user-provided host if available, or fall-back to the default host if
none of the other options match. IMO the resultant single-if condition
is clearer in intentions

42dbb71cfa
2020-05-08 14:13:29 +09:00
David Rodríguez
acb793b71c [rubygems/rubygems] Make cmake tests less verbose on jruby
These tests work on jruby, but the flags to the system command used to
detect whether `cmake` is present seem to be ignored on jruby and the
output is printed to screen instead of being sent to /dev/null. This
results in very verbose tests, like this:

```
$ rake TESTOPTS=--name=TestGemExtCmakeBuilder#test_self_build
(... warnings skipped ...)
Skipping `gem cert` tests on jruby.
Skipping Gem::Security tests on jruby.
Run options: --name=TestGemExtCmakeBuilder#test_self_build --seed 16839

# Running:

/home/deivid/Code/rubygems/test/rubygems/test_gem_ext_cmake_builder.rb:13: warning: system does not support options in JRuby yet: {:out=>"/dev/null", :err=>[:child, :out]}
Usage

  cmake [options] <path-to-source>
  cmake [options] <path-to-existing-build>

Specify a source directory to (re-)generate a build system for it in the
current working directory.  Specify an existing build directory to
re-generate its build system.

Run 'cmake --help' for more information.

.

Finished in 0.387301s, 2.5820 runs/s, 20.6558 assertions/s.

1 runs, 8 assertions, 0 failures, 0 errors, 0 skips
Coverage report generated for Unit Tests to /home/deivid/Code/rubygems/coverage. 2258 / 8832 LOC (25.57%) covered.
```

By using `Open3`, we get the test output clean:

```
$ rake TESTOPTS=--name=TestGemExtCmakeBuilder#test_self_build
(... warnings skipped ...)
Skipping `gem cert` tests on jruby.
Skipping Gem::Security tests on jruby.
Run options: --name=TestGemExtCmakeBuilder#test_self_build --seed 22605

# Running:

.

Finished in 0.381959s, 2.6181 runs/s, 20.9446 assertions/s.

1 runs, 8 assertions, 0 failures, 0 errors, 0 skips
Coverage report generated for Unit Tests to /home/deivid/Code/rubygems/coverage. 2258 / 8832 LOC (25.57%) covered.

```

531ce37ea3
2020-05-08 14:13:29 +09:00
David Rodríguez
676d816ef1 [rubygems/rubygems] Refactor ruby command line building for tests
43819b6973
2020-05-08 14:13:29 +09:00
Brandon Fish
1635394347 [rubygems/rubygems] Update test_realworld_default_gem to use rubygems project sources
7506f7eb07
2020-05-08 14:13:29 +09:00
David Rodríguez
9042787508 [rubygems/rubygems] Remove unnecessary @@ruby variable
5f20647ec1
2020-05-08 14:13:29 +09:00
David Rodríguez
c6979feb02 [rubygems/rubygems] Remove unneeded explicit requires
583316bf49
2020-05-08 14:13:29 +09:00
David Rodríguez
df39476a12 [rubygems/rubygems] Remove unneeded dups
2f072e3dc7
2020-05-08 14:13:29 +09:00
David Rodríguez
fd5e4ca41f [rubygems/rubygems] Remove unneeded untainting
ff223d8489
2020-05-08 14:13:29 +09:00
David Rodríguez
1039c32de6 [rubygems/rubygems] Simplify nested require exceptions
7fbef2f0e3
2020-05-08 14:13:29 +09:00
David Rodríguez
43daf4d288 [rubygems/rubygems] Fix ruby warning about unused local variables
cca2fccd95
2020-05-08 14:13:29 +09:00
David Rodríguez
2ece4d96f0 [rubygems/rubygems] Fix ruby warnings about a shadowed variable
5cfb3252d9
2020-05-08 14:13:29 +09:00
Josef Šimánek
a0c4d14acf [rubygems/rubygems] Fix symlink RubyGems test problems for non-admin user.
75f672ff0e
2020-05-08 14:13:29 +09:00
David Rodríguez
3315ce6904 [rubygems/rubygems] Fix race condition on bundler's parallel installer
When installing in parallel, bundler creates several `Gem::Installer`
instances that run in parallel. These installers access the `@@all` class
variable of `Gem::Specification` concurrently.

If a concurrent thread calls `Gem::Specification.reset` (resetting
`@all` to `nil`) while another thread is running
`Gem::Specification._all` or another method that expects `@@all` to be
loaded and not `nil`, that can result in `Enumerable` methods being
called on `nil`, resulting in crashes.

I fix it by protecting the other concurrent access to the `@all`
variable.

58b343c530
2020-05-08 14:13:29 +09:00
Dmytro Shyrshov
03fe7da186 [rubygems/rubygems] Allow spaces in file headers during octal check
e9e25731d8
2020-05-08 14:13:29 +09:00
Aaron Patterson
7574b836a9
Add T_IMEMO support to lldb
I'm trying to find why a reference to an IMEMO object isn't being
updated
2020-05-07 15:54:00 -07:00
Peter Zhu
ce91c5615c Fix typo in test name 2020-05-08 07:46:33 +09:00
David Rodríguez
427eb2b93f [rubygems/rubygems] Remove unnecessary DIR constant
We have `__dir__` which is the same thing.

f89776427f
2020-05-08 07:38:50 +09:00
David Rodríguez
1ede0c15a1 [rubygems/rubygems] Move stuff to the instance level
I don't know why it was living at the class level. At first I thought it
would be to reuse some server instances between tests, but they seem to
be cleaned up after every test anyways, so I don't think any of it is
needed.

04bee71216
2020-05-08 07:38:50 +09:00
David Rodríguez
0b40279d7d Normalize heredoc case in rubygems code base 2020-05-08 07:38:50 +09:00
David Rodríguez
2205ae8af5 Normalize heredoc delimiters 2020-05-08 07:38:50 +09:00
Benoit Daloze
31663e9e64 [rubygems/rubygems] These specs seem to work just fine on jruby
a0219b9f27
2020-05-08 07:38:50 +09:00
Benoit Daloze
fe2b83e225 [rubygems/rubygems] Fix platform comparison bug in #contains_requirable_file?
* One should not compare RUBY_ENGINE and Gem::Platform.
* Introduced in https://github.com/rubygems/rubygems/pull/2672

0e62c3be91
2020-05-08 07:38:50 +09:00
Benoit Daloze
1464719f5f [rubygems/rubygems] Only run the $SAFE test on MRI < 2.7
* Other Ruby implementations don't support $SAFE.

9a4ba16efa
2020-05-08 07:38:50 +09:00
Olle Jonsson
bb3d80bbbe [rubygems/rubygems] Autoload name_tuple.rb before use
- Resolver asked Molinillo to resolve-then-activate, which led to using Gem::NameTuple before any require had been passed

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

e11782b0c8
2020-05-08 07:38:50 +09:00
Josef Šimánek
39322317f3 [rubygems/rubygems] Do not use set.
1a72c8796f
2020-05-08 07:38:50 +09:00
Josef Šimánek
832a7b0458 [rubygems/rubygems] Add gem build test to check for removed methods.
c07b9cf4f1
2020-05-08 07:38:50 +09:00
Josef Šimánek
856cbbdd52 [rubygems/rubygems] Track removed methods calls and warn during build time.
move rubyforge_project= to removed methods

223f7fd470
2020-05-08 07:38:50 +09:00
Josef Šimánek
4dd46dbad0 [rubygems/rubygems] Deprecate rubyforge_project attribute only during build time.
c44eb21648
2020-05-08 07:38:50 +09:00
Josef Šimánek
60cafe8ea9 [rubygems/rubygems] Revert deprecation of deprecate method for now.
965eee1741
2020-05-08 07:38:50 +09:00
bronzdoc
0e85a39dc7 [rubygems/rubygems] Restore and deprecate old deprecate method
024267fa60
2020-05-08 07:38:50 +09:00
bronzdoc
7db538a7c9 [rubygems/rubygems] Rename version horizon deprecation methods
6afd914fda
2020-05-08 07:38:50 +09:00
bronzdoc
361ed8d0a6 [rubygems/rubygems] Avoid "ambiguous first argument" warning
984bb9b815
2020-05-08 07:38:50 +09:00
bronzdoc
80163db936 [rubygems/rubygems] Add next_rubygems_major_version method
db5bb65baf
2020-05-08 07:38:50 +09:00
bronzdoc
ff37dd7e9e [rubygems/rubygems] Modify files to use new version horizon deprecations
4fe5bb5bf3
2020-05-08 07:38:50 +09:00
bronzdoc
42c91de9ce [rubygems/rubygems] Use the next major version as default for deprecations
b679ab27af
2020-05-08 07:38:50 +09:00
bronzdoc
feb2974000 [rubygems/rubygems] Remove deprecation methods by date
3a14635cf5
2020-05-08 07:38:50 +09:00
bronzdoc
a7a7e7bea0 [rubygems/rubygems] Make the deprecate_command method recieve a Rubygems version instead of a date
bf95b1de78
2020-05-08 07:38:50 +09:00
bronzdoc
2f7865bb6e [rubygems/rubygems] Make the deprecate method recieve a Rubygems version instead of a date
f0e098a1b7
2020-05-08 07:38:50 +09:00
Hiroshi SHIBATA
1fe2b7f41c Workaround for Minitest5 2020-05-08 07:38:50 +09:00
Hiroshi SHIBATA
7050f86ae1 [rubygems/rubygems] Removed deprecated methods for Minitest5
It was migrated on ruby core repository too.

  e5db3da9d3

848bbe3c76
2020-05-08 07:38:50 +09:00
Hiroshi SHIBATA
e29c94e86b [rubygems/rubygems] Minitest::Test is works fine with the ruby core repository
afa01a29a3
2020-05-08 07:38:50 +09:00
Hiroshi SHIBATA
3041e2626d [rubygems/rubygems] Revert https://github.com/rubygems/rubygems/pull/3445
These changes completely broke the test suite on ruby core repository.

84b0bea3e1
2020-05-08 07:38:50 +09:00
David Rodríguez
3256480317 [rubygems/rubygems] Don't swallow gem activation exception
Our tests are now guaranteed to not work on older versions of minitest,
so I don't think we should swallow this activation error because it will
make it very clear for the user what the problem is if she has a
minitest version not satisfying the requirement.

a291b65369
2020-05-08 07:38:50 +09:00