Skip to content

Commit

Permalink
Call updated! in compare_file
Browse files Browse the repository at this point in the history
because updated! in each action won't be called in dry-run mode.
  • Loading branch information
ryotarai committed Apr 8, 2016
1 parent f1458b6 commit 8f4ddb8
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions lib/itamae/resource/file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,6 @@ def action_create(options)
run_command(["touch", attributes.path])
end

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

change_target = @temppath && updated? ? @temppath : attributes.path

if attributes.mode
Expand Down Expand Up @@ -110,11 +98,6 @@ def action_edit(options)
run_specinfra(:change_file_group, @temppath, group)
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 Expand Up @@ -145,6 +128,7 @@ def compare_file
Itamae.logger.info line.chomp
end
end
updated!
runner.handler.event(:file_content_changed, diff: diff.stdout)
end
end
Expand Down

0 comments on commit 8f4ddb8

Please sign in to comment.