-
Notifications
You must be signed in to change notification settings - Fork 440
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
Webri - a new console app for accessing Ruby online HTML docs [expermental] #1213
base: master
Are you sure you want to change the base?
Conversation
@@ -0,0 +1,170 @@ | |||
# frozen_string_literal: true | |||
require 'open-uri' | |||
require 'nokogiri' |
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 don't think we can assume users would have these gems installed?
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.
Agreed (for nokogiri
); I think open-uri
is installed with Ruby. But, better to avoid both.
|
||
def initialize(target_name, options) | ||
release_name = get_release_name(options[:release]) | ||
entries = get_entries(release_name) |
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.
So we'd have sent 2 requests by this point just to get the release and entries list. Considering both of them are rarely changed, I think we may introduce something like rdoc-data used to do that packages all these information into a gem. And a tool like this can simply use it to generate the target url without making additional requests.
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.
On my machine(!), making the two requests is much faster than reading the static RI files.
So a new gem would include the data that this app gathers from the two requests? And thus not need nokogiri? Interesting. But would not have master (though I'm not sure that's a drawback).
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.
The more think about this idea (the gem, already containing the data for each release), the better I like it. Will explore.
Can you explain on this a little? What's problem with |
RI output is often poorly formatted (compared to the corresponding HTML). I'm aware of the HTML online docs, but not of whatever comes from |
I'll look into building a gem that would do this work without the user's needing nokogiri. |
@BurdetteLamar I think parsing of HTML will be too brittle, since any change in rdoc template will potentially break the parsing. Could be |
I think @st0012's suggestion (about a gem) avoids the problem altogether. |
This is seriously experimental, and is best seen as a proof-of-concept.
I have not liked
ri
, so have worked up this app to get at the online docs.