lib/imap/backup/cli/transfer.rb in imap-backup-15.0.0 vs lib/imap/backup/cli/transfer.rb in imap-backup-15.0.1

- old
+ new

@@ -11,11 +11,11 @@ # Implements migration and mirroring class CLI::Transfer include CLI::Helpers # The possible values for the action parameter - ACTIONS = %i(copy migrate mirror).freeze + ACTIONS = %i(migrate mirror).freeze def initialize(action, source_email, destination_email, options) @action = action @source_email = source_email @destination_email = destination_email @@ -37,21 +37,18 @@ # @return [void] def run raise "Unknown action '#{action}'" if !ACTIONS.include?(action) process_options! - warn_if_source_account_is_not_in_mirror_mode if action == :mirror - run_backup if %i(copy mirror).include?(action) + prepare_mirror if action == :mirror folders.each do |serializer, folder| case action - when :copy - Mirror.new(serializer, folder, reset: false).run when :migrate Migrator.new(serializer, folder, reset: reset).run when :mirror - Mirror.new(serializer, folder, reset: true).run + Mirror.new(serializer, folder).run end end end private @@ -124,10 +121,12 @@ self.destination_prefix ||= "" self.source_delimiter ||= "/" self.source_prefix ||= "" end - def run_backup + def prepare_mirror + warn_if_source_account_is_not_in_mirror_mode + CLI::Backup.new(config: config_path, accounts: source_email).run end def warn_if_source_account_is_not_in_mirror_mode return if source_account.mirror_mode