Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bypass ERB's Ruby syntax error #573

Merged
merged 1 commit into from
Dec 23, 2017
Merged

Bypass ERB's Ruby syntax error #573

merged 1 commit into from
Dec 23, 2017

Conversation

aycabta
Copy link
Member

@aycabta aycabta commented Dec 23, 2017

The legacy lexical analyzer and parser of RDoc 5 process ERB file with no errors because of complex bug. RDoc 6 what uses Ripper causes errors when processes ERB file. It was just bug fix but RDoc lost
compatibility. For example, when installs ActiveRecord 5.1.4 by gem install activerecord -v 5.1.4, it uses RDoc internal, so the RDoc crashes if it's RDoc 6.0.0.

This commit provides compatibility behavior with RDoc 5 or older. When an exception occurs inside Ruby parser, confirms that the source code contains "<%" and "%>" to detect ERB file. Skips it if RDoc guesses that the file is ERB by the logic.

This closes #571.

The legacy lexical analyzer and parser of RDoc 5 process ERB file with
no errors because of complex bug. RDoc 6 what uses Ripper causes errors
when processes ERB file. It was just bug fix but RDoc lost
compatibility. For example, when installs ActiveRecord 5.1.4 by
"gem install activerecord -v 5.1.4", it uses RDoc internal, so the RDoc
crashes if it's RDoc 6.0.0.

This commit provides compatibility behavior with RDoc 5 or older. When
an exception occurs inside Ruby parser, confirms that the source code
contains "<%" and "%>" to detect ERB file. Skips it if RDoc guesses that
the file is ERB by the logic.
@aycabta aycabta requested a review from hsbt December 23, 2017 13:42
@aycabta
Copy link
Member Author

aycabta commented Dec 23, 2017

@hsbt After merging this, please bring RDoc 6.0.1 to Ruby 2.5...

@hsbt
Copy link
Member

hsbt commented Dec 23, 2017

I confirmed to install activerecord

~/D/g/r/rdoc (aycabta-bypass-erb) > gem i activerecord
Fetching: activerecord-5.1.4.gem (100%)
Successfully installed activerecord-5.1.4
Parsing documentation for activerecord-5.1.4
RDoc detects ERB file. Skips it for compatibility:
lib/rails/generators/active_record/migration/templates/create_table_migration.rb
RDoc detects ERB file. Skips it for compatibility:
lib/rails/generators/active_record/migration/templates/migration.rb
Installing ri documentation for activerecord-5.1.4
Done installing documentation for activerecord after 5 seconds
1 gem installed

@hsbt hsbt merged commit 1ccd1d5 into ruby:master Dec 23, 2017
@aycabta aycabta deleted the bypass-erb branch December 24, 2017 00:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Raise NoMethodError when installing Active Record with Rdoc 6.0.0
2 participants