s3_website 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 738dbf4da599ae01973619d033c4f6810d2f9378
4
- data.tar.gz: d3368566d619e4ee1352ac67683283f76045968a
3
+ metadata.gz: 9db72b2e594d4960fbf0dd0cc2302f380aa776e4
4
+ data.tar.gz: d7de0719b35ba9639dc145fec0f7202921d7f791
5
5
  SHA512:
6
- metadata.gz: e17da88a98541bc84052d59214e47bff501d0d0bfcb1e8acdb22609cba320b9c3f65335e539ac3bc886dbacf576a7ae107a21530cac9581bb4a95ba4495edb16
7
- data.tar.gz: 5bef4373d9f2466728d6d6e1b56fc34a083fd95b74e3a02871c9ac72f72924be3df10b8bdefc900f376bc36903f298df84d4c572cc6f1910e1ee40a1a32f0d96
6
+ metadata.gz: 4fb0c3f83704ac818ec1e602f2f0cb1d1ff2cda38cc5c3f677892df3d5db61860d353fedb755fafc074f5354b3aee93928d2932fc43cb90f15c59110c03a0208
7
+ data.tar.gz: 6bbf791ff5e4628eead0f6e07e2b427df07a1b2c86fc04efe217227705b384272b6155c6f967a9e27fe4434b7f70d37a0e5e91159b70bca5fad4cf4835953259
@@ -2,6 +2,10 @@
2
2
 
3
3
  This project uses [Semantic Versioning](http://semver.org).
4
4
 
5
+ ## 1.0.2
6
+
7
+ * Never upload the file *s3_website.yml*
8
+
5
9
  ## 1.0.1
6
10
 
7
11
  * Set default concurrency level to 100. Related to issue [#6](https://github.com/laurilehmijoki/s3_website/issues/6).
@@ -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"
@@ -0,0 +1,5 @@
1
+ <html>
2
+ <head>
3
+ <title>hello!</title>
4
+ </head>
5
+ </html>
@@ -0,0 +1,3 @@
1
+ s3_id: key
2
+ s3_secret: pass
3
+ s3_bucket: s3-website-test.net
@@ -0,0 +1,3 @@
1
+ s3_id: key
2
+ s3_secret: pass
3
+ s3_bucket: s3-website-test.net
@@ -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
@@ -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
 
@@ -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.0.1"
6
+ s.version = "1.0.2"
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ["Lauri Lehmijoki"]
9
9
  s.email = ["lauri.lehmijoki@iki.fi"]
@@ -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.1
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-08 00:00:00.000000000 Z
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