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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dc35704ef355b35bcead7f859c794b5108aaad94
4
- data.tar.gz: 2a61a4dddec1f8308df6292d01c254cdb713ee18
3
+ metadata.gz: 44b560c700f0298aa650b5558d4e98adbff4835b
4
+ data.tar.gz: 252e0d11c51dcf9c750aa6d101497ef806583d73
5
5
  SHA512:
6
- metadata.gz: b7af6c832b233c9a817fd3994d54664d549e660fbafba2584a6058113a06018fce38d076ec8aedc09f1821ec01aee535279d5b6597d70cb4352bef02c5f30038
7
- data.tar.gz: 115f4e95a4f801032900b8a97742441e69551f1eb8cce7fa849a108688b245474c4ad1a53d1530888182de08e98d35626f8c2ca62daf1bff1e9e85e5f65ff549
6
+ metadata.gz: 5d80cbb3d5bd1d0ad83f056816dfc73b24850ecb37dfe95364ab450cd25706e6aee58fa95c66030392f3bbfb39df64cb2c30098e16df13812a1fca09dc7ed358
7
+ data.tar.gz: 9eb07f87dab4c5a7b7510533dc9b72385bcd47ccdfd41a53b4315a13ccab6860e92bda7e35cb0a0770bc08923c7775092ac8cc3f26c026142292bd608dc21ffd
data/changelog.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  This project uses [Semantic Versioning](http://semver.org).
4
4
 
5
+ ## 1.6.12
6
+
7
+ * Fix bug <https://github.com/laurilehmijoki/s3_website/issues/63>
8
+
5
9
  ## 1.6.11
6
10
 
7
11
  * Loosen the dependency spec of mime-types (#70)
@@ -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
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "s3_website"
6
- s.version = "1.6.11"
6
+ s.version = "1.6.12"
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ["Lauri Lehmijoki"]
9
9
  s.email = ["lauri.lehmijoki@iki.fi"]
@@ -1,13 +1,13 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe S3Website::Cloudfront::Invalidator do
4
- describe 'default behaviour' do
5
- let(:config) {{
6
- 's3_id' => 'aws id',
7
- 's3_secret' => 'aws secret',
8
- 'cloudfront_distribution_id' => 'EFXX'
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
- describe 'option cloudfront_invalidate_root = true' do
23
- let(:config) {{
24
- 's3_id' => 'aws id',
25
- 's3_secret' => 'aws secret',
26
- 'cloudfront_distribution_id' => 'EFXX',
27
- 'cloudfront_invalidate_root' => true
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(config)
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(config, ['article/index.html'])
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.11
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-02-25 00:00:00.000000000 Z
11
+ date: 2014-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk