1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Speed up RDoc generation when it's already been done once

Only include files that contain changes since the last generation
of the API documentation.

Thus, only modified files are re-generated instead of the whole API.

The `created.rid` file won't contain the whole list of files anymore
if we generate several times the API but we don't really care about it,
only the generation date and time is important.

It is possible to fall back to the previous behavior by defining the ALL
environment variable running the `rake rdoc` task.
This commit is contained in:
Robin Dupret 2016-07-04 23:37:26 +02:00
parent 1c7cbe8da6
commit 9e99649e7e

View file

@ -121,6 +121,19 @@ module Rails
rdoc_files.exclude("#{cdr}/#{pattern}")
end
end
# Only generate documentation for files that have been
# changed since the API was generated.
if Dir.exist?('doc/rdoc') && !ENV['ALL']
last_generation = DateTime.rfc2822(File.open('doc/rdoc/created.rid', &:readline))
rdoc_files.keep_if do |file|
File.mtime(file).to_datetime > last_generation
end
# Nothing to do
exit(0) if rdoc_files.empty?
end
end
def setup_horo_variables