summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJosef Šimánek <josef.simanek@gmail.com>2021-10-25 02:47:04 +0200
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2024-02-27 12:33:45 +0900
commitbfb2dc8acfd7d7c825b7ba0f1eb50ec92631362c (patch)
treef2754f5eee41a7b332d62c896f0c13516f53df49 /lib
parent1745dd2691556a8c13e93f22001ae79b0b5046c5 (diff)
[rubygems/rubygems] Warn on empty or open required_ruby_version specification attribute.
https://github.com/rubygems/rubygems/commit/e4bb33747a
Diffstat (limited to 'lib')
-rw-r--r--lib/rubygems/specification_policy.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/rubygems/specification_policy.rb b/lib/rubygems/specification_policy.rb
index 27c2681533..516c26f53c 100644
--- a/lib/rubygems/specification_policy.rb
+++ b/lib/rubygems/specification_policy.rb
@@ -103,6 +103,8 @@ class Gem::SpecificationPolicy
validate_dependencies
+ validate_required_ruby_version
+
validate_extensions
validate_removed_attributes
@@ -227,6 +229,12 @@ duplicate dependency on #{dep}, (#{prev.requirement}) use:
end
end
+ def validate_required_ruby_version
+ if @specification.required_ruby_version.requirements == [Gem::Requirement::DefaultRequirement]
+ warning "make sure you specify the oldest ruby version constraint (like \">= 3.0\") that you want your gem to support by setting the `required_ruby_version` gemspec attribute"
+ end
+ end
+
##
# Issues a warning for each file to be packaged which is world-readable.
#