s3_assets_uploader 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/s3_assets_uploader/uploader.rb +11 -0
- data/lib/s3_assets_uploader/version.rb +1 -1
- data/s3_assets_uploader.gemspec +1 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d76723a14ca4cc1eaa57550a911870b9b9fca01d
|
4
|
+
data.tar.gz: 1ea0ea3af4123d4e1cb93271a6540aa978e97e9d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85f4b2575cc25c7d9999a204f142ba3255a67a9fce2fbaf648bfcdc6f519a616d9ba7a1c9a10d5f6f55dbb18ee014197ea1b2f88f58e83cb6518b6f2f267ffe2
|
7
|
+
data.tar.gz: ca73f6074b9ac9368fb8e3e0ec0e50b4e0566ff483cabfa35d07dc66bf424d4b30f46aef5d23c5c8e3feefcb497c0ef43d58bdba175ee1af4f7cd3f22023015b
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 's3_assets_uploader/config'
|
2
|
+
require 'mime/types'
|
2
3
|
|
3
4
|
module S3AssetsUploader
|
4
5
|
class Uploader
|
@@ -28,6 +29,7 @@ module S3AssetsUploader
|
|
28
29
|
body: f,
|
29
30
|
bucket: @config.bucket,
|
30
31
|
key: compute_asset_key(path),
|
32
|
+
content_type: guess_content_type(path),
|
31
33
|
)
|
32
34
|
end
|
33
35
|
end
|
@@ -41,6 +43,15 @@ module S3AssetsUploader
|
|
41
43
|
end
|
42
44
|
end
|
43
45
|
|
46
|
+
def guess_content_type(path)
|
47
|
+
mime_type = MIME::Types.type_for(path.basename.to_s).first
|
48
|
+
if mime_type
|
49
|
+
mime_type.content_type
|
50
|
+
else
|
51
|
+
'application/octet-stream'
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
44
55
|
def relative_path(path)
|
45
56
|
path.relative_path_from(@config.public_path)
|
46
57
|
end
|
data/s3_assets_uploader.gemspec
CHANGED
@@ -20,6 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
22
|
spec.add_dependency "aws-sdk", ">= 2.0"
|
23
|
+
spec.add_dependency "mime-types"
|
23
24
|
spec.add_development_dependency "bundler"
|
24
25
|
spec.add_development_dependency "rake"
|
25
26
|
spec.add_development_dependency "rspec", ">= 3.0"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: s3_assets_uploader
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kohei Suzuki
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '2.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: mime-types
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: bundler
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|