Skip to content

Commit

Permalink
Merge branch 'release-4.2.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
denisdefreyne committed Jul 10, 2016
2 parents ee1647c + 445e8bd commit ae6df04
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/nanoc/cli/commands/compile.rb
Expand Up @@ -63,10 +63,10 @@ def start
require 'tempfile'
setup_diffs
old_contents = {}
Nanoc::Int::NotificationCenter.on(:will_write_rep) do |rep, path|
Nanoc::Int::NotificationCenter.on(:will_write_rep, self) do |rep, path|
old_contents[rep] = File.file?(path) ? File.read(path) : nil
end
Nanoc::Int::NotificationCenter.on(:rep_written) do |rep, path, _is_created, _is_modified|
Nanoc::Int::NotificationCenter.on(:rep_written, self) do |rep, path, _is_created, _is_modified|
unless rep.binary?
new_contents = File.file?(path) ? File.read(path) : nil
if old_contents[rep] && new_contents
Expand All @@ -80,6 +80,10 @@ def start
# @see Listener#stop
def stop
super

Nanoc::Int::NotificationCenter.remove(:will_write_rep, self)
Nanoc::Int::NotificationCenter.remove(:rep_written, self)

teardown_diffs
end

Expand Down

0 comments on commit ae6df04

Please sign in to comment.