paperclip 3.0.4 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of paperclip might be problematic. Click here for more details.
- data/Appraisals +3 -3
- data/NEWS +43 -0
- data/README.md +81 -5
- data/features/basic_integration.feature +20 -2
- data/features/migration.feature +94 -0
- data/features/step_definitions/attachment_steps.rb +28 -0
- data/features/step_definitions/rails_steps.rb +19 -1
- data/features/step_definitions/web_steps.rb +3 -3
- data/gemfiles/3.0.gemfile +1 -1
- data/gemfiles/3.1.gemfile +1 -1
- data/gemfiles/3.2.gemfile +1 -1
- data/lib/generators/paperclip/templates/paperclip_migration.rb.erb +4 -8
- data/lib/paperclip.rb +2 -0
- data/lib/paperclip/attachment.rb +4 -0
- data/lib/paperclip/geometry.rb +33 -0
- data/lib/paperclip/glue.rb +2 -1
- data/lib/paperclip/io_adapters/abstract_adapter.rb +45 -0
- data/lib/paperclip/io_adapters/attachment_adapter.rb +13 -48
- data/lib/paperclip/io_adapters/file_adapter.rb +11 -61
- data/lib/paperclip/io_adapters/identity_adapter.rb +1 -1
- data/lib/paperclip/io_adapters/nil_adapter.rb +1 -1
- data/lib/paperclip/io_adapters/stringio_adapter.rb +11 -42
- data/lib/paperclip/io_adapters/uploaded_file_adapter.rb +6 -45
- data/lib/paperclip/matchers.rb +2 -2
- data/lib/paperclip/matchers/validate_attachment_content_type_matcher.rb +36 -17
- data/lib/paperclip/railtie.rb +5 -1
- data/lib/paperclip/schema.rb +59 -23
- data/lib/paperclip/storage/filesystem.rb +5 -0
- data/lib/paperclip/storage/fog.rb +36 -14
- data/lib/paperclip/storage/s3.rb +14 -16
- data/lib/paperclip/style.rb +2 -2
- data/lib/paperclip/tempfile_factory.rb +21 -0
- data/lib/paperclip/thumbnail.rb +10 -1
- data/lib/paperclip/version.rb +1 -1
- data/paperclip.gemspec +1 -1
- data/test/attachment_test.rb +56 -24
- data/test/fixtures/animated +0 -0
- data/test/fixtures/animated.unknown +0 -0
- data/test/generator_test.rb +26 -24
- data/test/geometry_test.rb +19 -0
- data/test/helper.rb +8 -0
- data/test/integration_test.rb +23 -23
- data/test/io_adapters/abstract_adapter_test.rb +44 -0
- data/test/io_adapters/attachment_adapter_test.rb +96 -34
- data/test/io_adapters/file_adapter_test.rb +13 -1
- data/test/io_adapters/stringio_adapter_test.rb +9 -10
- data/test/io_adapters/uploaded_file_adapter_test.rb +2 -1
- data/test/schema_test.rb +179 -77
- data/test/storage/filesystem_test.rb +18 -3
- data/test/storage/fog_test.rb +64 -1
- data/test/storage/s3_test.rb +38 -2
- data/test/tempfile_factory_test.rb +13 -0
- data/test/thumbnail_test.rb +45 -0
- metadata +16 -9
- data/features/support/fixtures/.boot_config.rb.swo +0 -0
- data/images.rake +0 -21
@@ -19,12 +19,27 @@ class FileSystemTest < Test::Unit::TestCase
|
|
19
19
|
|
20
20
|
should "store the original" do
|
21
21
|
@dummy.save
|
22
|
-
|
22
|
+
assert_file_exists(@dummy.avatar.path)
|
23
23
|
end
|
24
24
|
|
25
25
|
should "store the thumbnail" do
|
26
26
|
@dummy.save
|
27
|
-
|
27
|
+
assert_file_exists(@dummy.avatar.path(:thumbnail))
|
28
|
+
end
|
29
|
+
|
30
|
+
should "be rewinded after flush_writes" do
|
31
|
+
@dummy.avatar.instance_eval "def after_flush_writes; end"
|
32
|
+
|
33
|
+
files = @dummy.avatar.queued_for_write.values
|
34
|
+
@dummy.save
|
35
|
+
assert files.none?(&:eof?), "Expect all the files to be rewinded."
|
36
|
+
end
|
37
|
+
|
38
|
+
should "be removed after after_flush_writes" do
|
39
|
+
paths = @dummy.avatar.queued_for_write.values.map(&:path)
|
40
|
+
@dummy.save
|
41
|
+
assert paths.none?{ |path| File.exists?(path) },
|
42
|
+
"Expect all the files to be deleted."
|
28
43
|
end
|
29
44
|
end
|
30
45
|
|
@@ -41,7 +56,7 @@ class FileSystemTest < Test::Unit::TestCase
|
|
41
56
|
teardown { @file.close }
|
42
57
|
|
43
58
|
should "store the file" do
|
44
|
-
|
59
|
+
assert_file_exists(@dummy.avatar.path)
|
45
60
|
end
|
46
61
|
|
47
62
|
should "return a replaced version for path" do
|
data/test/storage/fog_test.rb
CHANGED
@@ -111,6 +111,21 @@ class FogTest < Test::Unit::TestCase
|
|
111
111
|
directory.destroy
|
112
112
|
end
|
113
113
|
|
114
|
+
should "be rewinded after flush_writes" do
|
115
|
+
@dummy.avatar.instance_eval "def after_flush_writes; end"
|
116
|
+
|
117
|
+
files = @dummy.avatar.queued_for_write.values
|
118
|
+
@dummy.save
|
119
|
+
assert files.none?(&:eof?), "Expect all the files to be rewinded."
|
120
|
+
end
|
121
|
+
|
122
|
+
should "be removed after after_flush_writes" do
|
123
|
+
paths = @dummy.avatar.queued_for_write.values.map(&:path)
|
124
|
+
@dummy.save
|
125
|
+
assert paths.none?{ |path| File.exists?(path) },
|
126
|
+
"Expect all the files to be deleted."
|
127
|
+
end
|
128
|
+
|
114
129
|
should "pass the content type to the Fog::Storage::AWS::Files instance" do
|
115
130
|
Fog::Storage::AWS::Files.any_instance.expects(:create).with do |hash|
|
116
131
|
hash[:content_type]
|
@@ -196,7 +211,19 @@ class FogTest < Test::Unit::TestCase
|
|
196
211
|
|
197
212
|
context "with a valid bucket name for a subdomain" do
|
198
213
|
should "provide an url in subdomain style" do
|
199
|
-
|
214
|
+
# The following line is the correct one when this pull request in Fog is released:
|
215
|
+
# https://github.com/fog/fog/pull/857
|
216
|
+
# assert_match /^http:\/\/papercliptests.s3.amazonaws.com\/avatars\/5k.png\?AWSAccessKeyId=.+$/, @dummy.avatar.expiring_url
|
217
|
+
# For now, use this passing one:
|
218
|
+
assert_match /^https:\/\/papercliptests.\/avatars\/5k.png\?\d*$/, @dummy.avatar.url
|
219
|
+
end
|
220
|
+
|
221
|
+
should "provide an url that expires in subdomain style" do
|
222
|
+
# The following line is the correct one when this pull request in Fog is released:
|
223
|
+
# https://github.com/fog/fog/pull/857
|
224
|
+
# assert_match /^http:\/\/papercliptests.s3.amazonaws.com\/avatars\/5k.png\?AWSAccessKeyId=.+$/, @dummy.avatar.expiring_url
|
225
|
+
# For now, use this passing one:
|
226
|
+
assert_match /^http:\/\/papercliptests.\/avatars\/5k.png\?AWSAccessKeyId=.+$/, @dummy.avatar.expiring_url
|
200
227
|
end
|
201
228
|
end
|
202
229
|
|
@@ -219,6 +246,10 @@ class FogTest < Test::Unit::TestCase
|
|
219
246
|
assert_match /^https:\/\/s3.amazonaws.com\/this_is_invalid\/avatars\/5k.png\?\d*$/, @dummy.avatar.url
|
220
247
|
end
|
221
248
|
|
249
|
+
should "provide a url that expires in folder style" do
|
250
|
+
assert_match /^http:\/\/s3.amazonaws.com\/this_is_invalid\/avatars\/5k.png\?AWSAccessKeyId=.+$/, @dummy.avatar.expiring_url
|
251
|
+
end
|
252
|
+
|
222
253
|
end
|
223
254
|
|
224
255
|
context "with a proc for a bucket name evaluating a model method" do
|
@@ -249,6 +280,38 @@ class FogTest < Test::Unit::TestCase
|
|
249
280
|
should "provide a public url" do
|
250
281
|
assert_match /http:\/\/dynamicfoghost\.com/, @dummy.avatar.url
|
251
282
|
end
|
283
|
+
|
284
|
+
end
|
285
|
+
|
286
|
+
context "with a custom fog_host" do
|
287
|
+
setup do
|
288
|
+
rebuild_model(@options.merge(:fog_host => "http://dynamicfoghost.com"))
|
289
|
+
@dummy = Dummy.new
|
290
|
+
@dummy.avatar = @file
|
291
|
+
@dummy.save
|
292
|
+
end
|
293
|
+
|
294
|
+
should "provide a public url" do
|
295
|
+
assert_match /http:\/\/dynamicfoghost\.com/, @dummy.avatar.url
|
296
|
+
end
|
297
|
+
|
298
|
+
should "provide an expiring url" do
|
299
|
+
assert_match /http:\/\/dynamicfoghost\.com/, @dummy.avatar.expiring_url
|
300
|
+
end
|
301
|
+
|
302
|
+
context "with an invalid bucket name for a subdomain" do
|
303
|
+
setup do
|
304
|
+
rebuild_model(@options.merge({:fog_directory => "this_is_invalid", :fog_host => "http://dynamicfoghost.com"}))
|
305
|
+
@dummy = Dummy.new
|
306
|
+
@dummy.avatar = @file
|
307
|
+
@dummy.save
|
308
|
+
end
|
309
|
+
|
310
|
+
should "provide an expiring url" do
|
311
|
+
assert_match /http:\/\/dynamicfoghost\.com/, @dummy.avatar.expiring_url
|
312
|
+
end
|
313
|
+
end
|
314
|
+
|
252
315
|
end
|
253
316
|
|
254
317
|
context "with a proc for the fog_credentials evaluating a model method" do
|
data/test/storage/s3_test.rb
CHANGED
@@ -144,6 +144,22 @@ class S3Test < Test::Unit::TestCase
|
|
144
144
|
end
|
145
145
|
end
|
146
146
|
|
147
|
+
context ":s3_protocol => :https" do
|
148
|
+
setup do
|
149
|
+
rebuild_model :storage => :s3,
|
150
|
+
:s3_credentials => {},
|
151
|
+
:s3_protocol => :https,
|
152
|
+
:bucket => "bucket",
|
153
|
+
:path => ":attachment/:basename.:extension"
|
154
|
+
@dummy = Dummy.new
|
155
|
+
@dummy.avatar = StringIO.new(".")
|
156
|
+
end
|
157
|
+
|
158
|
+
should "return a url based on an S3 path" do
|
159
|
+
assert_match %r{^https://s3.amazonaws.com/bucket/avatars/stringio.txt}, @dummy.avatar.url
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
147
163
|
context ":s3_protocol => ''" do
|
148
164
|
setup do
|
149
165
|
rebuild_model :storage => :s3,
|
@@ -276,8 +292,13 @@ class S3Test < Test::Unit::TestCase
|
|
276
292
|
'secret_access_key' => "54321"
|
277
293
|
}
|
278
294
|
|
279
|
-
|
280
|
-
|
295
|
+
stringio = StringIO.new(".")
|
296
|
+
class << stringio
|
297
|
+
def original_filename
|
298
|
+
"question?mark.png"
|
299
|
+
end
|
300
|
+
end
|
301
|
+
file = Paperclip.io_adapters.for(stringio)
|
281
302
|
@dummy = Dummy.new
|
282
303
|
@dummy.avatar = file
|
283
304
|
@dummy.save
|
@@ -564,6 +585,21 @@ class S3Test < Test::Unit::TestCase
|
|
564
585
|
assert_match %r{^http://s3\.amazonaws\.com/testing/avatars/original/5k\.png}, @dummy.avatar.url
|
565
586
|
end
|
566
587
|
|
588
|
+
should "be rewinded after flush_writes" do
|
589
|
+
@dummy.avatar.instance_eval "def after_flush_writes; end"
|
590
|
+
|
591
|
+
files = @dummy.avatar.queued_for_write.values.each(&:read)
|
592
|
+
@dummy.save
|
593
|
+
assert files.none?(&:eof?), "Expect all the files to be rewinded."
|
594
|
+
end
|
595
|
+
|
596
|
+
should "be removed after after_flush_writes" do
|
597
|
+
paths = @dummy.avatar.queued_for_write.values.map(&:path)
|
598
|
+
@dummy.save
|
599
|
+
assert paths.none?{ |path| File.exists?(path) },
|
600
|
+
"Expect all the files to be deleted."
|
601
|
+
end
|
602
|
+
|
567
603
|
context "and saved" do
|
568
604
|
setup do
|
569
605
|
object = stub
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require './test/helper'
|
2
|
+
|
3
|
+
class Paperclip::TempfileFactoryTest < Test::Unit::TestCase
|
4
|
+
should "be able to generate a tempfile with the right name" do
|
5
|
+
file = subject.generate("omg.png")
|
6
|
+
end
|
7
|
+
should "be able to generate a tempfile with the right name with a tilde at the beginning" do
|
8
|
+
file = subject.generate("~omg.png")
|
9
|
+
end
|
10
|
+
should "be able to generate a tempfile with the right name with a tilde at the end" do
|
11
|
+
file = subject.generate("omg.png~")
|
12
|
+
end
|
13
|
+
end
|
data/test/thumbnail_test.rb
CHANGED
@@ -234,6 +234,17 @@ class ThumbnailTest < Test::Unit::TestCase
|
|
234
234
|
end
|
235
235
|
end
|
236
236
|
|
237
|
+
context "being thumbnailed with default animated option (true)" do
|
238
|
+
should "call identify to check for animated images when sent #make" do
|
239
|
+
thumb = Paperclip::Thumbnail.new(@file, :geometry => "100x50#")
|
240
|
+
thumb.expects(:identify).at_least_once.with do |*arg|
|
241
|
+
arg[0] == '-format %m :file' &&
|
242
|
+
arg[1][:file] == "#{File.expand_path(thumb.file.path)}[0]"
|
243
|
+
end
|
244
|
+
thumb.make
|
245
|
+
end
|
246
|
+
end
|
247
|
+
|
237
248
|
context "passing a custom file geometry parser" do
|
238
249
|
teardown do
|
239
250
|
self.class.send(:remove_const, :GeoParser)
|
@@ -380,6 +391,40 @@ class ThumbnailTest < Test::Unit::TestCase
|
|
380
391
|
end
|
381
392
|
end
|
382
393
|
|
394
|
+
context "with unidentified source format" do
|
395
|
+
setup do
|
396
|
+
@unidentified_file = File.new(fixture_file("animated.unknown"), 'rb')
|
397
|
+
@thumb = Paperclip::Thumbnail.new(@file, :geometry => "60x60")
|
398
|
+
end
|
399
|
+
|
400
|
+
should "create the 12 frames thumbnail when sent #make" do
|
401
|
+
dst = @thumb.make
|
402
|
+
cmd = %Q[identify -format "%wx%h" "#{dst.path}"]
|
403
|
+
assert_equal "60x60"*12, `#{cmd}`.chomp
|
404
|
+
end
|
405
|
+
|
406
|
+
should "use the -coalesce option" do
|
407
|
+
assert_equal @thumb.transformation_command.first, "-coalesce"
|
408
|
+
end
|
409
|
+
end
|
410
|
+
|
411
|
+
context "with no source format" do
|
412
|
+
setup do
|
413
|
+
@unidentified_file = File.new(fixture_file("animated"), 'rb')
|
414
|
+
@thumb = Paperclip::Thumbnail.new(@file, :geometry => "70x70")
|
415
|
+
end
|
416
|
+
|
417
|
+
should "create the 12 frames thumbnail when sent #make" do
|
418
|
+
dst = @thumb.make
|
419
|
+
cmd = %Q[identify -format "%wx%h" "#{dst.path}"]
|
420
|
+
assert_equal "70x70"*12, `#{cmd}`.chomp
|
421
|
+
end
|
422
|
+
|
423
|
+
should "use the -coalesce option" do
|
424
|
+
assert_equal @thumb.transformation_command.first, "-coalesce"
|
425
|
+
end
|
426
|
+
end
|
427
|
+
|
383
428
|
context "with animated option set to false" do
|
384
429
|
setup do
|
385
430
|
@thumb = Paperclip::Thumbnail.new(@file, :geometry => "50x50", :animated => false)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paperclip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0
|
4
|
+
version: 3.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-06-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|
@@ -194,7 +194,7 @@ dependencies:
|
|
194
194
|
requirements:
|
195
195
|
- - ~>
|
196
196
|
- !ruby/object:Gem::Version
|
197
|
-
version: 1.1
|
197
|
+
version: 1.2.1
|
198
198
|
type: :development
|
199
199
|
prerelease: false
|
200
200
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -202,7 +202,7 @@ dependencies:
|
|
202
202
|
requirements:
|
203
203
|
- - ~>
|
204
204
|
- !ruby/object:Gem::Version
|
205
|
-
version: 1.1
|
205
|
+
version: 1.2.1
|
206
206
|
- !ruby/object:Gem::Dependency
|
207
207
|
name: aruba
|
208
208
|
requirement: !ruby/object:Gem::Requirement
|
@@ -384,6 +384,7 @@ files:
|
|
384
384
|
- UPGRADING
|
385
385
|
- cucumber/paperclip_steps.rb
|
386
386
|
- features/basic_integration.feature
|
387
|
+
- features/migration.feature
|
387
388
|
- features/rake_tasks.feature
|
388
389
|
- features/step_definitions/attachment_steps.rb
|
389
390
|
- features/step_definitions/html_steps.rb
|
@@ -393,7 +394,6 @@ files:
|
|
393
394
|
- features/support/env.rb
|
394
395
|
- features/support/fakeweb.rb
|
395
396
|
- features/support/file_helpers.rb
|
396
|
-
- features/support/fixtures/.boot_config.rb.swo
|
397
397
|
- features/support/fixtures/boot_config.txt
|
398
398
|
- features/support/fixtures/gemfile.txt
|
399
399
|
- features/support/fixtures/preinitializer.txt
|
@@ -403,13 +403,10 @@ files:
|
|
403
403
|
- gemfiles/3.0.gemfile
|
404
404
|
- gemfiles/3.1.gemfile
|
405
405
|
- gemfiles/3.2.gemfile
|
406
|
-
- images.rake
|
407
|
-
- lib/.DS_Store
|
408
406
|
- lib/generators/paperclip/USAGE
|
409
407
|
- lib/generators/paperclip/paperclip_generator.rb
|
410
408
|
- lib/generators/paperclip/templates/paperclip_migration.rb.erb
|
411
409
|
- lib/paperclip.rb
|
412
|
-
- lib/paperclip/.DS_Store
|
413
410
|
- lib/paperclip/attachment.rb
|
414
411
|
- lib/paperclip/attachment_options.rb
|
415
412
|
- lib/paperclip/callbacks.rb
|
@@ -419,6 +416,7 @@ files:
|
|
419
416
|
- lib/paperclip/helpers.rb
|
420
417
|
- lib/paperclip/instance_methods.rb
|
421
418
|
- lib/paperclip/interpolations.rb
|
419
|
+
- lib/paperclip/io_adapters/abstract_adapter.rb
|
422
420
|
- lib/paperclip/io_adapters/attachment_adapter.rb
|
423
421
|
- lib/paperclip/io_adapters/file_adapter.rb
|
424
422
|
- lib/paperclip/io_adapters/identity_adapter.rb
|
@@ -443,6 +441,7 @@ files:
|
|
443
441
|
- lib/paperclip/storage/s3.rb
|
444
442
|
- lib/paperclip/style.rb
|
445
443
|
- lib/paperclip/tempfile.rb
|
444
|
+
- lib/paperclip/tempfile_factory.rb
|
446
445
|
- lib/paperclip/thumbnail.rb
|
447
446
|
- lib/paperclip/url_generator.rb
|
448
447
|
- lib/paperclip/validators.rb
|
@@ -459,7 +458,9 @@ files:
|
|
459
458
|
- test/fixtures/12k.png
|
460
459
|
- test/fixtures/50x50.png
|
461
460
|
- test/fixtures/5k.png
|
461
|
+
- test/fixtures/animated
|
462
462
|
- test/fixtures/animated.gif
|
463
|
+
- test/fixtures/animated.unknown
|
463
464
|
- test/fixtures/bad.png
|
464
465
|
- test/fixtures/fog.yml
|
465
466
|
- test/fixtures/s3.yml
|
@@ -472,6 +473,7 @@ files:
|
|
472
473
|
- test/helper.rb
|
473
474
|
- test/integration_test.rb
|
474
475
|
- test/interpolations_test.rb
|
476
|
+
- test/io_adapters/abstract_adapter_test.rb
|
475
477
|
- test/io_adapters/attachment_adapter_test.rb
|
476
478
|
- test/io_adapters/file_adapter_test.rb
|
477
479
|
- test/io_adapters/identity_adapter_test.rb
|
@@ -496,6 +498,7 @@ files:
|
|
496
498
|
- test/support/mock_interpolator.rb
|
497
499
|
- test/support/mock_model.rb
|
498
500
|
- test/support/mock_url_generator_builder.rb
|
501
|
+
- test/tempfile_factory_test.rb
|
499
502
|
- test/thumbnail_test.rb
|
500
503
|
- test/url_generator_test.rb
|
501
504
|
- test/validators/attachment_content_type_validator_test.rb
|
@@ -536,6 +539,7 @@ specification_version: 3
|
|
536
539
|
summary: File attachments as attributes for ActiveRecord
|
537
540
|
test_files:
|
538
541
|
- features/basic_integration.feature
|
542
|
+
- features/migration.feature
|
539
543
|
- features/rake_tasks.feature
|
540
544
|
- features/step_definitions/attachment_steps.rb
|
541
545
|
- features/step_definitions/html_steps.rb
|
@@ -545,7 +549,6 @@ test_files:
|
|
545
549
|
- features/support/env.rb
|
546
550
|
- features/support/fakeweb.rb
|
547
551
|
- features/support/file_helpers.rb
|
548
|
-
- features/support/fixtures/.boot_config.rb.swo
|
549
552
|
- features/support/fixtures/boot_config.txt
|
550
553
|
- features/support/fixtures/gemfile.txt
|
551
554
|
- features/support/fixtures/preinitializer.txt
|
@@ -558,7 +561,9 @@ test_files:
|
|
558
561
|
- test/fixtures/12k.png
|
559
562
|
- test/fixtures/50x50.png
|
560
563
|
- test/fixtures/5k.png
|
564
|
+
- test/fixtures/animated
|
561
565
|
- test/fixtures/animated.gif
|
566
|
+
- test/fixtures/animated.unknown
|
562
567
|
- test/fixtures/bad.png
|
563
568
|
- test/fixtures/fog.yml
|
564
569
|
- test/fixtures/s3.yml
|
@@ -571,6 +576,7 @@ test_files:
|
|
571
576
|
- test/helper.rb
|
572
577
|
- test/integration_test.rb
|
573
578
|
- test/interpolations_test.rb
|
579
|
+
- test/io_adapters/abstract_adapter_test.rb
|
574
580
|
- test/io_adapters/attachment_adapter_test.rb
|
575
581
|
- test/io_adapters/file_adapter_test.rb
|
576
582
|
- test/io_adapters/identity_adapter_test.rb
|
@@ -595,6 +601,7 @@ test_files:
|
|
595
601
|
- test/support/mock_interpolator.rb
|
596
602
|
- test/support/mock_model.rb
|
597
603
|
- test/support/mock_url_generator_builder.rb
|
604
|
+
- test/tempfile_factory_test.rb
|
598
605
|
- test/thumbnail_test.rb
|
599
606
|
- test/url_generator_test.rb
|
600
607
|
- test/validators/attachment_content_type_validator_test.rb
|
Binary file
|
data/images.rake
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
namespace :images do
|
2
|
-
desc "Regenerate images"
|
3
|
-
task :regenerate => :environment do
|
4
|
-
require 'open-uri'
|
5
|
-
OpportunityPhoto.all.each do |photo|
|
6
|
-
begin
|
7
|
-
old_name = photo.image_file_name
|
8
|
-
new_image = open(photo.image.url(:original, escape: false))
|
9
|
-
class << new_image
|
10
|
-
def original_filename; @original_filename; end
|
11
|
-
def original_filename=(name); @original_filename = name; end
|
12
|
-
end
|
13
|
-
new_image.original_filename = old_name
|
14
|
-
photo.image = new_image
|
15
|
-
photo.save
|
16
|
-
rescue => e
|
17
|
-
puts "ERROR: #{e.message} while processing #{photo.id}"
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|