Class: Imap::Backup::CLI::Transfer
- Inherits:
-
Object
- Object
- Imap::Backup::CLI::Transfer
- Includes:
- Helpers
- Defined in:
- lib/imap/backup/cli/transfer.rb
Overview
Implements migration and mirroring
Constant Summary collapse
- ACTIONS =
The possible values for the action parameter
i(copy migrate mirror).freeze
Constants included from Helpers
Helpers::NAMESPACE_CONFIGURATION_DESCRIPTION
Instance Method Summary collapse
-
#initialize(action, source_email, destination_email, options) ⇒ Transfer
constructor
A new instance of Transfer.
- #run ⇒ Object
Methods included from Helpers
#account, included, #load_config, #requested_accounts
Constructor Details
#initialize(action, source_email, destination_email, options) ⇒ Transfer
Returns a new instance of Transfer.
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/imap/backup/cli/transfer.rb', line 18 def initialize(action, source_email, destination_email, ) @action = action @source_email = source_email @destination_email = destination_email = @automatic_namespaces = nil @config_path = nil @destination_delimiter = nil @destination_prefix = nil @reset = nil @source_delimiter = nil @source_prefix = nil end |
Instance Method Details
#run ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/imap/backup/cli/transfer.rb', line 38 def run raise "Unknown action '#{action}'" if !ACTIONS.include?(action) warn_if_source_account_is_not_in_mirror_mode if action == :mirror run_backup if i(copy mirror).include?(action) 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 end end end |