middleman-s3_sync 4.0.1.rc.1 → 4.0.1.rc.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -0
- data/lib/middleman-s3_sync/extension.rb +2 -0
- data/lib/middleman/s3_sync.rb +17 -1
- data/lib/middleman/s3_sync/options.rb +3 -1
- data/lib/middleman/s3_sync/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c3d7517dd1c40614ca272b6b33c3ac6363532ce6
|
4
|
+
data.tar.gz: bfaedfa1b4485554a3446bd87e86a596db1d79c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f90ea23d7a08702f1299a1a00a61b33a8527ecc1f793abbd86adda2dff116791c8dfb51168d722b09a7a8023beb2d846578218765197b5eb4c0b1b62eca7192a
|
7
|
+
data.tar.gz: 2034640bb056f492c1188997bc83d61c70eb94299f73829cc20aa4f10d80c5f34d9acf404746ffd0b514221e702bba0340188af8302eab6f3ed20c7ea96650a2
|
data/README.md
CHANGED
@@ -52,6 +52,8 @@ activate :s3_sync do |s3_sync|
|
|
52
52
|
s3_sync.encryption = false
|
53
53
|
s3_sync.prefix = ''
|
54
54
|
s3_sync.version_bucket = false
|
55
|
+
s3_sync.index_document = 'index.html'
|
56
|
+
s3_sync.error_document = '404.html'
|
55
57
|
end
|
56
58
|
```
|
57
59
|
|
@@ -333,6 +335,15 @@ headers will be set correctly. This will cause Amazon to serve the
|
|
333
335
|
compressed version of the resource. In order for this to work, you need to
|
334
336
|
have the `:gzip` extension activated in your `config.rb`.
|
335
337
|
|
338
|
+
#### Custom S3 Index and Error Documents
|
339
|
+
|
340
|
+
You can enable a custom [index document](http://docs.aws.amazon.com/AmazonS3/latest/dev/IndexDocumentSupport.html)
|
341
|
+
and [error document](http://docs.aws.amazon.com/AmazonS3/latest/dev/CustomErrorDocSupport.html)
|
342
|
+
settings. The ```index_document``` option tells which file name gets used as
|
343
|
+
the index document of a directory (typically, ```index.html```), while
|
344
|
+
```error_document``` specifies the document to display for 4xx errors (ie,
|
345
|
+
the 404 page).
|
346
|
+
|
336
347
|
## A Debt of Gratitude
|
337
348
|
|
338
349
|
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_document, nil, 'S3 custom index document path'
|
27
|
+
option :error_document, nil, 'S3 custom error document path'
|
26
28
|
|
27
29
|
# S3Sync must be the last action in the manipulator chain
|
28
30
|
self.resource_list_manipulator_priority = 9999
|
data/lib/middleman/s3_sync.rb
CHANGED
@@ -37,6 +37,8 @@ module Middleman
|
|
37
37
|
|
38
38
|
update_bucket_versioning
|
39
39
|
|
40
|
+
update_bucket_website
|
41
|
+
|
40
42
|
ignore_resources
|
41
43
|
create_resources
|
42
44
|
update_resources
|
@@ -75,6 +77,21 @@ module Middleman
|
|
75
77
|
connection.put_bucket_versioning(s3_sync_options.bucket, "Enabled") if s3_sync_options.version_bucket
|
76
78
|
end
|
77
79
|
|
80
|
+
def update_bucket_website
|
81
|
+
opts = {}
|
82
|
+
opts[:IndexDocument] = s3_sync_options.index_document if s3_sync_options.index_document
|
83
|
+
opts[:ErrorDocument] = s3_sync_options.error_document if s3_sync_options.error_document
|
84
|
+
|
85
|
+
if opts[:ErrorDocument] && !opts[:IndexDocument]
|
86
|
+
raise 'S3 requires `index_document` if `error_document` is specified'
|
87
|
+
end
|
88
|
+
|
89
|
+
unless opts.empty?
|
90
|
+
say_status "Putting bucket website: #{opts.to_json}"
|
91
|
+
connection.put_bucket_website(s3_sync_options.bucket, opts)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
78
95
|
def connection
|
79
96
|
connection_options = {
|
80
97
|
:region => s3_sync_options.region,
|
@@ -185,4 +202,3 @@ module Middleman
|
|
185
202
|
end
|
186
203
|
end
|
187
204
|
end
|
188
|
-
|
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: 4.0.1.rc.
|
4
|
+
version: 4.0.1.rc.2
|
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-
|
12
|
+
date: 2015-12-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: middleman-core
|