bake/modernize/gemspec.rb in bake-modernize-0.17.6 vs bake/modernize/gemspec.rb in bake-modernize-0.17.7

- old
+ new

@@ -12,11 +12,10 @@ 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) @@ -24,11 +23,11 @@ root = File.dirname(path) version_path = version_path(root) constant = File.read(version_path) - .scan(/module\s+(.*?)$/) + .scan(/(class|module)\s+(.*?)$/) .flatten .join("::") spec.metadata["funding_uri"] ||= detect_funding_uri(spec) spec.metadata["documentation_uri"] ||= detect_documentation_uri(spec) @@ -86,30 +85,22 @@ if extensions = spec.extensions and extensions.any? output.puts "\t" 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 + # Update the required Ruby version: + output.puts "\t" + output.puts "\tspec.required_ruby_version = #{MINIMUM_RUBY_VERSION.to_s.dump}" + # Update the required Rubygems version: if spec.runtime_dependencies.any? output.puts "\t" spec.runtime_dependencies.sort.each do |dependency| output.puts "\tspec.add_dependency #{format_dependency(dependency)}" end end + # Try to move development dependencies to `gems.rb`: if spec.development_dependencies.any? unless move_development_dependencies(spec.development_dependencies) output.puts "\t" spec.development_dependencies.sort.each do |dependency| output.puts "\tspec.add_development_dependency #{format_dependency(dependency)}"