[rubygems/rubygems] Deprecate Gem::Specification#datadir and will remove it at RG 4.1

e99cdab171
This commit is contained in:
Hiroshi SHIBATA 2025-08-05 18:45:25 +09:00
parent 51f88f9922
commit 052b38a5d9
3 changed files with 3 additions and 36 deletions

View file

@ -199,6 +199,9 @@ class Gem::BasicSpecification
File.expand_path(File.join(gems_dir, full_name, "data", name))
end
extend Gem::Deprecate
rubygems_deprecate :datadir, :none, "4.1"
##
# Full path of the target library file.
# If the file is not in this gem, return nil.

View file

@ -5,13 +5,6 @@ require "rubygems"
require "shellwords"
class TestGemConfig < Gem::TestCase
def test_datadir
util_make_gems
spec = Gem::Specification.find_by_name("a")
spec.activate
assert_equal "#{spec.full_gem_path}/data/a", spec.datadir
end
def test_good_rake_path_is_escaped
path = Gem::TestCase.class_variable_get(:@@good_rake)
ruby, rake = path.shellsplit

View file

@ -527,35 +527,6 @@ class TestGem < Gem::TestCase
assert_equal expected, Gem.configuration
end
def test_self_datadir
foo = nil
Dir.chdir @tempdir do
FileUtils.mkdir_p "data"
File.open File.join("data", "foo.txt"), "w" do |fp|
fp.puts "blah"
end
foo = util_spec "foo" do |s|
s.files = %w[data/foo.txt]
end
install_gem foo
end
gem "foo"
expected = File.join @gemhome, "gems", foo.full_name, "data", "foo"
assert_equal expected, Gem::Specification.find_by_name("foo").datadir
end
def test_self_datadir_nonexistent_package
assert_raise(Gem::MissingSpecError) do
Gem::Specification.find_by_name("xyzzy").datadir
end
end
def test_self_default_exec_format
ruby_install_name "ruby" do
assert_equal "%s", Gem.default_exec_format