summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Berger <dberger@redhat.com>2019-07-11 09:20:43 -0400
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2019-09-26 17:48:00 +0900
commit8436b2717c458a554dd81456a8e6e030e2c3e038 (patch)
treeaef62ef899f28d7cd768489f0fc25ca76d1d1ca9
parent6ffc045a817fbdf04a6945d3c260b55b0fa1fd1e (diff)
[rubygems/rubygems] Add a gem attr to the Gem::Package class.
https://github.com/rubygems/rubygems/commit/5b81f364ae
-rw-r--r--lib/rubygems/package.rb5
-rw-r--r--test/rubygems/test_gem_package.rb5
2 files changed, 10 insertions, 0 deletions
diff --git a/lib/rubygems/package.rb b/lib/rubygems/package.rb
index 49cdf98b310..16cda5affec 100644
--- a/lib/rubygems/package.rb
+++ b/lib/rubygems/package.rb
@@ -100,6 +100,11 @@ class Gem::Package
attr_reader :files
##
+ # Reference to the gem being packaged.
+
+ attr_reader :gem
+
+ ##
# The security policy used for verifying the contents of this package.
attr_accessor :security_policy
diff --git a/test/rubygems/test_gem_package.rb b/test/rubygems/test_gem_package.rb
index e07304e9a5e..f2f712ebe0b 100644
--- a/test/rubygems/test_gem_package.rb
+++ b/test/rubygems/test_gem_package.rb
@@ -1093,6 +1093,11 @@ class TestGemPackage < Gem::Package::TarTestCase
assert_equal @spec, package.spec
end
+ def test_gem_attr
+ package = Gem::Package.new(@gem)
+ assert_equal(package.gem, @gem)
+ end
+
def test_spec_from_io
# This functionality is used by rubygems.org to extract spec data from an
# uploaded gem before it is written to storage.