Commit graph

291 commits

Author SHA1 Message Date
Takumasa Ochi
5831f7c831 [rubygems/rubygems] Simplify code by Gem::Specification#runtime_dependencies
324139af8f
2023-05-08 08:56:22 +00:00
Josef Šimánek
1cbb501127
Onboard Rubocop Naming/MemoizedInstanceVariableName rule to RubyGems. 2023-03-28 15:27:35 +09:00
Hiroshi SHIBATA
acf12b6dfd util/rubocop -A --only Style/AsciiComments 2023-03-23 17:18:49 +09:00
Hiroshi SHIBATA
f24a86d83f util/rubocop -A --only Layout/EmptyLineAfterMagicComment 2023-03-23 17:18:49 +09:00
Hiroshi SHIBATA
2e3cd1dc3e [rubygems/rubygems] Enabled Style/RedundantReturn cop
05cc97bdf8
2023-03-23 17:18:49 +09:00
Hiroshi SHIBATA
a3670249fa [rubygems/rubygems] util/rubocop -A --only Lint/Void
9d25906e44
2023-03-23 17:18:49 +09:00
Hiroshi SHIBATA
0eef33e113 [rubygems/rubygems] util/rubocop -A --only Style/Next
e5868e92f7
2023-03-23 17:18:49 +09:00
Hiroshi SHIBATA
bec069b0ca [rubygems/rubygems] util/rubocop -A --only Style/MultilineMemoization
c1f6e4a97b
2023-03-23 17:18:49 +09:00
Hiroshi SHIBATA
01be518eba [rubygems/rubygems] util/rubocop -A --only Lint/UnderscorePrefixedVariableName
6dc4bc3a5b
2023-03-23 17:18:49 +09:00
Hiroshi SHIBATA
ec131071b9 [rubygems/rubygems] util/rubocop -A --only Lint/ReturnInVoidContext
021823a331
2023-03-23 17:18:49 +09:00
Hiroshi SHIBATA
1a60012612 [rubygems/rubygems] util/rubocop -A --only Lint/RescueException
e8a5db50af
2023-03-23 17:18:49 +09:00
Hiroshi SHIBATA
7e3612585d [rubygems/rubygems] util/rubocop -A --only Lint/DuplicateCaseCondition
df2b192e47
2023-03-23 17:18:49 +09:00
Hiroshi SHIBATA
31c572f4fa util/rubocop -A --only Style/SymbolArray 2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA
1ca67f13cd util/rubocop -A --only Style/RedundantSelf 2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA
5211900d37 util/rubocop -A --only Style/SymbolProc 2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA
be4cc74e26 [rubygems/rubygems] util/rubocop -A --only Style/IfUnlessModifierOfIfUnless
97e0af2518
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA
6ad269dc39 [rubygems/rubygems] util/rubocop -A --only Style/RescueStandardError
80b57da926
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA
fef0313ec7 [rubygems/rubygems] util/rubocop -A --only Style/PreferredHashMethods
ae3bdc0e85
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA
66bd2c1a1c [rubygems/rubygems] util/rubocop -A --only Style/CommentAnnotation
4e77a1d1d5
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA
52ea7afa5f [rubygems/rubygems] util/rubocop -A --only Style/NegatedIf
aa95ee27a2
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA
4bb5ce8188 [rubygems/rubygems] util/rubocop -A --only Style/StringLiteralsInInterpolation
cb554f6eb7
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA
83f9aa8f02 [rubygems/rubygems] util/rubocop -A --only Style/Alias
fba6e94de9
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA
9a1269eaaa [rubygems/rubygems] util/rubocop -A --only Layout/MultilineArrayBraceLayout
f4f45ab27e
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA
05208c3875 [rubygems/rubygems] util/rubocop -A --only Lint/UnusedBlockArgument
d8efd919db
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA
760b8b7d24 [rubygems/rubygems] Change enforce style with Layout/CaseIndentation on rubygems
d4938259c4
2023-03-16 01:59:11 +00:00
Hiroshi SHIBATA
55a0fbfaf8 [rubygems/rubygems] Move build artifact detection logic for root gemspec to bundler from Gem::Specification.
Gem::Specification#missing_extension? is heavily called from RubyGems.
  We should reduce extra method call from this place.

e24e59d44d
2023-03-15 03:35:54 +00:00
Hiroshi SHIBATA
ea8b5e7359 [rubygems/rubygems] rubocop -a lib/rubygems/specification.rb
85d60e9886
2023-03-08 23:23:45 +00:00
Hiroshi SHIBATA
cb3f1f6de8 [rubygems/rubygems] Detect extension files under full_required_paths
When we use this methods with local gemspec, we don't handle
  build status of extension correctly. So We need to find extension
  files in require_paths.

  Example with ruby/erb repository:

  ```
  $ bundle exec irb
  Ignoring erb-4.0.2 because its extensions are not built. Try: gem pristine erb --version 4.0.2
  >>
  ```

f90e43cf3f
2023-03-08 23:23:45 +00:00
Hiroshi SHIBATA
75829f4d37
Added debug message for 20230306T023004Z.fail.html.gz#dist 2023-03-06 12:45:05 +09:00
Hiroshi SHIBATA
0c9a2ce6e0 [rubygems/rubygems] Build default gems same as fresh installtion.
Current implementation tried to build installation artifact. But default gems
  didn't provide normal gem files. So, It's always build failure.

  7432842788

    ERROR:  Error installing pkg/bigdecimal-3.1.4.gem:
    ERROR: Failed to build gem native extension.

    No such file or directory @ dir_s_mkdir - /Users/runner/.rubies/ruby-head/lib/ruby/gems/3.3.0+0/gems/bigdecimal-3.1.4/ext/bigdecimal/.gem.20230225-2301-2mul99

    Gem files will remain installed in /Users/runner/.rubies/ruby-head/lib/ruby/gems/3.3.0+0/gems/bigdecimal-3.1.4 for inspection.
    Results logged to /Users/runner/.rubies/ruby-head/lib/ruby/gems/3.3.0+0/extensions/x86_64-darwin-19/3.3.0+0/bigdecimal-3.1.4/gem_make.out

2157aa8ec8
2023-03-05 23:52:28 +00:00
Hiroshi SHIBATA
bab809d98f [rubygems/rubygems] Introduce Gem::Specification.find_by_full_name for finding conbination of name and version for gemspec
0430551215
2023-03-05 23:52:28 +00:00
Nobuyoshi Nakada
9b6d421ff4 [rubygems/rubygems] [DOC] Update the link to OpenSource.org
The static list in alphabetical order seems no longer provided.

a37dff7736
2023-02-21 10:26:53 +00:00
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