Skip to content

Commit 540103c

Browse files
committed
Fix rake rdoc when the timestamp file is empty
This happens when rdoc fails during generation as the timestamp is only written on successful attemps. The file is created anyways though
1 parent de4d874 commit 540103c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

railties/lib/rails/api/task.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,9 @@ def configure_rdoc_files
160160

161161
# Only generate documentation for files that have been
162162
# changed since the API was generated.
163-
if Dir.exist?(api_dir) && !ENV["ALL"]
164-
last_generation = DateTime.rfc2822(File.open("#{api_dir}/created.rid", &:readline))
163+
timestamp_path = "#{api_dir}/created.rid"
164+
if File.exist?(timestamp_path) && !File.zero?(timestamp_path) && !ENV["ALL"]
165+
last_generation = DateTime.rfc2822(File.open(timestamp_path, &:readline))
165166

166167
rdoc_files.keep_if do |file|
167168
File.mtime(file).to_datetime > last_generation

0 commit comments

Comments
 (0)