carrierwave-bombshelter 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +5 -1
- data/carrierwave-bombshelter.gemspec +1 -0
- data/lib/carrierwave/bombshelter.rb +17 -8
- data/lib/carrierwave/bombshelter/version.rb +1 -1
- 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: bbd247bcda53117bd19252565bae2e084a924835
|
4
|
+
data.tar.gz: ff0afc1ad76680fecfc64ac7d7bda7e24de8152c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d69d4b423b4742491a35a056a013fd77b3da4189c7aa186733c0b06562b339c4c9974fa6e5d56c059b8def6f2a925fa336b13bfcf041377e514e23da5bba617
|
7
|
+
data.tar.gz: c338fde45f04ceccf99ad529a7bd4393a42c020fa2b2e703c3b4119f0bed7807c2b01d67ffd36f63cc18c0088db5a5e2da013567f59b95ef5cd5f6eb02dd9bd0
|
data/.travis.yml
CHANGED
@@ -26,6 +26,7 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.add_development_dependency 'fog'
|
27
27
|
spec.add_development_dependency 'fog-aws'
|
28
28
|
spec.add_development_dependency 'pry'
|
29
|
+
spec.add_development_dependency 'mime-types', '< 3.0'
|
29
30
|
|
30
31
|
spec.add_dependency 'activesupport', '>= 3.2.0'
|
31
32
|
spec.add_dependency 'fastimage'
|
@@ -13,6 +13,11 @@ module CarrierWave
|
|
13
13
|
module BombShelter
|
14
14
|
extend ActiveSupport::Concern
|
15
15
|
|
16
|
+
FILE_WRAPPERS = [
|
17
|
+
CarrierWave::SanitizedFile,
|
18
|
+
CarrierWave::Uploader::Base
|
19
|
+
]
|
20
|
+
|
16
21
|
included do
|
17
22
|
# `before` puts callback in the end of queue, but we need to run this
|
18
23
|
# callback first.
|
@@ -59,14 +64,18 @@ module CarrierWave
|
|
59
64
|
end
|
60
65
|
|
61
66
|
def get_file(file)
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
67
|
+
return file.url if in_fog?(file)
|
68
|
+
return get_file(file.file) if is_wrapped?(file)
|
69
|
+
file
|
70
|
+
end
|
71
|
+
|
72
|
+
def in_fog?(file)
|
73
|
+
defined?(CarrierWave::Storage::Fog) &&
|
74
|
+
file.is_a?(CarrierWave::Storage::Fog::File)
|
75
|
+
end
|
76
|
+
|
77
|
+
def is_wrapped?(file)
|
78
|
+
FILE_WRAPPERS.any? { |wrapper| file.is_a?(wrapper) }
|
70
79
|
end
|
71
80
|
end
|
72
81
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: carrierwave-bombshelter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- DarthSim
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -122,6 +122,20 @@ dependencies:
|
|
122
122
|
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: mime-types
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "<"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '3.0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "<"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '3.0'
|
125
139
|
- !ruby/object:Gem::Dependency
|
126
140
|
name: activesupport
|
127
141
|
requirement: !ruby/object:Gem::Requirement
|