Created
October 21, 2012 13:43
-
-
Save tily/3927000 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'digest/md5' | |
action :sync do | |
old_checksum = ::File.exists?(new_resource.name) ? ::Digest::MD5.file(new_resource.name) : nil | |
execute "rsync file" do | |
command "rsync -a -e '#{new_resource.command}' #{new_resource.source} #{new_resource.name}" | |
end | |
ruby_block "see if rsync_file[#{new_resource.name}] was updated" do | |
block do | |
new_checksum = ::Digest::MD5.file(new_resource.name) | |
if old_checksum && old_checksum != new_checksum | |
new_resource.updated_by_last_action true | |
end | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
actions :sync | |
attribute :name, :required => true, :kind_of => String, :name_attribute => true | |
attribute :source, :required => true, :kind_of => String | |
attribute :command, :required => true, :kind_of => String |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment