imap-backup 7.0.2 → 8.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -3
- data/docs/configuration.md +3 -1
- data/lib/imap/backup/account/connection/backup_folders.rb +13 -3
- data/lib/imap/backup/account/connection.rb +2 -6
- data/lib/imap/backup/account/folder.rb +5 -5
- data/lib/imap/backup/account.rb +13 -1
- data/lib/imap/backup/cli/backup.rb +12 -5
- data/lib/imap/backup/cli/helpers.rb +56 -18
- data/lib/imap/backup/cli/local.rb +91 -33
- data/lib/imap/backup/cli/migrate.rb +5 -1
- data/lib/imap/backup/cli/mirror.rb +6 -2
- data/lib/imap/backup/cli/remote.rb +95 -3
- data/lib/imap/backup/cli/restore.rb +14 -9
- data/lib/imap/backup/cli/setup.rb +7 -2
- data/lib/imap/backup/cli/stats.rb +3 -2
- data/lib/imap/backup/cli/utils.rb +13 -10
- data/lib/imap/backup/cli.rb +26 -46
- data/lib/imap/backup/client/default.rb +1 -1
- data/lib/imap/backup/configuration.rb +4 -4
- data/lib/imap/backup/downloader.rb +1 -1
- data/lib/imap/backup/mirror.rb +1 -1
- data/lib/imap/backup/setup/account/header.rb +86 -35
- data/lib/imap/backup/setup/account.rb +16 -14
- data/lib/imap/backup/setup.rb +6 -4
- data/lib/imap/backup/version.rb +2 -2
- metadata +2 -5
- data/lib/imap/backup/cli/accounts.rb +0 -43
- data/lib/imap/backup/cli/folders.rb +0 -29
- data/lib/imap/backup/cli/status.rb +0 -26
data/lib/imap/backup/setup.rb
CHANGED
@@ -11,6 +11,12 @@ module Imap::Backup
|
|
11
11
|
end
|
12
12
|
self.highline = HighLine.new
|
13
13
|
|
14
|
+
attr_accessor :config
|
15
|
+
|
16
|
+
def initialize(config:)
|
17
|
+
@config = config
|
18
|
+
end
|
19
|
+
|
14
20
|
def run
|
15
21
|
catch :done do
|
16
22
|
loop do
|
@@ -62,10 +68,6 @@ module Imap::Backup
|
|
62
68
|
end
|
63
69
|
end
|
64
70
|
|
65
|
-
def config
|
66
|
-
@config ||= Configuration.new
|
67
|
-
end
|
68
|
-
|
69
71
|
def default_account_config(username)
|
70
72
|
Imap::Backup::Account.new(
|
71
73
|
username: username,
|
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:
|
4
|
+
version: 8.0.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: 2022-09-
|
11
|
+
date: 2022-09-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: highline
|
@@ -239,9 +239,7 @@ files:
|
|
239
239
|
- lib/imap/backup/account/connection/folder_names.rb
|
240
240
|
- lib/imap/backup/account/folder.rb
|
241
241
|
- lib/imap/backup/cli.rb
|
242
|
-
- lib/imap/backup/cli/accounts.rb
|
243
242
|
- lib/imap/backup/cli/backup.rb
|
244
|
-
- lib/imap/backup/cli/folders.rb
|
245
243
|
- lib/imap/backup/cli/helpers.rb
|
246
244
|
- lib/imap/backup/cli/local.rb
|
247
245
|
- lib/imap/backup/cli/migrate.rb
|
@@ -250,7 +248,6 @@ files:
|
|
250
248
|
- lib/imap/backup/cli/restore.rb
|
251
249
|
- lib/imap/backup/cli/setup.rb
|
252
250
|
- lib/imap/backup/cli/stats.rb
|
253
|
-
- lib/imap/backup/cli/status.rb
|
254
251
|
- lib/imap/backup/cli/utils.rb
|
255
252
|
- lib/imap/backup/client/apple_mail.rb
|
256
253
|
- lib/imap/backup/client/default.rb
|
@@ -1,43 +0,0 @@
|
|
1
|
-
module Imap::Backup
|
2
|
-
class CLI; end
|
3
|
-
|
4
|
-
class CLI::Accounts
|
5
|
-
include Enumerable
|
6
|
-
|
7
|
-
attr_reader :required_accounts
|
8
|
-
|
9
|
-
def initialize(required_accounts = [])
|
10
|
-
@required_accounts = required_accounts
|
11
|
-
end
|
12
|
-
|
13
|
-
def each(&block)
|
14
|
-
return enum_for(:each) if !block
|
15
|
-
|
16
|
-
accounts.each(&block)
|
17
|
-
end
|
18
|
-
|
19
|
-
private
|
20
|
-
|
21
|
-
def accounts
|
22
|
-
@accounts ||=
|
23
|
-
if required_accounts.empty?
|
24
|
-
config.accounts
|
25
|
-
else
|
26
|
-
config.accounts.select do |account|
|
27
|
-
required_accounts.include?(account.username)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
def config
|
33
|
-
@config ||= begin
|
34
|
-
exists = Configuration.exist?
|
35
|
-
if !exists
|
36
|
-
path = Configuration.default_pathname
|
37
|
-
raise ConfigurationNotFound, "Configuration file '#{path}' not found"
|
38
|
-
end
|
39
|
-
Configuration.new
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
module Imap::Backup
|
2
|
-
class CLI::Folders < Thor
|
3
|
-
include Thor::Actions
|
4
|
-
include CLI::Helpers
|
5
|
-
|
6
|
-
attr_reader :account_names
|
7
|
-
|
8
|
-
def initialize(options)
|
9
|
-
super([])
|
10
|
-
@account_names = (options[:accounts] || "").split(",")
|
11
|
-
end
|
12
|
-
|
13
|
-
no_commands do
|
14
|
-
def run
|
15
|
-
each_connection(account_names) do |connection|
|
16
|
-
Kernel.puts connection.account.username
|
17
|
-
# TODO: Make folder_names private once this command
|
18
|
-
# has been removed.
|
19
|
-
folders = connection.folder_names
|
20
|
-
if folders.nil?
|
21
|
-
Kernel.warn "Unable to list account folders"
|
22
|
-
return false
|
23
|
-
end
|
24
|
-
folders.each { |f| Kernel.puts "\t#{f}" }
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
module Imap::Backup
|
2
|
-
class CLI::Status < Thor
|
3
|
-
include Thor::Actions
|
4
|
-
include CLI::Helpers
|
5
|
-
|
6
|
-
attr_reader :account_names
|
7
|
-
|
8
|
-
def initialize(options)
|
9
|
-
super([])
|
10
|
-
@account_names = (options[:accounts] || "").split(",")
|
11
|
-
end
|
12
|
-
|
13
|
-
no_commands do
|
14
|
-
def run
|
15
|
-
each_connection(account_names) do |connection|
|
16
|
-
Kernel.puts connection.account.username
|
17
|
-
folders = connection.status
|
18
|
-
folders.each do |f|
|
19
|
-
missing_locally = f[:remote] - f[:local]
|
20
|
-
Kernel.puts "#{f[:name]}: #{missing_locally.size}"
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|