Skip to content

Commit 8a45223

Browse files
authored
Merge pull request rails#52224 from Earlopain/rake-rdoc-abort
Fix `rake rdoc` when the timestamp file is empty
2 parents 999df68 + 540103c commit 8a45223

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)