-
Notifications
You must be signed in to change notification settings - Fork 438
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
Basic server mode support #1151
base: master
Are you sure you want to change the base?
Conversation
0435544
to
27a8909
Compare
opt.on( | ||
"--server[=PORT]", | ||
Integer, | ||
"[Experimental] Run WEBrick server with generated documentation.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel we can remove the [Experiment]
flag, we're not shipping something we're not expecting will work or introduce any breaking changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My interpretation of "experimental" is: the feature works but may not live up to expectation at the moment and has a slight chance to be removed if it's proven problematic.
In this case, I don't expect it to be removed later but it doesn't have the maturity to work like yard server
or some static site generators' server mode.
lib/rdoc/rdoc.rb
Outdated
end | ||
|
||
# Change the output directory to tmp so it doesn't overwrite the current documentation | ||
Dir.chdir "tmp" do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed this in Slack. Let's look at utilizing mktmpdir
instead of $CWD/test
This class is used as a server for the ri command, not as a rdoc server. So putting it under RDoc::RI will make its purpose clearer.
Co-authored-by: Colby Swandale <996377+colby-swandale@users.noreply.github.com>
@generator.update_data_from_store | ||
|
||
# Regenerate the documentation and asserts | ||
@generator.generate(server_mode: true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Through implementing this feature I learned a lot about how data are passed around, which sometimes simply duplicate in multiple classes. And I plan to do some refactor around them.
Currently,
rdoc
doesn't support server mode, which makes both using it and developing it extremely inconvenient.(
ri --server
is RI's web interface, which lets users read indexed RI documents in the browser. It does NOT run current project's RDoc documentation in server mode. To avoid confusion, I movedRDoc::Servlet
toRDoc::RI::Servlet
.)So in this PR, I want to introduce a very rough server support to RDoc:
rdoc --server
orrdoc -s
4000
but can be assigned with--port=PORT
rdoc
orrake rdoc
repeatedly