dynamic_paperclip 1.0.0a.2 → 1.0.0a.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -43,6 +43,17 @@ module DynamicPaperclip
43
43
  "#{url}#{delimiter_char}s=#{UrlSecurity.generate_hash(style_name)}"
44
44
  end
45
45
 
46
+ # Immediately deletes given styles without impacting existing delete queue
47
+ def delete_styles(*styles)
48
+ old_delete_queue = @queued_for_delete
49
+
50
+ @queued_for_delete = []
51
+ queue_some_for_delete *styles
52
+ flush_deletes
53
+
54
+ @queued_for_delete = old_delete_queue
55
+ end
56
+
46
57
  private
47
58
 
48
59
  def add_dynamic_style!(name)
@@ -1,3 +1,3 @@
1
1
  module DynamicPaperclip
2
- VERSION = "1.0.0a.2"
2
+ VERSION = "1.0.0a.3"
3
3
  end
@@ -23,8 +23,7 @@ namespace :dynamic_paperclip do
23
23
 
24
24
  puts "Deleting: #{attachment.path(style_name)}"
25
25
 
26
- attachment.send :queue_some_for_delete, style_name
27
- attachment.flush_deletes
26
+ attachment.delete_styles style_name
28
27
  end
29
28
  end
30
29
 
Binary file
@@ -23397,3 +23397,147 @@ Command :: file -b --mime '/var/folders/sd/669fr45168q7jsmsp132kqfr0000gn/T/rail
23397
23397
   (0.0ms) rollback transaction
23398
23398
   (0.0ms) begin transaction
23399
23399
   (0.0ms) rollback transaction
23400
+ Connecting to database specified by database.yml
23401
+  (11.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
23402
+ Migrating to CreatePhotos (20131102002336)
23403
+ Connecting to database specified by database.yml
23404
+  (1.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
23405
+ Migrating to CreatePhotos (20131102002336)
23406
+ Connecting to database specified by database.yml
23407
+  (1.3ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
23408
+ Migrating to CreatePhotos (20131102002336)
23409
+ Connecting to database specified by database.yml
23410
+  (1.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
23411
+ Migrating to CreatePhotos (20131102002336)
23412
+  (0.1ms) begin transaction
23413
+ Fixture Delete (0.2ms) DELETE FROM "photos"
23414
+ Fixture Insert (0.1ms) INSERT INTO "photos" ("id", "image_file_name", "image_content_type", "created_at", "updated_at") VALUES (1, 'rails.png', 'image/png', '2014-08-14 19:14:46', '2014-08-14 19:14:46')
23415
+  (0.6ms) commit transaction
23416
+  (0.0ms) begin transaction
23417
+ Photo Load (0.2ms) SELECT "photos".* FROM "photos" WHERE "photos"."id" = ? LIMIT 1 [["id", 1]]
23418
+  (0.1ms) rollback transaction
23419
+  (0.0ms) begin transaction
23420
+ Photo Load (0.1ms) SELECT "photos".* FROM "photos" WHERE "photos"."id" = ? LIMIT 1 [["id", 1]]
23421
+  (0.0ms) rollback transaction
23422
+  (0.0ms) begin transaction
23423
+ Photo Load (0.1ms) SELECT "photos".* FROM "photos" WHERE "photos"."id" = ? LIMIT 1 [["id", 1]]
23424
+  (0.0ms) rollback transaction
23425
+  (0.0ms) begin transaction
23426
+ Photo Load (0.1ms) SELECT "photos".* FROM "photos" WHERE "photos"."id" = ? LIMIT 1 [["id", 1]]
23427
+  (0.0ms) rollback transaction
23428
+  (0.0ms) begin transaction
23429
+ Photo Load (0.1ms) SELECT "photos".* FROM "photos" WHERE "photos"."id" = ? LIMIT 1 [["id", 1]]
23430
+  (0.0ms) rollback transaction
23431
+  (0.0ms) begin transaction
23432
+ Photo Load (0.1ms) SELECT "photos".* FROM "photos" WHERE "photos"."id" = ? LIMIT 1 [["id", 1]]
23433
+  (0.0ms) rollback transaction
23434
+  (0.0ms) begin transaction
23435
+  (0.0ms) rollback transaction
23436
+  (0.0ms) begin transaction
23437
+ Photo Load (0.1ms) SELECT "photos".* FROM "photos" WHERE "photos"."id" = ? LIMIT 1 [["id", 1]]
23438
+ Started GET "/system/photos/images/000/000/001/dynamic_100x100/rails.png?s=d2dcb69d514d1030ce01404ebc422423eccf1b02" for 127.0.0.1 at 2014-08-14 15:14:47 -0400
23439
+ Photo Load (0.1ms) SELECT "photos".* FROM "photos" WHERE "photos"."id" = ? LIMIT 1 [["id", 1]]
23440
+ Command :: identify -format '%wx%h,%[exif:orientation]' '/var/folders/sd/669fr45168q7jsmsp132kqfr0000gn/T/rails20140814-94331-1v62tr8.png[0]'
23441
+ Command :: identify -format %m '/var/folders/sd/669fr45168q7jsmsp132kqfr0000gn/T/rails20140814-94331-1v62tr8.png[0]'
23442
+ Command :: identify -format %m '/var/folders/sd/669fr45168q7jsmsp132kqfr0000gn/T/rails20140814-94331-1v62tr8.png[0]'
23443
+ Command :: identify -format %m '/var/folders/sd/669fr45168q7jsmsp132kqfr0000gn/T/rails20140814-94331-1v62tr8.png[0]'
23444
+ Command :: convert '/var/folders/sd/669fr45168q7jsmsp132kqfr0000gn/T/rails20140814-94331-1v62tr8.png[0]' -auto-orient -resize "100x100" '/var/folders/sd/669fr45168q7jsmsp132kqfr0000gn/T/rails20140814-94331-1v62tr820140814-94331-572yd5'
23445
+ Command :: file -b --mime '/var/folders/sd/669fr45168q7jsmsp132kqfr0000gn/T/rails20140814-94331-1v62tr820140814-94331-572yd5'
23446
+  (0.1ms) SAVEPOINT active_record_1
23447
+  (0.3ms) UPDATE "photos" SET "image_file_size" = 6646, "image_updated_at" = '2014-08-14 19:14:47.051994', "image_file_name" = 'rails.png', "updated_at" = '2014-08-14 19:14:47.372748' WHERE "photos"."id" = 1
23448
+  (0.0ms) RELEASE SAVEPOINT active_record_1
23449
+  (0.3ms) rollback transaction
23450
+  (0.1ms) begin transaction
23451
+  (0.0ms) rollback transaction
23452
+  (0.0ms) begin transaction
23453
+  (0.0ms) rollback transaction
23454
+ Connecting to database specified by database.yml
23455
+  (1.7ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
23456
+ Migrating to CreatePhotos (20131102002336)
23457
+  (0.1ms) begin transaction
23458
+ Fixture Delete (0.4ms) DELETE FROM "photos"
23459
+ Fixture Insert (0.1ms) INSERT INTO "photos" ("id", "image_file_name", "image_content_type", "created_at", "updated_at") VALUES (1, 'rails.png', 'image/png', '2014-08-14 19:15:12', '2014-08-14 19:15:12')
23460
+  (0.5ms) commit transaction
23461
+  (0.0ms) begin transaction
23462
+ Photo Load (0.2ms) SELECT "photos".* FROM "photos" WHERE "photos"."id" = ? LIMIT 1 [["id", 1]]
23463
+  (0.1ms) rollback transaction
23464
+  (0.0ms) begin transaction
23465
+ Photo Load (0.1ms) SELECT "photos".* FROM "photos" WHERE "photos"."id" = ? LIMIT 1 [["id", 1]]
23466
+  (0.0ms) rollback transaction
23467
+  (0.0ms) begin transaction
23468
+ Photo Load (0.1ms) SELECT "photos".* FROM "photos" WHERE "photos"."id" = ? LIMIT 1 [["id", 1]]
23469
+  (0.0ms) rollback transaction
23470
+  (0.0ms) begin transaction
23471
+ Photo Load (0.1ms) SELECT "photos".* FROM "photos" WHERE "photos"."id" = ? LIMIT 1 [["id", 1]]
23472
+  (0.0ms) rollback transaction
23473
+  (0.0ms) begin transaction
23474
+ Photo Load (0.1ms) SELECT "photos".* FROM "photos" WHERE "photos"."id" = ? LIMIT 1 [["id", 1]]
23475
+  (0.0ms) rollback transaction
23476
+  (0.0ms) begin transaction
23477
+ Photo Load (0.1ms) SELECT "photos".* FROM "photos" WHERE "photos"."id" = ? LIMIT 1 [["id", 1]]
23478
+  (0.0ms) rollback transaction
23479
+  (0.0ms) begin transaction
23480
+  (0.0ms) rollback transaction
23481
+  (0.0ms) begin transaction
23482
+ Photo Load (0.1ms) SELECT "photos".* FROM "photos" WHERE "photos"."id" = ? LIMIT 1 [["id", 1]]
23483
+ Started GET "/system/photos/images/000/000/001/dynamic_100x100/rails.png?s=d2dcb69d514d1030ce01404ebc422423eccf1b02" for 127.0.0.1 at 2014-08-14 15:15:12 -0400
23484
+ Photo Load (0.1ms) SELECT "photos".* FROM "photos" WHERE "photos"."id" = ? LIMIT 1 [["id", 1]]
23485
+ Command :: identify -format '%wx%h,%[exif:orientation]' '/var/folders/sd/669fr45168q7jsmsp132kqfr0000gn/T/rails20140814-94412-1l84rag.png[0]'
23486
+ Command :: identify -format %m '/var/folders/sd/669fr45168q7jsmsp132kqfr0000gn/T/rails20140814-94412-1l84rag.png[0]'
23487
+ Command :: identify -format %m '/var/folders/sd/669fr45168q7jsmsp132kqfr0000gn/T/rails20140814-94412-1l84rag.png[0]'
23488
+ Command :: identify -format %m '/var/folders/sd/669fr45168q7jsmsp132kqfr0000gn/T/rails20140814-94412-1l84rag.png[0]'
23489
+ Command :: convert '/var/folders/sd/669fr45168q7jsmsp132kqfr0000gn/T/rails20140814-94412-1l84rag.png[0]' -auto-orient -resize "100x100" '/var/folders/sd/669fr45168q7jsmsp132kqfr0000gn/T/rails20140814-94412-1l84rag20140814-94412-m02l5u'
23490
+ Command :: file -b --mime '/var/folders/sd/669fr45168q7jsmsp132kqfr0000gn/T/rails20140814-94412-1l84rag20140814-94412-m02l5u'
23491
+  (0.1ms) SAVEPOINT active_record_1
23492
+  (0.4ms) UPDATE "photos" SET "image_file_size" = 6646, "image_updated_at" = '2014-08-14 19:15:12.677592', "image_file_name" = 'rails.png', "updated_at" = '2014-08-14 19:15:12.768101' WHERE "photos"."id" = 1
23493
+  (0.0ms) RELEASE SAVEPOINT active_record_1
23494
+  (0.3ms) rollback transaction
23495
+  (0.1ms) begin transaction
23496
+  (0.0ms) rollback transaction
23497
+  (0.0ms) begin transaction
23498
+  (0.0ms) rollback transaction
23499
+ Connecting to database specified by database.yml
23500
+  (1.4ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
23501
+ Migrating to CreatePhotos (20131102002336)
23502
+  (0.1ms) begin transaction
23503
+ Fixture Delete (0.3ms) DELETE FROM "photos"
23504
+ Fixture Insert (0.1ms) INSERT INTO "photos" ("id", "image_file_name", "image_content_type", "created_at", "updated_at") VALUES (1, 'rails.png', 'image/png', '2014-08-14 19:16:10', '2014-08-14 19:16:10')
23505
+  (0.5ms) commit transaction
23506
+  (0.0ms) begin transaction
23507
+ Photo Load (0.2ms) SELECT "photos".* FROM "photos" WHERE "photos"."id" = ? LIMIT 1 [["id", 1]]
23508
+  (0.1ms) rollback transaction
23509
+  (0.0ms) begin transaction
23510
+ Photo Load (0.1ms) SELECT "photos".* FROM "photos" WHERE "photos"."id" = ? LIMIT 1 [["id", 1]]
23511
+  (0.0ms) rollback transaction
23512
+  (0.0ms) begin transaction
23513
+ Photo Load (0.1ms) SELECT "photos".* FROM "photos" WHERE "photos"."id" = ? LIMIT 1 [["id", 1]]
23514
+  (0.0ms) rollback transaction
23515
+  (0.0ms) begin transaction
23516
+ Photo Load (0.1ms) SELECT "photos".* FROM "photos" WHERE "photos"."id" = ? LIMIT 1 [["id", 1]]
23517
+  (0.0ms) rollback transaction
23518
+  (0.0ms) begin transaction
23519
+ Photo Load (0.1ms) SELECT "photos".* FROM "photos" WHERE "photos"."id" = ? LIMIT 1 [["id", 1]]
23520
+  (0.0ms) rollback transaction
23521
+  (0.0ms) begin transaction
23522
+ Photo Load (0.1ms) SELECT "photos".* FROM "photos" WHERE "photos"."id" = ? LIMIT 1 [["id", 1]]
23523
+  (0.1ms) rollback transaction
23524
+  (0.0ms) begin transaction
23525
+  (0.0ms) rollback transaction
23526
+  (0.0ms) begin transaction
23527
+ Photo Load (0.1ms) SELECT "photos".* FROM "photos" WHERE "photos"."id" = ? LIMIT 1 [["id", 1]]
23528
+ Started GET "/system/photos/images/000/000/001/dynamic_100x100/rails.png?s=d2dcb69d514d1030ce01404ebc422423eccf1b02" for 127.0.0.1 at 2014-08-14 15:16:10 -0400
23529
+ Photo Load (0.1ms) SELECT "photos".* FROM "photos" WHERE "photos"."id" = ? LIMIT 1 [["id", 1]]
23530
+ Command :: identify -format '%wx%h,%[exif:orientation]' '/var/folders/sd/669fr45168q7jsmsp132kqfr0000gn/T/rails20140814-94730-1fp83ta.png[0]'
23531
+ Command :: identify -format %m '/var/folders/sd/669fr45168q7jsmsp132kqfr0000gn/T/rails20140814-94730-1fp83ta.png[0]'
23532
+ Command :: identify -format %m '/var/folders/sd/669fr45168q7jsmsp132kqfr0000gn/T/rails20140814-94730-1fp83ta.png[0]'
23533
+ Command :: identify -format %m '/var/folders/sd/669fr45168q7jsmsp132kqfr0000gn/T/rails20140814-94730-1fp83ta.png[0]'
23534
+ Command :: convert '/var/folders/sd/669fr45168q7jsmsp132kqfr0000gn/T/rails20140814-94730-1fp83ta.png[0]' -auto-orient -resize "100x100" '/var/folders/sd/669fr45168q7jsmsp132kqfr0000gn/T/rails20140814-94730-1fp83ta20140814-94730-1uedefb'
23535
+ Command :: file -b --mime '/var/folders/sd/669fr45168q7jsmsp132kqfr0000gn/T/rails20140814-94730-1fp83ta20140814-94730-1uedefb'
23536
+  (0.1ms) SAVEPOINT active_record_1
23537
+  (0.3ms) UPDATE "photos" SET "image_file_size" = 6646, "image_updated_at" = '2014-08-14 19:16:10.801089', "image_file_name" = 'rails.png', "updated_at" = '2014-08-14 19:16:10.891646' WHERE "photos"."id" = 1
23538
+  (0.0ms) RELEASE SAVEPOINT active_record_1
23539
+  (0.3ms) rollback transaction
23540
+  (0.1ms) begin transaction
23541
+  (0.0ms) rollback transaction
23542
+  (0.0ms) begin transaction
23543
+  (0.0ms) rollback transaction
@@ -38,4 +38,17 @@ class AttachmentTest < ActiveSupport::TestCase
38
38
 
39
39
  assert_equal '42x42', attachment.styles[:dynamic_42x42].geometry
40
40
  end
41
+
42
+ should 'delete styles passed to #delete_styles and maintain existing delete queued' do
43
+ attachment = photos(:rails).image
44
+
45
+ attachment.instance_variable_set :@queued_for_delete, [:thumb]
46
+
47
+ attachment.expects(:queue_some_for_delete).with(:foo, :bar)
48
+ attachment.expects(:flush_deletes)
49
+
50
+ attachment.delete_styles :foo, :bar
51
+
52
+ assert_equal [:thumb], attachment.instance_variable_get(:@queued_for_delete)
53
+ end
41
54
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dynamic_paperclip
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0a.2
4
+ version: 1.0.0a.3
5
5
  prerelease: 5
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: 2014-08-13 00:00:00.000000000 Z
12
+ date: 2014-08-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack
@@ -217,7 +217,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
217
217
  version: '0'
218
218
  segments:
219
219
  - 0
220
- hash: 3168233451025285427
220
+ hash: 2099875005983279561
221
221
  required_rubygems_version: !ruby/object:Gem::Requirement
222
222
  none: false
223
223
  requirements: