summaryrefslogtreecommitdiff
path: root/lib/rubygems
AgeCommit message (Collapse)Author
2020-07-31[rubygems/rubygems] Remove very old TODO noteDavid Rodríguez
It was added 10 years ago on a "146 additions, 170 deletions" commit named "Deprecation removals and minor cleanup." that didn't explain much other than that. This TODO doesn't necessarily apply nowadays. I don't see how anyways. TODO notes, if useful at all, should include a clear explanation of what should be done either via the note itself or the commit message. This note doens't meet any of these. So I want to remove it because it distracts me every time I go through it. https://github.com/rubygems/rubygems/commit/58d81e8a32 Notes: Merged: https://github.com/ruby/ruby/pull/3379
2020-07-31[rubygems/rubygems] Simplify digest name selection and use SHA256Bart de Water
The previous commit introduces the Gem::Security.create_digest method, allowing to: - decouple algorithm choice from implementation (OpenSSL or Ruby built-in) - untangle the SHA512 fallback for TarWriter from the generic hashing digest choice (undoing commit 9471f8ed2bdc12248d2619bbbce6e53cd6c16cb6) https://github.com/rubygems/rubygems/commit/1bc03231e4 Notes: Merged: https://github.com/ruby/ruby/pull/3379
2020-07-31Stop using deprecated OpenSSL::Digest constantsBart de Water
Notes: Merged: https://github.com/ruby/ruby/pull/3379
2020-07-31[rubygems/rubygems] remove explicit require(s) for auto-loaded constant(s)Karol Bucek
the Gem module's auto-loads will handle loading these as needed, this started as a redundancy found in *rubygems.rb* which had: `autoload :Specification, 'rubygems/specification'` as well as `require 'rubygems/specification'` https://github.com/rubygems/rubygems/commit/43ceae7ac0 Notes: Merged: https://github.com/ruby/ruby/pull/3379
2020-07-31[rubygems/rubygems] Test files should not be included in spec.filesMarc-Andre Lafortune
https://github.com/rubygems/rubygems/commit/0c0760b734 Notes: Merged: https://github.com/ruby/ruby/pull/3379
2020-07-31Enforce no empty lines around class body in rubygemsDavid Rodríguez
To normalize the code style with `bundler`. Notes: Merged: https://github.com/ruby/ruby/pull/3379
2020-06-17Remove unnecessary explicit `rake` activationDavid Rodríguez
Notes: Merged: https://github.com/ruby/ruby/pull/3213
2020-06-17Remove unnecessary stuff from base test caseDavid Rodríguez
Notes: Merged: https://github.com/ruby/ruby/pull/3213
2020-06-17Tweaks to play nicer with ruby-core parallelized testsDavid Rodríguez
Notes: Merged: https://github.com/ruby/ruby/pull/3213
2020-06-17Make sure to only reset "dummy" $LOADED_FEATURESDavid Rodríguez
Namely, those generated under `/tmp`. The previous approach was brittle and broken in the case of ruby-core, because under that setup, the current folder is in the original `$LOAD_PATH`, and dummy features are created under `./tmp`, so they were failing to be reset. Notes: Merged: https://github.com/ruby/ruby/pull/3213
2020-06-17Make sure tmp folder exists before calling `Dir.tmpdir`David Rodríguez
This was guaranteed by our gitignore setup where a `tmp/` folder is always present right after cloning the repository, but was not guaranteed under the ruby-core setup. This alternative approach should always work. Notes: Merged: https://github.com/ruby/ruby/pull/3213
2020-06-17Revert "Revert "[rubygems/rubygems] Use a local temporary directory""David Rodríguez
This reverts commit 20971d0df41368e0f946683823bc786514e16fef. Notes: Merged: https://github.com/ruby/ruby/pull/3213
2020-06-17Remove unneeded codeDavid Rodríguez
This was added ~8 years to fix some json warning but I'm pretty sure it's not needed anymore. This has caused several issues in both ruby-core and rdoc test suite and it doesn't make much sense to me these days so let's kill it. Notes: Merged: https://github.com/ruby/ruby/pull/3213
2020-06-15Exit with non-zero status on disabled gem system update.Josef Šimánek
Notes: Merged: https://github.com/ruby/ruby/pull/3229
2020-06-15Add Gem.disable_system_update_message to disable gem update --system if needed.Josef Šimánek
Notes: Merged: https://github.com/ruby/ruby/pull/3229
2020-06-15Remove encoding magic commentsDavid Rodríguez
They are no longer needed since ruby 2.0. Notes: Merged: https://github.com/ruby/ruby/pull/3229
2020-06-15Deprecate `Gem::Util.silent_system`David Rodríguez
There's better tools for this job. Notes: Merged: https://github.com/ruby/ruby/pull/3229
2020-06-15Replace `Gem::Util.silent_system` with better toolsDavid Rodríguez
Notes: Merged: https://github.com/ruby/ruby/pull/3229
2020-06-15Remove random codeDavid Rodríguez
Notes: Merged: https://github.com/ruby/ruby/pull/3229
2020-06-15Use space inside block braces everywhereDavid Rodríguez
To make rubygems code style consistent with bundler. Notes: Merged: https://github.com/ruby/ruby/pull/3229
2020-06-15Fix ruby-head failing testsDavid Rodríguez
In `ruby-head` (where system rubygems already has the `XDG` standard implementation), some tests currently depend on the presence of a `~/.gem` folder in the home of the user that runs the tests. If that file is present, tests pass, otherwise they don't. For example, the following passes if you have a `~/.gem` folder but fails otherwise with: ``` $ rake TESTOPTS="--name=/TestGemCommandsGenerateIndexCommand#test_execute$\|TestGemCommandsUpdateCommand#test_execute_user_install/ -v" Run options: "--name=/TestGemCommandsGenerateIndexCommand#test_execute$|TestGemCommandsUpdateCommand#test_execute_user_install/" -v --seed 17318 # Running: TestGemCommandsGenerateIndexCommand#test_execute = 0.02 s = . TestGemCommandsUpdateCommand#test_execute_user_install = /rubygems/test/rubygems/test_gem_commands_update_command.rb:412: warning: instance variable @user_install not initialized 0.04 s = F Finished in 0.095337s, 20.9783 runs/s, 20.9783 assertions/s. 1) Failure: TestGemCommandsUpdateCommand#test_execute_user_install [/rubygems/test/rubygems/test_gem_commands_update_command.rb:414]: user_install must be set on the installer 2 runs, 2 assertions, 1 failures, 0 errors, 0 skips rake aborted! Command failed with status (1) Tasks: TOP => default => test (See full trace by running task with --trace) ``` This is because the very initial `require` of the default `did_you_mean` gem that ruby does on startup runs _before_ the global `setup` hook of our tests run. During this require `Gem.data_home` and its value is memoized to a path in the real users home (not the fake user's home that our tests setup, since that code hasn't run yet). Then that memoized value is used when looking for the default folders to look for gems, and since there's no `~/.gem` folder, its value is actually used as part of the `Gem.user_dir` folder in `Gem::Specification.dirs` (this is how we've approached backwards compatibility for the `XDG` feature). That means dummy test gems with the `--user-install` flag are installed to global, real locations and everything is messed up. This commit fixes the issue by resetting the `Gem.data_home` value in case it has already been memoized. Notes: Merged: https://github.com/ruby/ruby/pull/3211
2020-06-15Revert "Revert "[rubygems/rubygems] Remove unneeded global teardown""David Rodríguez
This reverts commit ac2c07e98373bb62be618001c897fa9d5809d8a4. Notes: Merged: https://github.com/ruby/ruby/pull/3211
2020-06-05[rubygems/rubygems] Use LoadError#path to figure out the argument passed to ↵Yuki Nishijima
'require' https://github.com/rubygems/rubygems/commit/5995394ec4 Notes: Merged: https://github.com/ruby/ruby/pull/3184
2020-06-05[rubygems/rubygems] Only run optional validations in packaging contextsDavid Rodríguez
https://github.com/rubygems/rubygems/commit/f4fe949dfa Notes: Merged: https://github.com/ruby/ruby/pull/3184
2020-06-05[rubygems/rubygems] Split validations into required and optionalDavid Rodríguez
https://github.com/rubygems/rubygems/commit/55b09a7aa2 Notes: Merged: https://github.com/ruby/ruby/pull/3184
2020-06-05[rubygems/rubygems] Mention that some validations only warnDavid Rodríguez
https://github.com/rubygems/rubygems/commit/32c7f7f484 Notes: Merged: https://github.com/ruby/ruby/pull/3184
2020-06-05[rubygems/rubygems] Reword `validate` method headerDavid Rodríguez
It's not so basic anymore, and it does much more than validating required fields. https://github.com/rubygems/rubygems/commit/3c0be4cdeb Notes: Merged: https://github.com/ruby/ruby/pull/3184
2020-06-05[rubygems/rubygems] Reuse `error` helperDavid Rodríguez
https://github.com/rubygems/rubygems/commit/3a44b6f846 Notes: Merged: https://github.com/ruby/ruby/pull/3184
2020-06-05[rubygems/rubygems] Move docs to a better placeDavid Rodríguez
https://github.com/rubygems/rubygems/commit/c87ac90528 Notes: Merged: https://github.com/ruby/ruby/pull/3184
2020-06-05[rubygems/rubygems] Deprecate some methods that are only there for compatibilityDavid Rodríguez
https://github.com/rubygems/rubygems/commit/b4948bda74 Notes: Merged: https://github.com/ruby/ruby/pull/3184
2020-06-05Enable rubocop-performance StartWith copOlle Jonsson
- this would keep the could-be-a-string-method matches few Notes: Merged: https://github.com/ruby/ruby/pull/3184
2020-06-05[rubygems/rubygems] Respect files loaded from default gems before rubygemsDavid Rodríguez
https://github.com/rubygems/rubygems/commit/f3da3c1190 Notes: Merged: https://github.com/ruby/ruby/pull/3184
2020-06-05[rubygems/rubygems] Remove direct reference to PRDavid Rodríguez
The code is quite different now, so I think the link might be even confusing. If you want to know more, use git history. https://github.com/rubygems/rubygems/commit/db872c7a18 Notes: Merged: https://github.com/ruby/ruby/pull/3184
2020-06-05[rubygems/rubygems] Fix `$LOADED_FEATURES` cache sometimes not respectedDavid Rodríguez
In the cases where the initial manually `-I` path resolution succeeded, we were passing a full path to the original require effectively skipping the `$LOADED_FEATURES` cache. With this change, we _only_ do the resolution when a matching requirable path is found in a default gem. In that case, we skip activation of the default gem if we detect that the required file will be picked up for a `-I` path. https://github.com/rubygems/rubygems/commit/22ad5717c3 Notes: Merged: https://github.com/ruby/ruby/pull/3184
2020-06-05[rubygems/rubygems] Extract a local outside the loopDavid Rodríguez
https://github.com/rubygems/rubygems/commit/da1492e9d7 Notes: Merged: https://github.com/ruby/ruby/pull/3184
2020-06-05[rubygems/rubygems] Refactor `Gem.load_path_insert_index`David Rodríguez
https://github.com/rubygems/rubygems/commit/ae95885dff Notes: Merged: https://github.com/ruby/ruby/pull/3184
2020-06-05[rubygems/rubygems] Fix performance regression in `require`David Rodríguez
Our check for `-I` paths should not go through all activated gems. https://github.com/rubygems/rubygems/commit/00d98eb8a3 Notes: Merged: https://github.com/ruby/ruby/pull/3184
2020-06-05Fix `ruby setup.rb` warningsDavid Rodríguez
Currently we get the following warnings on `ruby setup.rb`: ``` /home/deivid/.rbenv/versions/2.7.1/lib/ruby/site_ruby/2.7.0/rubygems/exceptions.rb:281: warning: already initialized constant Gem::UnsatisfiableDepedencyError /home/deivid/Code/rubygems/lib/rubygems/exceptions.rb:281: warning: previous definition of UnsatisfiableDepedencyError was here /home/deivid/.rbenv/versions/2.7.1/lib/ruby/site_ruby/2.7.0/rubygems/user_interaction.rb:557: warning: already initialized constant Gem::StreamUI::ThreadedDownloadReporter::MUTEX /home/deivid/Code/rubygems/lib/rubygems/user_interaction.rb:557: warning: previous definition of MUTEX was here /home/deivid/.rbenv/versions/2.7.1/lib/ruby/site_ruby/2.7.0/rubygems/ext/builder.rb:20: warning: already initialized constant Gem::Ext::Builder::CHDIR_MUTEX /home/deivid/Code/rubygems/lib/rubygems/ext/builder.rb:20: warning: previous definition of CHDIR_MUTEX was here /home/deivid/.rbenv/versions/2.7.1/lib/ruby/site_ruby/2.7.0/rubygems/ext/ext_conf_builder.rb:14: warning: already initialized constant Gem::Ext::ExtConfBuilder::FileEntry /home/deivid/Code/rubygems/lib/rubygems/ext/ext_conf_builder.rb:14: warning: previous definition of FileEntry was here /home/deivid/.rbenv/versions/2.7.1/lib/ruby/site_ruby/2.7.0/rubygems/version.rb:158: warning: already initialized constant Gem::Version::VERSION_PATTERN /home/deivid/Code/rubygems/lib/rubygems/version.rb:158: warning: previous definition of VERSION_PATTERN was here /home/deivid/.rbenv/versions/2.7.1/lib/ruby/site_ruby/2.7.0/rubygems/version.rb:159: warning: already initialized constant Gem::Version::ANCHORED_VERSION_PATTERN /home/deivid/Code/rubygems/lib/rubygems/version.rb:159: warning: previous definition of ANCHORED_VERSION_PATTERN was here /home/deivid/.rbenv/versions/2.7.1/lib/ruby/site_ruby/2.7.0/rubygems/requirement.rb:14: warning: already initialized constant Gem::Requirement::OPS /home/deivid/Code/rubygems/lib/rubygems/requirement.rb:14: warning: previous definition of OPS was here /home/deivid/.rbenv/versions/2.7.1/lib/ruby/site_ruby/2.7.0/rubygems/requirement.rb:24: warning: already initialized constant Gem::Requirement::SOURCE_SET_REQUIREMENT /home/deivid/Code/rubygems/lib/rubygems/requirement.rb:24: warning: previous definition of SOURCE_SET_REQUIREMENT was here /home/deivid/.rbenv/versions/2.7.1/lib/ruby/site_ruby/2.7.0/rubygems/requirement.rb:27: warning: already initialized constant Gem::Requirement::PATTERN_RAW /home/deivid/Code/rubygems/lib/rubygems/requirement.rb:27: warning: previous definition of PATTERN_RAW was here /home/deivid/.rbenv/versions/2.7.1/lib/ruby/site_ruby/2.7.0/rubygems/requirement.rb:32: warning: already initialized constant Gem::Requirement::PATTERN /home/deivid/Code/rubygems/lib/rubygems/requirement.rb:32: warning: previous definition of PATTERN was here /home/deivid/.rbenv/versions/2.7.1/lib/ruby/site_ruby/2.7.0/rubygems/requirement.rb:37: warning: already initialized constant Gem::Requirement::DefaultRequirement /home/deivid/Code/rubygems/lib/rubygems/requirement.rb:37: warning: previous definition of DefaultRequirement was here /home/deivid/.rbenv/versions/2.7.1/lib/ruby/site_ruby/2.7.0/rubygems/requirement.rb:42: warning: already initialized constant Gem::Requirement::DefaultPrereleaseRequirement /home/deivid/Code/rubygems/lib/rubygems/requirement.rb:42: warning: previous definition of DefaultPrereleaseRequirement was here /home/deivid/.rbenv/versions/2.7.1/lib/ruby/site_ruby/2.7.0/rubygems/requirement.rb:311: warning: already initialized constant Gem::Version::Requirement /home/deivid/Code/rubygems/lib/rubygems/requirement.rb:311: warning: previous definition of Requirement was here /home/deivid/.rbenv/versions/2.7.1/lib/ruby/site_ruby/2.7.0/rubygems/command.rb:626: warning: already initialized constant Gem::Command::HELP /home/deivid/Code/rubygems/lib/rubygems/command.rb:626: warning: previous definition of HELP was here Successfully built RubyGem Name: bundler Version: 2.2.0.dev File: bundler-2.2.0.dev.gem Bundler 2.2.0.dev installed RubyGems 3.2.0.pre1 installed Regenerating binstubs Regenerating plugins ------------------------------------------------------------------------------ RubyGems installed the following executables: /home/deivid/.rbenv/versions/2.7.1/bin/gem /home/deivid/.rbenv/versions/2.7.1/bin/bundle ``` This is because the `$LOAD_PATH` entry added by `setup.rb` is relatively and when the offending require happens, we're installing `bundler` and have switched folders to `bundler/`. So the require fallsback to the system rubygems. To avoid that, add an absolute path to the `$LOAD_PATH`. On jruby, somehow the $LOAD_PATH is manipulated so that we end up requiring stuff inside the built package even if we have specified the `-I` flag, so we get redefinition warnings anyways. I'm not sure about the root cause, but relative requiring fixes it, and it's faster anyways. Notes: Merged: https://github.com/ruby/ruby/pull/3184
2020-06-05[rubygems/rubygems] Require ext only in validate_extension, mention gemspec ↵Josef Šimánek
in warning. https://github.com/rubygems/rubygems/commit/5e31e1a421 Notes: Merged: https://github.com/ruby/ruby/pull/3184
2020-06-05[rubygems/rubygems] Add build warning when rake based extension is present, ↵Josef Šimánek
but rake is not specified as dependency. https://github.com/rubygems/rubygems/commit/75fe5475b6 Notes: Merged: https://github.com/ruby/ruby/pull/3184
2020-06-05[rubygems/rubygems] Prefer start_with? and end_with? over regex.Olle Jonsson
- In one of the cases, filenames were checked for ending with "gz" - this is changed to check for ending with ".gz" - The change was made to make it even easier to read the code, and to match only from the start of the input (as opposed to start of the line) https://github.com/rubygems/rubygems/commit/aac4290271 Notes: Merged: https://github.com/ruby/ruby/pull/3184
2020-06-05[rubygems/rubygems] Fix template cleanup as wellDavid Rodríguez
https://github.com/rubygems/rubygems/commit/10cc79ee21 Notes: Merged: https://github.com/ruby/ruby/pull/3184
2020-06-05[rubygems/rubygems] Fix installing template files with dotsDavid Rodríguez
https://github.com/rubygems/rubygems/commit/a82a77251d Notes: Merged: https://github.com/ruby/ruby/pull/3184
2020-06-05[rubygems/rubygems] Remove unnecessary parenthesisDavid Rodríguez
https://github.com/rubygems/rubygems/commit/97772bb066 Notes: Merged: https://github.com/ruby/ruby/pull/3184
2020-06-05[rubygems/rubygems] Make sure rubygems/package can be directly required reliablybronzdoc
https://github.com/rubygems/rubygems/commit/73c199b087 Notes: Merged: https://github.com/ruby/ruby/pull/3184
2020-06-05[rubygems/rubygems] Delay `fileutils` loading to fix some warningsDavid Rodríguez
If the following conditions are met: * You have a default version of fileutils and a higher version of fileutils installed as a regular gem. This case is common on ruby 2.6. * You use a bundler generated binstub on a gem setup with a `Gemfile` using the `gemspec` DSL. Then `fileutils` redefinition warnings happen because of the following: The gist of a bundler generated binstub is: ```ruby require "bundler/setup" load Gem.bin_path("rake", "rake") ``` First configure bundler, then load the requested gem. When `require "bundler/setup"` is called under the previously mentioned setup, `ext_conf_builder.rb` ends up being required because of the new validation that gemspecs with rake extensions depend on `rake`. And that loads the latest version of `fileutils` because of using "rubygems monkeypatched require" that auto-chooses the latest version of default gems. After that, when `Gem.bin_path` gets called, `ext_conf_builder.rb` gets required again, but this time already using "bundler's unmonkeypatched require" which means the default version is chosen and thus the redefinition warning happens. The solution as usual is to lazily load `fileutils`. https://github.com/rubygems/rubygems/commit/08d64e5f06 Notes: Merged: https://github.com/ruby/ruby/pull/3184
2020-06-05[rubygems/rubygems] Make `rake package` log messages to stdout by defaultDavid Rodríguez
The logging to $stderr is only happening due to a bug in `FileUtils`. Logging messages are not errors. https://github.com/rubygems/rubygems/commit/4d1b6659e6 Notes: Merged: https://github.com/ruby/ruby/pull/3184
2020-05-22Revert a commit miss in "Fixed potential memory leak"Nobuyoshi Nakada
This reverts an unintentional change in commit 79d9528ddca1dfe2dd99287dc88fd7c2b30f7137.
2020-05-22Fixed potential memory leakNobuyoshi Nakada
Create a wrapper object first, then buffer allocation which can fail.
2020-05-08Revert "[rubygems/rubygems] Remove unneeded global teardown"Hiroshi SHIBATA
This reverts commit 93d1588c782ab9d61699f98b6c64d7f0ab8121c0. Notes: Merged: https://github.com/ruby/ruby/pull/3092