bake/modernize/gemspec.rb in bake-modernize-0.16.2 vs bake/modernize/gemspec.rb in bake-modernize-0.17.0
- old
+ new
@@ -11,10 +11,14 @@
update(path: path, output: buffer)
File.write(path, buffer.string)
end
+# The latest end-of-life Ruby version.
+LATEST_END_OF_LIFE_RUBY = ::Gem::Version.new("2.7")
+MINIMUM_RUBY_VERSION = ::Gem::Requirement.new(">= 3.0")
+
# Rewrite the specified gemspec.
# @param
def update(path: default_gemspec_path, output: $stdout)
spec = ::Gem::Specification.load(path)
@@ -84,13 +88,20 @@
output.puts "\tspec.extensions = #{extensions.inspect}"
end
if required_ruby_version = spec.required_ruby_version
unless required_ruby_version.none?
+ if required_ruby_version.satisfied_by?(LATEST_END_OF_LIFE_RUBY)
+ Console.logger.warn(self, "Required Ruby version #{required_ruby_version} is end-of-life!")
+ end
+
output.puts "\t"
output.puts "\tspec.required_ruby_version = #{required_ruby_version.to_s.inspect}"
end
+ else
+ output.puts "\t"
+ output.puts "\tspec.required_ruby_version = #{MINIMUM_RUBY_VERSION.to_s.dump}"
end
if spec.runtime_dependencies.any?
output.puts "\t"
spec.runtime_dependencies.sort.each do |dependency|
@@ -172,11 +183,12 @@
def valid_uri?(uri)
Sync do
internet = Async::HTTP::Internet.new
response = internet.head(uri)
+ response.close
- next response.success?
+ response.success?
end
end
GITHUB_PROJECT = /github.com\/(?<account>.*?)\/(?<project>.*?)\/?/