jekyll-s3 2.5.0 → 2.5.1
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.
- data/README.md +4 -3
- data/changelog.md +5 -0
- data/features/support/test_site_dirs/index-and-assets.blog.fi/_jekyll_s3.yml +3 -0
- data/features/support/test_site_dirs/index-and-assets.blog.fi/_site/assets/picture.gif +0 -0
- data/features/support/test_site_dirs/index-and-assets.blog.fi/_site/css/styles.css +3 -0
- data/features/support/test_site_dirs/index-and-assets.blog.fi/_site/index.html +5 -0
- data/jekyll-s3.gemspec +1 -1
- data/lib/jekyll-s3/upload.rb +14 -1
- data/spec/lib/endpoint_spec.rb +7 -1
- data/spec/lib/upload_spec.rb +40 -1
- metadata +12 -4
data/README.md
CHANGED
@@ -99,7 +99,7 @@ values](http://docs.amazonwebservices.com/general/latest/gr/rande.html#s3_region
|
|
99
99
|
### Ignoring files you want to keep on AWS
|
100
100
|
|
101
101
|
Sometimes there are files or directories you want to keep on S3, but not on
|
102
|
-
your local machine. You may define a regular expression to ignore files like so:
|
102
|
+
your local machine. You may define a regular expression to ignore files like so:
|
103
103
|
|
104
104
|
```yaml
|
105
105
|
ignore_on_server: that_folder_of_stuff_i_dont_keep_locally
|
@@ -186,8 +186,8 @@ When sending pull requests, please accompany them with tests. Favor BDD style
|
|
186
186
|
in test descriptions. Use VCR-backed integration tests where possible. For
|
187
187
|
reference, you can look at the existing Jekyll-s3 tests.
|
188
188
|
|
189
|
-
If you are not sure how to test your pull request, you can ask the
|
190
|
-
|
189
|
+
If you are not sure how to test your pull request, you can ask the [gem owners
|
190
|
+
](http://rubygems.org/gems/jekyll-s3) to supplement the request with tests.
|
191
191
|
However, by including proper tests, you increase the chances of your pull
|
192
192
|
request being incorporated into future releases.
|
193
193
|
|
@@ -209,3 +209,4 @@ Contributors (in alphabetical order)
|
|
209
209
|
* Michael Bleigh
|
210
210
|
* Shigeaki Matsumura
|
211
211
|
* stanislas
|
212
|
+
* Zee Spencer
|
data/changelog.md
CHANGED
File without changes
|
data/jekyll-s3.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 = "jekyll-s3"
|
6
|
-
s.version = "2.5.
|
6
|
+
s.version = "2.5.1"
|
7
7
|
s.platform = Gem::Platform::RUBY
|
8
8
|
s.authors = ["Philippe Creux", "Lauri Lehmijoki"]
|
9
9
|
s.email = ["pcreux@gmail.com", "lauri.lehmijoki@iki.fi"]
|
data/lib/jekyll-s3/upload.rb
CHANGED
@@ -73,7 +73,8 @@ module Jekyll
|
|
73
73
|
|
74
74
|
def max_age
|
75
75
|
if config['max_age'].is_a?(Hash)
|
76
|
-
|
76
|
+
max_age_entries_most_specific_first.each do |glob_and_age|
|
77
|
+
(glob, age) = glob_and_age
|
77
78
|
return age if File.fnmatch(glob, path)
|
78
79
|
end
|
79
80
|
else
|
@@ -83,6 +84,18 @@ module Jekyll
|
|
83
84
|
return 0
|
84
85
|
end
|
85
86
|
|
87
|
+
# The most specific max-age glob == the longest glob
|
88
|
+
def max_age_entries_most_specific_first
|
89
|
+
sorted_by_glob_length = config['max_age'].
|
90
|
+
each_pair.
|
91
|
+
to_a.
|
92
|
+
sort_by do |glob_and_age|
|
93
|
+
(glob, age) = glob_and_age
|
94
|
+
sort_key = glob.length
|
95
|
+
end.
|
96
|
+
reverse
|
97
|
+
end
|
98
|
+
|
86
99
|
def mime_type
|
87
100
|
MIME::Types.type_for(path).first
|
88
101
|
end
|
data/spec/lib/endpoint_spec.rb
CHANGED
@@ -3,11 +3,15 @@ require 'pp'
|
|
3
3
|
|
4
4
|
describe Jekyll::S3::Endpoint do
|
5
5
|
|
6
|
-
it 'uses the
|
6
|
+
it 'uses the DEFAULT_LOCATION_CONSTRAINT constant to set the default location constraint' do
|
7
7
|
endpoint = Jekyll::S3::Endpoint.new
|
8
8
|
endpoint.location_constraint.should eq(Jekyll::S3::Endpoint::DEFAULT_LOCATION_CONSTRAINT)
|
9
9
|
end
|
10
10
|
|
11
|
+
it 'uses the "us-east-1" as the default location' do
|
12
|
+
Jekyll::S3::Endpoint::DEFAULT_LOCATION_CONSTRAINT.should eq('us-east-1')
|
13
|
+
end
|
14
|
+
|
11
15
|
it 'takes a valid location constraint as a constructor parameter' do
|
12
16
|
endpoint = Jekyll::S3::Endpoint.new('EU')
|
13
17
|
endpoint.location_constraint.should eq('EU')
|
@@ -19,3 +23,5 @@ describe Jekyll::S3::Endpoint do
|
|
19
23
|
}.to raise_error
|
20
24
|
end
|
21
25
|
end
|
26
|
+
|
27
|
+
|
data/spec/lib/upload_spec.rb
CHANGED
@@ -106,7 +106,14 @@ describe Jekyll::S3::Upload do
|
|
106
106
|
}
|
107
107
|
}
|
108
108
|
|
109
|
-
subject
|
109
|
+
let(:subject) {
|
110
|
+
Jekyll::S3::Upload.new(
|
111
|
+
"index.html",
|
112
|
+
mock(),
|
113
|
+
config,
|
114
|
+
'features/support/test_site_dirs/my.blog.com/_site'
|
115
|
+
)
|
116
|
+
}
|
110
117
|
|
111
118
|
describe '#cache_control?' do
|
112
119
|
it 'should be false if max_age is missing' do
|
@@ -138,6 +145,38 @@ describe Jekyll::S3::Upload do
|
|
138
145
|
config['max_age'] = {'*.js' => 500}
|
139
146
|
subject.send(:max_age).should == 0
|
140
147
|
end
|
148
|
+
|
149
|
+
context 'overriding the more general setting with the more specific' do
|
150
|
+
let(:config){
|
151
|
+
{
|
152
|
+
's3_reduced_redundancy' => false,
|
153
|
+
'max_age' => {
|
154
|
+
'**' => 150,
|
155
|
+
'assets/**' => 86400
|
156
|
+
}
|
157
|
+
}
|
158
|
+
}
|
159
|
+
|
160
|
+
it 'respects the most specific max-age selector' do
|
161
|
+
subject = Jekyll::S3::Upload.new(
|
162
|
+
'assets/picture.gif',
|
163
|
+
mock(),
|
164
|
+
config,
|
165
|
+
'features/support/test_site_dirs/index-and-assets.blog.fi/_site'
|
166
|
+
)
|
167
|
+
subject.send(:max_age).should == 86400
|
168
|
+
end
|
169
|
+
|
170
|
+
it 'respects the most specific max-age selector' do
|
171
|
+
subject = Jekyll::S3::Upload.new(
|
172
|
+
'index.html',
|
173
|
+
mock(),
|
174
|
+
config,
|
175
|
+
'features/support/test_site_dirs/index-and-assets.blog.fi/_site'
|
176
|
+
)
|
177
|
+
subject.send(:max_age).should == 150
|
178
|
+
end
|
179
|
+
end
|
141
180
|
end
|
142
181
|
end
|
143
182
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-s3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.5.
|
4
|
+
version: 2.5.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-04
|
13
|
+
date: 2013-05-04 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: aws-sdk
|
@@ -262,6 +262,10 @@ files:
|
|
262
262
|
- features/support/test_site_dirs/cdn-powered.with-one-change.blog.fi/_jekyll_s3.yml
|
263
263
|
- features/support/test_site_dirs/cdn-powered.with-one-change.blog.fi/_site/css/styles.css
|
264
264
|
- features/support/test_site_dirs/cdn-powered.with-one-change.blog.fi/_site/index.html
|
265
|
+
- features/support/test_site_dirs/index-and-assets.blog.fi/_jekyll_s3.yml
|
266
|
+
- features/support/test_site_dirs/index-and-assets.blog.fi/_site/assets/picture.gif
|
267
|
+
- features/support/test_site_dirs/index-and-assets.blog.fi/_site/css/styles.css
|
268
|
+
- features/support/test_site_dirs/index-and-assets.blog.fi/_site/index.html
|
265
269
|
- features/support/test_site_dirs/my.blog.com/_jekyll_s3.yml
|
266
270
|
- features/support/test_site_dirs/my.blog.com/_site/css/styles.css
|
267
271
|
- features/support/test_site_dirs/my.blog.com/_site/index.html
|
@@ -333,7 +337,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
333
337
|
version: '0'
|
334
338
|
segments:
|
335
339
|
- 0
|
336
|
-
hash:
|
340
|
+
hash: -2239747319602957789
|
337
341
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
338
342
|
none: false
|
339
343
|
requirements:
|
@@ -342,7 +346,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
342
346
|
version: '0'
|
343
347
|
segments:
|
344
348
|
- 0
|
345
|
-
hash:
|
349
|
+
hash: -2239747319602957789
|
346
350
|
requirements: []
|
347
351
|
rubyforge_project:
|
348
352
|
rubygems_version: 1.8.25
|
@@ -372,6 +376,10 @@ test_files:
|
|
372
376
|
- features/support/test_site_dirs/cdn-powered.with-one-change.blog.fi/_jekyll_s3.yml
|
373
377
|
- features/support/test_site_dirs/cdn-powered.with-one-change.blog.fi/_site/css/styles.css
|
374
378
|
- features/support/test_site_dirs/cdn-powered.with-one-change.blog.fi/_site/index.html
|
379
|
+
- features/support/test_site_dirs/index-and-assets.blog.fi/_jekyll_s3.yml
|
380
|
+
- features/support/test_site_dirs/index-and-assets.blog.fi/_site/assets/picture.gif
|
381
|
+
- features/support/test_site_dirs/index-and-assets.blog.fi/_site/css/styles.css
|
382
|
+
- features/support/test_site_dirs/index-and-assets.blog.fi/_site/index.html
|
375
383
|
- features/support/test_site_dirs/my.blog.com/_jekyll_s3.yml
|
376
384
|
- features/support/test_site_dirs/my.blog.com/_site/css/styles.css
|
377
385
|
- features/support/test_site_dirs/my.blog.com/_site/index.html
|