imap-backup 14.5.0 → 14.5.1

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: ee294a8f4d7c0af90c725939b3f4cd7826ac521194460af3446e7cf5378629f4
4
- data.tar.gz: c67cac7ddfb2448a9cb22b642b53be02b157959d51f3677bc37ec891da2471c8
3
+ metadata.gz: 7ff8bf4fdd37e57e1fd9cef8abc4485813eeb48752768a3f463df3afac3dc4d6
4
+ data.tar.gz: 831899f082fff0997acd46d1e341004ac43cf53a2883358e67ab095b88a26bf7
5
5
  SHA512:
6
- metadata.gz: e1b2f9affe114ea775b4f7f7d4d2db4349e03b3ccb842885b3423c28c2b84ff6e8872b224a520654e0cef8eb353e9f0ea268e9d0dcda2666b07709f5071a0db7
7
- data.tar.gz: 2feab585634685c45606d6e4668e52190af3fd193cf3c8468ea5b306a8834257c2944ca4c668ee5e1f9423ebfb3cf605de9d6c8052a983d57f3fe0df07d105c8
6
+ metadata.gz: d826d98de67625935c73a0ae01f2896717428dc3357ba899f5edee47a8b458064c932eea98a7331b0c6678f233329ae71001d7038cfaf1dd22aa5ea5f19d723e
7
+ data.tar.gz: 9570a8070e6ab390c65dfb1a395a69f5b26aa501a777acb8e1cd58956adddd76b0c6e6bdd828b26f29c375ff671adcb31a91fdd85839be363d99179bea92bf9f
@@ -108,6 +108,7 @@ module Imap::Backup
108
108
  def delete
109
109
  return if !exist?
110
110
 
111
+ Logger.logger.info("Deleting metadata file '#{pathname}'")
111
112
  FileUtils.rm(pathname)
112
113
  @loaded = false
113
114
  @messages = nil
@@ -70,6 +70,7 @@ module Imap::Backup
70
70
  def delete
71
71
  return if !exist?
72
72
 
73
+ Logger.logger.info("Deleting mailbox '#{pathname}'")
73
74
  FileUtils.rm(pathname)
74
75
  end
75
76
 
@@ -28,7 +28,41 @@ module Imap::Backup
28
28
  extend Forwardable
29
29
 
30
30
  def_delegator :mbox, :pathname, :mbox_pathname
31
- def_delegators :imap, :get, :messages, :uid_validity, :uids, :update_uid
31
+
32
+ # Get message metadata
33
+ # @param uid [Integer] a message UID
34
+ # @return [Serializer::Message]
35
+ def get(uid)
36
+ validate!
37
+ imap.get(uid)
38
+ end
39
+
40
+ # @return [Array<Hash>]
41
+ def messages
42
+ validate!
43
+ imap.messages
44
+ end
45
+
46
+ # @return [Integer] the UID validity for the folder
47
+ def uid_validity
48
+ validate!
49
+ imap.uid_validity
50
+ end
51
+
52
+ # @return [Array<Integer>] The uids of all messages
53
+ def uids
54
+ validate!
55
+ imap.uids
56
+ end
57
+
58
+ # Update a message's metadata, replacing its UID
59
+ # @param old [Integer] the existing message UID
60
+ # @param new [Integer] the new UID to apply to the message
61
+ # @return [void]
62
+ def update_uid(old, new)
63
+ validate!
64
+ imap.update_uid(old, new)
65
+ end
32
66
 
33
67
  # @return [String] a folder name
34
68
  attr_reader :folder
@@ -62,10 +96,14 @@ module Imap::Backup
62
96
 
63
97
  optionally_migrate2to3
64
98
 
65
- if imap.valid? && mbox.valid?
99
+ imap_valid = imap.valid?
100
+ mbox_valid = mbox.valid?
101
+ if imap_valid && mbox_valid
66
102
  @validated = true
67
103
  return true
68
104
  end
105
+ Logger.logger.info("Metadata file '#{imap.pathname}' is invalid") if !imap_valid
106
+ Logger.logger.info("Mailbox '#{mbox.pathname}' is invalid") if !mbox_valid
69
107
 
70
108
  delete
71
109
 
@@ -247,6 +285,8 @@ module Imap::Backup
247
285
  MESSAGE
248
286
 
249
287
  migrator.run
288
+ # Ensure new metadata gets loaded
289
+ @imap = nil
250
290
  end
251
291
 
252
292
  def ensure_containing_directory
@@ -6,7 +6,7 @@ module Imap::Backup
6
6
  # @private
7
7
  MINOR = 5
8
8
  # @private
9
- REVISION = 0
9
+ REVISION = 1
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.5.0
4
+ version: 14.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe Yates
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-13 00:00:00.000000000 Z
11
+ date: 2024-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: highline