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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f967fc711c4317a24c315f2c36d677541c776ad6
4
- data.tar.gz: 9e69636cf22c3fbe5fc1f0d04f8d7779a8a90aea
3
+ metadata.gz: bbd247bcda53117bd19252565bae2e084a924835
4
+ data.tar.gz: ff0afc1ad76680fecfc64ac7d7bda7e24de8152c
5
5
  SHA512:
6
- metadata.gz: 0156533849d6e3f42fdbc50badf688c02edb84da4e24242375cb26fc70fde380503738131f11483218dc8c88c3ded3e97b84226f57704361c3f6cab4bd9cac40
7
- data.tar.gz: 2da176b742ab05c707d51414710a185b74b70378204aea4237319804440a82f9e6d3e16ca9795fde7a21bb95e5df66bac9db5340547cbd28fc78fb9ea1a374d4
6
+ metadata.gz: 8d69d4b423b4742491a35a056a013fd77b3da4189c7aa186733c0b06562b339c4c9974fa6e5d56c059b8def6f2a925fa336b13bfcf041377e514e23da5bba617
7
+ data.tar.gz: c338fde45f04ceccf99ad529a7bd4393a42c020fa2b2e703c3b4119f0bed7807c2b01d67ffd36f63cc18c0088db5a5e2da013567f59b95ef5cd5f6eb02dd9bd0
@@ -1,4 +1,8 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.2.3
3
+ - 1.9.3
4
+ - 2.0.0
5
+ - 2.1.8
6
+ - 2.2.4
7
+ - 2.3.0
4
8
  before_install: gem install bundler -v 1.10.6
@@ -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
- case file
63
- when CarrierWave::Storage::Fog::File
64
- file.url
65
- when CarrierWave::SanitizedFile, CarrierWave::Uploader::Base
66
- get_file(file.file)
67
- else
68
- file
69
- end
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
@@ -1,5 +1,5 @@
1
1
  module CarrierWave
2
2
  module BombShelter
3
- VERSION = '0.2.1'.freeze
3
+ VERSION = '0.2.2'.freeze
4
4
  end
5
5
  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.1
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-16 00:00:00.000000000 Z
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