summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosef Šimánek <[email protected]>2020-04-19 17:43:31 +0200
committerHiroshi SHIBATA <[email protected]>2020-05-08 07:38:50 +0900
commit856cbbdd52eaafd27c21a8f4dea7e89373667694 ()
treec9bb3c9574c83d53e3e0fdbbfe6e454e5f57235a
parent4dd46dbad046c0c5902f0217243c3207dbb274b5 (diff)
[rubygems/rubygems] Track removed methods calls and warn during build time.
move rubyforge_project= to removed methods https://.com/rubygems/rubygems/commit/223f7fd470
Notes: Merged: https://.com/ruby/ruby/pull/3087
-rw-r--r--lib/rubygems/specification.rb20
-rw-r--r--lib/rubygems/specification_policy.rb10
-rw-r--r--test/rubygems/test_gem_specification.rb15
3 files changed, 22 insertions, 23 deletions
@@ -6,6 +6,7 @@
# See LICENSE.txt for permissions.
#++
require 'rubygems/version'
require 'rubygems/requirement'
require 'rubygems/platform'
@@ -193,6 +194,12 @@ class Gem::Specification < Gem::BasicSpecification
@@spec_with_requirable_file = {}
@@active_stub_with_requirable_file = {}
######################################################################
# :section: Required gemspec attributes
@@ -728,13 +735,6 @@ class Gem::Specification < Gem::BasicSpecification
attr_writer :original_platform # :nodoc:
##
- # Deprecated via specification policy and ignored during runtime.
- #
- # Formerly used to set rubyforge project.
-
- attr_accessor :rubyforge_project
-
- ##
# The Gem::Specification version of this gemspec.
#
# Do not set this, it is set automatically when the gem is packaged.
@@ -2099,9 +2099,15 @@ class Gem::Specification < Gem::BasicSpecification
end
##
# Warn about unknown attributes while loading a spec.
def method_missing(sym, *a, &b) # :nodoc:
if @specification_version > CURRENT_SPECIFICATION_VERSION and
sym.to_s =~ /=$/
warn "ignoring #{sym} loading #{full_name}" if $DEBUG
@@ -21,8 +21,6 @@ class Gem::SpecificationPolicy
funding_uri
].freeze # :nodoc:
- DEPRECATED_ATTRIBUTES = [:rubyforge_project].freeze #:nodoc:
-
def initialize(specification)
@warnings = 0
@@ -78,7 +76,7 @@ class Gem::SpecificationPolicy
validate_dependencies
- validate_deprecated_attributes
if @warnings > 0
if strict
@@ -413,9 +411,9 @@ 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
@@ -3128,24 +3128,19 @@ 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