s3_website 1.0.1 → 1.0.2
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/features/security.feature +8 -0
- data/features/support/test_site_dirs/site-that-contains-s3-website-file.com/_site/css/styles.css +3 -0
- data/features/support/test_site_dirs/site-that-contains-s3-website-file.com/_site/index.html +5 -0
- data/features/support/test_site_dirs/site-that-contains-s3-website-file.com/_site/s3_website.yml +3 -0
- data/features/support/test_site_dirs/site-that-contains-s3-website-file.com/s3_website.yml +3 -0
- data/lib/s3_website/upload.rb +8 -0
- data/lib/s3_website/uploader.rb +1 -1
- data/s3_website.gemspec +1 -1
- data/spec/lib/upload_spec.rb +13 -0
- metadata +12 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9db72b2e594d4960fbf0dd0cc2302f380aa776e4
|
|
4
|
+
data.tar.gz: d7de0719b35ba9639dc145fec0f7202921d7f791
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4fb0c3f83704ac818ec1e602f2f0cb1d1ff2cda38cc5c3f677892df3d5db61860d353fedb755fafc074f5354b3aee93928d2932fc43cb90f15c59110c03a0208
|
|
7
|
+
data.tar.gz: 6bbf791ff5e4628eead0f6e07e2b427df07a1b2c86fc04efe217227705b384272b6155c6f967a9e27fe4434b7f70d37a0e5e91159b70bca5fad4cf4835953259
|
data/changelog.md
CHANGED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
Feature: Security
|
|
2
|
+
|
|
3
|
+
@new-files
|
|
4
|
+
@wip
|
|
5
|
+
Scenario: The user does not want the s3_website.yml file to be uploaded
|
|
6
|
+
When my S3 website is in "features/support/test_site_dirs/site-that-contains-s3-website-file.com"
|
|
7
|
+
Then s3_website will push my blog to S3
|
|
8
|
+
And the output should not contain "s3_website.yml"
|
data/lib/s3_website/upload.rb
CHANGED
|
@@ -4,8 +4,10 @@ require 'zlib'
|
|
|
4
4
|
module S3Website
|
|
5
5
|
class Upload
|
|
6
6
|
attr_reader :config, :file, :path, :full_path, :s3
|
|
7
|
+
BLACKLISTED_FILES = ['s3_website.yml']
|
|
7
8
|
|
|
8
9
|
def initialize(path, s3, config, site_dir)
|
|
10
|
+
raise "May not upload #{path}, because it's blacklisted" if Upload.is_blacklisted path
|
|
9
11
|
@path = path
|
|
10
12
|
@full_path = "#{site_dir}/#{path}"
|
|
11
13
|
@file = File.open("#{site_dir}/#{path}")
|
|
@@ -23,6 +25,12 @@ module S3Website
|
|
|
23
25
|
"#{path}#{" [gzipped]" if gzip?}#{" [max-age=#{max_age}]" if cache_control?}"
|
|
24
26
|
end
|
|
25
27
|
|
|
28
|
+
def self.is_blacklisted(path)
|
|
29
|
+
BLACKLISTED_FILES.any? do |blacklisted_file|
|
|
30
|
+
path.include? blacklisted_file
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
26
34
|
private
|
|
27
35
|
|
|
28
36
|
def upload_file
|
data/lib/s3_website/uploader.rb
CHANGED
|
@@ -60,7 +60,7 @@ module S3Website
|
|
|
60
60
|
|
|
61
61
|
def self.upload_in_parallel_or_sequentially(files_to_upload, s3, config, site_dir)
|
|
62
62
|
Parallelism.each_in_parallel_or_sequentially(files_to_upload) { |f|
|
|
63
|
-
upload_file(f, s3, config, site_dir)
|
|
63
|
+
upload_file(f, s3, config, site_dir) unless Upload.is_blacklisted f
|
|
64
64
|
}
|
|
65
65
|
end
|
|
66
66
|
|
data/s3_website.gemspec
CHANGED
data/spec/lib/upload_spec.rb
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
3
|
describe S3Website::Upload do
|
|
4
|
+
describe 'uploading blacklisted files' do
|
|
5
|
+
let(:blacklisted_files) {
|
|
6
|
+
[ 's3_website.yml' ]
|
|
7
|
+
}
|
|
8
|
+
it 'should fail if the upload file is s3_website.yml' do
|
|
9
|
+
blacklisted_files.each do |blacklisted_file|
|
|
10
|
+
expect {
|
|
11
|
+
S3Website::Upload.new blacklisted_file, mock(), mock(), mock()
|
|
12
|
+
}.to raise_error "May not upload #{blacklisted_file}, because it's blacklisted"
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
4
17
|
describe 'reduced redundancy setting' do
|
|
5
18
|
let(:config) {
|
|
6
19
|
{ 's3_reduced_redundancy' => true }
|
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.0.
|
|
4
|
+
version: 1.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Lauri Lehmijoki
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2013-07-
|
|
11
|
+
date: 2013-07-20 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: aws-sdk
|
|
@@ -242,6 +242,7 @@ files:
|
|
|
242
242
|
- features/nanoc-support.feature
|
|
243
243
|
- features/push.feature
|
|
244
244
|
- features/redirects.feature
|
|
245
|
+
- features/security.feature
|
|
245
246
|
- features/step_definitions/steps.rb
|
|
246
247
|
- features/support/env.rb
|
|
247
248
|
- features/support/test_site_dirs/cdn-powered.blog.fi/_site/css/styles.css
|
|
@@ -277,6 +278,10 @@ files:
|
|
|
277
278
|
- features/support/test_site_dirs/only-changed-files.com/_site/css/styles.css
|
|
278
279
|
- features/support/test_site_dirs/only-changed-files.com/_site/index.html
|
|
279
280
|
- features/support/test_site_dirs/only-changed-files.com/s3_website.yml
|
|
281
|
+
- features/support/test_site_dirs/site-that-contains-s3-website-file.com/_site/css/styles.css
|
|
282
|
+
- features/support/test_site_dirs/site-that-contains-s3-website-file.com/_site/index.html
|
|
283
|
+
- features/support/test_site_dirs/site-that-contains-s3-website-file.com/_site/s3_website.yml
|
|
284
|
+
- features/support/test_site_dirs/site-that-contains-s3-website-file.com/s3_website.yml
|
|
280
285
|
- features/support/test_site_dirs/site.with.css-maxage.com/_site/css/styles.css
|
|
281
286
|
- features/support/test_site_dirs/site.with.css-maxage.com/_site/index.html
|
|
282
287
|
- features/support/test_site_dirs/site.with.css-maxage.com/s3_website.yml
|
|
@@ -369,6 +374,7 @@ test_files:
|
|
|
369
374
|
- features/nanoc-support.feature
|
|
370
375
|
- features/push.feature
|
|
371
376
|
- features/redirects.feature
|
|
377
|
+
- features/security.feature
|
|
372
378
|
- features/step_definitions/steps.rb
|
|
373
379
|
- features/support/env.rb
|
|
374
380
|
- features/support/test_site_dirs/cdn-powered.blog.fi/_site/css/styles.css
|
|
@@ -404,6 +410,10 @@ test_files:
|
|
|
404
410
|
- features/support/test_site_dirs/only-changed-files.com/_site/css/styles.css
|
|
405
411
|
- features/support/test_site_dirs/only-changed-files.com/_site/index.html
|
|
406
412
|
- features/support/test_site_dirs/only-changed-files.com/s3_website.yml
|
|
413
|
+
- features/support/test_site_dirs/site-that-contains-s3-website-file.com/_site/css/styles.css
|
|
414
|
+
- features/support/test_site_dirs/site-that-contains-s3-website-file.com/_site/index.html
|
|
415
|
+
- features/support/test_site_dirs/site-that-contains-s3-website-file.com/_site/s3_website.yml
|
|
416
|
+
- features/support/test_site_dirs/site-that-contains-s3-website-file.com/s3_website.yml
|
|
407
417
|
- features/support/test_site_dirs/site.with.css-maxage.com/_site/css/styles.css
|
|
408
418
|
- features/support/test_site_dirs/site.with.css-maxage.com/_site/index.html
|
|
409
419
|
- features/support/test_site_dirs/site.with.css-maxage.com/s3_website.yml
|