class Hookit::Resource::Rsync
Public Class Methods
new(name)
click to toggle source
Calls superclass method
Hookit::Resource::Base::new
# File lib/hookit/resource/rsync.rb, line 16 def initialize(name) source name unless source super end
Public Instance Methods
archive!()
click to toggle source
# File lib/hookit/resource/rsync.rb, line 32 def archive! (return "a") if archive "" end
checksum!()
click to toggle source
# File lib/hookit/resource/rsync.rb, line 42 def checksum! (return "c") if archive "" end
compress!()
click to toggle source
# File lib/hookit/resource/rsync.rb, line 47 def compress! (return "z") if archive "" end
recursive!()
click to toggle source
# File lib/hookit/resource/rsync.rb, line 37 def recursive! (return "r") if archive "" end
run(action)
click to toggle source
# File lib/hookit/resource/rsync.rb, line 21 def run(action) case action when :sync sync! end end
run_command!(cmd, expect_code=0)
click to toggle source
# File lib/hookit/resource/rsync.rb, line 57 def run_command!(cmd, expect_code=0) `#{cmd}` code = $?.exitstatus if code != expect_code raise Hookit::Error::UnexpectedExit, "#{cmd} failed with exit code '#{code}'" end end
sync!()
click to toggle source
# File lib/hookit/resource/rsync.rb, line 28 def sync! run_command! "rsync -q#{archive!}#{recursive!}#{checksum!}#{compress!} #{wrapper!} #{source} #{destination}" end
wrapper!()
click to toggle source
# File lib/hookit/resource/rsync.rb, line 52 def wrapper! (return "-e '#{wrapper}'") if wrapper "" end