imap-backup 1.4.2 → 2.0.0.rc1
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 +4 -4
- data/.rspec-all +2 -0
- data/README.md +36 -3
- data/bin/imap-backup +5 -0
- data/imap-backup.gemspec +7 -0
- data/lib/email/mboxrd/message.rb +13 -10
- data/lib/email/provider.rb +11 -2
- data/lib/imap/backup.rb +2 -1
- data/lib/imap/backup/account/connection.rb +41 -0
- data/lib/imap/backup/account/folder.rb +42 -2
- data/lib/imap/backup/serializer.rb +6 -0
- data/lib/imap/backup/serializer/mbox.rb +63 -83
- data/lib/imap/backup/serializer/mbox_store.rb +214 -0
- data/lib/imap/backup/uploader.rb +26 -0
- data/lib/imap/backup/utils.rb +3 -3
- data/lib/imap/backup/version.rb +5 -4
- data/spec/features/backup_spec.rb +85 -7
- data/spec/features/restore_spec.rb +112 -0
- data/spec/features/support/backup_directory.rb +21 -1
- data/spec/features/support/email_server.rb +66 -3
- data/spec/features/support/shared/message_fixtures.rb +2 -0
- data/spec/fixtures/connection.yml +2 -3
- data/spec/unit/account/connection_spec.rb +19 -5
- data/spec/unit/configuration/account_spec.rb +2 -1
- data/spec/unit/email/provider_spec.rb +1 -5
- data/spec/unit/serializer/mbox_spec.rb +52 -89
- data/spec/unit/serializer/mbox_store_spec.rb +117 -0
- data/spec/unit/utils_spec.rb +3 -3
- metadata +17 -8
- data/lib/imap/backup/serializer/base.rb +0 -16
- data/spec/unit/serializer/base_spec.rb +0 -19
data/spec/unit/utils_spec.rb
CHANGED
@@ -49,12 +49,12 @@ describe Imap::Backup::Utils do
|
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
-
context ".
|
52
|
+
context ".mode" do
|
53
53
|
context "with existing files" do
|
54
54
|
let(:mode) { 0o2345 }
|
55
55
|
|
56
56
|
it "is the last 9 bits of the file mode" do
|
57
|
-
expect(described_class.
|
57
|
+
expect(described_class.mode(filename)).to eq(0o345)
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
@@ -62,7 +62,7 @@ describe Imap::Backup::Utils do
|
|
62
62
|
let(:exists) { false }
|
63
63
|
|
64
64
|
it "is nil" do
|
65
|
-
expect(described_class.
|
65
|
+
expect(described_class.mode(filename)).to be_nil
|
66
66
|
end
|
67
67
|
end
|
68
68
|
end
|
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: 2.0.0.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joe Yates
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-08-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -132,6 +132,7 @@ extra_rdoc_files: []
|
|
132
132
|
files:
|
133
133
|
- ".gitignore"
|
134
134
|
- ".rspec"
|
135
|
+
- ".rspec-all"
|
135
136
|
- ".rubocop.yml"
|
136
137
|
- ".travis.yml"
|
137
138
|
- Gemfile
|
@@ -154,12 +155,15 @@ files:
|
|
154
155
|
- lib/imap/backup/configuration/setup.rb
|
155
156
|
- lib/imap/backup/configuration/store.rb
|
156
157
|
- lib/imap/backup/downloader.rb
|
157
|
-
- lib/imap/backup/serializer
|
158
|
+
- lib/imap/backup/serializer.rb
|
158
159
|
- lib/imap/backup/serializer/mbox.rb
|
160
|
+
- lib/imap/backup/serializer/mbox_store.rb
|
161
|
+
- lib/imap/backup/uploader.rb
|
159
162
|
- lib/imap/backup/utils.rb
|
160
163
|
- lib/imap/backup/version.rb
|
161
164
|
- spec/features/backup_spec.rb
|
162
165
|
- spec/features/helper.rb
|
166
|
+
- spec/features/restore_spec.rb
|
163
167
|
- spec/features/support/backup_directory.rb
|
164
168
|
- spec/features/support/email_server.rb
|
165
169
|
- spec/features/support/shared/connection_context.rb
|
@@ -183,14 +187,18 @@ files:
|
|
183
187
|
- spec/unit/downloader_spec.rb
|
184
188
|
- spec/unit/email/mboxrd/message_spec.rb
|
185
189
|
- spec/unit/email/provider_spec.rb
|
186
|
-
- spec/unit/serializer/base_spec.rb
|
187
190
|
- spec/unit/serializer/mbox_spec.rb
|
191
|
+
- spec/unit/serializer/mbox_store_spec.rb
|
188
192
|
- spec/unit/utils_spec.rb
|
189
193
|
- tmp/.gitkeep
|
190
194
|
homepage: https://github.com/joeyates/imap-backup
|
191
195
|
licenses: []
|
192
196
|
metadata: {}
|
193
|
-
post_install_message:
|
197
|
+
post_install_message: |
|
198
|
+
When upgrading imap-backup from version 1.x to 2.x not that the
|
199
|
+
metadata storage method has changed (from flat file to JSON).
|
200
|
+
As a result, on the first run after an upgrade, old backup folders will be
|
201
|
+
**deleted** and a full new backup created.
|
194
202
|
rdoc_options: []
|
195
203
|
require_paths:
|
196
204
|
- lib
|
@@ -201,9 +209,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
201
209
|
version: '0'
|
202
210
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
203
211
|
requirements:
|
204
|
-
- - "
|
212
|
+
- - ">"
|
205
213
|
- !ruby/object:Gem::Version
|
206
|
-
version:
|
214
|
+
version: 1.3.1
|
207
215
|
requirements: []
|
208
216
|
rubyforge_project:
|
209
217
|
rubygems_version: 2.7.6
|
@@ -213,6 +221,7 @@ summary: Backup GMail (or other IMAP) accounts to disk
|
|
213
221
|
test_files:
|
214
222
|
- spec/features/backup_spec.rb
|
215
223
|
- spec/features/helper.rb
|
224
|
+
- spec/features/restore_spec.rb
|
216
225
|
- spec/features/support/backup_directory.rb
|
217
226
|
- spec/features/support/email_server.rb
|
218
227
|
- spec/features/support/shared/connection_context.rb
|
@@ -236,6 +245,6 @@ test_files:
|
|
236
245
|
- spec/unit/downloader_spec.rb
|
237
246
|
- spec/unit/email/mboxrd/message_spec.rb
|
238
247
|
- spec/unit/email/provider_spec.rb
|
239
|
-
- spec/unit/serializer/base_spec.rb
|
240
248
|
- spec/unit/serializer/mbox_spec.rb
|
249
|
+
- spec/unit/serializer/mbox_store_spec.rb
|
241
250
|
- spec/unit/utils_spec.rb
|
@@ -1,16 +0,0 @@
|
|
1
|
-
module Imap::Backup
|
2
|
-
module Serializer
|
3
|
-
DIRECTORY_PERMISSIONS = 0o700
|
4
|
-
FILE_PERMISSIONS = 0o600
|
5
|
-
|
6
|
-
class Base
|
7
|
-
attr_reader :path
|
8
|
-
attr_reader :folder
|
9
|
-
|
10
|
-
def initialize(path, folder)
|
11
|
-
@path, @folder = path, folder
|
12
|
-
Utils.check_permissions(@path, DIRECTORY_PERMISSIONS)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe Imap::Backup::Serializer::Base do
|
4
|
-
context "#initialize" do
|
5
|
-
let(:stat) { double("File::Stat", mode: 0o345) }
|
6
|
-
|
7
|
-
before do
|
8
|
-
allow(File).to receive(:exist?).with("/base/path").and_return(true)
|
9
|
-
allow(File).to receive(:stat).with("/base/path").and_return(stat)
|
10
|
-
end
|
11
|
-
|
12
|
-
it "should fail if file permissions are to lax" do
|
13
|
-
message = "Permissions on '/base/path' should be 0700, not 0345"
|
14
|
-
expect do
|
15
|
-
described_class.new("/base/path", "my_folder")
|
16
|
-
end.to raise_error(RuntimeError, message)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|