Guard optional plugin specs and modernize Ruby URI parsing - #142
Merged
Conversation
Validate 3.3, 3.4 and 4.0 in CI instead of 3.3, 3.4 and 3.5, and state the supported range and the continuously validated set as two separate facts: required_ruby_version keeps its lower bound and gains no upper one, so a Ruby outside the matrix is permitted rather than refused. Replace the APIs Ruby 3.4 deprecated with the ones the whole supported range shares, without a RUBY_VERSION branch: URI::Parser#escape, URI.extract and URI::PATTERN answer through the RFC 3986 parser and report themselves obsolete, so URI::RFC2396_Parser is named directly. Stop mutating a string literal in the OPML parser, which Ruby 4.0 warns about. Correct the direction of the HTML parser dependency. Requiring automatic loaded nokogiri through FeedMaker, which never used it, and through FeedParser, where only parse_html does; the dead require is gone and the live one moved into that method, so the framework loads no HTML parser. nokogiri stays a runtime dependency because Supported plugins an installed gem must be able to run need it. nkf and sanitize are each needed by one plugin, so they move to the Gemfile's optional :plugins group, and a dead require of kconv is deleted. Keep the optional group out of the default test path. Its gems are a declared list rather than a discovered load failure, the two specs that need one guard their file with it and say what is not verified, and installing the group runs them as part of the ordinary suite. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XTSJZ48Jhsj9rquWgEvAXA
nkf is a plugin's dependency and is no longer declared as a runtime one, so listing it among the gems the framework requires read as a contradiction. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XTSJZ48Jhsj9rquWgEvAXA
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This change guards specs for plugins with optional gem dependencies behind a conditional check, ensuring they only run when their required gems are installed. It also modernizes URI parsing to use
URI::RFC2396_Parserdirectly instead of the deprecatedURI::Parser, and updates documentation to clarify the distinction between supported Ruby versions and continuously validated versions.Key Changes
FilterSanitizeandFilterDescriptionLinkspecs withif AutomaticSpec.optional_dependency?()guards, since these plugins depend on optional gems (sanitizeandnkf) not installed by defaultOPTIONAL_PLUGIN_GEMSconstant andoptional_dependency?()method toAutomaticSpecto manage optional plugin dependencies, with clear error messages when gems are missingURI::Parser.new.escape()calls withURI::RFC2396_Parser.new.escape()across multiple files (description_link.rb,link.rb,xml.rb,g_guide_spec.rb), which works consistently across all supported Ruby versionsPOLICY.mdthat supported Ruby range (3.3-4.0) and CI-validated versions (3.3, 3.4, 4.0) are separate statementsREQUIREMENTS.mdandREADME.mdto distinguish between supported range and continuously validated versionsBUNDLE_WITH=plugins bundle installDEPLOYMENT.mdandPLUGINS.mdto document optional plugin dependenciesrequire 'nokogiri'statements fromfeed_parser.rbandfeed_maker.rb, and updated string literal inopml.rbto use+''for clarity about mutabilityImplementation Details
The optional dependency system works by:
OPTIONAL_PLUGIN_GEMSlist inspec_helper.rbif AutomaticSpec.optional_dependency?('gem_name')BUNDLE_WITH=plugins bundle installto run all specsThe URI parser change uses
URI::RFC2396_Parser, which is the underlying implementation thatURI::Parserwas reaching, ensuring compatibility across Ruby 3.3-4.0 without version conditionals.https://claude.ai/code/session_01XTSJZ48Jhsj9rquWgEvAXA