diff options
author | Vít Ondruch <vondruch@redhat.com> | 2019-07-22 14:31:10 +0200 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2019-07-31 07:47:02 +0800 |
commit | a3b784b3a068ddd9a395b8951e9977035eca5066 (patch) | |
tree | 1f88477341eacd8c4b00ae4704441511cc79d2d2 /lib/rubygems | |
parent | d1806bd8da963c597ccd8c0b63ceac4dbe3ff3ae (diff) | |
download | ruby-a3b784b3a068ddd9a395b8951e9977035eca5066.tar.gz |
[rubygems/rubygems] Move default specifications dir definition out of BasicSpecification.
This was never the right place. The method got there just by evolution,
not by design. Move it within default methods, where it suits better.
Since this method is presumably used just internally, it should be safe
to deprecate it and remove later.
https://github.com/rubygems/rubygems/commit/0c0dd9458a
Diffstat (limited to 'lib/rubygems')
-rw-r--r-- | lib/rubygems/basic_specification.rb | 11 | ||||
-rw-r--r-- | lib/rubygems/commands/setup_command.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/defaults.rb | 7 | ||||
-rw-r--r-- | lib/rubygems/installer.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/specification.rb | 4 | ||||
-rw-r--r-- | lib/rubygems/uninstaller.rb | 2 |
6 files changed, 21 insertions, 7 deletions
diff --git a/lib/rubygems/basic_specification.rb b/lib/rubygems/basic_specification.rb index bafada01a3..168d07a72f 100644 --- a/lib/rubygems/basic_specification.rb +++ b/lib/rubygems/basic_specification.rb @@ -35,7 +35,14 @@ class Gem::BasicSpecification end def self.default_specifications_dir - File.join(Gem.default_dir, "specifications", "default") + Gem.default_specifications_dir + end + + class << self + + extend Gem::Deprecate + deprecate :default_specifications_dir, "Gem::BasicSpecification.default_specifications_dir", 2020, 02 + end ## @@ -84,7 +91,7 @@ class Gem::BasicSpecification def default_gem? loaded_from && - File.dirname(loaded_from) == self.class.default_specifications_dir + File.dirname(loaded_from) == Gem.default_specifications_dir end ## diff --git a/lib/rubygems/commands/setup_command.rb b/lib/rubygems/commands/setup_command.rb index 1754630c8c..1cbc980eb0 100644 --- a/lib/rubygems/commands/setup_command.rb +++ b/lib/rubygems/commands/setup_command.rb @@ -382,7 +382,7 @@ By default, this RubyGems will install gem as: end def install_default_bundler_gem(bin_dir) - specs_dir = Gem::Specification.default_specifications_dir + specs_dir = Gem.default_specifications_dir specs_dir = File.join(options[:destdir], specs_dir) unless Gem.win_platform? mkdir_p specs_dir, :mode => 0755 diff --git a/lib/rubygems/defaults.rb b/lib/rubygems/defaults.rb index 33b6ab3f3e..da304b213b 100644 --- a/lib/rubygems/defaults.rb +++ b/lib/rubygems/defaults.rb @@ -71,6 +71,13 @@ module Gem end ## + # Path to specification files of default gems. + + def self.default_specifications_dir + File.join(Gem.default_dir, "specifications", "default") + end + + ## # Path for gems in the user's home directory def self.user_dir diff --git a/lib/rubygems/installer.rb b/lib/rubygems/installer.rb index 0676dcea64..b230ce7bed 100644 --- a/lib/rubygems/installer.rb +++ b/lib/rubygems/installer.rb @@ -448,7 +448,7 @@ class Gem::Installer # def default_spec_file - File.join Gem::Specification.default_specifications_dir, "#{spec.full_name}.gemspec" + File.join Gem.default_specifications_dir, "#{spec.full_name}.gemspec" end ## diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb index 3b0b86230b..f40b9fd5fc 100644 --- a/lib/rubygems/specification.rb +++ b/lib/rubygems/specification.rb @@ -819,7 +819,7 @@ class Gem::Specification < Gem::BasicSpecification def self.default_stubs(pattern = "*.gemspec") base_dir = Gem.default_dir gems_dir = File.join base_dir, "gems" - gemspec_stubs_in(default_specifications_dir, pattern) do |path| + gemspec_stubs_in(Gem.default_specifications_dir, pattern) do |path| Gem::StubSpecification.default_gemspec_stub(path, base_dir, gems_dir) end end @@ -858,7 +858,7 @@ class Gem::Specification < Gem::BasicSpecification # Loads the default specifications. It should be called only once. def self.load_defaults - each_spec([default_specifications_dir]) do |spec| + each_spec([Gem.default_specifications_dir]) do |spec| # #load returns nil if the spec is bad, so we just ignore # it at this stage Gem.register_default_spec(spec) diff --git a/lib/rubygems/uninstaller.rb b/lib/rubygems/uninstaller.rb index 291bb6d611..bbca22154e 100644 --- a/lib/rubygems/uninstaller.rb +++ b/lib/rubygems/uninstaller.rb @@ -80,7 +80,7 @@ class Gem::Uninstaller dirs = Gem::Specification.dirs + - [Gem::Specification.default_specifications_dir] + [Gem.default_specifications_dir] Gem::Specification.each_spec dirs do |spec| next unless dependency.matches_spec? spec |