Commit graph

209 commits

Author SHA1 Message Date
Hiroshi SHIBATA
b7ad60a794 Merge RubyGems/Bundler master
from 72fd3dd209
2022-12-26 15:09:21 +09:00
David Rodríguez
24fd2f73d0 Resync Bundler & RubyGems 2022-09-08 11:25:03 +09:00
Hiroshi SHIBATA
44264b4fee Merge rubygems/bundler HEAD.
Pick from dfbb5a3811
2022-08-09 12:05:19 +09:00
David Rodríguez
20936eb3a9 [rubygems/rubygems] Warn (rather than crash) when setting nil specification versions
a4ba1a4d97
2022-08-03 06:56:18 +09:00
Takuya Noguchi
d7ffd3fea4
RubyGems: Enable Style/StringLiterals cop
Signed-off-by: Takuya Noguchi <takninnovationresearch@gmail.com>
2022-07-22 12:07:23 +09:00
Nobuyoshi Nakada
5ae83151b1 [rubygems/rubygems] Drop support for old Gem::Specification versions
`specification_version` method was added before RubyGems 1.0, and
`add_runtime_dependency` method was before 1.2.  These seem aged
enough to remove.

92770c5cd9
2022-07-16 19:33:16 +09:00
David Rodríguez
8c74eaa08d [rubygems/rubygems] Fix gem update --system crash while regenerating binstubs
Since a few commits ago, we no longer call `Gem::Specification.reset`
after each invocation of `Gem::Installer#install`. This means we don't
call it when the default Bundler is installed during `gem update
--system`. This causes no issues until the end of the upgrade process
when:

* The previous default Bundler spec is removed from disk.
* All specification stubs are turned into real specifications by loading
  them from disk. But the one for Bundler no longer exists so
  materializes to `nil` and regenerating binstubs crashes like this:

  ```
  Bundler 2.4.0.dev installed
  RubyGems 3.4.0.dev installed
  Regenerating binstubs
  ERROR:  While executing gem ... (NoMethodError)
      undefined method `platform' for nil:NilClass
    /Users/deivid/Code/rubygems/rubygems/lib/rubygems/commands/pristine_command.rb:116:in `block in execute'
    /Users/deivid/Code/rubygems/rubygems/lib/rubygems/specification.rb:981:in `block in each'
    /Users/deivid/Code/rubygems/rubygems/lib/rubygems/specification.rb:980:in `each'
    /Users/deivid/Code/rubygems/rubygems/lib/rubygems/specification.rb:980:in `each'
    /Users/deivid/Code/rubygems/rubygems/lib/rubygems/commands/pristine_command.rb:116:in `map'
    /Users/deivid/Code/rubygems/rubygems/lib/rubygems/commands/pristine_command.rb:116:in `each'
    /Users/deivid/Code/rubygems/rubygems/lib/rubygems/commands/pristine_command.rb:116:in `select'
    /Users/deivid/Code/rubygems/rubygems/lib/rubygems/commands/pristine_command.rb:116:in `execute'
    /Users/deivid/Code/rubygems/rubygems/lib/rubygems/command.rb:323:in `invoke_with_build_args'
    /Users/deivid/Code/rubygems/rubygems/lib/rubygems/command.rb:301:in `invoke'
    /Users/deivid/Code/rubygems/rubygems/lib/rubygems/commands/setup_command.rb:604:in `regenerate_binstubs'
    /Users/deivid/Code/rubygems/rubygems/lib/rubygems/commands/setup_command.rb:183:in `execute'
    /Users/deivid/Code/rubygems/rubygems/lib/rubygems/command.rb:323:in `invoke_with_build_args'
    /Users/deivid/Code/rubygems/rubygems/lib/rubygems/command_manager.rb:185:in `process_args'
    /Users/deivid/Code/rubygems/rubygems/lib/rubygems/command_manager.rb:149:in `run'
    /Users/deivid/Code/rubygems/rubygems/lib/rubygems/gem_runner.rb:51:in `run'
  setup.rb:33:in `<main>'
  ```

We fix it by more carefully managing the removal of the previous default
Bundler gem.

9989f6d5af
2022-07-14 04:47:58 +09:00
Hiroshi SHIBATA
437a5ae9d6 Merge RubyGems and Bundler master 2022-07-13 14:11:55 +09:00
David Rodríguez
12a5fa408b Sync RubyGems & Bundler with upstream repo 2022-06-24 10:52:02 +09:00
David Rodríguez
d0bf31e6cf [rubygems/rubygems] Don't on gemspecs with invalid require_paths, just warn
These gemspecs already work most of the times. When they are installed
normally, the require_paths in the gemspec stub line becomes actually
correct, and the incorrect value in the real gemspec is ignored. It only
becomes an issue in standalone mode.

In Ruby 3.2, `Kernel#=~` has been removed, and that means that it
becomes harder for us to gracefully deal with this error in standalone
mode, because it now happens earlier due to calling `Array#=~` for this
invalid gemspec (since require_paths is incorrectly an array of arrays).

The easiest way to fix this is to actually make this just work instead
by automatically fixing the issue when reading the packaged gemspec.

d3f2fe6d26
2022-06-12 02:02:20 +09:00
Daniel Berger
deff9e2699 [rubygems/rubygems] Remove unnecessary string concatenation
81ccb3ab89
2022-06-07 23:18:31 +09:00
David Rodríguez
ba38318827 [rubygems/rubygems] Unify loading Gem::Requirement
It was being explicitly required from `Gem::Specification` but also a
strange autoload was set for it at `Gem::Version`. The autoload was non
standard because it should've been done in the `Gem` module, not in
`Gem::Specification`, since that's where the constant is expected to get
defined. Doing this might get deprecated in the future, and it was not
being effective anyways due to the explicit require.

Unify everything with an `autoload` at the right place.

174ea3e24c
2022-06-06 18:36:31 +09:00
David Rodríguez
8381c568e7 [rubygems/rubygems] Restore ability to load old marshalled gemspec that use YAML::PrivateType
This issue was not detected because when all traces of old YAML parser
and emitter `Syck` were removed, this null-type.gemspec.rz marshalled
gemspec was updated to no longer load `YAML::Syck::PrivateType` but load
`Psych::PrivateType` instead.

However, realworld old marshalled gemspecs still use the
`YAML::PrivateType` constant, so this commit replaces the gemspec to be
the real pry-0.4.7 marshalled gemspec, so that it catches this issue.

51b330b8d2
2022-06-01 17:06:52 +09:00
David Rodríguez
ebb534801f [rubygems/rubygems] Remove no longer needed Psych::PrivateType cleanup
This old bug used to affect the `rubyforge_project` field in serialized
gemspecs. However, this field has been removed and it's no longer
present in marshaled loaded gemspecs.

So, while the constant is still present in these marshalled gemspecs and
we still need to make sure it exists, we no longer need to clean it up
from the loaded data.

09df18e522
2022-06-01 17:06:51 +09:00
Hiroshi SHIBATA
aeea88174d
Merge RubyGems and Bundler HEAD
125415593e
2022-05-20 17:32:19 +09:00
Hiroshi SHIBATA
1056489ea3 Merge 3f7d0352e8 2022-04-28 19:08:49 +09:00
Josef Šimánek
d5c9710b07 [rubygems/rubygems] Remove encoding pragma from specification.rb
- it is not used since it is not at the top of the file
- it is not useful anymore

6aee05d923
2022-02-01 05:20:38 +09:00
David Rodríguez
2b7025e680 [rubygems/rubygems] Rename Gem.open_with_flock to Gem.open_file
Since it only uses `flock` on Windows.

b877de4d9c
2022-01-20 06:45:28 +09:00
Hiroshi SHIBATA
d22511fd75 Merge rubygems/rubygems HEAD.
Picked at 12aeef6ba9a3be0022be9934c1a3e4c46a03ed3a
2022-01-19 15:01:44 +09:00
David Rodríguez
f04954d95c
[rubygems/rubygems] Normalize end alignment style with Bundler
f7f504b24c
2022-01-19 11:20:36 +09:00
Nobuyoshi Nakada
6d3ee418c2 [rubygems/rubygems] Markup code with RDoc notations
c29cd23826
2022-01-11 20:20:51 +09:00
Masataka Pocke Kuwabara
73707e5c51 [rubygems/rubygems] Make SpecificationPolicy autoload constant
It reduces memory usage about 204kb (1.4%).

b7d4b8c8a6
2021-12-27 10:45:36 +09:00
Hiroshi SHIBATA
b0ad6cb371 Merge RubyGems-3.3.2 and Bundler-2.3.2 2021-12-24 10:35:31 +09:00
Hiroshi SHIBATA
fb1ab27f53 Merge RubyGems-3.3.1 and Bundler-2.3.1 2021-12-23 09:44:45 +09:00
Hiroshi SHIBATA
7e084ed707 Merge RubyGems and Bundler master
Merge from 793ad95ecb
2021-12-15 18:05:18 +09:00
Josef Šimánek
1f4af99383 [rubygems/rubygems] Move required_ruby_version gemspec attribute to recommended section.
de6552ac30
2021-12-03 06:01:18 +09:00
David Rodríguez
8bdb56fcaf [rubygems/rubygems] Protect specs access at a finer level
c8cc053bde
2021-11-18 04:37:28 +09:00
David Rodríguez
4bc69a25f3 [rubygems/rubygems] Stop using a constant for something not constant
5cb0b9d9b8
2021-11-18 04:37:27 +09:00
David Rodríguez
a5cd4a0568 [rubygems/rubygems] Extract a helper method to reset specs
662de0c990
2021-11-18 04:37:27 +09:00
David Rodríguez
f542ab2e6d [rubygems/rubygems] Make clearing loaded spec cache really private
19f117652b
2021-11-18 04:37:26 +09:00
David Rodríguez
81eba77fc0 [rubygems/rubygems] We can now use standard memoization
231be44d38
2021-11-18 04:37:25 +09:00
David Rodríguez
61f023f03b [rubygems/rubygems] Easier preservation of activated specs
54e923ffc2
2021-11-18 04:37:25 +09:00
David Rodríguez
fdd3eed037 [rubygems/rubygems] Set @@all variable at class definition time
To spare the `defined?` check.

64d27bba01
2021-11-18 04:37:24 +09:00
Carlos Palhares
38785aa3b9
Update licenses= documentation 2021-11-02 10:24:35 +09:00
Masataka Pocke Kuwabara
d03d122ba1 [rubygems/rubygems] Improve performance of Specification#missing_extensions?
90c1919f94
2021-10-09 08:04:08 +09:00
Daniel Niknam
f212b9d4f2 [rubygems/rubygems] Refactor Ruby platform priority condition to its own method
The `Gem::Platform::RUBY ? -1 : 1` has been used multiple times in different places and could be refactored to a method (DRY).

9d43ca8f0c
2021-08-31 19:06:14 +09:00
David Rodríguez
54ae3f587e [rubygems/rubygems] Prefer require_relative to require for internal requires
c74fc58695
2021-08-31 19:06:14 +09:00
David Rodríguez
88e46cf6b8
[rubygems/rubygems] Remove all syck traces from rubygems
After reading [this blog
post](https://blog.rubygems.org/2011/08/31/shaving-the-yaml-yak.html),
published almost 10 years ago already, my understanding is that this
problem could come up in two ways:

* Rubygems.org serving corrupted gemspecs". As far as I understand this
was fixed in rubygems.org a lot time ago, since
https://github.com/rubygems/rubygems.org/pull/331.

* Clients having a ten years old gemspec cache with some of these bad
gemspecs. In this case, there's no easy solution but I think ten years
is enough and rebuilding the cache should do the trick.

So, I think it's time we remove this.

afcb15d556
2021-07-27 09:25:56 +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
53468cc111 Sync latest development version of bundler & rubygems 2021-03-08 13:47:35 +09:00
Hiroshi SHIBATA
4aca77edde Merge prepare version of RubyGems 3.2.0 2020-12-08 17:30:02 +09:00
Jean Boussier
91865230cd [rubygems/rubygems] Eval defaults with frozen_string_literal: true
d498ae3d62
2020-09-28 14:54:22 +09:00
Nobuyoshi Nakada
0629e695e3 Added --platform option to build command 2020-09-28 14:54:22 +09:00
Hiroshi SHIBATA
b717f73402
Revert "Manually merged from https://github.com/rubygems/rubygems/pull/2636"
31a6eaabc1 is obsoleted with
  https://github.com/rubygems/rubygems/pull/3820
2020-09-23 22:01:44 +09:00
Hiroshi SHIBATA
31a6eaabc1
Manually merged from https://github.com/rubygems/rubygems/pull/2636
Enable Style/EmptyLinesAroundClassBody rubocop cop.
2020-09-23 21:02:56 +09:00
David Rodríguez
ea8f7d4a81 [rubygems/rubygems] Gem::Specification#to_ruby doesn't need openssl
The `openssl` require when openssl not present was having the
side-effect the our custom require fallbacks would end up loading `Gem::Specification.stubs`.

Co-authored-by: Alyssa Ross <hi@alyssa.is>

22c4ded4ad
2020-07-31 21:07:19 +09:00
bronzdoc
6c19b0ec6e [rubygems/rubygems] Reword warning
cbd4abf8cf
2020-07-31 21:07:19 +09:00
bronzdoc
00bdac18cf [rubygems/rubygems] Warn on duplicate dependency in a specification
af3e5f7883
2020-07-31 21:07:19 +09:00
David Rodríguez
1260d22cae [rubygems/rubygems] Extract some common code into a private method
d1be8cdb3a
2020-07-31 21:07:19 +09:00