s3_website 1.4.5 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -0
- data/changelog.md +4 -0
- data/features/support/test_site_dirs/my.blog-with-clean-urls.com/_site/css/styles.css +3 -0
- data/features/support/test_site_dirs/my.blog-with-clean-urls.com/_site/index +5 -0
- data/features/support/test_site_dirs/my.blog-with-clean-urls.com/s3_website.yml +3 -0
- data/lib/s3_website/upload.rb +5 -1
- data/s3_website.gemspec +1 -1
- data/spec/lib/upload_spec.rb +23 -0
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d452e6e63e9899a341cb40775ca80603327cee29
|
4
|
+
data.tar.gz: 14adb79aea101ff7a523bdc83748b3bfebcbb13f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e346cfe763a9d015bf8534eae999d14cf5c5010868bc220a072095be4bdf8fbfa0ae71ea526e049139009447ac17463e0a2d854919a9d937c679b720f8141752
|
7
|
+
data.tar.gz: c6a8c95a58f2111b123242fb9c06d6d75e716399be1637a23bbe10dd379c3a81585cecce5caab7f4e255624f34aca8fa5df044a258bc0abcd53a1b917affcf3b
|
data/README.md
CHANGED
@@ -134,6 +134,18 @@ gzip:
|
|
134
134
|
Remember that the extensions here are referring to the *compiled* extensions,
|
135
135
|
not the pre-processed extensions.
|
136
136
|
|
137
|
+
### Specifying a MIME type for files without extensions
|
138
|
+
|
139
|
+
`s3_website` will look up the MIME type of each file it uploads, and infer the Content-Type from it automatically. By default, files without an extension will have a blank Content-Type.
|
140
|
+
|
141
|
+
You can specify a default MIME type for files without an extension using a line like this in `s3_website.yml`:
|
142
|
+
|
143
|
+
```yaml
|
144
|
+
extensionless_mime_type: text/html
|
145
|
+
```
|
146
|
+
|
147
|
+
This is useful when you are uploading HTML files for which you want 'clean' URLs, e.g. `www.domain.com/info`.
|
148
|
+
|
137
149
|
### Using non-standard AWS regions
|
138
150
|
|
139
151
|
By default, `s3_website` uses the US Standard Region. You can upload your
|
@@ -392,5 +404,6 @@ Contributors (in alphabetical order)
|
|
392
404
|
* Shigeaki Matsumura
|
393
405
|
* stanislas
|
394
406
|
* Tate Johnson
|
407
|
+
* Toby Marsden
|
395
408
|
* Trevor Fitzgerald
|
396
409
|
* Zee Spencer
|
data/changelog.md
CHANGED
data/lib/s3_website/upload.rb
CHANGED
@@ -113,7 +113,11 @@ module S3Website
|
|
113
113
|
end
|
114
114
|
|
115
115
|
def mime_type
|
116
|
-
|
116
|
+
if !!config['extensionless_mime_type'] && File.extname(path) == ""
|
117
|
+
config['extensionless_mime_type']
|
118
|
+
else
|
119
|
+
MIME::Types.type_for(path).first
|
120
|
+
end
|
117
121
|
end
|
118
122
|
end
|
119
123
|
end
|
data/s3_website.gemspec
CHANGED
data/spec/lib/upload_spec.rb
CHANGED
@@ -69,6 +69,29 @@ describe S3Website::Upload do
|
|
69
69
|
config,
|
70
70
|
'features/support/test_site_dirs/my.blog.com/_site').perform!
|
71
71
|
end
|
72
|
+
|
73
|
+
context 'the user specifies a mime-type for extensionless files' do
|
74
|
+
let(:config) {{
|
75
|
+
'extensionless_mime_type' => "text/html",
|
76
|
+
's3_reduced_redundancy' => false
|
77
|
+
}}
|
78
|
+
|
79
|
+
it 'adds the content type of the uploaded extensionless file into the S3 object' do
|
80
|
+
file_to_upload = 'index'
|
81
|
+
s3_client = create_verifying_s3_client(file_to_upload) do |s3_object|
|
82
|
+
s3_object.should_receive(:write).with(
|
83
|
+
anything(),
|
84
|
+
:content_type => 'text/html; charset=utf-8',
|
85
|
+
:reduced_redundancy => false
|
86
|
+
)
|
87
|
+
end
|
88
|
+
S3Website::Upload.new(file_to_upload,
|
89
|
+
s3_client,
|
90
|
+
config,
|
91
|
+
'features/support/test_site_dirs/my.blog-with-clean-urls.com/_site').perform!
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
72
95
|
end
|
73
96
|
|
74
97
|
describe 'gzip compression' do
|
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.
|
4
|
+
version: 1.5.0
|
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-10-
|
11
|
+
date: 2013-10-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|
@@ -261,6 +261,9 @@ files:
|
|
261
261
|
- features/support/test_site_dirs/jekyllrb.com/_site/css/styles.css
|
262
262
|
- features/support/test_site_dirs/jekyllrb.com/_site/index.html
|
263
263
|
- features/support/test_site_dirs/jekyllrb.com/s3_website.yml
|
264
|
+
- features/support/test_site_dirs/my.blog-with-clean-urls.com/_site/css/styles.css
|
265
|
+
- features/support/test_site_dirs/my.blog-with-clean-urls.com/_site/index
|
266
|
+
- features/support/test_site_dirs/my.blog-with-clean-urls.com/s3_website.yml
|
264
267
|
- features/support/test_site_dirs/my.blog.com/_site/css/styles.css
|
265
268
|
- features/support/test_site_dirs/my.blog.com/_site/index.html
|
266
269
|
- features/support/test_site_dirs/my.blog.com/s3_website.yml
|
@@ -394,6 +397,9 @@ test_files:
|
|
394
397
|
- features/support/test_site_dirs/jekyllrb.com/_site/css/styles.css
|
395
398
|
- features/support/test_site_dirs/jekyllrb.com/_site/index.html
|
396
399
|
- features/support/test_site_dirs/jekyllrb.com/s3_website.yml
|
400
|
+
- features/support/test_site_dirs/my.blog-with-clean-urls.com/_site/css/styles.css
|
401
|
+
- features/support/test_site_dirs/my.blog-with-clean-urls.com/_site/index
|
402
|
+
- features/support/test_site_dirs/my.blog-with-clean-urls.com/s3_website.yml
|
397
403
|
- features/support/test_site_dirs/my.blog.com/_site/css/styles.css
|
398
404
|
- features/support/test_site_dirs/my.blog.com/_site/index.html
|
399
405
|
- features/support/test_site_dirs/my.blog.com/s3_website.yml
|