basho/rebar — pull request #288 by efine (2012-08-05 23:44:08+00:00)
Title: Fix edoc target so that it regens if overview.edoc changes.

Previously, rebar_edoc checked to see if any of the .erl files in the src directory were newer than the edoc-info file. If any of them were newer, it did a complete regen. This did not take into account the overview.edoc file. If the overview.edoc file changed, rebar doc did not regenerate the docs, which is incorrect.

I added a check to compare the overview file's timestamp against the edoc-info file. I refactored the existing code because it was getting too cluttered with the additions I made, and pulled most of the code out into a new function, needs_regen/1.

I also changed the way the exception was thrown and caught so that it now communicates the name and timestamp of the modified file that caused the regen. This is information that is shown in the debug statement, so is very important for debugging. The refactoring also allowed me to use the same logic to check that the overview file had changed and to check that any of the source files had changed.