dragonfly 0.9.1 → 0.9.2

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 CHANGED
@@ -1,3 +1,14 @@
1
+ 0.9.2 (2011-05-19)
2
+ ==================
3
+ Features
4
+ --------
5
+ - Added env['dragonfly.job'] for use in other Rack middlewares
6
+ - Added CookieMonster middleware for removing 'Set-Cookie' headers
7
+
8
+ Fixes
9
+ -----
10
+ - Remove 'Set-Cookie' header from any requests coming from a rails route
11
+
1
12
  0.9.1 (2011-05-11)
2
13
  ==================
3
14
  Features
@@ -8,6 +19,8 @@ Fixes
8
19
  -----
9
20
  - Improved performance of `resize_and_crop` method, using imagemagick built-in '^' operator
10
21
  - Improved server security validations
22
+ - Deal with Excon::Errors::SocketError: EOFError errors which get thrown sometimes from S3 connection
23
+ - Allow files with '..' (but not '../') in the middle of their name in file data store
11
24
 
12
25
  0.9.0 (2011-04-27)
13
26
  ==================
@@ -60,13 +73,20 @@ Fixes
60
73
  -----
61
74
  - Performance tweaks regarding temp_objects model accessors and job objects
62
75
 
63
- 0.8.4 (2010-04-27)
76
+ 0.8.5 (2011-05-11)
77
+ ==================
78
+ Fixes
79
+ -----
80
+ - Allow filenames that have '..' in them (but not '../') in the filedatastore
81
+ - Better security for server
82
+
83
+ 0.8.4 (2011-04-27)
64
84
  ==================
65
85
  Fixes
66
86
  -----
67
87
  - Security fix for file data store
68
88
 
69
- 0.8.2 (2010-01-11)
89
+ 0.8.2 (2011-01-11)
70
90
  ==================
71
91
  Fixes
72
92
  -----
data/README.md CHANGED
@@ -12,7 +12,7 @@ For the lazy Rails user...
12
12
  **Gemfile**:
13
13
 
14
14
  gem 'rack-cache', :require => 'rack/cache'
15
- gem 'dragonfly', '~>0.9.1'
15
+ gem 'dragonfly', '~>0.9.2'
16
16
 
17
17
  **Initializer** (e.g. config/initializers/dragonfly.rb):
18
18
 
data/Rakefile CHANGED
@@ -19,7 +19,6 @@ Jeweler::Tasks.new do |gem|
19
19
  gem.homepage = "http://github.com/markevans/dragonfly"
20
20
  gem.license = "MIT"
21
21
  gem.authors = ["Mark Evans"]
22
- gem.add_runtime_dependency('rack')
23
22
  end
24
23
  Jeweler::RubygemsDotOrgTasks.new
25
24
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.9.1
1
+ 0.9.2
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.1"
8
+ s.version = "0.9.2"
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-05-11}
12
+ s.date = %q{2011-05-19}
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}
@@ -85,6 +85,7 @@ Gem::Specification.new do |s|
85
85
  "lib/dragonfly/config/image_magick.rb",
86
86
  "lib/dragonfly/config/rails.rb",
87
87
  "lib/dragonfly/configurable.rb",
88
+ "lib/dragonfly/cookie_monster.rb",
88
89
  "lib/dragonfly/core_ext/array.rb",
89
90
  "lib/dragonfly/core_ext/hash.rb",
90
91
  "lib/dragonfly/core_ext/object.rb",
@@ -117,6 +118,7 @@ Gem::Specification.new do |s|
117
118
  "lib/dragonfly/processing/image_magick_processor.rb",
118
119
  "lib/dragonfly/processor.rb",
119
120
  "lib/dragonfly/rails/images.rb",
121
+ "lib/dragonfly/railtie.rb",
120
122
  "lib/dragonfly/response.rb",
121
123
  "lib/dragonfly/routed_endpoint.rb",
122
124
  "lib/dragonfly/serializer.rb",
@@ -135,6 +137,7 @@ Gem::Specification.new do |s|
135
137
  "spec/dragonfly/analysis/file_command_analyser_spec.rb",
136
138
  "spec/dragonfly/app_spec.rb",
137
139
  "spec/dragonfly/configurable_spec.rb",
140
+ "spec/dragonfly/cookie_monster_spec.rb",
138
141
  "spec/dragonfly/core_ext/array_spec.rb",
139
142
  "spec/dragonfly/core_ext/hash_spec.rb",
140
143
  "spec/dragonfly/core_ext/string_spec.rb",
@@ -192,6 +195,7 @@ Gem::Specification.new do |s|
192
195
  "spec/dragonfly/analysis/file_command_analyser_spec.rb",
193
196
  "spec/dragonfly/app_spec.rb",
194
197
  "spec/dragonfly/configurable_spec.rb",
198
+ "spec/dragonfly/cookie_monster_spec.rb",
195
199
  "spec/dragonfly/core_ext/array_spec.rb",
196
200
  "spec/dragonfly/core_ext/hash_spec.rb",
197
201
  "spec/dragonfly/core_ext/string_spec.rb",
@@ -253,7 +257,6 @@ Gem::Specification.new do |s|
253
257
  s.add_development_dependency(%q<bluecloth>, [">= 0"])
254
258
  s.add_development_dependency(%q<bson_ext>, [">= 0"])
255
259
  s.add_development_dependency(%q<sqlite3-ruby>, [">= 0"])
256
- s.add_runtime_dependency(%q<rack>, [">= 0"])
257
260
  else
258
261
  s.add_dependency(%q<rack>, [">= 0"])
259
262
  s.add_dependency(%q<capybara>, [">= 0"])
@@ -273,7 +276,6 @@ Gem::Specification.new do |s|
273
276
  s.add_dependency(%q<bluecloth>, [">= 0"])
274
277
  s.add_dependency(%q<bson_ext>, [">= 0"])
275
278
  s.add_dependency(%q<sqlite3-ruby>, [">= 0"])
276
- s.add_dependency(%q<rack>, [">= 0"])
277
279
  end
278
280
  else
279
281
  s.add_dependency(%q<rack>, [">= 0"])
@@ -294,7 +296,6 @@ Gem::Specification.new do |s|
294
296
  s.add_dependency(%q<bluecloth>, [">= 0"])
295
297
  s.add_dependency(%q<bson_ext>, [">= 0"])
296
298
  s.add_dependency(%q<sqlite3-ruby>, [">= 0"])
297
- s.add_dependency(%q<rack>, [">= 0"])
298
299
  end
299
300
  end
300
301
 
@@ -17,7 +17,7 @@ where `:some_method` is added by the configured generators.
17
17
 
18
18
  ImageMagick Generator
19
19
  ---------------------
20
- See {file:Imagemagick}.
20
+ See {file:ImageMagick}.
21
21
 
22
22
  Custom Generators
23
23
  -----------------
data/extra_docs/Rails2.md CHANGED
@@ -1,7 +1,7 @@
1
1
  Using With Rails 2.3
2
2
  ====================
3
3
 
4
- **NOTE: RAILS 2.3 IS NOT SUPPORTED IN NEW VERSIONS OF DRAGONFLY SO PLEASE USE VERSION 0.8.4**
4
+ **NOTE: RAILS 2.3 IS NOT SUPPORTED IN NEW VERSIONS OF DRAGONFLY SO PLEASE USE VERSION 0.8.5**
5
5
 
6
6
  Setting up the quick way
7
7
  ------------------------
@@ -36,7 +36,7 @@ Gems
36
36
  ----
37
37
  environment.rb
38
38
 
39
- config.gem 'dragonfly', '0.8.4'
39
+ config.gem 'dragonfly', '0.8.5'
40
40
  config.gem 'rack-cache', :lib => 'rack/cache'
41
41
 
42
42
  Capistrano
data/extra_docs/Rails3.md CHANGED
@@ -33,7 +33,7 @@ application.rb:
33
33
  Gemfile
34
34
  -------
35
35
 
36
- gem 'dragonfly', '~>0.9.1'
36
+ gem 'dragonfly', '~>0.9.2'
37
37
  gem 'rack-cache', :require => 'rack/cache'
38
38
 
39
39
  Capistrano
@@ -0,0 +1,15 @@
1
+ module Dragonfly
2
+ class CookieMonster
3
+
4
+ def initialize(app)
5
+ @app = app
6
+ end
7
+
8
+ def call(env)
9
+ status, headers, body = @app.call(env)
10
+ headers.delete('Set-Cookie') if env['dragonfly.job']
11
+ [status, headers, body]
12
+ end
13
+
14
+ end
15
+ end
@@ -0,0 +1,10 @@
1
+ require 'dragonfly'
2
+ require 'rails'
3
+
4
+ module Dragonfly
5
+ class Railtie < ::Rails::Railtie
6
+ initializer "dragonfly.railtie.initializer" do |app|
7
+ app.middleware.insert 0, Dragonfly::CookieMonster
8
+ end
9
+ end
10
+ end
@@ -19,9 +19,11 @@ module Dragonfly
19
19
  [304, cache_headers, []]
20
20
  elsif request.head?
21
21
  job.apply
22
+ env['dragonfly.job'] = job
22
23
  [200, success_headers, []]
23
24
  elsif request.get?
24
25
  job.apply
26
+ env['dragonfly.job'] = job
25
27
  [200, success_headers, job.result]
26
28
  end
27
29
  rescue DataStorage::DataNotFound, DataStorage::BadUID => e
data/lib/dragonfly.rb CHANGED
@@ -36,6 +36,8 @@ require 'dragonfly/core_ext/symbol'
36
36
  require 'dragonfly/core_ext/array'
37
37
  require 'dragonfly/core_ext/hash'
38
38
 
39
+ Dragonfly::Railtie if defined?(::Rails) # Coz it will autoload
40
+
39
41
  module Dragonfly
40
42
  class << self
41
43
 
@@ -0,0 +1,27 @@
1
+ require 'spec_helper'
2
+ require 'rack'
3
+
4
+ describe Dragonfly::CookieMonster do
5
+
6
+ def app(extra_env={})
7
+ Rack::Builder.new do
8
+ use Dragonfly::CookieMonster
9
+ run proc{|env| env.merge!(extra_env); [200, {"Set-Cookie" => "blah", "Something" => "else"}, ["body here"]] }
10
+ end
11
+ end
12
+
13
+ it "should not delete the set-cookie header from the response if the response doesn't come from dragonfly" do
14
+ response = Rack::MockRequest.new(app).get('')
15
+ response.status.should == 200
16
+ response.body.should == "body here"
17
+ response.headers.should == {"Set-Cookie" => "blah", "Something" => "else"}
18
+ end
19
+
20
+ it "should delete the set-cookie header from the response if the response comes from dragonfly" do
21
+ response = Rack::MockRequest.new(app('dragonfly.job' => mock)).get('')
22
+ response.status.should == 200
23
+ response.body.should == "body here"
24
+ response.headers.should == {"Something" => "else"}
25
+ end
26
+
27
+ end
@@ -199,4 +199,31 @@ describe Dragonfly::JobEndpoint do
199
199
  end
200
200
  end
201
201
 
202
+ describe "setting the job in the env for communicating with other rack middlewares" do
203
+ before(:each) do
204
+ @app.generator.add(:test_data){ "TEST DATA" }
205
+ @job = @app.generate(:test_data)
206
+ @endpoint = Dragonfly::JobEndpoint.new(@job)
207
+ @middleware = Class.new do
208
+ def initialize(app)
209
+ @app = app
210
+ end
211
+
212
+ def call(env)
213
+ @app.call(env)
214
+ throw :result, env['dragonfly.job']
215
+ end
216
+ end
217
+ end
218
+ it "should add the job to env" do
219
+ middleware, endpoint = @middleware, @endpoint
220
+ app = Rack::Builder.new do
221
+ use middleware
222
+ run endpoint
223
+ end
224
+ result = catch(:result){ Rack::MockRequest.new(app).get('/') }
225
+ result.should == @job
226
+ end
227
+ end
228
+
202
229
  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.1
5
+ version: 0.9.2
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-05-11 00:00:00 +01:00
13
+ date: 2011-05-19 00:00:00 +01:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -211,17 +211,6 @@ dependencies:
211
211
  type: :development
212
212
  prerelease: false
213
213
  version_requirements: *id018
214
- - !ruby/object:Gem::Dependency
215
- name: rack
216
- requirement: &id019 !ruby/object:Gem::Requirement
217
- none: false
218
- requirements:
219
- - - ">="
220
- - !ruby/object:Gem::Version
221
- version: "0"
222
- type: :runtime
223
- prerelease: false
224
- version_requirements: *id019
225
214
  description: |-
226
215
  Dragonfly is a framework that enables on-the-fly processing for any content type.
227
216
  It is especially suited to image handling. Its uses range from image thumbnails to standard attachments to on-demand text generation.
@@ -301,6 +290,7 @@ files:
301
290
  - lib/dragonfly/config/image_magick.rb
302
291
  - lib/dragonfly/config/rails.rb
303
292
  - lib/dragonfly/configurable.rb
293
+ - lib/dragonfly/cookie_monster.rb
304
294
  - lib/dragonfly/core_ext/array.rb
305
295
  - lib/dragonfly/core_ext/hash.rb
306
296
  - lib/dragonfly/core_ext/object.rb
@@ -333,6 +323,7 @@ files:
333
323
  - lib/dragonfly/processing/image_magick_processor.rb
334
324
  - lib/dragonfly/processor.rb
335
325
  - lib/dragonfly/rails/images.rb
326
+ - lib/dragonfly/railtie.rb
336
327
  - lib/dragonfly/response.rb
337
328
  - lib/dragonfly/routed_endpoint.rb
338
329
  - lib/dragonfly/serializer.rb
@@ -351,6 +342,7 @@ files:
351
342
  - spec/dragonfly/analysis/file_command_analyser_spec.rb
352
343
  - spec/dragonfly/app_spec.rb
353
344
  - spec/dragonfly/configurable_spec.rb
345
+ - spec/dragonfly/cookie_monster_spec.rb
354
346
  - spec/dragonfly/core_ext/array_spec.rb
355
347
  - spec/dragonfly/core_ext/hash_spec.rb
356
348
  - spec/dragonfly/core_ext/string_spec.rb
@@ -409,7 +401,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
409
401
  requirements:
410
402
  - - ">="
411
403
  - !ruby/object:Gem::Version
412
- hash: 3227660044973148793
404
+ hash: 3194904429017796395
413
405
  segments:
414
406
  - 0
415
407
  version: "0"
@@ -433,6 +425,7 @@ test_files:
433
425
  - spec/dragonfly/analysis/file_command_analyser_spec.rb
434
426
  - spec/dragonfly/app_spec.rb
435
427
  - spec/dragonfly/configurable_spec.rb
428
+ - spec/dragonfly/cookie_monster_spec.rb
436
429
  - spec/dragonfly/core_ext/array_spec.rb
437
430
  - spec/dragonfly/core_ext/hash_spec.rb
438
431
  - spec/dragonfly/core_ext/string_spec.rb