From f1c0b6d2fdfeb57838653c2bb76213f0ea8b85b8 Mon Sep 17 00:00:00 2001 From: Stan Lo Date: Wed, 31 Jul 2024 21:53:39 +0100 Subject: [PATCH 1/4] Print warning message when using Prism Ruby parser --- lib/rdoc/parser/ruby.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/rdoc/parser/ruby.rb b/lib/rdoc/parser/ruby.rb index 1e3b401a5d..909b02d2af 100644 --- a/lib/rdoc/parser/ruby.rb +++ b/lib/rdoc/parser/ruby.rb @@ -11,6 +11,9 @@ if ENV['RDOC_USE_PRISM_PARSER'] require 'rdoc/parser/prism_ruby' RDoc::Parser.const_set(:Ruby, RDoc::Parser::PrismRuby) + puts "=========================================================================" + puts "RDoc is using the experimental Prism parser to generate the documentation" + puts "=========================================================================" return end From bbbc43a0049bf100e085b27449101ce34d7416b3 Mon Sep 17 00:00:00 2001 From: Stan Lo Date: Wed, 31 Jul 2024 21:53:53 +0100 Subject: [PATCH 2/4] Run all tests with Prism Ruby parser on CI --- .github/workflows/test.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 72fa2b42bf..d28f5844c5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -43,6 +43,11 @@ jobs: run: bundle exec rake env: RUBYOPT: --enable-frozen_string_literal + - name: Run test with Prism parser + run: bundle exec rake + env: + RUBYOPT: --enable-frozen_string_literal + RDOC_USE_PRISM_PARSER: true - if: ${{ matrix.ruby == 'head' && startsWith(matrix.os, 'ubuntu') }} run: bundle exec rake rdoc lint: From e54e2ee5e0cf2b4397f6e51953cb303c86b11845 Mon Sep 17 00:00:00 2001 From: Stan Lo Date: Wed, 31 Jul 2024 22:03:44 +0100 Subject: [PATCH 3/4] Run CI with Ruby 3.0 too --- .github/workflows/test.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d28f5844c5..c0d8e86c9e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,6 +8,9 @@ permissions: # added using https://github.com/step-security/secure-workflows jobs: ruby-versions: uses: ruby/actions/.github/workflows/ruby_versions.yml@master + with: + # 2.7 breaks `test_parse_statements_nodoc_identifier_alias_method` + min_version: 3.0 test: needs: ruby-versions From 65ce9405da99dfaa7e1bcdab91a178076c596e24 Mon Sep 17 00:00:00 2001 From: Stan Lo Date: Thu, 1 Aug 2024 11:40:22 +0100 Subject: [PATCH 4/4] Make prism dependency optional --- Gemfile | 1 + rdoc.gemspec | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index df26e09887..8435662441 100644 --- a/Gemfile +++ b/Gemfile @@ -10,4 +10,5 @@ group :development do gem 'test-unit-ruby-core' gem 'rubocop', '>= 1.31.0' gem 'gettext' + gem 'prism', '>= 0.30.0' end diff --git a/rdoc.gemspec b/rdoc.gemspec index e3ceea9e0a..93a281c8ae 100644 --- a/rdoc.gemspec +++ b/rdoc.gemspec @@ -230,9 +230,8 @@ RDoc includes the +rdoc+ and +ri+ tools for generating and displaying documentat s.rdoc_options = ["--main", "README.rdoc"] s.extra_rdoc_files += s.files.grep(%r[\A[^\/]+\.(?:rdoc|md)\z]) - s.required_ruby_version = Gem::Requirement.new(">= 2.7.0") + s.required_ruby_version = Gem::Requirement.new(">= 2.6.0") s.required_rubygems_version = Gem::Requirement.new(">= 2.2") - s.add_dependency 'prism', '>= 0.30.0' s.add_dependency 'psych', '>= 4.0.0' end