1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[rubygems/rubygems] Deprecate rubyforge_project attribute only during build time.

https://github.com/rubygems/rubygems/commit/c44eb21648
This commit is contained in:
Josef Šimánek 2020-04-10 18:58:04 +02:00 committed by Hiroshi SHIBATA
parent 60cafe8ea9
commit 4dd46dbad0
Notes: git 2020-05-08 07:39:26 +09:00
3 changed files with 32 additions and 3 deletions

View file

@ -728,12 +728,11 @@ class Gem::Specification < Gem::BasicSpecification
attr_writer :original_platform # :nodoc:
##
# Deprecated and ignored.
# Deprecated via specification policy and ignored during runtime.
#
# Formerly used to set rubyforge project.
attr_writer :rubyforge_project
rubygems_deprecate :rubyforge_project=
attr_accessor :rubyforge_project
##
# The Gem::Specification version of this gemspec.

View file

@ -21,6 +21,8 @@ class Gem::SpecificationPolicy
funding_uri
].freeze # :nodoc:
DEPRECATED_ATTRIBUTES = [:rubyforge_project].freeze #:nodoc:
def initialize(specification)
@warnings = 0
@ -76,6 +78,8 @@ class Gem::SpecificationPolicy
validate_dependencies
validate_deprecated_attributes
if @warnings > 0
if strict
error "specification has warnings"
@ -409,6 +413,12 @@ http://spdx.org/licenses or '#{Gem::Licenses::NONSTANDARD}' for a nonstandard li
warning "#{executable_path} is missing #! line"
end
def validate_deprecated_attributes # :nodoc:
DEPRECATED_ATTRIBUTES.each do |attr|
warning("#{attr} is deprecated") unless @specification.send(attr).nil?
end
end
def warning(statement) # :nodoc:
@warnings += 1

View file

@ -3128,6 +3128,26 @@ http://spdx.org/licenses or 'Nonstandard' for a nonstandard license.
warning
end
def test_deprecated_attributes
assert_equal Gem::SpecificationPolicy::DEPRECATED_ATTRIBUTES, [:rubyforge_project]
end
def test_validate_deprecated_attributes
util_setup_validate
use_ui @ui do
Gem::SpecificationPolicy::DEPRECATED_ATTRIBUTES.each do |attr|
@a1.send("#{attr}=", 'invalid-attribute')
end
@a1.validate
end
Gem::SpecificationPolicy::DEPRECATED_ATTRIBUTES.each do |attr|
assert_match "#{attr} is deprecated", @ui.error
end
end
def test_validate_license_values
util_setup_validate