rubygems-datadir 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 1d7a50868ae72010979c0bb8af508c4cb9bebb4d2f6ad52d828ddef3a987d579
4
+ data.tar.gz: bb3cc93cf806fd86aa7faf42ee873413342e3a8df34c906143d852646ef39198
5
+ SHA512:
6
+ metadata.gz: d4767b926aa4f8df3a61d19c73bd5daac7ad5db52924a16ff138ae12b7efc969b22fb6ffe381fb0f7e3bedc69b7b03a55fe7c83440f998d591050ec49007b52e
7
+ data.tar.gz: 122de2dfa97106f3603b570b318f369db955910689cde62bf49701e823ea6e280dfeac026685c746bc78c8103324f99fa208a00008730788a8228a2dc0c3fa3c
checksums.yaml.gz.sig ADDED
@@ -0,0 +1,5 @@
1
+ UZ�>��΄J�0��k^q���
2
+ C����<߀
3
+ �E!hjֹ��|~ƍ:� a�Ԩݓ$�d,qz9�}FdQc/�Ɯ��":�&�{)��%w��U��� Ʋ��խ���
4
+ '�zߜv �O{�5�m-1��� �Ί�C�.��5�67R�i��ܤ������ܟ&i��NL���]|)HޒG�-g���l��Y!�v�ρ�.Q�6JS-+o���׃�@egJ��,_����_hX�P)=m����k3��=a�˱�'h�SR���MfFP�'�M{@9';����D��ë"�Τ�'�yf֜;����,���=�蒂@�xy��
5
+ �`V@������g��]���<���EꍺI��������
data/History.md ADDED
@@ -0,0 +1,4 @@
1
+ ## v0.0.1 [2026-04-06] Michael Granger <ged@FaerieMUD.org>
2
+
3
+ Initial release.
4
+
data/LICENSE.txt ADDED
@@ -0,0 +1,23 @@
1
+ Copyright (c) 2026, Michael Granger
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without modification,
5
+ are permitted provided that the following conditions are met:
6
+
7
+ 1. Redistributions of source code must retain the above copyright notice, this
8
+ list of conditions and the following disclaimer.
9
+
10
+ 2. Redistributions in binary form must reproduce the above copyright notice,
11
+ this list of conditions and the following disclaimer in the documentation
12
+ and/or other materials provided with the distribution.
13
+
14
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
15
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
18
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/README.md ADDED
@@ -0,0 +1,90 @@
1
+ # rubygems-datadir
2
+
3
+ home
4
+ : https://sr.ht/~ged/rubygems-datadir
5
+
6
+ code
7
+ : https://hg.sr.ht/~ged/rubygems-datadir
8
+
9
+ github
10
+ : https://github.com/ged/rubygems-datadir
11
+
12
+ docs
13
+ : https://deveiate.org/code/rubygems-datadir
14
+
15
+
16
+ ## Description
17
+
18
+ Restores Rubygems datadirs. This is a set of refinements that restore the "datadir" functionality of Rubygems, which was deprecated and slated for removal in an upcoming (minor) version.
19
+
20
+ I use this functionality extensively in a number of my gems, as [do a number of other Ruby projects](https://github.com/search?q=Gem.datadir+language%3Aruby&type=code), so I'm a bit baffled as to why it was deprecated, but that's the beauty of Ruby I suppose; you can always just add it back where you need it.
21
+
22
+ ### Usage
23
+
24
+ This gem contains refinements that restore the removed functionality, so to keep your code from breaking, just add the following to any files that use that API:
25
+
26
+ require 'rubygems/datadir'
27
+ using Gem::DataDirRefinements
28
+
29
+ This restores both `Gem.datadir` and `Gem::Specification#datadir`.
30
+
31
+
32
+ ## Prerequisites
33
+
34
+ * Ruby
35
+
36
+
37
+ ## Installation
38
+
39
+ $ gem install rubygems-datadir
40
+
41
+
42
+ ## Contributing
43
+
44
+ You can check out the current development source with Mercurial via its
45
+ [project page](https://hg.sr.ht/~ged/rubygems-datadir). Or if you prefer Git, via
46
+ [its Github mirror](https://github.com/ged/rubygems-datadir).
47
+
48
+ After checking out the source, run:
49
+
50
+ $ rake setup
51
+
52
+ This task will install dependencies, and do any other necessary setup for development.
53
+
54
+
55
+ ## Authors
56
+
57
+ - Michael Granger <ged@faeriemud.org>
58
+
59
+
60
+ ## License
61
+
62
+ Copyright (c) 2026, Michael Granger
63
+ All rights reserved.
64
+
65
+ Redistribution and use in source and binary forms, with or without
66
+ modification, are permitted provided that the following conditions are met:
67
+
68
+ * Redistributions of source code must retain the above copyright notice,
69
+ this list of conditions and the following disclaimer.
70
+
71
+ * Redistributions in binary form must reproduce the above copyright notice,
72
+ this list of conditions and the following disclaimer in the documentation
73
+ and/or other materials provided with the distribution.
74
+
75
+ * Neither the name of the author/s, nor the names of the project's
76
+ contributors may be used to endorse or promote products derived from this
77
+ software without specific prior written permission.
78
+
79
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
80
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
81
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
82
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
83
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
84
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
85
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
86
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
87
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
88
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
89
+
90
+
@@ -0,0 +1,33 @@
1
+ # -*- ruby -*-
2
+
3
+ # A Refinement for restoring the `datadir` accessor to Gem::Specification, which
4
+ # was deprecated and removed for seemingly no reason.
5
+ module Gem::DataDirRefinements
6
+
7
+ # Package version
8
+ VERSION = '0.0.1'
9
+
10
+
11
+ refine ::Gem.singleton_class do
12
+
13
+ def datadir( gem_name )
14
+ spec = @loaded_specs[ gem_name ]
15
+ return nil if spec.nil?
16
+ return spec.datadir
17
+ end
18
+
19
+ end
20
+
21
+
22
+ refine ::Gem::Specification do
23
+
24
+ def datadir
25
+ base = self.gems_dir
26
+ path = File.join( base, self.full_name, "data", self.name )
27
+ return File.expand_path( path )
28
+ end
29
+
30
+ end
31
+
32
+ end # module Gem::DataDirRefinements
33
+
@@ -0,0 +1,38 @@
1
+ # -*- ruby -*-
2
+
3
+ require_relative '../spec_helper'
4
+
5
+ require 'did_you_mean'
6
+
7
+ require 'rspec'
8
+ require 'rubygems/datadir'
9
+
10
+
11
+ RSpec.describe( Gem::DataDirRefinements, "without using the refinements" ) do
12
+
13
+ it "doesn't affect the Gem namespace" do
14
+ expect {
15
+ Gem.datadir( 'did_you_mean' )
16
+ }.to raise_error( NoMethodError, /undefined method/i )
17
+ end
18
+
19
+
20
+ it "doesn't affect the Gem::Specification namespace", if: :pre_41 do
21
+ spec = Gem.loaded_specs[ 'did_you_mean' ]
22
+ expect( spec ).to be_a( Gem::Specification )
23
+ expect {
24
+ spec.datadir
25
+ }.to output( /deprecated/i ).to_stderr
26
+ end
27
+
28
+
29
+ it "doesn't affect the Gem::Specification namespace", unless: :pre_41 do
30
+ spec = Gem.loaded_specs[ 'did_you_mean' ]
31
+ expect( spec ).to be_a( Gem::Specification )
32
+ expect {
33
+ spec.datadir
34
+ }.to raise_error( NoMethodError, /undefined method/i )
35
+ end
36
+
37
+ end
38
+
@@ -0,0 +1,30 @@
1
+ # -*- ruby -*-
2
+
3
+ require_relative '../spec_helper'
4
+
5
+ require 'did_you_mean'
6
+
7
+ require 'rspec'
8
+ require 'rubygems/datadir'
9
+
10
+ using Gem::DataDirRefinements
11
+
12
+
13
+ RSpec.describe( Gem::DataDirRefinements, "using the refinements" ) do
14
+
15
+ it "restores the top-level datadir method" do
16
+ expect( Gem.datadir('did_you_mean') ).
17
+ to match( %r{did_you_mean-\d+\.\d+\.\d+/data/did_you_mean} )
18
+ end
19
+
20
+
21
+ it "restores the datadir method on Gem::Specifications" do
22
+ spec = Gem.loaded_specs[ 'did_you_mean' ]
23
+ expect( spec ).to be_a( Gem::Specification )
24
+
25
+ expect( spec.datadir ).
26
+ to match( %r{did_you_mean-\d+\.\d+\.\d+/data/did_you_mean} )
27
+ end
28
+
29
+ end
30
+
@@ -0,0 +1,30 @@
1
+ # -*- ruby -*-
2
+
3
+ require 'simplecov' if ENV['COVERAGE']
4
+
5
+ require 'rspec'
6
+
7
+ require 'loggability/spechelpers'
8
+
9
+
10
+ ### Mock with RSpec
11
+ RSpec.configure do |config|
12
+ config.mock_with( :rspec ) do |mock|
13
+ mock.syntax = :expect
14
+ end
15
+
16
+ config.disable_monkey_patching!
17
+ config.example_status_persistence_file_path = "spec/.status"
18
+ config.filter_run :focus
19
+ config.filter_run_when_matching :focus
20
+ if Gem::Version.new( Gem::VERSION ) < Gem::Version.new( '4.1.0' )
21
+ config.filter_run( :pre_41 )
22
+ end
23
+ config.order = :random
24
+ config.profile_examples = 5
25
+ config.run_all_when_everything_filtered = true
26
+ config.shared_context_metadata_behavior = :apply_to_host_groups
27
+ # config.warnings = true
28
+ end
29
+
30
+
data.tar.gz.sig ADDED
Binary file
metadata ADDED
@@ -0,0 +1,94 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rubygems-datadir
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Michael Granger
8
+ bindir: bin
9
+ cert_chain:
10
+ - |
11
+ -----BEGIN CERTIFICATE-----
12
+ MIIEMDCCApigAwIBAgIBAjANBgkqhkiG9w0BAQsFADA+MQwwCgYDVQQDDANnZWQx
13
+ GTAXBgoJkiaJk/IsZAEZFglGYWVyaWVNVUQxEzARBgoJkiaJk/IsZAEZFgNvcmcw
14
+ HhcNMjYwMjAyMjExMjQ0WhcNMjcwMjAyMjExMjQ0WjA+MQwwCgYDVQQDDANnZWQx
15
+ GTAXBgoJkiaJk/IsZAEZFglGYWVyaWVNVUQxEzARBgoJkiaJk/IsZAEZFgNvcmcw
16
+ ggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQC/JWGRHO+USzR97vXjkFgt
17
+ 83qeNf2KHkcvrRTSnR64i6um/ziin0I0oX23H7VYrDJC9A/uoUa5nGRJS5Zw/+wW
18
+ ENcvWVZS4iUzi4dsYJGY6yEOsXh2CcF46+QevV8iE+UmbkU75V7Dy1JCaUOyizEt
19
+ TH5UHsOtUU7k9TYARt/TgYZKuaoAMZZd5qyVqhF1vV+7/Qzmp89NGflXf2xYP26a
20
+ 4MAX2qqKX/FKXqmFO+AGsbwYTEds1mksBF3fGsFgsQWxftG8GfZQ9+Cyu2+l1eOw
21
+ cZ+lPcg834G9DrqW2zhqUoLr1MTly4pqxYGb7XoDhoR7dd1kFE2a067+DzWC/ADt
22
+ +QkcqWUm5oh1fN0eqr7NsZlVJDulFgdiiYPQiIN7UNsii4Wc9aZqBoGcYfBeQNPZ
23
+ soo/6za/bWajOKUmDhpqvaiRv9EDpVLzuj53uDoukMMwxCMfgb04+ckQ0t2G7wqc
24
+ /D+K9JW9DDs3Yjgv9k4h7YMhW5gftosd+NkNC/+Y2CkCAwEAAaM5MDcwCQYDVR0T
25
+ BAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFHKN/nkRusdqCJEuq3lgB3fJvyTg
26
+ MA0GCSqGSIb3DQEBCwUAA4IBgQAQwvsRIJ8FV1bYadOnOg2jcSzZXjt0FVPbOQG9
27
+ eQ9UM7+bTPU0eRCGZuOPrEp8ROc1s5zwZNFv7qHWv/zWWC6sIj4gEnCZkUugK03k
28
+ bYDsSlkyjiQ4ApVV00+h/Vhxcw+RLIZuqy2QFl8YAfMJm+JS8G7SuoqpFjbv3UUF
29
+ vrObIiO7LbhJxpYzTGkGzMFigcnm6vIGMex4AgtArc2RpWOvtAXQrU7CZHUkcdQM
30
+ 4n5eVK+m3IZlD7dd4HoPT2jF2cOGmk8XFclT0GcPVYmEWFFmotN2aiMj4sqVm/Ob
31
+ V+FmyTUy4gVtcNOFO/sBnFRiQW0fxV9/97Dog9ciYesfiAhm4EpcuTmatdAuMrZR
32
+ WBmf+jXIub5S7RBw+m0mk2xhmcSkg1vY5w6IEIhSo2e2gE9rA0rIkZO5wP4sCouE
33
+ XdaRMEnt/AVHUzroBR3CWAz/6ZnDF8GS7EK1bOfM+YWqJL30g7PoxpT+UJTqWJtM
34
+ CCC1LSoBD7OEUiaIMWUo4h7xWIs=
35
+ -----END CERTIFICATE-----
36
+ date: 2026-04-06 00:00:00.000000000 Z
37
+ dependencies:
38
+ - !ruby/object:Gem::Dependency
39
+ name: rake-deveiate
40
+ requirement: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - "~>"
43
+ - !ruby/object:Gem::Version
44
+ version: '0.10'
45
+ type: :development
46
+ prerelease: false
47
+ version_requirements: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - "~>"
50
+ - !ruby/object:Gem::Version
51
+ version: '0.10'
52
+ description: Restores Rubygems datadirs. This is a set of refinements that restore
53
+ the “datadir” functionality of Rubygems, which was deprecated and slated for removal
54
+ in an upcoming (minor) version.
55
+ email:
56
+ - ged@faeriemud.org
57
+ executables: []
58
+ extensions: []
59
+ extra_rdoc_files: []
60
+ files:
61
+ - History.md
62
+ - LICENSE.txt
63
+ - README.md
64
+ - lib/rubygems/datadir.rb
65
+ - spec/rubygems/datadir_nousing_spec.rb
66
+ - spec/rubygems/datadir_using_spec.rb
67
+ - spec/spec_helper.rb
68
+ homepage: https://sr.ht/~ged/rubygems-datadir
69
+ licenses:
70
+ - BSD-3-Clause
71
+ metadata:
72
+ homepage_uri: https://sr.ht/~ged/rubygems-datadir
73
+ documentation_uri: https://deveiate.org/code/rubygems-datadir
74
+ changelog_uri: https://deveiate.org/code/rubygems-datadir/History_md.html
75
+ source_uri: https://hg.sr.ht/~ged/rubygems-datadir
76
+ bug_tracker_uri: https://todo.sr.ht/~ged/rubygems-datadir
77
+ rdoc_options: []
78
+ require_paths:
79
+ - lib
80
+ required_ruby_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ required_rubygems_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ requirements: []
91
+ rubygems_version: 4.0.3
92
+ specification_version: 4
93
+ summary: Restores Rubygems datadirs.
94
+ test_files: []
metadata.gz.sig ADDED
Binary file