Class: Imap::Backup::CLI::Restore
- Inherits:
-
Thor
- Object
- Thor
- Imap::Backup::CLI::Restore
- Includes:
- Helpers, Thor::Actions
- Defined in:
- lib/imap/backup/cli/restore.rb
Overview
Restores backups for one or more accounts
Instance Method Summary collapse
-
#initialize(email = nil, options) ⇒ Restore
constructor
A new instance of Restore.
- #run ⇒ void
Methods included from Helpers
#account, included, #load_config, #requested_accounts
Constructor Details
#initialize(email = nil, options) ⇒ Restore
Returns a new instance of Restore.
17 18 19 20 21 |
# File 'lib/imap/backup/cli/restore.rb', line 17 def initialize(email = nil, ) super([]) @email = email @options = end |
Instance Method Details
#run ⇒ void
This method returns an undefined value.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/imap/backup/cli/restore.rb', line 26 no_commands do def run config = load_config(**) case when email && !.key?(:accounts) account = account(config, email) restore(account, **) when !email && !.key?(:accounts) Logger.logger.info "Calling restore without an EMAIL parameter is deprecated" config.accounts.each { |a| restore(a) } when email && .key?(:accounts) raise "Missing EMAIL parameter" when !email && .key?(:accounts) Logger.logger.info( "Calling restore with the --account option is deprecated, " \ "please pass a single EMAIL parameter" ) requested_accounts(config).each { |a| restore(a) } end end end |