s3_website 1.6.11 → 1.6.12
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/changelog.md +4 -0
- data/lib/cloudfront/invalidator.rb +8 -1
- data/s3_website.gemspec +1 -1
- data/spec/lib/cloudfront/invalidator_spec.rb +26 -15
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 44b560c700f0298aa650b5558d4e98adbff4835b
|
4
|
+
data.tar.gz: 252e0d11c51dcf9c750aa6d101497ef806583d73
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d80cbb3d5bd1d0ad83f056816dfc73b24850ecb37dfe95364ab450cd25706e6aee58fa95c66030392f3bbfb39df64cb2c30098e16df13812a1fca09dc7ed358
|
7
|
+
data.tar.gz: 9eb07f87dab4c5a7b7510533dc9b72385bcd47ccdfd41a53b4315a13ccab6860e92bda7e35cb0a0770bc08923c7775092ac8cc3f26c026142292bd608dc21ffd
|
data/changelog.md
CHANGED
@@ -9,13 +9,20 @@ module S3Website
|
|
9
9
|
s3_object_keys << ""
|
10
10
|
report = SimpleCloudfrontInvalidator::CloudfrontClient.new(
|
11
11
|
aws_key, aws_secret, cloudfront_distribution_id
|
12
|
-
).invalidate(s3_object_keys)
|
12
|
+
).invalidate(url_encode_keys s3_object_keys)
|
13
13
|
puts report[:text_report]
|
14
14
|
report[:invalidated_items_count]
|
15
15
|
end
|
16
16
|
|
17
17
|
private
|
18
18
|
|
19
|
+
def self.url_encode_keys(keys)
|
20
|
+
require 'uri'
|
21
|
+
keys.map do |key|
|
22
|
+
URI::encode(key, Regexp.union([URI::Parser.new.regexp[:UNSAFE],'~','@', "'"]))
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
19
26
|
def self.apply_config(config, changed_files)
|
20
27
|
if config['cloudfront_invalidate_root']
|
21
28
|
changed_files.map { |changed_file|
|
data/s3_website.gemspec
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe S3Website::Cloudfront::Invalidator do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
}}
|
4
|
+
let(:config) {{
|
5
|
+
's3_id' => 'aws id',
|
6
|
+
's3_secret' => 'aws secret',
|
7
|
+
'cloudfront_distribution_id' => 'EFXX'
|
8
|
+
}}
|
10
9
|
|
10
|
+
describe 'default behaviour' do
|
11
11
|
it 'invalidates the root resource' do
|
12
12
|
invalidator = create_simple_cloudfront_invalidator(config)
|
13
13
|
invalidator.
|
@@ -19,22 +19,33 @@ describe S3Website::Cloudfront::Invalidator do
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
|
23
|
-
let(:
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
}}
|
22
|
+
context 'option cloudfront_invalidate_root = true' do
|
23
|
+
let(:config_with_root_invalidation) {
|
24
|
+
config.merge( {
|
25
|
+
'cloudfront_invalidate_root' => true
|
26
|
+
})
|
27
|
+
}
|
29
28
|
|
30
29
|
it 'invalidates all root resources' do
|
31
|
-
invalidator = create_simple_cloudfront_invalidator(
|
30
|
+
invalidator = create_simple_cloudfront_invalidator(config_with_root_invalidation)
|
32
31
|
invalidator.
|
33
32
|
should_receive(:invalidate).
|
34
33
|
with(['article/', '']).
|
35
34
|
and_return(:text_report => 'report txt')
|
36
35
|
|
37
|
-
S3Website::Cloudfront::Invalidator.invalidate(
|
36
|
+
S3Website::Cloudfront::Invalidator.invalidate(config_with_root_invalidation, ['article/index.html'])
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
context 'the file name contains special characters' do
|
41
|
+
it 'encodes the file paths according to rfc1738' do
|
42
|
+
invalidator = create_simple_cloudfront_invalidator config
|
43
|
+
invalidator.
|
44
|
+
should_receive(:invalidate).
|
45
|
+
with(['article/arnold%27s%20file.html', '']).
|
46
|
+
and_return(:text_report => 'report txt')
|
47
|
+
|
48
|
+
S3Website::Cloudfront::Invalidator.invalidate(config, ["article/arnold's file.html"])
|
38
49
|
end
|
39
50
|
end
|
40
51
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: s3_website
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lauri Lehmijoki
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-03-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|