dynamic_paperclip 1.0.0a.1 → 1.0.0a.2
Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,33 @@
|
|
1
|
+
namespace :dynamic_paperclip do
|
2
|
+
desc 'Removes the given dynamic DEFINITION from the given CLASS and ATTACHMENT'
|
3
|
+
task :remove_style => :environment do
|
4
|
+
class_name = ENV['CLASS'] || ENV['class']
|
5
|
+
attachment_name = ENV['ATTACHMENT'] || ENV['attachment']
|
6
|
+
definition = ENV['DEFINITION'] || ENV['definition']
|
7
|
+
|
8
|
+
raise 'must specify a DEFINITION' unless definition.present?
|
9
|
+
raise 'must specify a CLASS' unless class_name.present?
|
10
|
+
raise 'must specify an ATTACHMENT' unless attachment_name.present?
|
11
|
+
|
12
|
+
raise "'#{attachment_name}' is not a dynamic attachment on the #{class_name} class" unless DynamicPaperclip::AttachmentRegistry.names_for(class_name.constantize).include?(attachment_name.to_sym)
|
13
|
+
|
14
|
+
total_deletes = 0
|
15
|
+
|
16
|
+
Paperclip.each_instance_with_attachment(class_name, attachment_name) do |instance|
|
17
|
+
attachment = instance.send(attachment_name)
|
18
|
+
style_name = DynamicPaperclip::StyleNaming.dynamic_style_name_from_definition(definition)
|
19
|
+
|
20
|
+
# Only proceed if this attachment has generated the given definition
|
21
|
+
if attachment.dynamic_styles.keys.include?(style_name)
|
22
|
+
total_deletes += 1
|
23
|
+
|
24
|
+
puts "Deleting: #{attachment.path(style_name)}"
|
25
|
+
|
26
|
+
attachment.send :queue_some_for_delete, style_name
|
27
|
+
attachment.flush_deletes
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
puts "**Deleted #{total_deletes} instances of the '#{definition}' dynamic style for the #{class_name} #{attachment_name} attachment**"
|
32
|
+
end
|
33
|
+
end
|
data/test/dummy/db/test.sqlite3
CHANGED
Binary file
|
data/test/dummy/log/test.log
CHANGED
@@ -23310,3 +23310,90 @@ Command :: file -b --mime '/var/folders/sd/669fr45168q7jsmsp132kqfr0000gn/T/rail
|
|
23310
23310
|
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
23311
23311
|
[1m[35m (0.1ms)[0m begin transaction
|
23312
23312
|
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
23313
|
+
Connecting to database specified by database.yml
|
23314
|
+
[1m[36m (27.5ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
23315
|
+
Migrating to CreatePhotos (20131102002336)
|
23316
|
+
[1m[35m (0.1ms)[0m begin transaction
|
23317
|
+
[1m[36mFixture Delete (0.5ms)[0m [1mDELETE FROM "photos"[0m
|
23318
|
+
[1m[35mFixture Insert (0.4ms)[0m INSERT INTO "photos" ("id", "image_file_name", "image_content_type", "created_at", "updated_at") VALUES (1, 'rails.png', 'image/png', '2014-08-13 20:51:28', '2014-08-13 20:51:28')
|
23319
|
+
[1m[36m (0.6ms)[0m [1mcommit transaction[0m
|
23320
|
+
[1m[35m (0.0ms)[0m begin transaction
|
23321
|
+
[1m[36mPhoto Load (0.3ms)[0m [1mSELECT "photos".* FROM "photos" WHERE "photos"."id" = ? LIMIT 1[0m [["id", 1]]
|
23322
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
23323
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
23324
|
+
[1m[35mPhoto Load (0.1ms)[0m SELECT "photos".* FROM "photos" WHERE "photos"."id" = ? LIMIT 1 [["id", 1]]
|
23325
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
23326
|
+
[1m[35m (0.0ms)[0m begin transaction
|
23327
|
+
[1m[36mPhoto Load (0.1ms)[0m [1mSELECT "photos".* FROM "photos" WHERE "photos"."id" = ? LIMIT 1[0m [["id", 1]]
|
23328
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
23329
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
23330
|
+
[1m[35mPhoto Load (0.1ms)[0m SELECT "photos".* FROM "photos" WHERE "photos"."id" = ? LIMIT 1 [["id", 1]]
|
23331
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
23332
|
+
[1m[35m (0.0ms)[0m begin transaction
|
23333
|
+
[1m[36mPhoto Load (0.1ms)[0m [1mSELECT "photos".* FROM "photos" WHERE "photos"."id" = ? LIMIT 1[0m [["id", 1]]
|
23334
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
23335
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
23336
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
23337
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
23338
|
+
[1m[35mPhoto Load (0.1ms)[0m SELECT "photos".* FROM "photos" WHERE "photos"."id" = ? LIMIT 1 [["id", 1]]
|
23339
|
+
Started GET "/system/photos/images/000/000/001/dynamic_100x100/rails.png?s=d2dcb69d514d1030ce01404ebc422423eccf1b02" for 127.0.0.1 at 2014-08-13 16:51:29 -0400
|
23340
|
+
[1m[36mPhoto Load (0.1ms)[0m [1mSELECT "photos".* FROM "photos" WHERE "photos"."id" = ? LIMIT 1[0m [["id", 1]]
|
23341
|
+
Command :: identify -format '%wx%h,%[exif:orientation]' '/var/folders/sd/669fr45168q7jsmsp132kqfr0000gn/T/rails20140813-38714-1qcilzk.png[0]'
|
23342
|
+
Command :: identify -format %m '/var/folders/sd/669fr45168q7jsmsp132kqfr0000gn/T/rails20140813-38714-1qcilzk.png[0]'
|
23343
|
+
Command :: identify -format %m '/var/folders/sd/669fr45168q7jsmsp132kqfr0000gn/T/rails20140813-38714-1qcilzk.png[0]'
|
23344
|
+
Command :: identify -format %m '/var/folders/sd/669fr45168q7jsmsp132kqfr0000gn/T/rails20140813-38714-1qcilzk.png[0]'
|
23345
|
+
Command :: convert '/var/folders/sd/669fr45168q7jsmsp132kqfr0000gn/T/rails20140813-38714-1qcilzk.png[0]' -auto-orient -resize "100x100" '/var/folders/sd/669fr45168q7jsmsp132kqfr0000gn/T/rails20140813-38714-1qcilzk20140813-38714-au8n9b'
|
23346
|
+
Command :: file -b --mime '/var/folders/sd/669fr45168q7jsmsp132kqfr0000gn/T/rails20140813-38714-1qcilzk20140813-38714-au8n9b'
|
23347
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
23348
|
+
[1m[36m (0.3ms)[0m [1mUPDATE "photos" SET "image_file_size" = 6646, "image_updated_at" = '2014-08-13 20:51:29.546459', "image_file_name" = 'rails.png', "updated_at" = '2014-08-13 20:51:29.681071' WHERE "photos"."id" = 1[0m
|
23349
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
23350
|
+
[1m[36m (0.6ms)[0m [1mrollback transaction[0m
|
23351
|
+
[1m[35m (0.1ms)[0m begin transaction
|
23352
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
23353
|
+
[1m[35m (0.1ms)[0m begin transaction
|
23354
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
23355
|
+
Connecting to database specified by database.yml
|
23356
|
+
[1m[36m (1.2ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
23357
|
+
Migrating to CreatePhotos (20131102002336)
|
23358
|
+
Connecting to database specified by database.yml
|
23359
|
+
[1m[36m (17.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
23360
|
+
Migrating to CreatePhotos (20131102002336)
|
23361
|
+
[1m[35m (0.1ms)[0m begin transaction
|
23362
|
+
[1m[36mFixture Delete (0.3ms)[0m [1mDELETE FROM "photos"[0m
|
23363
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "photos" ("id", "image_file_name", "image_content_type", "created_at", "updated_at") VALUES (1, 'rails.png', 'image/png', '2014-08-13 20:52:22', '2014-08-13 20:52:22')
|
23364
|
+
[1m[36m (0.5ms)[0m [1mcommit transaction[0m
|
23365
|
+
[1m[35m (0.0ms)[0m begin transaction
|
23366
|
+
[1m[36mPhoto Load (0.2ms)[0m [1mSELECT "photos".* FROM "photos" WHERE "photos"."id" = ? LIMIT 1[0m [["id", 1]]
|
23367
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
23368
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
23369
|
+
[1m[35mPhoto Load (0.1ms)[0m SELECT "photos".* FROM "photos" WHERE "photos"."id" = ? LIMIT 1 [["id", 1]]
|
23370
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
23371
|
+
[1m[35m (0.0ms)[0m begin transaction
|
23372
|
+
[1m[36mPhoto Load (0.1ms)[0m [1mSELECT "photos".* FROM "photos" WHERE "photos"."id" = ? LIMIT 1[0m [["id", 1]]
|
23373
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
23374
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
23375
|
+
[1m[35mPhoto Load (0.1ms)[0m SELECT "photos".* FROM "photos" WHERE "photos"."id" = ? LIMIT 1 [["id", 1]]
|
23376
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
23377
|
+
[1m[35m (0.0ms)[0m begin transaction
|
23378
|
+
[1m[36mPhoto Load (0.1ms)[0m [1mSELECT "photos".* FROM "photos" WHERE "photos"."id" = ? LIMIT 1[0m [["id", 1]]
|
23379
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
23380
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
23381
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
23382
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
23383
|
+
[1m[35mPhoto Load (0.1ms)[0m SELECT "photos".* FROM "photos" WHERE "photos"."id" = ? LIMIT 1 [["id", 1]]
|
23384
|
+
Started GET "/system/photos/images/000/000/001/dynamic_100x100/rails.png?s=d2dcb69d514d1030ce01404ebc422423eccf1b02" for 127.0.0.1 at 2014-08-13 16:52:22 -0400
|
23385
|
+
[1m[36mPhoto Load (0.1ms)[0m [1mSELECT "photos".* FROM "photos" WHERE "photos"."id" = ? LIMIT 1[0m [["id", 1]]
|
23386
|
+
Command :: identify -format '%wx%h,%[exif:orientation]' '/var/folders/sd/669fr45168q7jsmsp132kqfr0000gn/T/rails20140813-38914-1j3slva.png[0]'
|
23387
|
+
Command :: identify -format %m '/var/folders/sd/669fr45168q7jsmsp132kqfr0000gn/T/rails20140813-38914-1j3slva.png[0]'
|
23388
|
+
Command :: identify -format %m '/var/folders/sd/669fr45168q7jsmsp132kqfr0000gn/T/rails20140813-38914-1j3slva.png[0]'
|
23389
|
+
Command :: identify -format %m '/var/folders/sd/669fr45168q7jsmsp132kqfr0000gn/T/rails20140813-38914-1j3slva.png[0]'
|
23390
|
+
Command :: convert '/var/folders/sd/669fr45168q7jsmsp132kqfr0000gn/T/rails20140813-38914-1j3slva.png[0]' -auto-orient -resize "100x100" '/var/folders/sd/669fr45168q7jsmsp132kqfr0000gn/T/rails20140813-38914-1j3slva20140813-38914-u8fp6l'
|
23391
|
+
Command :: file -b --mime '/var/folders/sd/669fr45168q7jsmsp132kqfr0000gn/T/rails20140813-38914-1j3slva20140813-38914-u8fp6l'
|
23392
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
23393
|
+
[1m[36m (0.3ms)[0m [1mUPDATE "photos" SET "image_file_size" = 6646, "image_updated_at" = '2014-08-13 20:52:22.354099', "image_file_name" = 'rails.png', "updated_at" = '2014-08-13 20:52:22.442267' WHERE "photos"."id" = 1[0m
|
23394
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
23395
|
+
[1m[36m (0.3ms)[0m [1mrollback transaction[0m
|
23396
|
+
[1m[35m (0.1ms)[0m begin transaction
|
23397
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
23398
|
+
[1m[35m (0.0ms)[0m begin transaction
|
23399
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
# require 'rake'
|
3
|
+
load 'tasks/paperclip.rake'
|
4
|
+
|
5
|
+
class RakeTest < Test::Unit::TestCase
|
6
|
+
context "calling `rake dynamic_paperclip:remove_style`" do
|
7
|
+
setup do
|
8
|
+
|
9
|
+
end
|
10
|
+
|
11
|
+
should 'queue dynamic style for delete and flush deletes' do
|
12
|
+
::Rake::Task['dynamic_paperclip:remove_style'].execute
|
13
|
+
end
|
14
|
+
end
|
15
|
+
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.
|
4
|
+
version: 1.0.0a.2
|
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-
|
12
|
+
date: 2014-08-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rack
|
@@ -160,6 +160,7 @@ files:
|
|
160
160
|
- lib/dynamic_paperclip/version.rb
|
161
161
|
- lib/dynamic_paperclip.rb
|
162
162
|
- lib/generators/dynamic_paperclip/install_generator.rb
|
163
|
+
- lib/tasks/dynamic_paperclip.rake
|
163
164
|
- MIT-LICENSE
|
164
165
|
- Rakefile
|
165
166
|
- README.md
|
@@ -201,6 +202,7 @@ files:
|
|
201
202
|
- test/unit/attachment_style_generator_test.rb
|
202
203
|
- test/unit/attachment_test.rb
|
203
204
|
- test/unit/has_attached_file_test.rb
|
205
|
+
- test/unit/rake_test.rb
|
204
206
|
homepage: http://github.com/room118solutions/dynamic_paperclip
|
205
207
|
licenses: []
|
206
208
|
post_install_message:
|
@@ -215,7 +217,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
215
217
|
version: '0'
|
216
218
|
segments:
|
217
219
|
- 0
|
218
|
-
hash:
|
220
|
+
hash: 3168233451025285427
|
219
221
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
220
222
|
none: false
|
221
223
|
requirements:
|
@@ -267,3 +269,4 @@ test_files:
|
|
267
269
|
- test/unit/attachment_style_generator_test.rb
|
268
270
|
- test/unit/attachment_test.rb
|
269
271
|
- test/unit/has_attached_file_test.rb
|
272
|
+
- test/unit/rake_test.rb
|