imap-backup 9.0.0 → 9.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/docs/development.md +1 -1
- data/lib/imap/backup/account/connection/backup_folders.rb +12 -12
- data/lib/imap/backup/cli.rb +1 -8
- data/lib/imap/backup/migrator.rb +1 -21
- data/lib/imap/backup/mirror/map.rb +10 -0
- data/lib/imap/backup/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2482ddc0519b2eb1b1160cee2aae34befdb8faa4acf9de2127be214bac3907f
|
4
|
+
data.tar.gz: 2ed7b7b25497ee53cdfd1735628401076defaee63829aa9bfabd5fc483e69a28
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7a6790a9354d9c06eedb72b2a6bf1960ed691a53c95b4a11c0ce50359ca397e0929240b2eafc93365610f43588c190515367462c4cde3ccf58242d5afd31622
|
7
|
+
data.tar.gz: 6270491bbc12302365de92b666b438b3638baa67d162f01e0b825deef73544f349919b779d6f4ea3db4dc3e570b3d27ede88e108667745b811596c9214fd205f
|
data/docs/development.md
CHANGED
@@ -14,24 +14,24 @@ module Imap::Backup
|
|
14
14
|
def run
|
15
15
|
all_names = Account::Connection::FolderNames.new(client: client, account: account).run
|
16
16
|
|
17
|
-
|
18
|
-
|
17
|
+
configured =
|
18
|
+
case
|
19
|
+
when account.folders&.any?
|
19
20
|
account.folders.map { |af| af[:name] }
|
21
|
+
when account.folder_blacklist
|
22
|
+
[]
|
20
23
|
else
|
21
24
|
all_names
|
22
25
|
end
|
23
26
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
end
|
31
|
-
next if !backup
|
27
|
+
names =
|
28
|
+
if account.folder_blacklist
|
29
|
+
all_names - configured
|
30
|
+
else
|
31
|
+
all_names & configured
|
32
|
+
end
|
32
33
|
|
33
|
-
|
34
|
-
end.compact
|
34
|
+
names.map { |name| Account::Folder.new(account.connection, name) }
|
35
35
|
end
|
36
36
|
end
|
37
37
|
end
|
data/lib/imap/backup/cli.rb
CHANGED
@@ -75,14 +75,7 @@ module Imap::Backup
|
|
75
75
|
When one or other account uses a delimiter other than `/` (i.e. `.`),
|
76
76
|
use the `--source-delimiter=` and/or `--destination-delimiter=` options.
|
77
77
|
|
78
|
-
|
79
|
-
|
80
|
-
Before migrating each folder, `imap-backup` checks if the destination
|
81
|
-
folder is empty.
|
82
|
-
|
83
|
-
If it finds a non-empty destination folder, it halts with an error.
|
84
|
-
|
85
|
-
If you are sure that these destination emails can be deleted,
|
78
|
+
If you you want to delete existing emails in destination folders,
|
86
79
|
use the `--reset` option. In this case, all existing emails are
|
87
80
|
deleted before uploading the migrated emails.
|
88
81
|
DESC
|
data/lib/imap/backup/migrator.rb
CHANGED
@@ -13,7 +13,7 @@ module Imap::Backup
|
|
13
13
|
def run
|
14
14
|
count = serializer.uids.count
|
15
15
|
folder.create
|
16
|
-
|
16
|
+
folder.clear if reset
|
17
17
|
|
18
18
|
Logger.logger.debug "[#{folder.name}] #{count} to migrate"
|
19
19
|
serializer.each_message(serializer.uids).with_index do |message, i|
|
@@ -31,25 +31,5 @@ module Imap::Backup
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
34
|
-
|
35
|
-
private
|
36
|
-
|
37
|
-
def ensure_destination_empty!
|
38
|
-
if reset
|
39
|
-
folder.clear
|
40
|
-
else
|
41
|
-
fail_if_destination_not_empty!
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
def fail_if_destination_not_empty!
|
46
|
-
return if folder.uids.empty?
|
47
|
-
|
48
|
-
raise <<~ERROR
|
49
|
-
The destination folder '#{folder.name}' is not empty.
|
50
|
-
Pass the --reset flag if you want to clear existing emails from destination
|
51
|
-
folders before uploading.
|
52
|
-
ERROR
|
53
|
-
end
|
54
34
|
end
|
55
35
|
end
|
@@ -33,14 +33,24 @@ module Imap::Backup
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def source_uid(destination_uid)
|
36
|
+
if destination_store == {}
|
37
|
+
raise "Assign UID validities with #reset before calling #source_uid"
|
38
|
+
end
|
39
|
+
|
36
40
|
map.key(destination_uid)
|
37
41
|
end
|
38
42
|
|
39
43
|
def destination_uid(source_uid)
|
44
|
+
if destination_store == {}
|
45
|
+
raise "Assign UID validities with #reset before calling #destination_uid"
|
46
|
+
end
|
47
|
+
|
40
48
|
map[source_uid]
|
41
49
|
end
|
42
50
|
|
43
51
|
def map_uids(source:, destination:)
|
52
|
+
raise "Assign UID validities with #reset before calling #map_uids" if destination_store == {}
|
53
|
+
|
44
54
|
map[source] = destination
|
45
55
|
end
|
46
56
|
|
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.0.
|
4
|
+
version: 9.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joe Yates
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: highline
|