Skip to content

Commit 052b38a

Browse files
committed
[rubygems/rubygems] Deprecate Gem::Specification#datadir and will remove it at RG 4.1
rubygems/rubygems@e99cdab171
1 parent 51f88f9 commit 052b38a

File tree

3 files changed

+3
-36
lines changed

3 files changed

+3
-36
lines changed

lib/rubygems/basic_specification.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,9 @@ def datadir
199199
File.expand_path(File.join(gems_dir, full_name, "data", name))
200200
end
201201

202+
extend Gem::Deprecate
203+
rubygems_deprecate :datadir, :none, "4.1"
204+
202205
##
203206
# Full path of the target library file.
204207
# If the file is not in this gem, return nil.

test/rubygems/test_config.rb

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,6 @@
55
require "shellwords"
66

77
class TestGemConfig < Gem::TestCase
8-
def test_datadir
9-
util_make_gems
10-
spec = Gem::Specification.find_by_name("a")
11-
spec.activate
12-
assert_equal "#{spec.full_gem_path}/data/a", spec.datadir
13-
end
14-
158
def test_good_rake_path_is_escaped
169
path = Gem::TestCase.class_variable_get(:@@good_rake)
1710
ruby, rake = path.shellsplit

test/rubygems/test_gem.rb

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -527,35 +527,6 @@ def test_self_configuration
527527
assert_equal expected, Gem.configuration
528528
end
529529

530-
def test_self_datadir
531-
foo = nil
532-
533-
Dir.chdir @tempdir do
534-
FileUtils.mkdir_p "data"
535-
File.open File.join("data", "foo.txt"), "w" do |fp|
536-
fp.puts "blah"
537-
end
538-
539-
foo = util_spec "foo" do |s|
540-
s.files = %w[data/foo.txt]
541-
end
542-
543-
install_gem foo
544-
end
545-
546-
gem "foo"
547-
548-
expected = File.join @gemhome, "gems", foo.full_name, "data", "foo"
549-
550-
assert_equal expected, Gem::Specification.find_by_name("foo").datadir
551-
end
552-
553-
def test_self_datadir_nonexistent_package
554-
assert_raise(Gem::MissingSpecError) do
555-
Gem::Specification.find_by_name("xyzzy").datadir
556-
end
557-
end
558-
559530
def test_self_default_exec_format
560531
ruby_install_name "ruby" do
561532
assert_equal "%s", Gem.default_exec_format

0 commit comments

Comments
 (0)