imap-backup 4.1.2 → 4.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 00a744249ff80a26be2c57655709be59d9678c9bb998dc1c9f3ea4bf3539d747
4
- data.tar.gz: 4f44c050c66fe2ef2e136b46dec581a91f77ab4b650e9b3466a893540e481a24
3
+ metadata.gz: e0cd29188ed972abfb2b2ce21d237ce3b7aed5b434717ba64fa2e3475da38ded
4
+ data.tar.gz: 597b58cdee1ab1b5881ea29111ac85e7fdedfbaa370824d0d24ba1b19c869dcb
5
5
  SHA512:
6
- metadata.gz: 66067924fda33810aff4b02aa047c20cd26ce3fc31d8e752fc43a8f78af3e1c952871fa0ba372c670a5ee399e7fc686f9df9601fc5cbb7caa6f2065b4ac95b90
7
- data.tar.gz: 443a86c3bda9cc1652fc9d1c5619347c1d82498befed16851a6f8a227eaf3299813dd6a4084e1bb0d180170adb1b63ccf8e5d2a8bb19f0457611e7916d796c4d
6
+ metadata.gz: a3adc1984eea76a5ef993a40e89520a01997e6d01357e0a1e41cd4b58a4efc56801fc3d4f8801b95e828ec3a6a1e7884be974aaabf40f921a3faccdc99cf9b98
7
+ data.tar.gz: 55c0c91fdfb4829ba77be5292b4e475c6ea31e9e6e9ea5abf9702121f8a12c20b9b0105da5e1b97bcb2482105807c614530dea9e058d64af2cde96f7fd19348b
@@ -10,7 +10,7 @@ module Email::Mboxrd
10
10
 
11
11
  attr_reader :supplied_body
12
12
 
13
- def self.from_serialized(serialized)
13
+ def self.clean_serialized(serialized)
14
14
  cleaned = serialized.gsub(/^>(>*From)/, "\\1")
15
15
  # Serialized messages in this format *should* start with a line
16
16
  # From xxx yy zz
@@ -19,7 +19,11 @@ module Email::Mboxrd
19
19
  cleaned = cleaned.sub(/^From .*[\r\n]*/, "")
20
20
  end
21
21
  # rubocop:enable Style/IfUnlessModifier
22
- new(cleaned)
22
+ cleaned
23
+ end
24
+
25
+ def self.from_serialized(serialized)
26
+ new(clean_serialized(serialized))
23
27
  end
24
28
 
25
29
  def initialize(supplied_body)
@@ -40,7 +40,16 @@ module Imap::Backup
40
40
  end
41
41
  end
42
42
 
43
- FileUtils.cp serializer.mbox_pathname, local_folder.full_path
43
+ File.open(local_folder.full_path, "w") do |f|
44
+ enumerator = Serializer::MboxEnumerator.new(serializer.mbox_pathname)
45
+ enumerator.each.with_index do |raw, i|
46
+ clean = Email::Mboxrd::Message.clean_serialized(raw)
47
+ timestamp = Time.now.strftime("%a %b %d %H:%M:%S %Y")
48
+ thunderbird_fom_line = "From - #{timestamp}"
49
+ output = "#{thunderbird_fom_line}\n#{clean}\n"
50
+ f.write output
51
+ end
52
+ end
44
53
 
45
54
  true
46
55
  end
@@ -2,8 +2,8 @@ module Imap; end
2
2
 
3
3
  module Imap::Backup
4
4
  MAJOR = 4
5
- MINOR = 1
6
- REVISION = 2
5
+ MINOR = 2
6
+ REVISION = 0
7
7
  PRE = nil
8
8
  VERSION = [MAJOR, MINOR, REVISION, PRE].compact.map(&:to_s).join(".")
9
9
  end
@@ -77,17 +77,14 @@ class Thunderbird::Subdirectory
77
77
 
78
78
  def check
79
79
  case
80
- when placeholder.exists? && !exists?
81
- Kernel.puts "Can't set up folder '#{folder_path}': '#{placeholder.path}' exists, but '#{full_path}' is missing"
82
- false
83
80
  when exists? && !placeholder.exists?
84
- Kernel.puts "Can't set up folder '#{folder_path}': '#{full_path}' exists, but '#{placeholder.path}' is missing"
81
+ Kernel.puts "Can't set up folder '#{full_path}': '#{full_path}' exists, but '#{placeholder.path}' is missing"
85
82
  false
86
83
  when placeholder.exists? && !placeholder.regular?
87
- Kernel.puts "Can't set up folder '#{folder_path}': '#{placeholder.path}' exists, but it is not a regular file"
84
+ Kernel.puts "Can't set up folder '#{full_path}': '#{placeholder.path}' exists, but it is not a regular file"
88
85
  false
89
86
  when exists? && !directory?
90
- Kernel.puts "Can't set up folder '#{folder_path}': '#{full_path}' exists, but it is not a directory"
87
+ Kernel.puts "Can't set up folder '#{full_path}': '#{full_path}' exists, but it is not a directory"
91
88
  false
92
89
  else
93
90
  true
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.1.2
4
+ version: 4.2.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: 2022-01-07 00:00:00.000000000 Z
11
+ date: 2022-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: highline
@@ -271,7 +271,7 @@ homepage: https://github.com/joeyates/imap-backup
271
271
  licenses:
272
272
  - MIT
273
273
  metadata: {}
274
- post_install_message:
274
+ post_install_message:
275
275
  rdoc_options: []
276
276
  require_paths:
277
277
  - lib
@@ -287,46 +287,46 @@ required_rubygems_version: !ruby/object:Gem::Requirement
287
287
  version: '0'
288
288
  requirements: []
289
289
  rubygems_version: 3.1.6
290
- signing_key:
290
+ signing_key:
291
291
  specification_version: 4
292
292
  summary: Backup GMail (or other IMAP) accounts to disk
293
293
  test_files:
294
- - spec/features/helper.rb
295
- - spec/features/support/backup_directory.rb
296
- - spec/features/support/shared/message_fixtures.rb
297
- - spec/features/support/shared/connection_context.rb
298
- - spec/features/support/email_server.rb
299
- - spec/features/restore_spec.rb
300
- - spec/features/status_spec.rb
301
- - spec/features/backup_spec.rb
302
- - spec/support/higline_test_helpers.rb
303
- - spec/support/fixtures.rb
304
- - spec/support/silence_logging.rb
305
- - spec/gather_rspec_coverage.rb
306
- - spec/unit/email/provider/gmail_spec.rb
307
- - spec/unit/email/provider/fastmail_spec.rb
308
- - spec/unit/email/provider/base_spec.rb
309
- - spec/unit/email/provider/apple_mail_spec.rb
310
- - spec/unit/email/mboxrd/message_spec.rb
311
- - spec/unit/email/provider_spec.rb
312
- - spec/unit/imap/backup/cli/utils_spec.rb
313
- - spec/unit/imap/backup/cli/accounts_spec.rb
314
- - spec/unit/imap/backup/cli/local_spec.rb
294
+ - spec/spec_helper.rb
295
+ - spec/unit/imap/backup/serializer/mbox_spec.rb
296
+ - spec/unit/imap/backup/serializer/mbox_store_spec.rb
297
+ - spec/unit/imap/backup/serializer/mbox_enumerator_spec.rb
298
+ - spec/unit/imap/backup/setup_spec.rb
299
+ - spec/unit/imap/backup/logger_spec.rb
300
+ - spec/unit/imap/backup/configuration_spec.rb
315
301
  - spec/unit/imap/backup/setup/account_spec.rb
316
302
  - spec/unit/imap/backup/setup/connection_tester_spec.rb
317
- - spec/unit/imap/backup/setup/folder_chooser_spec.rb
318
303
  - spec/unit/imap/backup/setup/asker_spec.rb
319
- - spec/unit/imap/backup/uploader_spec.rb
320
- - spec/unit/imap/backup/utils_spec.rb
321
- - spec/unit/imap/backup/configuration_spec.rb
322
- - spec/unit/imap/backup/setup_spec.rb
323
- - spec/unit/imap/backup/logger_spec.rb
324
- - spec/unit/imap/backup/serializer/mbox_store_spec.rb
325
- - spec/unit/imap/backup/serializer/mbox_enumerator_spec.rb
326
- - spec/unit/imap/backup/serializer/mbox_spec.rb
304
+ - spec/unit/imap/backup/setup/folder_chooser_spec.rb
305
+ - spec/unit/imap/backup/cli/accounts_spec.rb
306
+ - spec/unit/imap/backup/cli/utils_spec.rb
307
+ - spec/unit/imap/backup/cli/local_spec.rb
327
308
  - spec/unit/imap/backup/downloader_spec.rb
309
+ - spec/unit/imap/backup/uploader_spec.rb
328
310
  - spec/unit/imap/backup/account/folder_spec.rb
329
311
  - spec/unit/imap/backup/account/connection_spec.rb
312
+ - spec/unit/imap/backup/utils_spec.rb
330
313
  - spec/unit/imap/backup/client/default_spec.rb
331
- - spec/spec_helper.rb
314
+ - spec/unit/email/mboxrd/message_spec.rb
315
+ - spec/unit/email/provider/gmail_spec.rb
316
+ - spec/unit/email/provider/apple_mail_spec.rb
317
+ - spec/unit/email/provider/fastmail_spec.rb
318
+ - spec/unit/email/provider/base_spec.rb
319
+ - spec/unit/email/provider_spec.rb
320
+ - spec/features/backup_spec.rb
321
+ - spec/features/helper.rb
322
+ - spec/features/restore_spec.rb
323
+ - spec/features/status_spec.rb
324
+ - spec/features/support/email_server.rb
325
+ - spec/features/support/backup_directory.rb
326
+ - spec/features/support/shared/connection_context.rb
327
+ - spec/features/support/shared/message_fixtures.rb
328
+ - spec/support/fixtures.rb
329
+ - spec/support/silence_logging.rb
330
+ - spec/support/higline_test_helpers.rb
332
331
  - spec/fixtures/connection.yml
332
+ - spec/gather_rspec_coverage.rb