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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3cec0056627295c72fd85c41c1f4da128e6bf4ff
4
- data.tar.gz: 8a55567ae2b010aa8bea43b33bd2efdfd3287d99
3
+ metadata.gz: d452e6e63e9899a341cb40775ca80603327cee29
4
+ data.tar.gz: 14adb79aea101ff7a523bdc83748b3bfebcbb13f
5
5
  SHA512:
6
- metadata.gz: 8b6fc00e2687748a152d3f7f031a20a6813b5dff2861f2203bc6574524c07883df9eea1f7779982fced473da3276fee79ec1e246297535b1a540467c8cadf05c
7
- data.tar.gz: b6e30b9096746a2cff6a208f5e913e8388fffeaf46dad53c70c009320e77ded02dab72decc9807542077c0ca4539d61f0a77bf752bb549f2b1a600c17038961f
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
@@ -2,6 +2,10 @@
2
2
 
3
3
  This project uses [Semantic Versioning](http://semver.org).
4
4
 
5
+ ## 1.5.0
6
+
7
+ * Add support for specifying the MIME type for extensionless files
8
+
5
9
  ## 1.4.5
6
10
 
7
11
  * If max-age=0, set `Cache-Control: no-cache, max-age=0`
@@ -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
@@ -113,7 +113,11 @@ module S3Website
113
113
  end
114
114
 
115
115
  def mime_type
116
- MIME::Types.type_for(path).first
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
@@ -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.4.5"
6
+ s.version = "1.5.0"
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ["Lauri Lehmijoki"]
9
9
  s.email = ["lauri.lehmijoki@iki.fi"]
@@ -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.5
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-13 00:00:00.000000000 Z
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