middleman-s3_sync 3.3.3 → 3.3.4

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: 4274b6ae700e7ada09737ca3bc4a4759e5296f84
4
- data.tar.gz: 3577abf69438b8f29aa8883c021501c9a4cd22cd
3
+ metadata.gz: a6071ceb81646793152f2cea3d256f2d72fc9be0
4
+ data.tar.gz: 40fa042f69caa0f1cb11080f46c58b7617cebf18
5
5
  SHA512:
6
- metadata.gz: 20af8b1a06d25eb867eea58ae34f61fa571539ed3db35b3258d76eb156a71646bcf6bbece977cdda6e9c3857034a581682e0d0d2557c6a1f9dc19cebdd5989b7
7
- data.tar.gz: 509254dbfde2791ef44e63e4cf55e13b5562c1294283a4375446a3d026216896f1c5e11f45465cc8edac8d6a33b32c30edf137527a9a5d8fa905a3689ec971d5
6
+ metadata.gz: c8b469c2462cbbab0a69ee4b62b7e540c3d4931058fa75768671d081ea10a68858f437da65a3087bb1aa6add9032781c427ccf7258ad93cd98d26adadcefaa19
7
+ data.tar.gz: ac19ceff36c306b7efb4f9507332c141a1521017c810a637a574b07c8de8eecf3053a21a626c60bac8d1cfbf13fd640960a21ce7d02dd80dbd2063591239fb4d
data/README.md CHANGED
@@ -47,6 +47,8 @@ activate :s3_sync do |s3_sync|
47
47
  s3_sync.encryption = false
48
48
  s3_sync.prefix = ''
49
49
  s3_sync.version_bucket = false
50
+ s3_sync.error_document = '404.html'
51
+ s3_sync.index_suffix = 'index.html'
50
52
  end
51
53
  ```
52
54
 
@@ -69,6 +71,7 @@ The following defaults apply to the configuration items:
69
71
  | encryption | ```false``` |
70
72
  | acl | ```'public-read'``` |
71
73
  | version_bucket | ```false``` |
74
+ | index_suffix | ```index.html``` |
72
75
 
73
76
  You do not need to specify the settings that match the defaults. This
74
77
  simplify the configuration of the extension:
@@ -303,6 +306,15 @@ headers will be set correctly. This will cause Amazon to serve the
303
306
  compressed version of the resource. In order for this to work, you need to
304
307
  have the `:gzip` extension activated in your `config.rb`.
305
308
 
309
+ #### Custom index suffix and error document
310
+
311
+ You can enable a custom [index suffix](http://docs.aws.amazon.com/AmazonS3/latest/dev/IndexDocumentSupport.html)
312
+ and [error document](http://docs.aws.amazon.com/AmazonS3/latest/dev/CustomErrorDocSupport.html)
313
+ settings. The ```index_suffix``` option tells which file name gets used as
314
+ the index document of a directory (typically, ```index.html```), while
315
+ ```error_document``` specifies the document to display for 4xx errors (ie,
316
+ the 404 page).
317
+
306
318
  ## A Debt of Gratitude
307
319
 
308
320
  I used Middleman Sync as a template for building a Middleman extension.
@@ -23,6 +23,8 @@ module Middleman
23
23
  option :version_bucket, false, 'Whether to enable versionning on the S3 bucket content'
24
24
  option :verbose, false, 'Whether to provide more verbose output'
25
25
  option :dry_run, false, 'Whether to perform a dry-run'
26
+ option :index_suffix, nil, 'Path of S3 directory index document'
27
+ option :error_document, nil, 'Path of S3 custom error document'
26
28
 
27
29
  def initialize(app, options_hash = {}, &block)
28
30
  super
@@ -35,6 +35,8 @@ module Middleman
35
35
 
36
36
  update_bucket_versioning
37
37
 
38
+ update_bucket_website
39
+
38
40
  ignore_resources
39
41
  create_resources
40
42
  update_resources
@@ -78,6 +80,17 @@ module Middleman
78
80
  connection.put_bucket_versioning(s3_sync_options.bucket, "Enabled") if s3_sync_options.version_bucket
79
81
  end
80
82
 
83
+ def update_bucket_website
84
+ opts = {}
85
+ opts[:ErrorDocument] = s3_sync_options.error_document unless s3_sync_options.error_document.nil?
86
+ opts[:IndexDocument] = s3_sync_options.index_suffix unless s3_sync_options.index_suffix.nil?
87
+ unless opts.empty?
88
+ opts[:IndexDocument] ||= 'index.html' # IndexDocument is mandatory in put_bucket_website
89
+ say_status "Putting bucket website: #{opts.to_json}"
90
+ connection.put_bucket_website(s3_sync_options.bucket, opts)
91
+ end
92
+ end
93
+
81
94
  def connection
82
95
  connection_options = {
83
96
  :region => s3_sync_options.region,
@@ -188,4 +201,3 @@ module Middleman
188
201
  end
189
202
  end
190
203
  end
191
-
@@ -21,7 +21,9 @@ module Middleman
21
21
  :version_bucket,
22
22
  :dry_run,
23
23
  :verbose,
24
- :content_types
24
+ :content_types,
25
+ :index_suffix,
26
+ :error_document
25
27
  ]
26
28
  attr_accessor *OPTIONS
27
29
 
@@ -1,5 +1,5 @@
1
1
  module Middleman
2
2
  module S3Sync
3
- VERSION = "3.3.3"
3
+ VERSION = "3.3.4"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman-s3_sync
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.3
4
+ version: 3.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Frederic Jean
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-10-14 00:00:00.000000000 Z
12
+ date: 2015-11-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: middleman-core