Граф коммитов

214 Коммитов

Автор SHA1 Сообщение Дата
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 e0bfc77824 [rubygems/rubygems] Remove unnecessary guard clause
Since 1ccf0912a161d20e0c4a7b139fd76e8739a411ba, this method no longer
uses `Kernel.gem`, so this guard clause is now unnecessary.

https://github.com/rubygems/rubygems/commit/8a19e7401c
2020-07-31 21:07:19 +09:00
Jean Boussier 76722c4928 [rubygems/rubygems] Optimize Gem.already_loaded?
Profiling a simple `ruby -e '1'` I see:

```
==================================
  Mode: wall(10)
  Samples: 3414 (55.10% miss rate)
  GC: 856 (25.07%)
==================================
     TOTAL    (pct)     SAMPLES    (pct)     FRAME
       689  (20.2%)         669  (19.6%)     Gem.already_loaded?
       462  (13.5%)         462  (13.5%)     (marking)
       393  (11.5%)         393  (11.5%)     (sweeping)
       815  (23.9%)         365  (10.7%)     Gem::Specification.load
      1050  (30.8%)         156   (4.6%)     Gem.register_default_spec
       100   (2.9%)          84   (2.5%)     Gem::Specification#files
        64   (1.9%)          64   (1.9%)     Gem::BasicSpecification#internal_init
       136   (4.0%)          59   (1.7%)     <top (required)>
      2312  (67.7%)          58   (1.7%)     <top (required)>
        57   (1.7%)          57   (1.7%)     RbConfig.expand
        81   (2.4%)          55   (1.6%)     Gem::Requirement.parse
       191   (5.6%)          51   (1.5%)     <top (required)>
       128   (3.7%)          47   (1.4%)     Gem::Requirement#initialize
        41   (1.2%)          41   (1.2%)     Gem.suffix_regexp
       229   (6.7%)          35   (1.0%)     <module:Gem>
       260   (7.6%)          34   (1.0%)     Kernel#require
```

So clearly `Gem.already_loaded?` is a major hotspot.

After this optimization, it's down to:
```
==================================
  Mode: wall(10)
  Samples: 2653 (58.21% miss rate)
  GC: 718 (27.06%)
==================================
     TOTAL    (pct)     SAMPLES    (pct)     FRAME
       416  (15.7%)         416  (15.7%)     (marking)
       715  (27.0%)         312  (11.8%)     Gem::Specification.load
       299  (11.3%)         299  (11.3%)     (sweeping)
       279  (10.5%)         279  (10.5%)     Gem.already_loaded?
       564  (21.3%)         106   (4.0%)     Gem.register_default_spec
        95   (3.6%)          80   (3.0%)     Gem::Specification#files
        72   (2.7%)          72   (2.7%)     Gem::BasicSpecification#internal_init
       129   (4.9%)          58   (2.2%)     <top (required)>
        53   (2.0%)          53   (2.0%)     RbConfig.expand
      1697  (64.0%)          52   (2.0%)     <top (required)>
        68   (2.6%)          49   (1.8%)     Gem::Requirement.parse
       183   (6.9%)          48   (1.8%)     <top (required)>
       112   (4.2%)          44   (1.7%)     Gem::Requirement#initialize
       220   (8.3%)          33   (1.2%)     <module:Gem>
       250   (9.4%)          32   (1.2%)     Kernel#require
```

The idea is that the vast majority of the time `already_loaded?` won't match
anything. So by first looking for candidate paths that `end_with?` the file we
look for, we save `default_gem_load_paths.size` iterations and string concatenations.

https://github.com/rubygems/rubygems/commit/c60ce88d49
2020-07-31 21:07:19 +09:00
Hiroshi SHIBATA 832fe77879 Bump version to 3.2.0.rc.1 2020-07-31 21:07:19 +09:00
Karol Bucek e7b6e0ff58 [rubygems/rubygems] remove explicit require(s) for auto-loaded constant(s)
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
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
Josef Šimánek 3ab1cfc325 Add Gem.disable_system_update_message to disable gem update --system if needed. 2020-06-15 21:20:37 +09:00
David Rodríguez c61031d6b6 Remove modelines for consistency
No other files in the repo include this.
2020-06-15 21:20:37 +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 f8f5e7fadf [rubygems/rubygems] Respect files loaded from default gems before rubygems
https://github.com/rubygems/rubygems/commit/f3da3c1190
2020-06-05 07:32:42 +09:00
David Rodríguez 5aa5aad48a [rubygems/rubygems] Refactor `Gem.load_path_insert_index`
https://github.com/rubygems/rubygems/commit/ae95885dff
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.

https://github.com/rubygems/rubygems/commit/00d98eb8a3
2020-06-05 07:32:42 +09:00
David Rodríguez 28be8e0480 [rubygems/rubygems] Remove explicit `psych` activation
We don't need to explictly activate `psych` since `require` will take
care of that automatically.

We don't need to care about a minimum version either since the oldest
ruby we support at the moment ships with a `psych` version higher than
2.0.0.

https://github.com/rubygems/rubygems/commit/1ccf0912a1
2020-06-05 07:32:42 +09:00
David Rodríguez 4a417b08ae [rubygems/rubygems] Fix incorrect bundler version being required
In ruby 2.7.0, there's a slight change in bundler's default gemspec file
where the executable folder of the bundler gem is `libexec` instead of
`exe`. I made that change in https://github.com/ruby/ruby/pull/2380 to
try to simplify the integration of the `bundler` gem with upstream,
minimizing the number of changes that need to be made to the gemspec to
adapt to the structure of ruby-core.

That worked ok, expected for this issue. The new name of the folder
including the executable files uncovered a bug in rubygems, which is the
following:

* In order to be able to use newer versions of default gems, `rubygems`
ships with a customized `require` that has knowledge about which files
belong to which default gem. If one of these files is required,
`rubygems` will detect that and activate its gem mechanism to choose the
newest version of the corresponding default gem present in the system
(unless a different version has already been activated). It's this part
of the custom require:

ea3e6f194d/lib/rubygems/core_ext/kernel_require.rb (L77-L85)

* In order to do that, `rubygems` registers a map of default gems and
their files when it is first required:

ea3e6f194d/lib/rubygems.rb (L1247-L1276)

As explained in the method's header, two types of default gem
specifications are supported. One of the formats is the style used by
some ruby-core gemspec files, where paths inside the `spec.files` array
don't include the `spec.require_paths` part. So in this "old style", if
a gem ships with a `lib/bundler.rb` file, it will be registered in this
array as `spec.files = ["bundler.rb"]`, not as `spec.files =
["lib/bundler.rb"]`. The `Gem.register_default_spec` method "detects"
this style by making sure that none of the files in the `spec.files`
array start with any of the `spec.require_paths`.

* Since in ruby 2.7 the default specification file of the `bundler` gem
includes a `libexec/bundle` file, this check would no longer work
correctly, because even though the specification file is still "old
style", it has one registered file which starts with "lib", one of the
"require paths" of the gem.

* This means that the gem is incorrectly detected as "new style", but
since none of the paths start with "lib/", no files are actually
registered, so the gem is not being considered a default gem, and thus
the default version is always used with no possibility of being
"upgraded".

The fix of the problem is simple: check that no files start with `lib/`
(or any other require paths), instead of with "lib" which doesn't
exclude other potential "non requirable folder" starting with lib, like
in the `bundler` case.

https://github.com/rubygems/rubygems/commit/94df740c2b
2020-05-08 14:13:29 +09:00
David Rodríguez 8250000187 [rubygems/rubygems] Extract logic to a local variable for later reuse
https://github.com/rubygems/rubygems/commit/dc715888d4
2020-05-08 14:13:29 +09:00
David Rodríguez 0b40279d7d Normalize heredoc case in rubygems code base 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>

https://github.com/rubygems/rubygems/commit/e11782b0c8
2020-05-08 07:38:50 +09:00
David Rodríguez 2396f703cf [rubygems/rubygems] Update minitest version in `Gem.install` docs
https://github.com/rubygems/rubygems/commit/aec3887d9c
2020-05-08 07:38:50 +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
David Rodríguez ba9dcdab36
[rubygems/rubygems] Enable Style/PercentLiteralDelimiters cop in rubygems
So it matches the style used by bundler.

https://github.com/rubygems/rubygems/commit/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 d8db343a21
Merge RubyGems 3.1.1 and update the NEWS entry for RubyGems 2019-12-16 20:47:04 +09:00
Hiroshi SHIBATA 980ddca47e
Prepare to release rubygems-3.1.0 2019-12-15 16:48:52 +09:00
Hiroshi SHIBATA 82cc2843a9
Prepare to release RubyGems 3.1.0 final version. 2019-12-13 20:19:33 +09:00
Hiroshi SHIBATA 546e50c2fb
Merge released version of RubyGems 3.1.0.pre3 2019-11-13 10:36:08 +09:00
Yusuke Endoh b72eda3c59 lib/rubygems.rb: Suppress "Resolving dependencies..."
And suppress "Leaked file descriptor" again.
2019-11-12 01:47:18 +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
Hiroshi SHIBATA e0e93a199d
[rubygems/rubygems] Bump version to 3.1.0.pre2
https://github.com/rubygems/rubygems/commit/a7a673ce22
2019-10-15 20:57:01 +09:00
Ellen Marie Dash 508afe2c26
[rubygems/rubygems] Set SOURCE_DATE_EPOCH env var if not provided.
Fixes #2290.

1. `Gem::Specification.date` returns SOURCE_DATE_EPOCH when defined,
2. this commit makes RubyGems set it _persistently_ when not provided.

This combination means that you can build a gem, check the build time,
and use that value to generate a new build -- and then verify they're
the same.

https://github.com/rubygems/rubygems/commit/d830d53f59
2019-09-26 17:48:00 +09:00
Jeremy Evans d08e1004e0 Fix keyword argument separation issues in lib
Mostly requires adding ** in either calls or method definitions.
2019-08-30 12:39:31 -07:00
David Rodríguez 3587824d71
[rubygems/rubygems] Don't unregister default specifications
I think this should be more efficient?

https://github.com/rubygems/rubygems/commit/a1de78104f
2019-08-17 07:35:48 +09:00
David Rodríguez 1ac6890bd0
[rubygems/rubygems] Fix removing unresolved default spec files from map
https://github.com/rubygems/rubygems/commit/7964917bbc
2019-08-17 07:35:48 +09:00
David Rodríguez f42ad4a425
[rubygems/rubygems] Little refactor
There's already a method called `suffix_pattern`, that's different from
this local variable. So, move the local variable to a `suffix_regexp`
that clearly differenciates from `suffix_pattern`.

https://github.com/rubygems/rubygems/commit/4ec69c48b9
2019-08-17 07:35:48 +09:00
Benoit Daloze 86ac51c301 [rubygems/rubygems] Use the standard RUBY_ENGINE_VERSION instead of JRUBY_VERSION
* RUBY_ENGINE and RUBY_ENGINE_VERSION are defined on every modern Ruby.
* There is no such constant as TRUFFLERUBY_VERSION or RBX_VERSION.

https://github.com/rubygems/rubygems/commit/431d0aefdd
2019-08-05 18:45:24 +09:00
bronzdoc 5a8d848849 [rubygems/rubygems] Remove FIXME comment
https://github.com/rubygems/rubygems/commit/5a1d3d618d
2019-08-05 18:44:40 +09:00
bronzdoc 56801d4532
[rubygems/rubygems] Remove missleading comment, no reason to move Gem.host to Gem::Util
https://github.com/rubygems/rubygems/commit/e12c98aa72
2019-07-31 07:47:01 +08:00
Kazuhiro NISHIYAMA fcc36d767b
Revert "Stop `circular require` warning"
This reverts commit c2a9c35024.

It cannot stop `circular require` warning.
2019-06-06 16:49:40 +09:00
Kazuhiro NISHIYAMA c2a9c35024
Stop `circular require` warning 2019-06-06 15:41:55 +09:00
Yusuke Endoh 861b50d81d lib/rubygems.rb: Stop "Leaked file descriptor" warning
Bundler.setup changes Gem::DefaultUserInteraction.ui and does not close
it.  This change makes sure that it is closed.
2019-06-06 15:25:18 +09:00
Hiroshi SHIBATA 56660de3c6 Merge rubygems master from upstream.
I picked the commit from 3c469e0da538428a0ddd94f99aa73c32da22e8ba
2019-06-01 13:50:41 +03:00
aycabta 559dca509d Show documents when completion 2019-05-25 03:30:01 +09:00
David Rodríguez d0a5467320 Update rubygems with latest upstream changes
Closes: https://github.com/ruby/ruby/pull/2154
2019-04-28 11:07:45 +09:00
Nobuyoshi Nakada f4f66bd11c
Revert "IRB is improved with Reline and RDoc, take 2"
Accidentally merged when 89271d4a37
"Adjusted indents".
2019-04-23 21:55:29 +09:00
aycabta f2cd4f4cd0
IRB is improved with Reline and RDoc, take 2 2019-04-23 20:08:02 +09:00
aycabta 51cec00953 Revert "IRB is improved with Reline and RDoc"
This reverts commit 7f273ac6d0.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-21 09:13:49 +00:00
aycabta 7f273ac6d0 IRB is improved with Reline and RDoc
Reline is a readline stdlib compatible library. It also supports
multiline input. IRB is improved with Reline and supports multiline.
Besides, supports showing documents when completed.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67645 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-20 08:51:20 +00:00
hsbt f28be7e02d Merge rubygems/rubygems from upstream.
The current master branch is
  97b264f0fa

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67415 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-02 11:48:18 +00:00