carrierwave 2.2.0 → 2.2.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of carrierwave might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a6e511db9d3eebc43bd42613884cf42ba2ad5f236a438a609cccc67c6ce3d192
4
- data.tar.gz: 20cef424394b5a40d27e73e8677161870c6d35f60734fd05cf2d0666f461b834
3
+ metadata.gz: a16b1f5ad9e05370bb6ad6381f5d94b36d3233c3ddbbd4782b54d3a01fb6a747
4
+ data.tar.gz: a5093ecbce4d1ee217c6b78b57f6c50d6ecad9cff0c3b865a22ebbbd196743aa
5
5
  SHA512:
6
- metadata.gz: 28aeace46926db2716ac4600a67cb3a318c553f8f04f533fcf19afaddbafc46489bc3df5d523bc878f5b77164d4110c69ddfe346944caeb46b0dd83df39d7ac9
7
- data.tar.gz: dc271f6fdfd5a515295185265a53b0b894ecef7e1d72bdcaa062357dacd5c7e9bca54a818ffcd344a95b341628451f5b6e579b62587845148075f9db9de949f7
6
+ metadata.gz: 561070ea4b8d2eb9b6e606e4eb465aa3c6ecf3c5664102b5de9ada7317adbc8c8c2561b68baed39acb656cdece7509455e359b3f5ef9cb0e0c85202458c9ac02
7
+ data.tar.gz: 386f211d2fb219185543d330e84cbc7331ef8fe0f48992a9ef98f965e96dce2b7ec8731317951867bfc68bf7496c08211cc840003130cc20154dd4173b095d47
data/README.md CHANGED
@@ -361,6 +361,22 @@ created. This can cut down on processing cost.
361
361
 
362
362
  See `carrierwave/processing/mini_magick.rb` for details.
363
363
 
364
+ ### conditional process
365
+
366
+ If you want to use conditional process, you can only use `if` statement.
367
+
368
+ See `carrierwave/uploader/processing.rb` for details.
369
+
370
+ ```ruby
371
+ class MyUploader < CarrierWave::Uploader::Base
372
+ process :scale => [200, 200], :if => :image?
373
+
374
+ def image?(carrier_wave_sanitized_file)
375
+ true
376
+ end
377
+ end
378
+ ```
379
+
364
380
  ### Nested versions
365
381
 
366
382
  It is possible to nest versions within versions:
@@ -1056,6 +1072,8 @@ See [CONTRIBUTING.md](https://github.com/carrierwaveuploader/carrierwave/blob/ma
1056
1072
 
1057
1073
  ## License
1058
1074
 
1075
+ The MIT License (MIT)
1076
+
1059
1077
  Copyright (c) 2008-2015 Jonas Nicklas
1060
1078
 
1061
1079
  Permission is hereby granted, free of charge, to any person obtaining
@@ -1,8 +1,7 @@
1
1
  require 'pathname'
2
2
  require 'active_support/core_ext/string/multibyte'
3
3
  require 'mini_mime'
4
- require 'mimemagic'
5
- require 'mimemagic/overlay'
4
+ require 'marcel'
6
5
 
7
6
  module CarrierWave
8
7
 
@@ -262,7 +261,7 @@ module CarrierWave
262
261
  def content_type
263
262
  @content_type ||=
264
263
  existing_content_type ||
265
- mime_magic_content_type ||
264
+ marcel_magic_content_type ||
266
265
  mini_mime_content_type
267
266
  end
268
267
 
@@ -329,14 +328,14 @@ module CarrierWave
329
328
  end
330
329
  end
331
330
 
332
- def mime_magic_content_type
331
+ def marcel_magic_content_type
333
332
  if path
334
333
  type = File.open(path) do |file|
335
- MimeMagic.by_magic(file).try(:type)
334
+ Marcel::Magic.by_magic(file).try(:type)
336
335
  end
337
336
 
338
337
  if type.nil?
339
- type = ::MiniMime.lookup_by_filename(path).try(:content_type)
338
+ type = Marcel::Magic.by_path(file).try(:type)
340
339
  type = 'invalid/invalid' unless type.nil? || type.start_with?('text/')
341
340
  end
342
341
 
@@ -147,8 +147,9 @@ module CarrierWave
147
147
  :public => uploader.fog_public
148
148
  ).files.all(:prefix => uploader.cache_dir).each do |file|
149
149
  # generate_cache_id returns key formated TIMEINT-PID(-COUNTER)-RND
150
- time = file.key.scan(/(\d+)-\d+-\d+(?:-\d+)?/).first.map { |t| t.to_i }
151
- time = Time.at(*time)
150
+ matched = file.key.match(/(\d+)-\d+-\d+(?:-\d+)?/)
151
+ next unless matched
152
+ time = Time.at(matched[1].to_i)
152
153
  file.destroy if time < (Time.now.utc - seconds)
153
154
  end
154
155
  end
@@ -1,3 +1,3 @@
1
1
  module CarrierWave
2
- VERSION = "2.2.0"
2
+ VERSION = "2.2.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: carrierwave
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonas Nicklas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-23 00:00:00.000000000 Z
11
+ date: 2021-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -67,19 +67,19 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '1.1'
69
69
  - !ruby/object:Gem::Dependency
70
- name: mimemagic
70
+ name: marcel
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 0.3.0
75
+ version: 1.0.0
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 0.3.0
82
+ version: 1.0.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: addressable
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -164,6 +164,20 @@ dependencies:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
166
  version: '3.4'
167
+ - !ruby/object:Gem::Dependency
168
+ name: rspec-retry
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
167
181
  - !ruby/object:Gem::Dependency
168
182
  name: webmock
169
183
  requirement: !ruby/object:Gem::Requirement
@@ -199,6 +213,9 @@ dependencies:
199
213
  - - "~>"
200
214
  - !ruby/object:Gem::Version
201
215
  version: '1.7'
216
+ - - "!="
217
+ - !ruby/object:Gem::Version
218
+ version: 1.12.1
202
219
  type: :development
203
220
  prerelease: false
204
221
  version_requirements: !ruby/object:Gem::Requirement
@@ -206,6 +223,9 @@ dependencies:
206
223
  - - "~>"
207
224
  - !ruby/object:Gem::Version
208
225
  version: '1.7'
226
+ - - "!="
227
+ - !ruby/object:Gem::Version
228
+ version: 1.12.1
209
229
  - !ruby/object:Gem::Dependency
210
230
  name: fog-local
211
231
  requirement: !ruby/object:Gem::Requirement