class Backup::Syncer::RSync::Pull
Public Instance Methods
perform!()
click to toggle source
# File lib/backup/syncer/rsync/pull.rb, line 7 def perform! log!(:started) write_password_file! create_dest_path! run("#{ rsync_command } #{ host_options }#{ paths_to_pull } " + "'#{ dest_path }'") log!(:finished) ensure remove_password_file! end
Private Instance Methods
create_dest_path!()
click to toggle source
# File lib/backup/syncer/rsync/pull.rb, line 43 def create_dest_path! FileUtils.mkdir_p dest_path end
dest_path()
click to toggle source
Expand path, since this is local and shell-quoted.
# File lib/backup/syncer/rsync/pull.rb, line 39 def dest_path @dest_path ||= File.expand_path(path) end
paths_to_pull()
click to toggle source
Returns the syntax for pulling multiple paths from the remote host. e.g.
rsync -a -e "ssh -p 22" host:'path1' :'path2' '/dest' rsync -a rsync_user@host::'modname/path1' ::'modname/path2' '/dest'
Remove any preceeding '~/', since these paths are on the remote. Also remove any trailing `/`, since we don't want rsync's “trailing / on source directories” behavior.
# File lib/backup/syncer/rsync/pull.rb, line 31 def paths_to_pull sep = mode == :ssh ? ':' : '::' directories.map {|dir| "#{ sep }'#{ dir.sub(/^~\//, '').sub(/\/$/, '') }'" }.join(' ').sub(/^#{ sep }/, '') end