imap-backup 13.0.0 → 13.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +12 -1
  3. data/lib/cli_coverage.rb +2 -3
  4. data/lib/imap/backup/account/backup_folders.rb +2 -0
  5. data/lib/imap/backup/account/folder.rb +1 -1
  6. data/lib/imap/backup/account/folder_backup.rb +2 -0
  7. data/lib/imap/backup/account/restore.rb +1 -0
  8. data/lib/imap/backup/account/serialized_folders.rb +4 -0
  9. data/lib/imap/backup/account.rb +2 -0
  10. data/lib/imap/backup/cli/backup.rb +6 -0
  11. data/lib/imap/backup/cli/folder_enumerator.rb +8 -0
  12. data/lib/imap/backup/cli/helpers.rb +5 -1
  13. data/lib/imap/backup/cli/local/check.rb +6 -0
  14. data/lib/imap/backup/cli/local.rb +5 -0
  15. data/lib/imap/backup/cli/remote.rb +5 -0
  16. data/lib/imap/backup/cli/restore.rb +6 -0
  17. data/lib/imap/backup/cli/setup.rb +7 -0
  18. data/lib/imap/backup/cli/stats.rb +1 -0
  19. data/lib/imap/backup/cli/transfer.rb +1 -0
  20. data/lib/imap/backup/cli/utils.rb +8 -0
  21. data/lib/imap/backup/cli.rb +2 -2
  22. data/lib/imap/backup/client/default.rb +2 -0
  23. data/lib/imap/backup/configuration_not_found.rb +5 -0
  24. data/lib/imap/backup/logger.rb +0 -1
  25. data/lib/imap/backup/mirror/map.rb +2 -0
  26. data/lib/imap/backup/serializer/appender.rb +2 -0
  27. data/lib/imap/backup/serializer/delayed_metadata_serializer.rb +1 -0
  28. data/lib/imap/backup/serializer/directory.rb +1 -0
  29. data/lib/imap/backup/serializer/imap.rb +1 -0
  30. data/lib/imap/backup/serializer/permission_checker.rb +2 -0
  31. data/lib/imap/backup/serializer/unused_name_finder.rb +2 -0
  32. data/lib/imap/backup/serializer/version2_migrator.rb +2 -0
  33. data/lib/imap/backup/serializer.rb +2 -0
  34. data/lib/imap/backup/setup/account/header.rb +2 -0
  35. data/lib/imap/backup/setup/account.rb +2 -0
  36. data/lib/imap/backup/setup/connection_tester.rb +1 -1
  37. data/lib/imap/backup/setup.rb +2 -0
  38. data/lib/imap/backup/thunderbird/mailbox_exporter.rb +2 -1
  39. data/lib/imap/backup/uploader.rb +4 -0
  40. data/lib/imap/backup/version.rb +1 -1
  41. metadata +3 -3
  42. data/lib/imap/backup.rb +0 -18
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ff649779fd21a8a5ab2216b21618da22930c171dbe49fd2cf3aada02e3f2f18b
4
- data.tar.gz: 7e0ac7d099b71a9404d183cbae3b43b0100ab81c80e69a0485447f7c392b3317
3
+ metadata.gz: 6ef98e7550571026f402c2fa7c82b37707be3c79ee23bd190dd091d234e9c9e7
4
+ data.tar.gz: f2f7508af8f492cfd19972ba11e3ca651bc417f69b43dd5f78d511500f5373af
5
5
  SHA512:
6
- metadata.gz: 8846edccdd5e391d8740533a0a8f1b74b023ed181765e8ff8da4bf7782066b7186449ddf96a765d0a92ced194bf7e5b5f37c30ec2f1ddcab157e1a4b493d53e7
7
- data.tar.gz: 064fd1b42bfabfddf9abfe740a21d9f6f5247eb7d58605becaf25a01f2657ea623b37063ca4567715daff684231995e7bd9fde2e5ed72fe68b5e124f3c165787
6
+ metadata.gz: 7d6bb21bffea6ac0c7dc70c073700fe532d3fe5492ad9fd54f668070b682b17e958c152f07e91807a3c5f6aa8e354c7cdb0ca188cd2398bccc16951b421d4ea0
7
+ data.tar.gz: 2a1f679f55a047626cb85b2bd8b3b69cadbce20426af6ad278fab2f24758e379276575dc0149265b7783804da18f433731672cbaf34e0bf7c52ee38fa26a258e
data/README.md CHANGED
@@ -7,6 +7,15 @@
7
7
 
8
8
  Backup, restore and migrate email accounts.
9
9
 
10
+ # Quick Start
11
+
12
+ ```sh
13
+ brew install imap-backup # for macOS
14
+ gem install imap-backup # for Linux
15
+ imap-backup setup
16
+ imap-backup
17
+ ```
18
+
10
19
  # Modes
11
20
 
12
21
  There are two types of backups:
@@ -57,7 +66,9 @@ imap-backup setup
57
66
 
58
67
  ## GMail
59
68
 
60
- To use imap-backup with GMail, you will need to enable 'App passwords' on your account.
69
+ To use imap-backup with GMail, Office 365 and other services that require
70
+ OAuth2 authentication, you can use [email-oauth2-proxy](https://github.com/simonrob/email-oauth2-proxy)
71
+ to handle authentication, and then connect to the proxy on a local port.
61
72
 
62
73
  # Backup
63
74
 
data/lib/cli_coverage.rb CHANGED
@@ -2,10 +2,9 @@ class CliCoverage
2
2
  def self.conditionally_activate
3
3
  return if !ENV.key?("COVERAGE")
4
4
 
5
- require "simplecov"
6
-
7
5
  # Collect coverage separately
8
- SimpleCov.command_name "#{ENV.fetch('COVERAGE')} #{ARGV.join(' ')} coverage"
6
+ ENV["SIMPLECOV_COMMAND_NAME"] = "#{ENV.fetch('COVERAGE')} #{ARGV.join(' ')} coverage"
7
+ require "simplecov"
9
8
 
10
9
  # Silence output
11
10
  SimpleCov.formatter = SimpleCov::Formatter::SimpleFormatter
@@ -1,3 +1,5 @@
1
+ require "imap/backup/account/folder"
2
+
1
3
  module Imap; end
2
4
 
3
5
  module Imap::Backup
@@ -137,7 +137,7 @@ module Imap::Backup
137
137
  def unseen(uids)
138
138
  messages = uids.map(&:to_s).join(",")
139
139
  examine
140
- client.uid_search([messages, "UNSEEN"])
140
+ client.uid_search(["UID", messages, "UNSEEN"])
141
141
  rescue NoMethodError
142
142
  # Apple Mail returns an empty response when searches have no results
143
143
  []
@@ -2,6 +2,8 @@ require "imap/backup/serializer/delayed_metadata_serializer"
2
2
  require "imap/backup/downloader"
3
3
  require "imap/backup/flag_refresher"
4
4
  require "imap/backup/local_only_message_deleter"
5
+ require "imap/backup/logger"
6
+ require "imap/backup/serializer"
5
7
 
6
8
  module Imap; end
7
9
 
@@ -1,4 +1,5 @@
1
1
  require "imap/backup/account/serialized_folders"
2
+ require "imap/backup/uploader"
2
3
 
3
4
  module Imap; end
4
5
 
@@ -1,4 +1,8 @@
1
+ require "pathname"
2
+
3
+ require "imap/backup/account/folder"
1
4
  require "imap/backup/account/folder_ensurer"
5
+ require "imap/backup/serializer"
2
6
 
3
7
  module Imap; end
4
8
 
@@ -1,3 +1,5 @@
1
+ require "json"
2
+
1
3
  require "imap/backup/account/client_factory"
2
4
  require "imap/backup/account/restore"
3
5
 
@@ -1,9 +1,15 @@
1
1
  require "net/imap"
2
+ require "thor"
3
+
2
4
  require "imap/backup/account/backup"
5
+ require "imap/backup/cli/helpers"
6
+ require "imap/backup/logger"
3
7
 
4
8
  module Imap; end
5
9
 
6
10
  module Imap::Backup
11
+ class CLI < Thor; end
12
+
7
13
  class CLI::Backup < Thor
8
14
  include Thor::Actions
9
15
  include CLI::Helpers
@@ -1,6 +1,14 @@
1
+ require "thor"
2
+ require "pathname"
3
+
4
+ require "imap/backup/account/folder"
5
+ require "imap/backup/serializer"
6
+
1
7
  module Imap; end
2
8
 
3
9
  module Imap::Backup
10
+ class CLI < Thor; end
11
+
4
12
  class CLI::FolderEnumerator
5
13
  attr_reader :destination
6
14
  attr_reader :destination_delimiter
@@ -1,8 +1,12 @@
1
- require "imap/backup"
1
+ require "thor"
2
+
3
+ require "imap/backup/configuration"
2
4
 
3
5
  module Imap; end
4
6
 
5
7
  module Imap::Backup
8
+ class CLI < Thor; end
9
+
6
10
  module CLI::Helpers
7
11
  def self.included(base)
8
12
  base.class_eval do
@@ -1,3 +1,9 @@
1
+ require "thor"
2
+
3
+ require "imap/backup/account/serialized_folders"
4
+ require "imap/backup/cli/helpers"
5
+ require "imap/backup/serializer/integrity_checker"
6
+
1
7
  module Imap; end
2
8
 
3
9
  module Imap::Backup
@@ -1,9 +1,14 @@
1
+ require "thor"
2
+
1
3
  require "imap/backup/account/serialized_folders"
4
+ require "imap/backup/cli/helpers"
2
5
  require "imap/backup/cli/local/check"
3
6
 
4
7
  module Imap; end
5
8
 
6
9
  module Imap::Backup
10
+ class CLI < Thor; end
11
+
7
12
  class CLI::Local < Thor
8
13
  include Thor::Actions
9
14
  include CLI::Helpers
@@ -1,8 +1,13 @@
1
+ require "thor"
2
+
3
+ require "imap/backup/cli/helpers"
1
4
  require "imap/backup/logger"
2
5
 
3
6
  module Imap; end
4
7
 
5
8
  module Imap::Backup
9
+ class CLI < Thor; end
10
+
6
11
  class CLI::Remote < Thor
7
12
  include Thor::Actions
8
13
  include CLI::Helpers
@@ -1,6 +1,12 @@
1
+ require "thor"
2
+
3
+ require "imap/backup/cli/helpers"
4
+
1
5
  module Imap; end
2
6
 
3
7
  module Imap::Backup
8
+ class CLI < Thor; end
9
+
4
10
  class CLI::Restore < Thor
5
11
  include Thor::Actions
6
12
  include CLI::Helpers
@@ -1,6 +1,13 @@
1
+ require "thor"
2
+
3
+ require "imap/backup/cli/helpers"
4
+ require "imap/backup/setup"
5
+
1
6
  module Imap; end
2
7
 
3
8
  module Imap::Backup
9
+ class CLI < Thor; end
10
+
4
11
  class CLI::Setup < Thor
5
12
  include Thor::Actions
6
13
  include CLI::Helpers
@@ -1,4 +1,5 @@
1
1
  require "imap/backup/account/backup_folders"
2
+ require "imap/backup/serializer"
2
3
 
3
4
  module Imap; end
4
5
 
@@ -1,6 +1,7 @@
1
1
  require "imap/backup/cli/backup"
2
2
  require "imap/backup/cli/helpers"
3
3
  require "imap/backup/cli/folder_enumerator"
4
+ require "imap/backup/logger"
4
5
  require "imap/backup/migrator"
5
6
  require "imap/backup/mirror"
6
7
 
@@ -1,10 +1,18 @@
1
+ require "thor"
2
+ require "thunderbird/profiles"
3
+
1
4
  require "imap/backup/account/backup_folders"
2
5
  require "imap/backup/account/serialized_folders"
6
+ require "imap/backup/cli/helpers"
7
+ require "imap/backup/logger"
8
+ require "imap/backup/serializer"
3
9
  require "imap/backup/thunderbird/mailbox_exporter"
4
10
 
5
11
  module Imap; end
6
12
 
7
13
  module Imap::Backup
14
+ class CLI < Thor; end
15
+
8
16
  class CLI::Utils < Thor
9
17
  include Thor::Actions
10
18
  include CLI::Helpers
@@ -1,4 +1,5 @@
1
1
  require "thor"
2
+
2
3
  require "imap/backup/logger"
3
4
 
4
5
  module Imap; end
@@ -8,7 +9,6 @@ module Imap::Backup
8
9
  require "imap/backup/cli/helpers"
9
10
 
10
11
  autoload :Backup, "imap/backup/cli/backup"
11
- autoload :Folders, "imap/backup/cli/folders"
12
12
  autoload :Local, "imap/backup/cli/local"
13
13
  autoload :Remote, "imap/backup/cli/remote"
14
14
  autoload :Restore, "imap/backup/cli/restore"
@@ -234,7 +234,7 @@ module Imap::Backup
234
234
  verbose_option
235
235
  def setup
236
236
  non_logging_options = Imap::Backup::Logger.setup_logging(options)
237
- Setup.new(non_logging_options).run
237
+ CLI::Setup.new(non_logging_options).run
238
238
  end
239
239
 
240
240
  desc "stats EMAIL [OPTIONS]", "Print stats for each account folder"
@@ -1,6 +1,8 @@
1
1
  require "forwardable"
2
2
  require "net/imap"
3
3
 
4
+ require "imap/backup/logger"
5
+
4
6
  module Imap; end
5
7
 
6
8
  module Imap::Backup
@@ -0,0 +1,5 @@
1
+ module Imap; end
2
+
3
+ module Imap::Backup
4
+ class ConfigurationNotFound < StandardError; end
5
+ end
@@ -1,7 +1,6 @@
1
1
  require "logger"
2
2
  require "singleton"
3
3
 
4
- require "imap/backup/configuration"
5
4
  require "text/sanitizer"
6
5
 
7
6
  module Imap; end
@@ -1,3 +1,5 @@
1
+ require "json"
2
+
1
3
  module Imap; end
2
4
 
3
5
  module Imap::Backup
@@ -1,3 +1,5 @@
1
+ require "email/mboxrd/message"
2
+
1
3
  module Imap; end
2
4
 
3
5
  module Imap::Backup
@@ -1,3 +1,4 @@
1
+ require "email/mboxrd/message"
1
2
  require "imap/backup/serializer/imap"
2
3
  require "imap/backup/serializer/mbox"
3
4
  require "imap/backup/serializer/transaction"
@@ -1,5 +1,6 @@
1
1
  require "os"
2
2
 
3
+ require "imap/backup/file_mode"
3
4
  require "imap/backup/serializer/folder_maker"
4
5
 
5
6
  module Imap; end
@@ -1,6 +1,7 @@
1
1
  require "json"
2
2
 
3
3
  require "imap/backup/serializer/message"
4
+ require "imap/backup/serializer/mbox"
4
5
  require "imap/backup/serializer/transaction"
5
6
 
6
7
  module Imap; end
@@ -1,3 +1,5 @@
1
+ require "imap/backup/file_mode"
2
+
1
3
  module Imap; end
2
4
 
3
5
  module Imap::Backup
@@ -1,3 +1,5 @@
1
+ require "imap/backup/serializer"
2
+
1
3
  module Imap; end
2
4
 
3
5
  module Imap::Backup
@@ -1,5 +1,7 @@
1
1
  require "json"
2
2
 
3
+ require "imap/backup/serializer/imap"
4
+
3
5
  module Imap; end
4
6
 
5
7
  module Imap::Backup
@@ -1,8 +1,10 @@
1
1
  require "forwardable"
2
2
 
3
3
  require "email/mboxrd/message"
4
+ require "imap/backup/logger"
4
5
  require "imap/backup/naming"
5
6
  require "imap/backup/serializer/appender"
7
+ require "imap/backup/serializer/directory"
6
8
  require "imap/backup/serializer/integrity_checker"
7
9
  require "imap/backup/serializer/imap"
8
10
  require "imap/backup/serializer/mbox"
@@ -1,3 +1,5 @@
1
+ require "json"
2
+
1
3
  require "imap/backup/setup/helpers"
2
4
 
3
5
  module Imap; end
@@ -1,6 +1,8 @@
1
1
  require "imap/backup/setup/account/header"
2
2
  require "imap/backup/setup/backup_path"
3
+ require "imap/backup/setup/connection_tester"
3
4
  require "imap/backup/setup/email"
5
+ require "imap/backup/setup/folder_chooser"
4
6
 
5
7
  module Imap; end
6
8
 
@@ -11,7 +11,7 @@ module Imap::Backup
11
11
  end
12
12
 
13
13
  def test
14
- account.client
14
+ account.client.login
15
15
  "Connection successful"
16
16
  rescue Net::IMAP::NoResponseError
17
17
  "No response"
@@ -2,6 +2,8 @@ require "highline"
2
2
 
3
3
  require "email/provider"
4
4
  require "imap/backup/account"
5
+ require "imap/backup/setup/account"
6
+ require "imap/backup/setup/asker"
5
7
  require "imap/backup/setup/global_options"
6
8
  require "imap/backup/setup/helpers"
7
9
 
@@ -1,5 +1,6 @@
1
1
  require "thunderbird/local_folder"
2
- require "thunderbird/profiles"
2
+
3
+ require "imap/backup/logger"
3
4
 
4
5
  module Imap; end
5
6
 
@@ -1,3 +1,7 @@
1
+ require "imap/backup/account/folder"
2
+ require "imap/backup/logger"
3
+ require "imap/backup/serializer"
4
+
1
5
  module Imap; end
2
6
 
3
7
  module Imap::Backup
@@ -2,7 +2,7 @@ module Imap; end
2
2
 
3
3
  module Imap::Backup
4
4
  MAJOR = 13
5
- MINOR = 0
5
+ MINOR = 2
6
6
  REVISION = 0
7
7
  PRE = nil
8
8
  VERSION = [MAJOR, MINOR, REVISION, PRE].compact.map(&:to_s).join(".")
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: 13.0.0
4
+ version: 13.2.0
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-09-30 00:00:00.000000000 Z
11
+ date: 2023-10-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: highline
@@ -146,7 +146,6 @@ files:
146
146
  - lib/email/provider/gmail.rb
147
147
  - lib/email/provider/purelymail.rb
148
148
  - lib/email/provider/unknown.rb
149
- - lib/imap/backup.rb
150
149
  - lib/imap/backup/account.rb
151
150
  - lib/imap/backup/account/backup.rb
152
151
  - lib/imap/backup/account/backup_folders.rb
@@ -173,6 +172,7 @@ files:
173
172
  - lib/imap/backup/client/automatic_login_wrapper.rb
174
173
  - lib/imap/backup/client/default.rb
175
174
  - lib/imap/backup/configuration.rb
175
+ - lib/imap/backup/configuration_not_found.rb
176
176
  - lib/imap/backup/downloader.rb
177
177
  - lib/imap/backup/file_mode.rb
178
178
  - lib/imap/backup/flag_refresher.rb
data/lib/imap/backup.rb DELETED
@@ -1,18 +0,0 @@
1
- require "imap/backup/account/folder"
2
- require "imap/backup/configuration"
3
- require "imap/backup/downloader"
4
- require "imap/backup/logger"
5
- require "imap/backup/uploader"
6
- require "imap/backup/serializer"
7
- require "imap/backup/setup"
8
- require "imap/backup/setup/account"
9
- require "imap/backup/setup/asker"
10
- require "imap/backup/setup/connection_tester"
11
- require "imap/backup/setup/folder_chooser"
12
- require "imap/backup/version"
13
-
14
- module Imap; end
15
-
16
- module Imap::Backup
17
- class ConfigurationNotFound < StandardError; end
18
- end