imap-backup 14.4.4 → 14.4.5
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/README.md +67 -137
- data/docs/documentation.md +19 -0
- data/lib/imap/backup/account/backup.rb +2 -0
- data/lib/imap/backup/account/backup_folders.rb +7 -1
- data/lib/imap/backup/account/client_factory.rb +1 -0
- data/lib/imap/backup/account/folder.rb +26 -0
- data/lib/imap/backup/account/folder_backup.rb +4 -1
- data/lib/imap/backup/account/folder_ensurer.rb +3 -0
- data/lib/imap/backup/account/local_only_folder_deleter.rb +2 -0
- data/lib/imap/backup/account/restore.rb +2 -0
- data/lib/imap/backup/account/serialized_folders.rb +5 -1
- data/lib/imap/backup/account.rb +15 -11
- data/lib/imap/backup/cli/backup.rb +3 -0
- data/lib/imap/backup/cli/folder_enumerator.rb +6 -0
- data/lib/imap/backup/cli/helpers.rb +13 -0
- data/lib/imap/backup/cli/local/check.rb +3 -0
- data/lib/imap/backup/cli/local.rb +13 -0
- data/lib/imap/backup/cli/remote.rb +7 -0
- data/lib/imap/backup/cli/restore.rb +4 -0
- data/lib/imap/backup/cli/setup.rb +3 -0
- data/lib/imap/backup/cli/single/backup.rb +3 -0
- data/lib/imap/backup/cli/single.rb +4 -0
- data/lib/imap/backup/cli/stats.rb +3 -0
- data/lib/imap/backup/cli/transfer.rb +8 -0
- data/lib/imap/backup/cli/utils.rb +6 -0
- data/lib/imap/backup/cli.rb +8 -0
- data/lib/imap/backup/client/apple_mail.rb +2 -0
- data/lib/imap/backup/client/automatic_login_wrapper.rb +9 -1
- data/lib/imap/backup/client/default.rb +15 -4
- data/lib/imap/backup/configuration.rb +13 -0
- data/lib/imap/backup/configuration_not_found.rb +1 -0
- data/lib/imap/backup/downloader.rb +4 -0
- data/lib/imap/backup/email/mboxrd/message.rb +14 -0
- data/lib/imap/backup/email/provider/apple_mail.rb +2 -0
- data/lib/imap/backup/email/provider/base.rb +2 -0
- data/lib/imap/backup/email/provider/fastmail.rb +2 -0
- data/lib/imap/backup/email/provider/gmail.rb +2 -0
- data/lib/imap/backup/email/provider/purelymail.rb +2 -0
- data/lib/imap/backup/email/provider/unknown.rb +2 -6
- data/lib/imap/backup/email/provider.rb +5 -0
- data/lib/imap/backup/file_mode.rb +2 -0
- data/lib/imap/backup/flag_refresher.rb +4 -0
- data/lib/imap/backup/local_only_message_deleter.rb +2 -0
- data/lib/imap/backup/logger.rb +18 -0
- data/lib/imap/backup/migrator.rb +3 -0
- data/lib/imap/backup/mirror/map.rb +21 -0
- data/lib/imap/backup/mirror.rb +8 -0
- data/lib/imap/backup/naming.rb +10 -1
- data/lib/imap/backup/retry_on_error.rb +9 -0
- data/lib/imap/backup/serializer/appender.rb +9 -0
- data/lib/imap/backup/serializer/delayed_metadata_serializer.rb +4 -0
- data/lib/imap/backup/serializer/folder_maker.rb +1 -0
- data/lib/imap/backup/serializer/imap.rb +38 -2
- data/lib/imap/backup/serializer/integrity_checker.rb +1 -0
- data/lib/imap/backup/serializer/mbox.rb +26 -0
- data/lib/imap/backup/serializer/message.rb +13 -0
- data/lib/imap/backup/serializer/message_enumerator.rb +10 -2
- data/lib/imap/backup/serializer/permission_checker.rb +6 -0
- data/lib/imap/backup/serializer/transaction.rb +18 -0
- data/lib/imap/backup/serializer/unused_name_finder.rb +4 -0
- data/lib/imap/backup/serializer/version2_migrator.rb +4 -0
- data/lib/imap/backup/serializer.rb +56 -2
- data/lib/imap/backup/setup/account/header.rb +6 -0
- data/lib/imap/backup/setup/account.rb +6 -0
- data/lib/imap/backup/setup/asker.rb +16 -0
- data/lib/imap/backup/setup/backup_path.rb +6 -0
- data/lib/imap/backup/setup/connection_tester.rb +5 -0
- data/lib/imap/backup/setup/email_changer.rb +6 -0
- data/lib/imap/backup/setup/folder_chooser.rb +4 -0
- data/lib/imap/backup/setup/global_options/download_strategy_chooser.rb +4 -0
- data/lib/imap/backup/setup/global_options.rb +4 -0
- data/lib/imap/backup/setup/helpers.rb +3 -0
- data/lib/imap/backup/setup.rb +5 -0
- data/lib/imap/backup/text/sanitizer.rb +9 -0
- data/lib/imap/backup/thunderbird/mailbox_exporter.rb +7 -0
- data/lib/imap/backup/uploader.rb +5 -0
- data/lib/imap/backup/version.rb +6 -1
- metadata +3 -5
- data/docs/api.md +0 -20
- data/docs/development.md +0 -110
- data/docs/migrate-server-keep-address.md +0 -47
data/docs/development.md
DELETED
@@ -1,110 +0,0 @@
|
|
1
|
-
# Repository
|
2
|
-
|
3
|
-
After cloning the repo, run the following command to get
|
4
|
-
better `git blame` output:
|
5
|
-
|
6
|
-
```sh
|
7
|
-
git config --local blame.ignoreRevsFile .git-blame-ignore-revs
|
8
|
-
```
|
9
|
-
|
10
|
-
# Design Goals
|
11
|
-
|
12
|
-
* Secure - use a local configuration file protected by permissions
|
13
|
-
* Restartable - calculate start point based on already downloaded messages
|
14
|
-
* Standalone - do not rely on an email client or MTA
|
15
|
-
|
16
|
-
# Testing
|
17
|
-
|
18
|
-
## Feature Specs
|
19
|
-
|
20
|
-
Specs under `specs/features` are integration specs.
|
21
|
-
Some of these specs run against two local IMAP servers
|
22
|
-
controlled by Podman (or Docker) Compose.
|
23
|
-
|
24
|
-
Start them before running the test suite
|
25
|
-
|
26
|
-
```sh
|
27
|
-
$ podman-compose -f dev/compose.yml up -d
|
28
|
-
```
|
29
|
-
|
30
|
-
or, with Podman
|
31
|
-
|
32
|
-
```sh
|
33
|
-
$ podman-compose -f dev/compose.yml up -d
|
34
|
-
```
|
35
|
-
|
36
|
-
Then, run all specs
|
37
|
-
|
38
|
-
```sh
|
39
|
-
$ rspec
|
40
|
-
```
|
41
|
-
|
42
|
-
To exclude container-based tests
|
43
|
-
|
44
|
-
```sh
|
45
|
-
$ rspec --tag ~docker
|
46
|
-
```
|
47
|
-
|
48
|
-
To run **just** the feature specs
|
49
|
-
|
50
|
-
```sh
|
51
|
-
rspec spec/features/**/*_spec.rb
|
52
|
-
```
|
53
|
-
|
54
|
-
## Full Test Run
|
55
|
-
|
56
|
-
The full test run includes RSpec specs **and** Runbocop checks
|
57
|
-
|
58
|
-
```sh
|
59
|
-
rake
|
60
|
-
```
|
61
|
-
|
62
|
-
# Older Rubies
|
63
|
-
|
64
|
-
A Containerfile is available to allow testing with all available Ruby versions,
|
65
|
-
see the README in the `dev` directory.
|
66
|
-
|
67
|
-
# Performance Specs
|
68
|
-
|
69
|
-
```sh
|
70
|
-
PERFORMANCE=1 rspec --order=defined
|
71
|
-
```
|
72
|
-
|
73
|
-
Beware: the performance spec (just backup for now) takes a very
|
74
|
-
long time to run, approximately 24 hours!
|
75
|
-
|
76
|
-
### Debugging
|
77
|
-
|
78
|
-
The feature specs are run 'out of process' via the Aruba gem.
|
79
|
-
In order to see debugging output from the process,
|
80
|
-
use `last_command_started.output`.
|
81
|
-
|
82
|
-
## Access Docker imap server
|
83
|
-
|
84
|
-
```ruby
|
85
|
-
require "net/imap"
|
86
|
-
require_relative "spec/features/support/30_email_server_helpers"
|
87
|
-
|
88
|
-
include EmailServerHelpers
|
89
|
-
|
90
|
-
test_connection = test_server_connection_parameters
|
91
|
-
|
92
|
-
test_imap = Net::IMAP.new(test_connection[:server], test_connection[:connection_options])
|
93
|
-
test_imap.login(test_connection[:username], test_connection[:password])
|
94
|
-
|
95
|
-
message = "From: #{test_connection[:username]}\nSubject: Some Subject\n\nHello!\n"
|
96
|
-
response = test_imap.append("INBOX", message, nil, nil)
|
97
|
-
|
98
|
-
test_imap.examine("INBOX")
|
99
|
-
uids = test_imap.uid_search(["ALL"]).sort
|
100
|
-
|
101
|
-
fetch_data_items = test_imap.uid_fetch(uids, ["BODY[]"])
|
102
|
-
```
|
103
|
-
|
104
|
-
# Contributing
|
105
|
-
|
106
|
-
1. Fork it
|
107
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
108
|
-
3. Commit your changes (`git commit -am 'Added some feature'`)
|
109
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
110
|
-
5. Create new Pull Request
|
@@ -1,47 +0,0 @@
|
|
1
|
-
# Migrate to a new e-mail server while keeping your existing address
|
2
|
-
|
3
|
-
While switching e-mail provider (from provider `A` to `B`),
|
4
|
-
you might want to keep the same address (`mymail@domain.com`),
|
5
|
-
and copy all your existing e-mails to your new server `B`.
|
6
|
-
`imap-backup` can do that too!
|
7
|
-
|
8
|
-
It is best to use [`imap-backup migrate`](/docs/commands/migrate.md)
|
9
|
-
and not [`imap-backup restore`](/docs/commands/restore.md) here because
|
10
|
-
`migrate` simply copies emails to folders with the same name as the ones
|
11
|
-
they were downloaded from, while `restore` changes the names of restored
|
12
|
-
folders if folders with the same name already exist on the destination server.
|
13
|
-
|
14
|
-
1. Backup your e-mails: use [`imap-backup setup`](/docs/commands/setup.md)
|
15
|
-
to setup connection to your old provider `A`,
|
16
|
-
then launch [`imap-backup backup`](/docs/commands/backup.md).
|
17
|
-
1. Actually switch your e-mail service provider (update your DNS MX and all that...).
|
18
|
-
1. As both the source and the destination have the same address,
|
19
|
-
you need to manually rename your old account first:
|
20
|
-
|
21
|
-
1. Modify your configuration file manually
|
22
|
-
(i.e. not via `imap-backup setup`) and
|
23
|
-
rename your account to `mymail-old@domain.com`:
|
24
|
-
|
25
|
-
```diff
|
26
|
-
"accounts": [
|
27
|
-
{
|
28
|
-
- "username": "mymail@domain.com",
|
29
|
-
+ "username": "mymail-old@domain.com",
|
30
|
-
"password": "...",
|
31
|
-
- "local_path": "/some/path/.imap-backup/mymail_domain.com",
|
32
|
-
+ "local_path": "/some/path/.imap-backup/mymail-old_domain.com",
|
33
|
-
"folders": [...],
|
34
|
-
"server": "..."
|
35
|
-
}
|
36
|
-
```
|
37
|
-
|
38
|
-
1. Rename the backup directory from `mymail_domain.com`
|
39
|
-
to `mymail-old_domain.com`.
|
40
|
-
|
41
|
-
1. Set up a new account giving access to the new provider `B`
|
42
|
-
using `imap-backup setup`.
|
43
|
-
1. Now you can use `imap-backup migrate`, optionally adapting
|
44
|
-
[delimiters and prefixes configuration](/docs/delimiters-and-prefixes.md)
|
45
|
-
if need be:
|
46
|
-
|
47
|
-
imap-backup migrate mymail-old@domain.com mymail@domain.com [options]
|