imap-backup 9.0.2 → 9.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/imap/backup/cli/backup.rb +6 -0
- data/lib/imap/backup/cli.rb +12 -12
- data/lib/imap/backup/logger.rb +7 -2
- data/lib/imap/backup/version.rb +2 -2
- metadata +2 -5
- data/docs/configuration.md +0 -25
- data/docs/restore.md +0 -28
- data/docs/setup.md +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f5cf8072ca8c7a95ca74edc961352099b468a287e846c71c0243d5c2fc285e17
|
4
|
+
data.tar.gz: 8b66b63ed93044a9fe019ce5af838f165589a9f7b1eebe0751cc804891dacab2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79a410fe6b307969a27cafed38cd145951016c86c45f62033b91dd6b9df289993f4e134c42bd6ddabbb8b4a523534fdad18ea4b71cd40aa6656375c750c4aaf6
|
7
|
+
data.tar.gz: baf5eb4583afe8263f54cede96ad308f1b0ce507987b10adfba337eb899ecc456f22c9895cb18805a87ef486ba3712f150af17ca21beed5160081b3eb4c07ffe
|
@@ -15,6 +15,12 @@ module Imap::Backup
|
|
15
15
|
config = load_config(**options)
|
16
16
|
each_connection(config, emails) do |connection|
|
17
17
|
connection.run_backup(refresh: refresh)
|
18
|
+
rescue StandardError => e
|
19
|
+
message =
|
20
|
+
"Backup for account '#{connection.account.username}' " \
|
21
|
+
"failed with error #{e}"
|
22
|
+
Logger.logger.warn message
|
23
|
+
next
|
18
24
|
end
|
19
25
|
end
|
20
26
|
|
data/lib/imap/backup/cli.rb
CHANGED
@@ -54,8 +54,8 @@ module Imap::Backup
|
|
54
54
|
aliases: ["-r"]
|
55
55
|
)
|
56
56
|
def backup
|
57
|
-
Imap::Backup::Logger.setup_logging
|
58
|
-
Backup.new(
|
57
|
+
non_logging_options = Imap::Backup::Logger.setup_logging(options)
|
58
|
+
Backup.new(non_logging_options).run
|
59
59
|
end
|
60
60
|
|
61
61
|
desc "local SUBCOMMAND [OPTIONS]", "View local info"
|
@@ -111,8 +111,8 @@ module Imap::Backup
|
|
111
111
|
aliases: ["-s"]
|
112
112
|
)
|
113
113
|
def migrate(source_email, destination_email)
|
114
|
-
Imap::Backup::Logger.setup_logging
|
115
|
-
Migrate.new(source_email, destination_email, **
|
114
|
+
non_logging_options = Imap::Backup::Logger.setup_logging(options)
|
115
|
+
Migrate.new(source_email, destination_email, **non_logging_options).run
|
116
116
|
end
|
117
117
|
|
118
118
|
desc(
|
@@ -161,8 +161,8 @@ module Imap::Backup
|
|
161
161
|
aliases: ["-s"]
|
162
162
|
)
|
163
163
|
def mirror(source_email, destination_email)
|
164
|
-
Imap::Backup::Logger.setup_logging
|
165
|
-
Mirror.new(source_email, destination_email, **
|
164
|
+
non_logging_options = Imap::Backup::Logger.setup_logging(options)
|
165
|
+
Mirror.new(source_email, destination_email, **non_logging_options).run
|
166
166
|
end
|
167
167
|
|
168
168
|
desc "remote SUBCOMMAND [OPTIONS]", "View info about online accounts"
|
@@ -178,8 +178,8 @@ module Imap::Backup
|
|
178
178
|
quiet_option
|
179
179
|
verbose_option
|
180
180
|
def restore(email = nil)
|
181
|
-
Imap::Backup::Logger.setup_logging
|
182
|
-
Restore.new(email,
|
181
|
+
non_logging_options = Imap::Backup::Logger.setup_logging(options)
|
182
|
+
Restore.new(email, non_logging_options).run
|
183
183
|
end
|
184
184
|
|
185
185
|
desc "setup", "Configure imap-backup"
|
@@ -191,8 +191,8 @@ module Imap::Backup
|
|
191
191
|
quiet_option
|
192
192
|
verbose_option
|
193
193
|
def setup
|
194
|
-
Imap::Backup::Logger.setup_logging
|
195
|
-
Setup.new(
|
194
|
+
non_logging_options = Imap::Backup::Logger.setup_logging(options)
|
195
|
+
Setup.new(non_logging_options).run
|
196
196
|
end
|
197
197
|
|
198
198
|
desc "stats EMAIL [OPTIONS]", "Print stats for each account folder"
|
@@ -206,8 +206,8 @@ module Imap::Backup
|
|
206
206
|
quiet_option
|
207
207
|
verbose_option
|
208
208
|
def stats(email)
|
209
|
-
Imap::Backup::Logger.setup_logging
|
210
|
-
Stats.new(email,
|
209
|
+
non_logging_options = Imap::Backup::Logger.setup_logging(options)
|
210
|
+
Stats.new(email, non_logging_options).run
|
211
211
|
end
|
212
212
|
|
213
213
|
desc "utils SUBCOMMAND [OPTIONS]", "Various utilities"
|
data/lib/imap/backup/logger.rb
CHANGED
@@ -13,11 +13,14 @@ module Imap::Backup
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def self.setup_logging(options = {})
|
16
|
+
copy = options.clone
|
17
|
+
quiet = copy.delete(:quiet)
|
18
|
+
verbose = copy.delete(:verbose)
|
16
19
|
level =
|
17
20
|
case
|
18
|
-
when
|
21
|
+
when quiet
|
19
22
|
::Logger::Severity::UNKNOWN
|
20
|
-
when
|
23
|
+
when verbose
|
21
24
|
::Logger::Severity::DEBUG
|
22
25
|
else
|
23
26
|
::Logger::Severity::INFO
|
@@ -25,6 +28,8 @@ module Imap::Backup
|
|
25
28
|
logger.level = level
|
26
29
|
debug = level == ::Logger::Severity::DEBUG
|
27
30
|
Net::IMAP.debug = debug
|
31
|
+
|
32
|
+
copy
|
28
33
|
end
|
29
34
|
|
30
35
|
def self.sanitize_stderr
|
data/lib/imap/backup/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: imap-backup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 9.
|
4
|
+
version: 9.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joe Yates
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-02-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: highline
|
@@ -217,11 +217,8 @@ files:
|
|
217
217
|
- LICENSE
|
218
218
|
- README.md
|
219
219
|
- bin/imap-backup
|
220
|
-
- docs/configuration.md
|
221
220
|
- docs/delimiters-and-prefixes.md
|
222
221
|
- docs/development.md
|
223
|
-
- docs/restore.md
|
224
|
-
- docs/setup.md
|
225
222
|
- imap-backup.gemspec
|
226
223
|
- lib/cli_coverage.rb
|
227
224
|
- lib/email/mboxrd/message.rb
|
data/docs/configuration.md
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
Configuration is stored in a JSON file.
|
2
|
-
|
3
|
-
The format is documented [here](files/config.md).
|
4
|
-
|
5
|
-
# Folders
|
6
|
-
|
7
|
-
By default, all folders are backed-up. You can override this by choosing
|
8
|
-
specific folders.
|
9
|
-
|
10
|
-
# Connection options
|
11
|
-
|
12
|
-
You can override the parameters passed to `Net::IMAP` with `connection_options`.
|
13
|
-
|
14
|
-
See the Ruby Standard Library documentation for `Net::IMAP` of details of [supported parameters](https://ruby-doc.org/stdlib-3.1.2/libdoc/net-imap/rdoc/Net/IMAP.html#method-c-new).
|
15
|
-
|
16
|
-
Specifically, if you are using a self-signed certificate and get SSL errors, e.g.
|
17
|
-
`certificate verify failed`, you can choose to not verify the TLS connection.
|
18
|
-
|
19
|
-
Connection options can be entered via `imap-backup setup` as JSON.
|
20
|
-
|
21
|
-
Choose the account, then 'modify connection options'.
|
22
|
-
|
23
|
-
For example:
|
24
|
-
|
25
|
-
![Entering connection options as JSON](./images/entering-connection-options-as-json.png "Entering connection options as JSON")
|
data/docs/restore.md
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
# FAQ
|
2
|
-
|
3
|
-
# How does restore work?
|
4
|
-
|
5
|
-
Backed-up emails are pushed to the IMAP server.
|
6
|
-
If there are clashes, folders are renamed.
|
7
|
-
|
8
|
-
# What are all these 'INBOX.12345' files?
|
9
|
-
|
10
|
-
If, when the backup is launched, the IMAP server contains a folder with
|
11
|
-
the same name, but different history to the local backup, the local
|
12
|
-
emails cannot simply be added to the existing folder.
|
13
|
-
|
14
|
-
In this case, a numeric suffix is added to the **local** folder,
|
15
|
-
before it is restored.
|
16
|
-
|
17
|
-
In this way, old and new emails are kept separate.
|
18
|
-
|
19
|
-
# Will my email get overwritten?
|
20
|
-
|
21
|
-
No.
|
22
|
-
|
23
|
-
Emails are identified by folder and a specific email id. Any email that
|
24
|
-
is already on the server is skipped.
|
25
|
-
|
26
|
-
## How do I restore to a different service?
|
27
|
-
|
28
|
-
It is best to use the `migrate` command in this case.
|