diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9a3e5674..a3b6ca10 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,14 +9,21 @@ permissions: jobs: build: - name: "Test / Ruby ${{ matrix.ruby }}" + name: "Test / Ruby ${{ matrix.ruby }} / RDoc ${{ matrix.rdoc }}" runs-on: ubuntu-latest + env: + RDOC_VERSION: "~> ${{ matrix.rdoc }}" strategy: matrix: + rdoc: + - "7.2.0" ruby: - "3.3" - "3.4" - "4.0" + include: + - ruby: "4.0" + rdoc: "8.0" fail-fast: false steps: @@ -28,7 +35,11 @@ jobs: - uses: ruby/setup-ruby@a0102e0972be65f351c307e2d64b9314a57c8073 # v1 with: ruby-version: ${{ matrix.ruby }} - bundler-cache: true + bundler-cache: ${{ matrix.rdoc == '7.2.0' }} + + - name: Install RDoc 8 dependencies + if: matrix.rdoc == '8.0' + run: bundle update rdoc - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 with: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2c83e31e..9e2b9886 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -37,6 +37,11 @@ To run the tests: If nothing complains, congratulations! +CI tests RDoc 7.2 and 8.x. To test RDoc 8.x locally: + + $ RDOC_VERSION='~> 8.0' bundle update rdoc + $ RDOC_VERSION='~> 8.0' bundle exec rake + ## Releasing a new version If you are the current maintainer of this gem: diff --git a/Gemfile b/Gemfile index 6bb9fcb8..c111f6f1 100644 --- a/Gemfile +++ b/Gemfile @@ -5,7 +5,7 @@ gem "redcarpet", :platforms => :ruby gem "kramdown", :platforms => :jruby gem "RedCloth" gem "commonmarker", "~> 2.8.2" -gem "rdoc", "~> 7.2.0" +gem "rdoc", ENV.fetch("RDOC_VERSION", "~> 7.2.0") gem "org-ruby", "0.9.12" gem "creole", "~>0.5.0" gem "wikicloth", "=0.8.3" diff --git a/Gemfile.lock b/Gemfile.lock index f255b9c3..77cc42a8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,7 +2,7 @@ PATH remote: . specs: github-markup (6.0.0) - rdoc (< 8) + rdoc (< 9) GEM remote: https://rubygems.org/ diff --git a/README.md b/README.md index 12188dcb..018f54cc 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ you wish to run the library. You can also run `script/bootstrap` to fetch them a * [.markdown, .mdown, .mkdn, .md](http://daringfireball.net/projects/markdown/) -- `gem install commonmarker` (https://github.com/gjtorikian/commonmarker) * [.textile](https://textile-lang.com/) -- `gem install RedCloth` (https://github.com/jgarber/redcloth) -* [.rdoc](https://ruby.github.io/rdoc/) -- `gem install rdoc -v 3.6.1` +* [.rdoc](https://ruby.github.io/rdoc/) -- `gem install rdoc` * [.org](http://orgmode.org/) -- `gem install org-ruby` (https://github.com/wallyqs/org-ruby) * [.creole](http://wikicreole.org/) -- `gem install creole` (https://github.com/larsch/creole) * [.mediawiki, .wiki](http://www.mediawiki.org/wiki/Help:Formatting) -- `gem install wikicloth` (https://github.com/nricciar/wikicloth) diff --git a/github-markup.gemspec b/github-markup.gemspec index 19d55653..1e6bd6ea 100644 --- a/github-markup.gemspec +++ b/github-markup.gemspec @@ -23,7 +23,7 @@ Gem::Specification.new do |s| s.test_files = s.files.grep(%r{^(test|spec|features)/}) s.require_paths = %w[lib] - s.add_dependency 'rdoc', '< 8' + s.add_dependency 'rdoc', '< 9' s.add_development_dependency 'rake', '~> 13' s.add_development_dependency 'activesupport', '~> 8.1.3' diff --git a/lib/github/markup/rdoc.rb b/lib/github/markup/rdoc.rb index 3ac25151..e3258e74 100644 --- a/lib/github/markup/rdoc.rb +++ b/lib/github/markup/rdoc.rb @@ -10,13 +10,15 @@ def initialize end def render(filename, content, options: {}) - if ::RDoc::VERSION.to_i >= 4 + # RDoc 4-7 require positional Options; RDoc 8 uses keyword options. + # Each run covers only the installed RDoc's branch; CI tests both. + # :nocov: + if (4...8).cover?(::RDoc::VERSION.to_i) h = ::RDoc::Markup::ToHtml.new(::RDoc::Options.new) else - # :nocov: RDoc < 4 has been unsupported since Ruby 2.4 (2016); modern RDoc requires Options. h = ::RDoc::Markup::ToHtml.new - # :nocov: end + # :nocov: h.convert(content) end diff --git a/test/coverage_test.rb b/test/coverage_test.rb index f5043b5d..c971d67d 100644 --- a/test/coverage_test.rb +++ b/test/coverage_test.rb @@ -94,11 +94,6 @@ def test_try_require_returns_false_for_missing_gem refute md.send(:try_require, "github_markup_definitely_not_a_real_gem_#{Time.now.to_i}") end - # --- rdoc.rb legacy version branch -------------------------------------- - # The `RDoc::VERSION < 4` branch in rdoc.rb is marked :nocov: in source - # because the modern RDoc::Markup::ToHtml constructor requires Options - # and the legacy zero-arg form has been broken since RDoc 4 (2013). - # --- implementation.rb default render and Linguist-less match? --------- def test_base_implementation_render_raises_not_implemented_error