Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Use Ripper for lexical analyser #512
I replaced legacy lexical analyser from IRB with Ripper what is standard library of Ruby. It's important to support new syntax.
I explain what this code can parse Ruby code with checking diff for all Ruby documents and all Rails documents.
Checkout each branches
mkdir test-for-rdoc cd test-for-rdoc git clone -b master --single-branch email@example.com:ruby/rdoc.git original-rdoc cd original-rdoc git checkout 0c5eb20 # This is HEAD of master as of now bundle cd .. git clone -b use-ripper --single-branch firstname.lastname@example.org:aycabta/rdoc.git ripper-rdoc cd ripper-rdoc git checkout 23f12c1 # This is HEAD of use-ripper branch as of now bundle cd .. git clone -b trunk --single-branch email@example.com:ruby/ruby.git cd ruby git checkout d68a6b3 cd .. git clone -b master --single-branch firstname.lastname@example.org:rails/rails.git cd rails git checkout 665ac7c cd ..
Generate CRuby documents
ruby -Ioriginal-rdoc/lib original-rdoc/exe/rdoc -o ruby-doc-original ruby ruby -Iripper-rdoc/lib ripper-rdoc/exe/rdoc -https://github.com/zzak/sdoc/pull/112o ruby-doc-ripper ruby
Generate Rails documents
cd rials # Tha patch below for removing monkey patch (https://github.com/zzak/sdoc/pull/112) and, # using suitable variable (https://github.com/zzak/sdoc/pull/113) with # suitable behavior of RDoc (https://github.com/ruby/rdoc/pull/502) curl -fsSL https://gist.githubusercontent.com/aycabta/1d4eac210d3ede1b91a520804499a457/raw/ca90a8ce8fe3089a1d45629a01550012b2be46e1/sdoc.diff | patch -p1 bundle update RUBYOPT=-I../original-rdoc/lib bundle exec rake rdoc mv doc/rdoc ../rails-doc-original RUBYOPT=-I../ripper-rdoc/lib bundle exec rake rdoc mv doc/rdoc ../rails-doc-ripper cd ..
diff -ru --exclude "*.js" --exclude "*.gz" --exclude "*.css" --exclude "*.png" --exclude "*.gif" --exclude "*.ttf" rails-doc-original rails-doc-ripper | less
diff -ru --exclude "*.js" --exclude "*.gz" --exclude "*.css" --exclude "*.png" --exclude "*.gif" --exclude "*.ttf" ruby-doc-original ruby-doc-ripper | less
Explanation of remaining differences
These are unnecessary to fix.
@zzak: I want to join SDoc collaborators and RubyGems owners for fix some trouble in the future, and it's just an aside, let's talk about some documentations in the future.
@amatsuda and/or other Rails committers: This SDoc problem is so severe for replacement lexical analyser with Ripper because RDoc crashes with this Pull Request certainly until now, especially about this monkey patch. I think that Rails should use original SDoc as new version.
I wrote doctest.sh for checking diff between original RDoc and Ripper version RDoc of specified GitHub repository.
$ git clone email@example.com:24a122ba798337cc3b9a7bfb32fc28f4.git doctest $ cd doctest $ ./doctest.sh Usage: ./doctest.sh username/repository $ ./doctest.sh ruby/ruby # run diff command with less command
Awesome work @aycabta !
Rails is currently pointing to a fork of SDoc because the API site relies on unreleased changed and we are waiting for 1.0.0 final to be cut before updating the Gemfile but no worries, this is temporary.
By the way, the generation time is reduced by ~10s in the Rails repository with this patch ; great ! As you mentioned earlier, the outputs aren't exactly the same but apart from different code highlighting, everything seems fine regarding Rails.
OK, I understand what is going on.
Thank you, I think that this Pull Request is practically settled.
This was referenced
Sep 10, 2017
I confirmed that differences of rdoc documents generated old-rdoc and ripper version. I didn't find another difference without
I approved to merge this pull request and release 6.0.0.beta2 before RubyKaigi 2017.
@aycabta How do you think about this release?