def start
require 'tempfile'
self.setup_diffs
old_contents = {}
Nanoc::NotificationCenter.on(:will_write_rep) do |rep, snapshot|
path = rep.raw_path(:snapshot => snapshot)
old_contents[rep] = File.file?(path) ? File.read(path) : nil
end
Nanoc::NotificationCenter.on(:rep_written) do |rep, path, is_created, is_modified|
if !rep.binary?
new_contents = File.file?(path) ? File.read(path) : nil
if old_contents[rep] && new_contents
generate_diff_for(rep, old_contents[rep], new_contents)
end
old_contents.delete(rep)
end
end
end