Skip to content

Commit 9d36593

Browse files
authored
Follow up changes for Prism Ruby parser (#1145)
* Print warning message when using Prism Ruby parser * Run all tests with Prism Ruby parser on CI * Run CI with Ruby 3.0 too * Make prism dependency optional
1 parent fde99f1 commit 9d36593

File tree

4 files changed

+13
-2
lines changed

4 files changed

+13
-2
lines changed

.github/workflows/test.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ permissions: # added using https://github.com/step-security/secure-workflows
88
jobs:
99
ruby-versions:
1010
uses: ruby/actions/.github/workflows/ruby_versions.yml@master
11+
with:
12+
# 2.7 breaks `test_parse_statements_nodoc_identifier_alias_method`
13+
min_version: 3.0
1114

1215
test:
1316
needs: ruby-versions
@@ -43,6 +46,11 @@ jobs:
4346
run: bundle exec rake
4447
env:
4548
RUBYOPT: --enable-frozen_string_literal
49+
- name: Run test with Prism parser
50+
run: bundle exec rake
51+
env:
52+
RUBYOPT: --enable-frozen_string_literal
53+
RDOC_USE_PRISM_PARSER: true
4654
- if: ${{ matrix.ruby == 'head' && startsWith(matrix.os, 'ubuntu') }}
4755
run: bundle exec rake rdoc
4856
lint:

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ group :development do
1010
gem 'test-unit-ruby-core'
1111
gem 'rubocop', '>= 1.31.0'
1212
gem 'gettext'
13+
gem 'prism', '>= 0.30.0'
1314
end

lib/rdoc/parser/ruby.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
if ENV['RDOC_USE_PRISM_PARSER']
1212
require 'rdoc/parser/prism_ruby'
1313
RDoc::Parser.const_set(:Ruby, RDoc::Parser::PrismRuby)
14+
puts "========================================================================="
15+
puts "RDoc is using the experimental Prism parser to generate the documentation"
16+
puts "========================================================================="
1417
return
1518
end
1619

rdoc.gemspec

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,8 @@ RDoc includes the +rdoc+ and +ri+ tools for generating and displaying documentat
230230
s.rdoc_options = ["--main", "README.rdoc"]
231231
s.extra_rdoc_files += s.files.grep(%r[\A[^\/]+\.(?:rdoc|md)\z])
232232

233-
s.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
233+
s.required_ruby_version = Gem::Requirement.new(">= 2.6.0")
234234
s.required_rubygems_version = Gem::Requirement.new(">= 2.2")
235235

236-
s.add_dependency 'prism', '>= 0.30.0'
237236
s.add_dependency 'psych', '>= 4.0.0'
238237
end

0 commit comments

Comments
 (0)