Skip to content

Adjust Rails docs logging #338

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

Merged
merged 1 commit into from
Apr 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,18 +66,22 @@ def generate_rails_document_urls(name)
private def build_search_index
return unless RAILTIES_VERSION

$stderr.puts("Fetching Rails Documents...")
$stderr.puts("Fetching search index for Rails documentation")

response = Net::HTTP.get_response(URI("#{RAILS_DOC_HOST}/v#{RAILTIES_VERSION}/js/search_index.js"))

body = case response
when Net::HTTPSuccess
$stderr.puts("Finished fetching search index for Rails documentation")
response.body
when Net::HTTPRedirection
# If the version's doc is not found, e.g. Rails main, it'll be redirected
# In this case, we just fetch the latest doc
response = Net::HTTP.get_response(URI("#{RAILS_DOC_HOST}/js/search_index.js"))
response.body if response.is_a?(Net::HTTPSuccess)
if response.is_a?(Net::HTTPSuccess)
$stderr.puts("Finished fetching search index for Rails documentation")
response.body
end
else
$stderr.puts("Response failed: #{response.inspect}")
nil
Expand Down