Class: Imap::Backup::CLI
- Inherits:
-
Thor
- Object
- Thor
- Imap::Backup::CLI
show all
- Includes:
- Helpers
- Defined in:
- lib/imap/backup/cli.rb,
lib/imap/backup/cli/local.rb,
lib/imap/backup/cli/setup.rb,
lib/imap/backup/cli/utils.rb,
lib/imap/backup/cli/backup.rb,
lib/imap/backup/cli/remote.rb,
lib/imap/backup/cli/single.rb,
lib/imap/backup/cli/helpers.rb,
lib/imap/backup/cli/restore.rb,
lib/imap/backup/cli/local/check.rb,
lib/imap/backup/cli/single/backup.rb,
lib/imap/backup/cli/folder_enumerator.rb
Defined Under Namespace
Modules: Helpers
Classes: Backup, FolderEnumerator, Local, Remote, Restore, Setup, Single, Stats, Transfer, Utils
Constant Summary
collapse
- NAMESPACE_CONFIGURATION_DESCRIPTION =
"Some IMAP servers use namespaces (i.e. prefixes like \"INBOX\"),\nwhile others, while others concatenate the names of subfolders\nwith a charater (\"delimiter\") other than \"/\".\n\nIn these cases there are two choices.\n\nYou can use the `--automatic-namespaces` option.\nThis wil query the source and detination servers for their\nnamespace configuration and will adapt paths accordingly.\nThis option requires that both the source and destination\nservers are available and work with the provided parameters\nand authentication.\n\nIf automatic configuration does not work as desired, there are the\n`--source-prefix=`, `--source-delimiter=`,\n`--destination-prefix=` and `--destination-delimiter=` parameters.\nTo check what values you should use, check the output of the\n`imap-backup remote namespaces EMAIL` command.\n".freeze
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Helpers
#account, included, #load_config, #options, #requested_accounts
Class Method Details
.exit_on_failure? ⇒ Boolean
67
68
69
|
# File 'lib/imap/backup/cli.rb', line 67
def self.exit_on_failure?
true
end
|
.start(args) ⇒ Object
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
# File 'lib/imap/backup/cli.rb', line 47
def self.start(args)
if args.include?("--version")
new.version
exit 0
end
first_argument_is_help = ARGV[0] == "help"
second_argument_is_subcommand = subcommands.include?(ARGV[1])
if first_argument_is_help && second_argument_is_subcommand
help, subcommand = ARGV.shift(2)
ARGV.unshift(subcommand, help)
end
super
end
|
Instance Method Details
#backup ⇒ Object
84
85
86
87
|
# File 'lib/imap/backup/cli.rb', line 84
def backup
non_logging_options = Imap::Backup::Logger.setup_logging(options)
Backup.new(non_logging_options).run
end
|
#migrate(source_email, destination_email) ⇒ Object
144
145
146
147
|
# File 'lib/imap/backup/cli.rb', line 144
def migrate(source_email, destination_email)
non_logging_options = Imap::Backup::Logger.setup_logging(options)
Transfer.new(:migrate, source_email, destination_email, non_logging_options).run
end
|
#mirror(source_email, destination_email) ⇒ Object
203
204
205
206
|
# File 'lib/imap/backup/cli.rb', line 203
def mirror(source_email, destination_email)
non_logging_options = Imap::Backup::Logger.setup_logging(options)
Transfer.new(:mirror, source_email, destination_email, non_logging_options).run
end
|
#restore(email = nil) ⇒ Object
220
221
222
223
|
# File 'lib/imap/backup/cli.rb', line 220
def restore(email = nil)
non_logging_options = Imap::Backup::Logger.setup_logging(options)
Restore.new(email, non_logging_options).run
end
|
#setup ⇒ Object
233
234
235
236
|
# File 'lib/imap/backup/cli.rb', line 233
def setup
non_logging_options = Imap::Backup::Logger.setup_logging(options)
CLI::Setup.new(non_logging_options).run
end
|
#stats(email) ⇒ Object
256
257
258
259
|
# File 'lib/imap/backup/cli.rb', line 256
def stats(email)
non_logging_options = Imap::Backup::Logger.setup_logging(options)
Stats.new(email, non_logging_options).run
end
|
#version ⇒ Object
265
266
267
|
# File 'lib/imap/backup/cli.rb', line 265
def version
Kernel.puts "imap-backup #{Imap::Backup::VERSION}"
end
|