Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions docs/file-scrapers.md
Original file line number Diff line number Diff line change
Expand Up @@ -272,13 +272,13 @@ cp -r minitest/docs $DEVDOCS/docs/minitest
```

### Ruby on Rails
* Download a release at https://github.com/rails/rails/releases or clone https://github.com/rails/rails.git (checkout to the branch of the rails' version that is going to be scraped)
* Run `git clone --branch v$RELEASE --depth 7 https://github.com/rails/rails.git && cd rails`
* Open `railties/lib/rails/api/task.rb` and comment out any code related to sdoc (`configure_sdoc`)
* Run `bundle config set --local without 'db job'` (in the Rails directory)
* Run `bundle install && bundle exec rake rdoc` (in the Rails directory)
* Run `cd guides && bundle exec rake guides:generate:html && cd ..`
* Run `cp -r guides/output html/guides`
* Run `cp -r html $DEVDOCS/docs/rails~[version]`
* Run `cp -r html $DEVDOCS/docs/rails~$VERSION`

### Ruby
Download the tarball of Ruby from https://www.ruby-lang.org/en/downloads/, extract it, run
Expand Down
7 changes: 5 additions & 2 deletions lib/docs/filters/rdoc/clean_html.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,18 @@ def other
link_node.content = 'Show source'
link_node['class'] = 'method-click-advice'

node.parent.parent.at_css('.method-heading').add_child(link_node)
# Only add "Show source" if source is present
method_root = node.ancestors('.method-detail').first
method_root.at_css('.method-heading').add_child(link_node) if method_root.at_css('.method-source-code')
end

# (RDoc for Ruby 3.4+) Remove the additional "Source" toggle from the page
css('.method-controls').remove

# Add class to differentiate Ruby code from C code
css('.method-source-code').each do |node|
node.parent.prepend_child(node)
header = node.ancestors('.method-detail').first.at_css('.method-header')
header.add_next_sibling(node)
pre = node.at_css('pre')
pre['class'] = pre.at_css('.ruby-keyword') ? 'ruby' : 'c'
end
Expand Down
4 changes: 4 additions & 0 deletions lib/docs/scrapers/rdoc/rails.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ class Rails < Rdoc
end
end

version '8.1' do
self.release = '8.1.2'
end

version '8.0' do
self.release = '8.0.1'
end
Expand Down
Loading