imap-backup 14.4.5 → 14.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e492fd50201bbf2424231905b4cdb6fe3d44d99fa446c624b851c9ef50eb686f
4
- data.tar.gz: e2ed159ec5e92e7d97a685093456491afe94d34e70702d4e7a0449cf150009dd
3
+ metadata.gz: ee294a8f4d7c0af90c725939b3f4cd7826ac521194460af3446e7cf5378629f4
4
+ data.tar.gz: c67cac7ddfb2448a9cb22b642b53be02b157959d51f3677bc37ec891da2471c8
5
5
  SHA512:
6
- metadata.gz: d0f4acc27fa79b789c83298af7788c01e9b8c837aa5086d1675e98b7ef80abd7fe1b3decb4b36c3f586126f7d9dc54499358bc05f7e65e0de3cbc29207233188
7
- data.tar.gz: e036ad78bff71f98012907444f5eb36c56e01f3a3a8d2f37fbb0b06f5c1850eaddd26a4be86a8581a8f25e322731eac06a25a18853ac4433a2793cbd603b8727
6
+ metadata.gz: e1b2f9affe114ea775b4f7f7d4d2db4349e03b3ccb842885b3423c28c2b84ff6e8872b224a520654e0cef8eb353e9f0ea268e9d0dcda2666b07709f5071a0db7
7
+ data.tar.gz: 2feab585634685c45606d6e4668e52190af3fd193cf3c8468ea5b306a8834257c2944ca4c668ee5e1f9423ebfb3cf605de9d6c8052a983d57f3fe0df07d105c8
data/README.md CHANGED
@@ -63,7 +63,7 @@ $ rspec
63
63
  To exclude container-based tests
64
64
 
65
65
  ```sh
66
- $ rspec --tag ~docker
66
+ $ rspec --tag ~container
67
67
  ```
68
68
 
69
69
  To run **just** the feature specs
data/imap-backup.gemspec CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |gem|
27
27
  gem.add_runtime_dependency "os"
28
28
  gem.add_runtime_dependency "rake"
29
29
  gem.add_runtime_dependency "thor", "~> 1.1"
30
- gem.add_runtime_dependency "thunderbird", ">= 0.0.0"
30
+ gem.add_runtime_dependency "thunderbird", "0.3.0"
31
31
 
32
32
  gem.metadata = {
33
33
  "rubygems_mfa_required" => "true"
@@ -22,7 +22,7 @@ module Imap::Backup
22
22
  )
23
23
  wanted = backup_folders.map(&:name)
24
24
  serialized_folders = Account::SerializedFolders.new(account: account)
25
- serialized_folders.each do |serializer, _folder|
25
+ serialized_folders.each_key do |serializer|
26
26
  serializer.delete if !wanted.include?(serializer.folder)
27
27
  end
28
28
  end
@@ -17,7 +17,7 @@ module Imap::Backup
17
17
  @account = account
18
18
  end
19
19
 
20
- # Runs the enumeration
20
+ # Runs the enumeration over local serializers and remote folders
21
21
  # @yieldparam serializer [Serializer] the folder's serializer
22
22
  # @yieldparam folder [Account::Folder] the online folder
23
23
  # @return [void]
@@ -32,6 +32,32 @@ module Imap::Backup
32
32
  end
33
33
  end
34
34
 
35
+ # Runs the enumeration over each local serializer
36
+ # @yieldparam serializer [Serializer] the folder's serializer
37
+ # @return [void]
38
+ def each_key(&block)
39
+ return enum_for(:each_key) if !block
40
+
41
+ glob.each do |path|
42
+ name = path.relative_path_from(base).to_s[0..-6]
43
+ serializer = Serializer.new(account.local_path, name)
44
+ block.call(serializer)
45
+ end
46
+ end
47
+
48
+ # Runs the enumeration over each remote folder
49
+ # @yieldparam folder [Account::Folder] the online folder
50
+ # @return [void]
51
+ def each_value(&block)
52
+ return enum_for(:each_value) if !block
53
+
54
+ glob.each do |path|
55
+ name = path.relative_path_from(base).to_s[0..-6]
56
+ folder = Account::Folder.new(account.client, name)
57
+ block.call(folder)
58
+ end
59
+ end
60
+
35
61
  private
36
62
 
37
63
  attr_reader :account
@@ -42,9 +42,6 @@ module Imap::Backup
42
42
  # The address of the IMAP server
43
43
  # @return [String]
44
44
  attr_reader :server
45
- # Extra options to be passed to the IMAP server when connecting
46
- # @return [Hash, void]
47
- attr_reader :connection_options
48
45
  # The name of the download strategy to adopt during backups
49
46
  # @return [String]
50
47
  attr_accessor :download_strategy
@@ -67,10 +64,11 @@ module Imap::Backup
67
64
  @password = options[:password]
68
65
  @local_path = options[:local_path]
69
66
  @folders = options[:folders]
70
- @folder_blacklist = options[:folder_blacklist]
71
- @mirror_mode = options[:mirror_mode]
67
+ @folder_blacklist = options[:folder_blacklist] || false
68
+ @mirror_mode = options[:mirror_mode] || false
72
69
  @server = options[:server]
73
- @connection_options = options[:connection_options]
70
+ @connection_options = nil
71
+ @supplied_connection_options = options[:connection_options]
74
72
  @download_strategy = options[:download_strategy]
75
73
  @multi_fetch_size_orignal = options[:multi_fetch_size]
76
74
  @reset_seen_flags_after_fetch = options[:reset_seen_flags_after_fetch]
@@ -146,7 +144,7 @@ module Imap::Backup
146
144
  h[:folder_blacklist] = true if @folder_blacklist
147
145
  h[:mirror_mode] = true if @mirror_mode
148
146
  h[:server] = @server if @server
149
- h[:connection_options] = @connection_options if @connection_options
147
+ h[:connection_options] = @connection_options if connection_options
150
148
  h[:multi_fetch_size] = multi_fetch_size
151
149
  if @reset_seen_flags_after_fetch
152
150
  h[:reset_seen_flags_after_fetch] = @reset_seen_flags_after_fetch
@@ -198,8 +196,22 @@ module Imap::Backup
198
196
  update(:server, value)
199
197
  end
200
198
 
199
+ # Extra options to be passed to the IMAP server when connecting
200
+ # @return [Hash, void]
201
+ def connection_options
202
+ @connection_options ||=
203
+ case @supplied_connection_options
204
+ when String
205
+ JSON.parse(@supplied_connection_options, symbolize_names: true)
206
+ else
207
+ @supplied_connection_options
208
+ end
209
+ end
210
+
201
211
  # @return [void]
202
212
  def connection_options=(value)
213
+ # Ensure we've loaded the connection_options
214
+ connection_options
203
215
  parsed =
204
216
  if value == ""
205
217
  nil
@@ -70,7 +70,7 @@ module Imap::Backup
70
70
  list = serialized_folders.map { |_s, f| {name: f.name} }
71
71
  Kernel.puts list.to_json
72
72
  else
73
- serialized_folders.each do |_s, f|
73
+ serialized_folders.each_value do |f|
74
74
  Kernel.puts %("#{f.name}")
75
75
  end
76
76
  end
@@ -84,7 +84,7 @@ module Imap::Backup
84
84
 
85
85
  raise "No serialized folders were found for account '#{email}'" if serialized_folders.none?
86
86
 
87
- serialized_folders.each do |serializer, _folder|
87
+ serialized_folders.each_key do |serializer|
88
88
  Thunderbird::MailboxExporter.new(
89
89
  email, serializer, profile, force: force
90
90
  ).run
@@ -8,9 +8,7 @@ module Imap::Backup
8
8
  class Email::Provider::Base
9
9
  # @return [Hash] defaults for the Net::IMAP connection
10
10
  def options
11
- # rubocop:disable Naming/VariableNumber
12
- {port: 993, ssl: {ssl_version: :TLSv1_2}}
13
- # rubocop:enable Naming/VariableNumber
11
+ {port: 993, ssl: {min_version: OpenSSL::SSL::TLS1_2_VERSION}}
14
12
  end
15
13
 
16
14
  def sets_seen_flags_on_fetch?
@@ -104,7 +104,7 @@ module Imap::Backup
104
104
  @local_folder ||= begin
105
105
  top_level_folders = [EXPORT_PREFIX, email]
106
106
  prefixed_folder_path = File.join(top_level_folders, serializer.folder)
107
- ::Thunderbird::LocalFolder.new(profile, prefixed_folder_path)
107
+ ::Thunderbird::LocalFolder.new(profile: profile, path: prefixed_folder_path)
108
108
  end
109
109
  end
110
110
 
@@ -4,9 +4,9 @@ module Imap::Backup
4
4
  # @private
5
5
  MAJOR = 14
6
6
  # @private
7
- MINOR = 4
7
+ MINOR = 5
8
8
  # @private
9
- REVISION = 5
9
+ REVISION = 0
10
10
  # @private
11
11
  PRE = nil
12
12
  # The application version
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: 14.4.5
4
+ version: 14.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe Yates
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-24 00:00:00.000000000 Z
11
+ date: 2024-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: highline
@@ -112,16 +112,16 @@ dependencies:
112
112
  name: thunderbird
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ">="
115
+ - - '='
116
116
  - !ruby/object:Gem::Version
117
- version: 0.0.0
117
+ version: 0.3.0
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ">="
122
+ - - '='
123
123
  - !ruby/object:Gem::Version
124
- version: 0.0.0
124
+ version: 0.3.0
125
125
  description: Backup GMail, or any other IMAP email service, to disk.
126
126
  email:
127
127
  - joe.g.yates@gmail.com
@@ -218,7 +218,7 @@ licenses:
218
218
  - MIT
219
219
  metadata:
220
220
  rubygems_mfa_required: 'true'
221
- post_install_message:
221
+ post_install_message:
222
222
  rdoc_options: []
223
223
  require_paths:
224
224
  - lib
@@ -233,8 +233,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
233
233
  - !ruby/object:Gem::Version
234
234
  version: '0'
235
235
  requirements: []
236
- rubygems_version: 3.3.7
237
- signing_key:
236
+ rubygems_version: 3.4.10
237
+ signing_key:
238
238
  specification_version: 4
239
239
  summary: Backup GMail (or other IMAP) accounts to disk
240
240
  test_files: []