Commit graph

149 commits

Author SHA1 Message Date
Hiroshi SHIBATA
4aca77edde Merge prepare version of RubyGems 3.2.0 2020-12-08 17:30:02 +09:00
Hiroshi SHIBATA
ab6c4f8be3 Merge rubygems-3.2.0.rc.2 2020-10-15 14:12:02 +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
Hiroshi SHIBATA
0e2d8c487c [rubygems/rubygems] unset XDG_* environmental variables for testing of rubygems.
539fd9a39a
2020-07-31 21:07:19 +09:00
David Rodríguez
aa4ecfe7f7 [rubygems/rubygems] Revert "Disallow warnings to creep into the test suite"
This reverts commit 694e6afee769ffb3168a564ee7d315af2a934993.

It was failed on Windows and I'm unsure why. Also, the check seems
brittle since it could fail potentially fail because of warnings outside
of our control.

908e9344dd
2020-07-31 21:07:19 +09:00
David Rodríguez
14ab281faa [rubygems/rubygems] Disallow warnings to creep into the test suite
694e6afee7
2020-07-31 21:07:19 +09:00
David Rodríguez
9d6123da15 [rubygems/rubygems] Fix test warning
f4c4cddb68
2020-07-31 21:07:19 +09:00
David Rodríguez
06f84d0567 [rubygems/rubygems] Don't super on main test setup
The `teardown` method doesn't call it either and I don't think it's
necessary.

ca2a5d485d
2020-07-31 21:07:19 +09:00
David Rodríguez
d0cc4ecb8f [rubygems/rubygems] Remove very old compatibility code
6e4bef758b
2020-07-31 21:07:19 +09:00
David Rodríguez
a89665b7b1 Enforce no empty lines around class body in rubygems
To normalize the code style with `bundler`.
2020-07-31 21:07:19 +09:00
David Rodríguez
7b5a779576 Remove unnecessary stuff from base test case 2020-06-17 21:16:56 +09:00
David Rodríguez
66b0677bcf Tweaks to play nicer with ruby-core parallelized tests 2020-06-17 21:16:56 +09:00
David Rodríguez
106d616cc8 Make sure to only reset "dummy" $LOADED_FEATURES
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.
2020-06-17 21:16:56 +09:00
David Rodríguez
f5459acd79 Make sure tmp folder exists before calling Dir.tmpdir
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.
2020-06-17 21:16:56 +09:00
David Rodríguez
97819759de Revert "Revert "[rubygems/rubygems] Use a local temporary directory""
This reverts commit 20971d0df4.
2020-06-17 21:16:56 +09:00
David Rodríguez
955f1837a1 Use space inside block braces everywhere
To make rubygems code style consistent with bundler.
2020-06-15 21:20:37 +09:00
David Rodríguez
ef481c120c Fix ruby-head failing tests
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.
2020-06-15 19:48:25 +09:00
David Rodríguez
c3ecd1cbd3 Revert "Revert "[rubygems/rubygems] Remove unneeded global teardown""
This reverts commit ac2c07e983.
2020-06-15 19:48:25 +09:00
David Rodríguez
f8f5e7fadf [rubygems/rubygems] Respect files loaded from default gems before rubygems
f3da3c1190
2020-06-05 07:32:42 +09:00
David Rodríguez
a18e81d797 [rubygems/rubygems] Fix performance regression in require
Our check for `-I` paths should not go through all activated gems.

00d98eb8a3
2020-06-05 07:32:42 +09:00
Hiroshi SHIBATA
ac2c07e983 Revert "[rubygems/rubygems] Remove unneeded global teardown"
This reverts commit 93d1588c78.
2020-05-08 14:13:29 +09:00
Hiroshi SHIBATA
20971d0df4 Revert "[rubygems/rubygems] Use a local temporary directory"
This reverts commit e98455f289.
2020-05-08 14:13:29 +09:00
David Rodríguez
93293043f1 [rubygems/rubygems] Remove unneeded global teardown
Instead, make each test cleanup after itself.

e0aba9d64f
2020-05-08 14:13:29 +09:00
Hiroshi SHIBATA
58af4c0a1f [rubygems/rubygems] Split credential helper as credential_setup and use it
b0c55c76ca
2020-05-08 14:13:29 +09:00
David Rodríguez
ce88e2a8aa [rubygems/rubygems] Suppress warnings coming from jar-dependencies
This is a default gem on jruby, which ships with a rubygems plugin,
which prints warnings all over the place during our tests.

This plugin is unnecessary from our tests, so I disable it through the
`JARS_SKIP` environment variable provided by this gem.

0aabbcf269
2020-05-08 14:13:29 +09:00
David Rodríguez
314d7f897c Remove builder gem requirement for gem regenerate_index
This requirement was introduced 14 years ago in
7ce7039b390440754954df5efea619e9f57ef823, and I don't think it's
necessary anymore. I made several tests introducing UTF-8 characters in
gemspec files and generating indexes out of them, and couldn't find any
issues. Gemspecs are read with UTF-8 encoding these days.
2020-05-08 14:13:29 +09:00
David Rodríguez
2efe741902 [rubygems/rubygems] Use a local temporary directory
To make tests more deterministic, since `Dir.tmpdir` sometimes will
return the current directory dependending on the writability of other
paths, and in that case since the current directory is changed by our
tests, tests can fail.

Force a local tmp folder instead, which will always be writable.

3e522bac65
2020-05-08 14:13:29 +09:00
David Rodríguez
fca24dd121 [rubygems/rubygems] No longer necessary
Fixed in
45df1c24d2,
released with ruby 2.3

f8f67f3952
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
David Rodríguez
9042787508 [rubygems/rubygems] Remove unnecessary @@ruby variable
5f20647ec1
2020-05-08 14:13:29 +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
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
David Rodríguez
b8ef5ed8bd [rubygems/rubygems] Remove minitest compatibility code
24213b97d8
2020-05-08 07:38:50 +09:00
David Rodríguez
f4022f943d [rubygems/rubygems] [rubygems/rubygems] Require minitest ~> 5.13
f2cc5d7033

ae5b4e2043
2020-05-08 07:38:50 +09:00
Nobuyoshi Nakada
c6020ba277
Clear cached XDG path names 2020-04-25 02:35:57 +09:00
Hiroshi SHIBATA
5c6269c459
Support XDG_* (#2174)
* Support XDG_CONFIG_HOME for gemrc.

* Support XDG_DATA_HOME for .gem

* Added test for XDG_DATA_HOME

* Do not reuse environmental variable.

* Unify .rdoc path to RDoc.home.

* Support XDG_DATA_HOME for .rdoc

* Ignore exists?

* Extracted config_home path

* Use XDG_CONFIG_HOME for default credential path

* Fixed inconsistency location.

* Fixed the broken tests.

* Support XDG_CONFIG_HOME for irbrc

* Introduce Gem.cache_home as XDG_CACHE_HOME

* Use Gem.cache_home instead of Gem.config_home for the credential file of RubyGems.

* Initialized the old configurations

* Fixed test failure related the configuration initialization

* restore XDG_DATA_HOME

* Fixed the broken examples of bundler with XDG_*

* Do not modify environmental variable on test file

* Use XDG_DATA_HOME insted of XDG_CACHE_HOME for credential file

* stub out Gem.data_home

* Move dir accessor to defaults.rb file

* Use XDG_DATA_HOME for signed gem features

* Use XDG_DATA_HOME for spec cache

* Do not rely on Gem.user_home

* Gem.user_home is always exists. Don't need to use FileUitls.mkdir_p

* Bump support version to RubyGems 3.2.0+

* Removed the needless fallback configuration

* Fixed the inconsistency methods that are find_config_file and config_file

* Use Gem.configuration.credentials_path instead of hard-coded path

* gem_path is always provided

* Removed the duplicated code of find_home

* Also removed the duplicated code of user_home

* use Gem::UNTAINT instead of untaint for surpressing the warnings

* Use File.directory

* Restore XDG_DATA_HOME

* Use File.write
2020-04-23 19:16:06 +09:00
Hiroshi SHIBATA
e5db3da9d3
Migrate {assert,refute}_patch_exits for compatibility with Minitest5 2020-03-30 21:32:26 +09:00
David Rodríguez
7e1e60b044 [rubygems/rubygems] Remove ruby 1.8 leftovers
84c89275b8
2020-03-30 12:49:24 +09:00
David Rodríguez
061add792e
[rubygems/rubygems] Enable Style/ExtraSpacing and auto-correct
6fa0b1b679
2020-03-30 12:48:23 +09:00
David Rodríguez
ba9dcdab36
[rubygems/rubygems] Enable Style/PercentLiteralDelimiters cop in rubygems
So it matches the style used by bundler.

ab0580fd65
2020-03-30 12:42:10 +09:00
David Rodríguez
96064e6f1c
Sync rubygems with current master (#2889) 2020-03-24 15:39:24 +09:00
Hiroshi SHIBATA
600a715c9b
Merge the current master branch of rubygems/rubygems.
Just started to develop RubyGems 3.2.0.
2020-02-01 11:14:57 +09:00
Hiroshi SHIBATA
e672494cd7
Merge RubyGems 3.1.2 2019-12-20 11:50:32 +09:00
Hiroshi SHIBATA
7d463e360b Merge RubyGems 3.1.0.pre3
* Fix gem pristine not accounting for user installed gems. Pull request
    #2914 by Luis Sagastume.
  * Refactor keyword argument test for Ruby 2.7. Pull request #2947 by
    SHIBATA Hiroshi.
  * Fix errors at frozen Gem::Version. Pull request #2949 by Nobuyoshi
    Nakada.
  * Remove taint usage on Ruby 2.7+. Pull request #2951 by Jeremy Evans.
  * Check Manifest.txt is up to date. Pull request #2953 by David Rodríguez.
  * Clarify symlink conditionals in tests. Pull request #2962 by David
    Rodríguez.
  * Update command line parsing to work under ps. Pull request #2966 by
    David Rodríguez.
  * Properly test `Gem::Specifications.stub_for`. Pull request #2970 by
    David Rodríguez.
  * Fix Gem::LOADED_SPECS_MUTEX handling for recursive locking. Pull request
    #2985 by MSP-Greg.
2019-11-11 16:59:49 +09:00
Nobuyoshi Nakada
8b8e7e6e9e
$LOAD_PATH elements should be real paths
Installed path may contain symbolic links.
2019-08-18 00:32:21 +09:00
Hiroshi SHIBATA
dd16f8524c
Revert "Revert "[rubygems/rubygems] [Require] Ensure -I beats a default gem""
This reverts commit 75d29db8f9.
2019-08-17 15:12:45 +09:00