paperclip 2.3.7 → 2.3.8
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/lib/paperclip/version.rb +1 -1
- data/lib/tasks/paperclip.rake +9 -7
- metadata +4 -4
data/lib/paperclip/version.rb
CHANGED
data/lib/tasks/paperclip.rake
CHANGED
@@ -1,15 +1,17 @@
|
|
1
1
|
def obtain_class
|
2
2
|
class_name = ENV['CLASS'] || ENV['class']
|
3
3
|
raise "Must specify CLASS" unless class_name
|
4
|
+
class_name
|
4
5
|
end
|
5
6
|
|
6
|
-
def obtain_attachments
|
7
|
+
def obtain_attachments(klass)
|
8
|
+
klass = Object.const_get(klass.to_s)
|
7
9
|
name = ENV['ATTACHMENT'] || ENV['attachment']
|
8
|
-
raise "Class #{
|
9
|
-
if !name.blank? &&
|
10
|
+
raise "Class #{klass.name} has no attachments specified" unless klass.respond_to?(:attachment_definitions)
|
11
|
+
if !name.blank? && klass.attachment_definitions.keys.include?(name)
|
10
12
|
[ name ]
|
11
13
|
else
|
12
|
-
|
14
|
+
klass.attachment_definitions.keys
|
13
15
|
end
|
14
16
|
end
|
15
17
|
|
@@ -21,8 +23,8 @@ namespace :paperclip do
|
|
21
23
|
desc "Regenerates thumbnails for a given CLASS (and optional ATTACHMENT)."
|
22
24
|
task :thumbnails => :environment do
|
23
25
|
errors = []
|
24
|
-
names = obtain_attachments
|
25
26
|
klass = obtain_class
|
27
|
+
names = obtain_attachments(klass)
|
26
28
|
names.each do |name|
|
27
29
|
Paperclip.each_instance_with_attachment(klass, name) do |instance|
|
28
30
|
result = instance.send(name).reprocess!
|
@@ -34,8 +36,8 @@ namespace :paperclip do
|
|
34
36
|
|
35
37
|
desc "Regenerates content_type/size metadata for a given CLASS (and optional ATTACHMENT)."
|
36
38
|
task :metadata => :environment do
|
37
|
-
names = obtain_attachments
|
38
39
|
klass = obtain_class
|
40
|
+
names = obtain_attachments(klass)
|
39
41
|
names.each do |name|
|
40
42
|
Paperclip.each_instance_with_attachment(klass, name) do |instance|
|
41
43
|
if file = instance.send(name).to_file
|
@@ -53,8 +55,8 @@ namespace :paperclip do
|
|
53
55
|
|
54
56
|
desc "Cleans out invalid attachments. Useful after you've added new validations."
|
55
57
|
task :clean => :environment do
|
56
|
-
names = obtain_attachments
|
57
58
|
klass = obtain_class
|
59
|
+
names = obtain_attachments(klass)
|
58
60
|
names.each do |name|
|
59
61
|
Paperclip.each_instance_with_attachment(klass, name) do |instance|
|
60
62
|
instance.send(name).send(:validate)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paperclip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 2.3.
|
9
|
+
- 8
|
10
|
+
version: 2.3.8
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jon Yurek
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-12-
|
18
|
+
date: 2010-12-15 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|