[rubygems/rubygems] Deprecate rubyforge_project attribute only during build time.
https://github.com/rubygems/rubygems/commit/c44eb21648
This commit is contained in:
parent
60cafe8ea9
commit
4dd46dbad0
Notes:
git
2020-05-08 07:39:26 +09:00
@ -728,12 +728,11 @@ class Gem::Specification < Gem::BasicSpecification
|
|||||||
attr_writer :original_platform # :nodoc:
|
attr_writer :original_platform # :nodoc:
|
||||||
|
|
||||||
##
|
##
|
||||||
# Deprecated and ignored.
|
# Deprecated via specification policy and ignored during runtime.
|
||||||
#
|
#
|
||||||
# Formerly used to set rubyforge project.
|
# Formerly used to set rubyforge project.
|
||||||
|
|
||||||
attr_writer :rubyforge_project
|
attr_accessor :rubyforge_project
|
||||||
rubygems_deprecate :rubyforge_project=
|
|
||||||
|
|
||||||
##
|
##
|
||||||
# The Gem::Specification version of this gemspec.
|
# The Gem::Specification version of this gemspec.
|
||||||
|
@ -21,6 +21,8 @@ class Gem::SpecificationPolicy
|
|||||||
funding_uri
|
funding_uri
|
||||||
].freeze # :nodoc:
|
].freeze # :nodoc:
|
||||||
|
|
||||||
|
DEPRECATED_ATTRIBUTES = [:rubyforge_project].freeze #:nodoc:
|
||||||
|
|
||||||
def initialize(specification)
|
def initialize(specification)
|
||||||
@warnings = 0
|
@warnings = 0
|
||||||
|
|
||||||
@ -76,6 +78,8 @@ class Gem::SpecificationPolicy
|
|||||||
|
|
||||||
validate_dependencies
|
validate_dependencies
|
||||||
|
|
||||||
|
validate_deprecated_attributes
|
||||||
|
|
||||||
if @warnings > 0
|
if @warnings > 0
|
||||||
if strict
|
if strict
|
||||||
error "specification has warnings"
|
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"
|
warning "#{executable_path} is missing #! line"
|
||||||
end
|
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:
|
def warning(statement) # :nodoc:
|
||||||
@warnings += 1
|
@warnings += 1
|
||||||
|
|
||||||
|
@ -3128,6 +3128,26 @@ http://spdx.org/licenses or 'Nonstandard' for a nonstandard license.
|
|||||||
warning
|
warning
|
||||||
end
|
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
|
def test_validate_license_values
|
||||||
util_setup_validate
|
util_setup_validate
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user