lib/backup/syncer/rsync/pull.rb in backup-4.4.1 vs lib/backup/syncer/rsync/pull.rb in backup-5.0.0.beta.1
- old
+ new
@@ -1,19 +1,16 @@
-# encoding: utf-8
-
module Backup
module Syncer
module RSync
class Pull < Push
-
def perform!
log!(:started)
write_password_file!
create_dest_path!
- run("#{ rsync_command } #{ host_options }#{ paths_to_pull } " +
- "'#{ dest_path }'")
+ run("#{rsync_command} #{host_options}#{paths_to_pull} " \
+ "'#{dest_path}'")
log!(:finished)
ensure
remove_password_file!
end
@@ -28,24 +25,23 @@
#
# 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.
def paths_to_pull
- sep = mode == :ssh ? ':' : '::'
- directories.map {|dir|
- "#{ sep }'#{ dir.sub(/^~\//, '').sub(/\/$/, '') }'"
- }.join(' ').sub(/^#{ sep }/, '')
+ sep = mode == :ssh ? ":" : "::"
+ directories.map do |dir|
+ "#{sep}'#{dir.sub(/^~\//, "").sub(/\/$/, "")}'"
+ end.join(" ").sub(/^#{ sep }/, "")
end
# Expand path, since this is local and shell-quoted.
def dest_path
@dest_path ||= File.expand_path(path)
end
def create_dest_path!
FileUtils.mkdir_p dest_path
end
-
end
end
end
end