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:
parent
1c7cbe8da6
commit
9e99649e7e
1 changed files with 13 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue