dragonfly 0.9.3 → 0.9.4
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of dragonfly might be problematic. Click here for more details.
- data/History.md +7 -0
- data/README.md +1 -1
- data/VERSION +1 -1
- data/dragonfly.gemspec +2 -2
- data/extra_docs/Rails3.md +1 -1
- data/lib/dragonfly/job.rb +15 -6
- data/lib/dragonfly/response.rb +1 -1
- data/spec/dragonfly/job_spec.rb +24 -0
- metadata +3 -3
data/History.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
0.9.4 (2011-06-10)
|
2
|
+
==================
|
3
|
+
Fixes
|
4
|
+
-----
|
5
|
+
- Made use of Rack calling `close` on the response body to clean up tempfiles.
|
6
|
+
The response body is now the job, which delegates `each` to the temp_object.
|
7
|
+
|
1
8
|
0.9.3 (2011-06-03)
|
2
9
|
==================
|
3
10
|
Fixes
|
data/README.md
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.
|
1
|
+
0.9.4
|
data/dragonfly.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{dragonfly}
|
8
|
-
s.version = "0.9.
|
8
|
+
s.version = "0.9.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Mark Evans"]
|
12
|
-
s.date = %q{2011-06-
|
12
|
+
s.date = %q{2011-06-10}
|
13
13
|
s.description = %q{Dragonfly is a framework that enables on-the-fly processing for any content type.
|
14
14
|
It is especially suited to image handling. Its uses range from image thumbnails to standard attachments to on-demand text generation.}
|
15
15
|
s.email = %q{mark@new-bamboo.co.uk}
|
data/extra_docs/Rails3.md
CHANGED
data/lib/dragonfly/job.rb
CHANGED
@@ -19,7 +19,7 @@ module Dragonfly
|
|
19
19
|
|
20
20
|
extend Forwardable
|
21
21
|
def_delegators :result,
|
22
|
-
:data, :file, :tempfile, :path, :to_file, :size
|
22
|
+
:data, :file, :tempfile, :path, :to_file, :size, :each
|
23
23
|
def_delegator :app, :server
|
24
24
|
|
25
25
|
class Step
|
@@ -201,6 +201,7 @@ module Dragonfly
|
|
201
201
|
@steps = []
|
202
202
|
@next_step_index = 0
|
203
203
|
@meta = {}
|
204
|
+
@previous_temp_objects = []
|
204
205
|
update(content, meta)
|
205
206
|
end
|
206
207
|
|
@@ -211,8 +212,13 @@ module Dragonfly
|
|
211
212
|
end
|
212
213
|
end
|
213
214
|
|
214
|
-
attr_accessor :temp_object
|
215
215
|
attr_reader :app, :steps
|
216
|
+
attr_reader :temp_object
|
217
|
+
|
218
|
+
def temp_object=(temp_object)
|
219
|
+
previous_temp_objects.push(@temp_object) if @temp_object
|
220
|
+
@temp_object = temp_object
|
221
|
+
end
|
216
222
|
|
217
223
|
# define fetch(), fetch!(), process(), etc.
|
218
224
|
STEPS.each do |step_class|
|
@@ -317,10 +323,6 @@ module Dragonfly
|
|
317
323
|
to_app.call(env)
|
318
324
|
end
|
319
325
|
|
320
|
-
def to_path
|
321
|
-
"/#{serialize}"
|
322
|
-
end
|
323
|
-
|
324
326
|
def to_fetched_job(uid)
|
325
327
|
new_job = self.class.new(app, temp_object, meta)
|
326
328
|
new_job.fetch!(uid)
|
@@ -418,6 +420,11 @@ module Dragonfly
|
|
418
420
|
end
|
419
421
|
end
|
420
422
|
|
423
|
+
def close
|
424
|
+
previous_temp_objects.each{|temp_object| temp_object.close }
|
425
|
+
temp_object.close if temp_object
|
426
|
+
end
|
427
|
+
|
421
428
|
protected
|
422
429
|
|
423
430
|
attr_writer :steps
|
@@ -425,6 +432,8 @@ module Dragonfly
|
|
425
432
|
|
426
433
|
private
|
427
434
|
|
435
|
+
attr_reader :previous_temp_objects
|
436
|
+
|
428
437
|
def format_from_meta
|
429
438
|
meta[:format] || (ext.to_sym if ext && app.trust_file_extensions)
|
430
439
|
end
|
data/lib/dragonfly/response.rb
CHANGED
data/spec/dragonfly/job_spec.rb
CHANGED
@@ -1022,4 +1022,28 @@ describe Dragonfly::Job do
|
|
1022
1022
|
end
|
1023
1023
|
end
|
1024
1024
|
|
1025
|
+
describe "close" do
|
1026
|
+
before(:each) do
|
1027
|
+
@app = test_app
|
1028
|
+
@app.generator.add(:toast){ "toast" }
|
1029
|
+
@app.processor.add(:upcase){|t| t.data.upcase }
|
1030
|
+
@job = @app.generate(:toast)
|
1031
|
+
@path1 = @job.tempfile.path
|
1032
|
+
@job.process!(:upcase)
|
1033
|
+
@path2 = @job.tempfile.path
|
1034
|
+
end
|
1035
|
+
|
1036
|
+
it "should clean up tempfiles for the last temp_object" do
|
1037
|
+
File.exist?(@path2).should be_true
|
1038
|
+
@job.close
|
1039
|
+
File.exist?(@path2).should be_false
|
1040
|
+
end
|
1041
|
+
|
1042
|
+
it "should clean up tempfiles for previous temp_objects" do
|
1043
|
+
File.exist?(@path1).should be_true
|
1044
|
+
@job.close
|
1045
|
+
File.exist?(@path1).should be_false
|
1046
|
+
end
|
1047
|
+
end
|
1048
|
+
|
1025
1049
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: dragonfly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.9.
|
5
|
+
version: 0.9.4
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Mark Evans
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-06-
|
13
|
+
date: 2011-06-10 00:00:00 +01:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -401,7 +401,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
401
401
|
requirements:
|
402
402
|
- - ">="
|
403
403
|
- !ruby/object:Gem::Version
|
404
|
-
hash:
|
404
|
+
hash: 1699270307650863016
|
405
405
|
segments:
|
406
406
|
- 0
|
407
407
|
version: "0"
|