middleman-s3_sync 4.6.1 → 4.6.3
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/.envrc.backup +5 -0
- data/.gitignore +1 -0
- data/.mise.toml +17 -0
- data/Changelog.md +12 -0
- data/WARP.md +112 -0
- data/lib/middleman/s3_sync/options.rb +26 -3
- data/lib/middleman/s3_sync/resource.rb +59 -39
- data/lib/middleman/s3_sync/version.rb +1 -1
- data/lib/middleman/s3_sync.rb +3 -3
- data/lib/middleman-s3_sync/extension.rb +22 -1
- data/middleman-s3_sync.gemspec +2 -4
- data/spec/aws_sdk_parameters_spec.rb +525 -0
- data/spec/extension_spec.rb +114 -0
- data/spec/options_spec.rb +272 -0
- metadata +17 -36
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Middleman::S3Sync::Options do
|
|
4
|
+
let(:options) { described_class.new }
|
|
5
|
+
|
|
6
|
+
describe 'option accessors' do
|
|
7
|
+
it 'provides accessors for all defined options' do
|
|
8
|
+
described_class::OPTIONS.each do |option_name|
|
|
9
|
+
expect(options).to respond_to(option_name)
|
|
10
|
+
expect(options).to respond_to("#{option_name}=")
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
describe 'AWS credentials options' do
|
|
16
|
+
it 'supports aws_access_key_id' do
|
|
17
|
+
options.aws_access_key_id = 'test_key'
|
|
18
|
+
expect(options.aws_access_key_id).to eq('test_key')
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
it 'supports aws_secret_access_key' do
|
|
22
|
+
options.aws_secret_access_key = 'test_secret'
|
|
23
|
+
expect(options.aws_secret_access_key).to eq('test_secret')
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
it 'supports aws_session_token' do
|
|
27
|
+
options.aws_session_token = 'test_token'
|
|
28
|
+
expect(options.aws_session_token).to eq('test_token')
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
it 'falls back to ENV for aws_access_key_id' do
|
|
32
|
+
ENV['AWS_ACCESS_KEY_ID'] = 'env_key'
|
|
33
|
+
expect(options.aws_access_key_id).to eq('env_key')
|
|
34
|
+
ensure
|
|
35
|
+
ENV.delete('AWS_ACCESS_KEY_ID')
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
it 'falls back to ENV for aws_secret_access_key' do
|
|
39
|
+
ENV['AWS_SECRET_ACCESS_KEY'] = 'env_secret'
|
|
40
|
+
expect(options.aws_secret_access_key).to eq('env_secret')
|
|
41
|
+
ensure
|
|
42
|
+
ENV.delete('AWS_SECRET_ACCESS_KEY')
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
describe 'CloudFront options' do
|
|
47
|
+
it 'supports cloudfront_distribution_id' do
|
|
48
|
+
options.cloudfront_distribution_id = 'E1234567890123'
|
|
49
|
+
expect(options.cloudfront_distribution_id).to eq('E1234567890123')
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
it 'supports cloudfront_invalidate' do
|
|
53
|
+
options.cloudfront_invalidate = true
|
|
54
|
+
expect(options.cloudfront_invalidate).to be true
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
it 'supports cloudfront_invalidate_all' do
|
|
58
|
+
options.cloudfront_invalidate_all = true
|
|
59
|
+
expect(options.cloudfront_invalidate_all).to be true
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
it 'supports cloudfront_invalidation_batch_size' do
|
|
63
|
+
options.cloudfront_invalidation_batch_size = 500
|
|
64
|
+
expect(options.cloudfront_invalidation_batch_size).to eq(500)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
it 'supports cloudfront_invalidation_max_retries' do
|
|
68
|
+
options.cloudfront_invalidation_max_retries = 10
|
|
69
|
+
expect(options.cloudfront_invalidation_max_retries).to eq(10)
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
it 'supports cloudfront_invalidation_batch_delay' do
|
|
73
|
+
options.cloudfront_invalidation_batch_delay = 5
|
|
74
|
+
expect(options.cloudfront_invalidation_batch_delay).to eq(5)
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
it 'supports cloudfront_wait' do
|
|
78
|
+
options.cloudfront_wait = true
|
|
79
|
+
expect(options.cloudfront_wait).to be true
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
describe 'S3 options' do
|
|
84
|
+
it 'supports bucket' do
|
|
85
|
+
options.bucket = 'my-bucket'
|
|
86
|
+
expect(options.bucket).to eq('my-bucket')
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
it 'supports region' do
|
|
90
|
+
options.region = 'us-west-2'
|
|
91
|
+
expect(options.region).to eq('us-west-2')
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
it 'supports endpoint' do
|
|
95
|
+
options.endpoint = 'https://s3-compatible.example.com'
|
|
96
|
+
expect(options.endpoint).to eq('https://s3-compatible.example.com')
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
it 'supports prefix' do
|
|
100
|
+
options.prefix = 'my-prefix'
|
|
101
|
+
expect(options.prefix).to eq('my-prefix/')
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
it 'supports path_style' do
|
|
105
|
+
options.path_style = false
|
|
106
|
+
expect(options.path_style).to be false
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
it 'defaults path_style to true' do
|
|
110
|
+
expect(options.path_style).to be true
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
it 'supports encryption' do
|
|
114
|
+
options.encryption = true
|
|
115
|
+
expect(options.encryption).to be true
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
it 'defaults encryption to false' do
|
|
119
|
+
expect(options.encryption).to be false
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
it 'supports reduced_redundancy_storage' do
|
|
123
|
+
options.reduced_redundancy_storage = true
|
|
124
|
+
expect(options.reduced_redundancy_storage).to be true
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
describe 'ACL options' do
|
|
129
|
+
it 'supports acl' do
|
|
130
|
+
options.acl = 'private'
|
|
131
|
+
expect(options.acl).to eq('private')
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
it 'defaults acl to public-read' do
|
|
135
|
+
expect(options.acl).to eq('public-read')
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
it 'supports acl_enabled?' do
|
|
139
|
+
expect(options.acl_enabled?).to be true
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
context 'when acl is disabled' do
|
|
143
|
+
it 'returns false for acl_enabled? when set to empty string' do
|
|
144
|
+
options.acl = ''
|
|
145
|
+
expect(options.acl_enabled?).to be false
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
it 'returns false for acl_enabled? when set to nil' do
|
|
149
|
+
options.acl = nil
|
|
150
|
+
expect(options.acl_enabled?).to be false
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
it 'returns false for acl_enabled? when set to false' do
|
|
154
|
+
options.acl = false
|
|
155
|
+
expect(options.acl_enabled?).to be false
|
|
156
|
+
end
|
|
157
|
+
end
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
describe 'sync behavior options' do
|
|
161
|
+
it 'supports delete' do
|
|
162
|
+
options.delete = false
|
|
163
|
+
expect(options.delete).to be false
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
it 'defaults delete to true' do
|
|
167
|
+
expect(options.delete).to be true
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
it 'supports force' do
|
|
171
|
+
options.force = true
|
|
172
|
+
expect(options.force).to be true
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
it 'supports prefer_gzip' do
|
|
176
|
+
options.prefer_gzip = false
|
|
177
|
+
expect(options.prefer_gzip).to be false
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
it 'defaults prefer_gzip to true' do
|
|
181
|
+
expect(options.prefer_gzip).to be true
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
it 'supports verbose' do
|
|
185
|
+
options.verbose = true
|
|
186
|
+
expect(options.verbose).to be true
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
it 'supports dry_run' do
|
|
190
|
+
options.dry_run = true
|
|
191
|
+
expect(options.dry_run).to be true
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
it 'supports version_bucket' do
|
|
195
|
+
options.version_bucket = true
|
|
196
|
+
expect(options.version_bucket).to be true
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
it 'defaults version_bucket to false' do
|
|
200
|
+
expect(options.version_bucket).to be false
|
|
201
|
+
end
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
describe 'build options' do
|
|
205
|
+
it 'supports build_dir' do
|
|
206
|
+
options.build_dir = 'dist'
|
|
207
|
+
expect(options.build_dir).to eq('dist')
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
it 'supports after_build' do
|
|
211
|
+
options.after_build = true
|
|
212
|
+
expect(options.after_build).to be true
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
it 'defaults after_build to false' do
|
|
216
|
+
expect(options.after_build).to be false
|
|
217
|
+
end
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
describe 'content options' do
|
|
221
|
+
it 'supports content_types' do
|
|
222
|
+
content_types = { '.webp' => 'image/webp' }
|
|
223
|
+
options.content_types = content_types
|
|
224
|
+
expect(options.content_types).to eq(content_types)
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
it 'supports ignore_paths' do
|
|
228
|
+
ignore_paths = [/\.bak$/, 'temp/']
|
|
229
|
+
options.ignore_paths = ignore_paths
|
|
230
|
+
expect(options.ignore_paths).to eq(ignore_paths)
|
|
231
|
+
end
|
|
232
|
+
|
|
233
|
+
it 'defaults ignore_paths to empty array' do
|
|
234
|
+
expect(options.ignore_paths).to eq([])
|
|
235
|
+
end
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
describe 'website options' do
|
|
239
|
+
it 'supports index_document' do
|
|
240
|
+
options.index_document = 'index.html'
|
|
241
|
+
expect(options.index_document).to eq('index.html')
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
it 'supports error_document' do
|
|
245
|
+
options.error_document = '404.html'
|
|
246
|
+
expect(options.error_document).to eq('404.html')
|
|
247
|
+
end
|
|
248
|
+
end
|
|
249
|
+
|
|
250
|
+
describe 'option consistency' do
|
|
251
|
+
it 'includes all options from extension in OPTIONS constant' do
|
|
252
|
+
# These are the options defined in the extension
|
|
253
|
+
extension_options = [
|
|
254
|
+
:prefix, :http_prefix, :acl, :bucket, :endpoint, :region,
|
|
255
|
+
:aws_access_key_id, :aws_secret_access_key, :aws_session_token,
|
|
256
|
+
:after_build, :build_dir, :delete, :encryption, :force,
|
|
257
|
+
:prefer_gzip, :reduced_redundancy_storage, :path_style,
|
|
258
|
+
:version_bucket, :verbose, :dry_run, :index_document,
|
|
259
|
+
:error_document, :content_types, :ignore_paths,
|
|
260
|
+
:cloudfront_distribution_id, :cloudfront_invalidate,
|
|
261
|
+
:cloudfront_invalidate_all, :cloudfront_invalidation_batch_size,
|
|
262
|
+
:cloudfront_invalidation_max_retries, :cloudfront_invalidation_batch_delay,
|
|
263
|
+
:cloudfront_wait
|
|
264
|
+
]
|
|
265
|
+
|
|
266
|
+
extension_options.each do |option_name|
|
|
267
|
+
expect(described_class::OPTIONS).to include(option_name),
|
|
268
|
+
"Expected OPTIONS to include :#{option_name}"
|
|
269
|
+
end
|
|
270
|
+
end
|
|
271
|
+
end
|
|
272
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: middleman-s3_sync
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.6.
|
|
4
|
+
version: 4.6.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Frederic Jean
|
|
8
8
|
- Will Koehler
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-01-03 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: middleman-core
|
|
@@ -38,34 +38,20 @@ dependencies:
|
|
|
38
38
|
- - ">="
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
40
|
version: '0'
|
|
41
|
-
- !ruby/object:Gem::Dependency
|
|
42
|
-
name: unf
|
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
|
44
|
-
requirements:
|
|
45
|
-
- - ">="
|
|
46
|
-
- !ruby/object:Gem::Version
|
|
47
|
-
version: '0'
|
|
48
|
-
type: :runtime
|
|
49
|
-
prerelease: false
|
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
-
requirements:
|
|
52
|
-
- - ">="
|
|
53
|
-
- !ruby/object:Gem::Version
|
|
54
|
-
version: '0'
|
|
55
41
|
- !ruby/object:Gem::Dependency
|
|
56
42
|
name: aws-sdk-s3
|
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
|
58
44
|
requirements:
|
|
59
45
|
- - ">="
|
|
60
46
|
- !ruby/object:Gem::Version
|
|
61
|
-
version:
|
|
47
|
+
version: 1.187.0
|
|
62
48
|
type: :runtime
|
|
63
49
|
prerelease: false
|
|
64
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
51
|
requirements:
|
|
66
52
|
- - ">="
|
|
67
53
|
- !ruby/object:Gem::Version
|
|
68
|
-
version:
|
|
54
|
+
version: 1.187.0
|
|
69
55
|
- !ruby/object:Gem::Dependency
|
|
70
56
|
name: aws-sdk-cloudfront
|
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -84,16 +70,16 @@ dependencies:
|
|
|
84
70
|
name: map
|
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|
|
86
72
|
requirements:
|
|
87
|
-
- -
|
|
73
|
+
- - '='
|
|
88
74
|
- !ruby/object:Gem::Version
|
|
89
|
-
version:
|
|
75
|
+
version: 6.6.0
|
|
90
76
|
type: :runtime
|
|
91
77
|
prerelease: false
|
|
92
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
93
79
|
requirements:
|
|
94
|
-
- -
|
|
80
|
+
- - '='
|
|
95
81
|
- !ruby/object:Gem::Version
|
|
96
|
-
version:
|
|
82
|
+
version: 6.6.0
|
|
97
83
|
- !ruby/object:Gem::Dependency
|
|
98
84
|
name: parallel
|
|
99
85
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -150,20 +136,6 @@ dependencies:
|
|
|
150
136
|
- - "~>"
|
|
151
137
|
- !ruby/object:Gem::Version
|
|
152
138
|
version: '3.1'
|
|
153
|
-
- !ruby/object:Gem::Dependency
|
|
154
|
-
name: base64
|
|
155
|
-
requirement: !ruby/object:Gem::Requirement
|
|
156
|
-
requirements:
|
|
157
|
-
- - ">="
|
|
158
|
-
- !ruby/object:Gem::Version
|
|
159
|
-
version: '0'
|
|
160
|
-
type: :runtime
|
|
161
|
-
prerelease: false
|
|
162
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
163
|
-
requirements:
|
|
164
|
-
- - ">="
|
|
165
|
-
- !ruby/object:Gem::Version
|
|
166
|
-
version: '0'
|
|
167
139
|
- !ruby/object:Gem::Dependency
|
|
168
140
|
name: nokogiri
|
|
169
141
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -311,7 +283,9 @@ executables: []
|
|
|
311
283
|
extensions: []
|
|
312
284
|
extra_rdoc_files: []
|
|
313
285
|
files:
|
|
286
|
+
- ".envrc.backup"
|
|
314
287
|
- ".gitignore"
|
|
288
|
+
- ".mise.toml"
|
|
315
289
|
- ".rspec"
|
|
316
290
|
- ".s3_sync.sample"
|
|
317
291
|
- ".travis.yml"
|
|
@@ -320,6 +294,7 @@ files:
|
|
|
320
294
|
- LICENSE.txt
|
|
321
295
|
- README.md
|
|
322
296
|
- Rakefile
|
|
297
|
+
- WARP.md
|
|
323
298
|
- lib/middleman-s3_sync.rb
|
|
324
299
|
- lib/middleman-s3_sync/commands.rb
|
|
325
300
|
- lib/middleman-s3_sync/extension.rb
|
|
@@ -333,8 +308,11 @@ files:
|
|
|
333
308
|
- lib/middleman/s3_sync/version.rb
|
|
334
309
|
- lib/middleman_extension.rb
|
|
335
310
|
- middleman-s3_sync.gemspec
|
|
311
|
+
- spec/aws_sdk_parameters_spec.rb
|
|
336
312
|
- spec/caching_policy_spec.rb
|
|
337
313
|
- spec/cloudfront_spec.rb
|
|
314
|
+
- spec/extension_spec.rb
|
|
315
|
+
- spec/options_spec.rb
|
|
338
316
|
- spec/resource_spec.rb
|
|
339
317
|
- spec/s3_sync_integration_spec.rb
|
|
340
318
|
- spec/spec_helper.rb
|
|
@@ -360,8 +338,11 @@ rubygems_version: 3.6.2
|
|
|
360
338
|
specification_version: 4
|
|
361
339
|
summary: Tries really, really hard not to push files to S3.
|
|
362
340
|
test_files:
|
|
341
|
+
- spec/aws_sdk_parameters_spec.rb
|
|
363
342
|
- spec/caching_policy_spec.rb
|
|
364
343
|
- spec/cloudfront_spec.rb
|
|
344
|
+
- spec/extension_spec.rb
|
|
345
|
+
- spec/options_spec.rb
|
|
365
346
|
- spec/resource_spec.rb
|
|
366
347
|
- spec/s3_sync_integration_spec.rb
|
|
367
348
|
- spec/spec_helper.rb
|