Skip to content

Commit

Permalink
Merge pull request #169 from kurochan/fix-file-edit-notifies
Browse files Browse the repository at this point in the history
Fix not send notifies when file edited
  • Loading branch information
ryotarai committed Oct 8, 2015
2 parents a56be22 + c601665 commit 8518d86
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/itamae/resource/file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ def action_edit(options)
run_command(['chown', '--reference', attributes.path, @temppath])
end

unless check_command(["diff", "-q", @temppath, attributes.path])
# the file is modified
updated!
end

run_specinfra(:move_file, @temppath, attributes.path)
end

Expand Down
5 changes: 5 additions & 0 deletions spec/integration/recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,11 @@
block do |content|
content.gsub!('world', 'Itamae')
end
notifies :run, "execute[echo 1 >> /tmp/file_edit_notifies]"
end

execute 'echo 1 >> /tmp/file_edit_notifies' do
action :nothing
end

###
Expand Down

0 comments on commit 8518d86

Please sign in to comment.