dragonfly 0.9.5 → 0.9.8

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.

Files changed (39) hide show
  1. data/Gemfile +1 -2
  2. data/History.md +29 -0
  3. data/README.md +1 -1
  4. data/VERSION +1 -1
  5. data/dragonfly.gemspec +15 -14
  6. data/extra_docs/DataStorage.md +5 -2
  7. data/extra_docs/Rails3.md +6 -4
  8. data/features/steps/rails_steps.rb +18 -6
  9. data/features/support/setup.rb +10 -1
  10. data/fixtures/rails/files/features/step_definitions/image_steps.rb +1 -1
  11. data/lib/dragonfly.rb +4 -0
  12. data/lib/dragonfly/analysis/file_command_analyser.rb +2 -1
  13. data/lib/dragonfly/data_storage/couch_data_store.rb +1 -1
  14. data/lib/dragonfly/data_storage/mongo_data_store.rb +4 -2
  15. data/lib/dragonfly/data_storage/s3data_store.rb +5 -1
  16. data/lib/dragonfly/image_magick/generator.rb +2 -2
  17. data/lib/dragonfly/image_magick/processor.rb +2 -2
  18. data/lib/dragonfly/image_magick/utils.rb +3 -25
  19. data/lib/dragonfly/rails/images.rb +17 -12
  20. data/lib/dragonfly/railtie.rb +1 -1
  21. data/lib/dragonfly/shell.rb +44 -0
  22. data/lib/dragonfly/temp_object.rb +13 -6
  23. data/spec/dragonfly/analysis/file_command_analyser_spec.rb +1 -0
  24. data/spec/dragonfly/cookie_monster_spec.rb +4 -2
  25. data/spec/dragonfly/data_storage/file_data_store_spec.rb +1 -1
  26. data/spec/dragonfly/data_storage/mongo_data_store_spec.rb +23 -8
  27. data/spec/dragonfly/image_magick/generator_spec.rb +0 -5
  28. data/spec/dragonfly/job_spec.rb +5 -1
  29. data/spec/dragonfly/shell_spec.rb +34 -0
  30. data/spec/dragonfly/temp_object_spec.rb +44 -12
  31. data/spec/functional/image_magick_app_spec.rb +1 -1
  32. data/spec/functional/remote_on_the_fly_spec.rb +6 -6
  33. data/spec/functional/shell_commands_spec.rb +23 -0
  34. data/spec/functional/to_response_spec.rb +1 -1
  35. data/spec/spec_helper.rb +6 -3
  36. data/spec/support/image_matchers.rb +1 -0
  37. data/tmp/.gitignore +2 -0
  38. metadata +71 -85
  39. data/spec/dragonfly/image_magick/utils_spec.rb +0 -18
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+
3
+ describe "a configured imagemagick app" do
4
+
5
+ before(:each) do
6
+ @app = test_app.configure_with(:imagemagick)
7
+ end
8
+
9
+ describe "shell injection" do
10
+
11
+ it "should not allow it!" do
12
+ begin
13
+ suppressing_stderr do
14
+ @app.generate(:plain, 10, 10, 'white').convert("-resize 5x5 ; touch tmp/stuff").apply
15
+ end
16
+ rescue Dragonfly::FunctionManager::UnableToHandle
17
+ end
18
+ File.exist?('tmp/stuff').should be_false
19
+ end
20
+
21
+ end
22
+
23
+ end
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
  describe "getting rack response directly" do
4
4
 
5
5
  before(:each) do
6
- @app = Dragonfly[:to_response].configure do |c|
6
+ @app = test_app.configure do |c|
7
7
  c.generator.add :test do
8
8
  "bunheads"
9
9
  end
data/spec/spec_helper.rb CHANGED
@@ -20,7 +20,7 @@ def todo
20
20
  end
21
21
 
22
22
  require 'logger'
23
- LOG_FILE = File.dirname(__FILE__) + '/spec.log' unless defined?(LOG_FILE)
23
+ LOG_FILE = 'tmp/test.log' unless defined?(LOG_FILE)
24
24
  FileUtils.rm_rf(LOG_FILE)
25
25
  def mock_app(extra_stubs={})
26
26
  mock('app', {
@@ -37,13 +37,16 @@ def mock_app(extra_stubs={})
37
37
  end
38
38
 
39
39
  def test_app
40
- Dragonfly::App.send(:new)
40
+ app = Dragonfly::App.send(:new)
41
+ app.log = Logger.new(LOG_FILE)
42
+ app.datastore.root_path = 'tmp/file_data_store_test'
43
+ app
41
44
  end
42
45
 
43
46
  def suppressing_stderr
44
47
  original_stderr = $stderr.dup
45
48
  tempfile = Tempfile.new('stderr')
46
- $stderr.reopen(tempfile)
49
+ $stderr.reopen(tempfile) rescue
47
50
  yield
48
51
  ensure
49
52
  tempfile.close!
@@ -3,6 +3,7 @@ def image_properties(image)
3
3
  tempfile = image
4
4
  else
5
5
  tempfile = Tempfile.new('image')
6
+ tempfile.binmode
6
7
  tempfile.write(image.is_a?(Dragonfly::TempObject) ? image.data : image)
7
8
  tempfile.close
8
9
  end
data/tmp/.gitignore ADDED
@@ -0,0 +1,2 @@
1
+ *
2
+ !.gitignore
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dragonfly
3
3
  version: !ruby/object:Gem::Version
4
- hash: 49
4
+ hash: 43
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 5
10
- version: 0.9.5
9
+ - 8
10
+ version: 0.9.8
11
11
  platform: ruby
12
12
  authors:
13
13
  - Mark Evans
@@ -15,10 +15,10 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-08-02 00:00:00 +01:00
19
- default_executable:
18
+ date: 2011-09-08 00:00:00 Z
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
21
+ type: :runtime
22
22
  requirement: &id001 !ruby/object:Gem::Requirement
23
23
  none: false
24
24
  requirements:
@@ -28,11 +28,11 @@ dependencies:
28
28
  segments:
29
29
  - 0
30
30
  version: "0"
31
- prerelease: false
32
- name: rack
33
- type: :runtime
34
31
  version_requirements: *id001
32
+ name: rack
33
+ prerelease: false
35
34
  - !ruby/object:Gem::Dependency
35
+ type: :development
36
36
  requirement: &id002 !ruby/object:Gem::Requirement
37
37
  none: false
38
38
  requirements:
@@ -42,11 +42,11 @@ dependencies:
42
42
  segments:
43
43
  - 0
44
44
  version: "0"
45
- prerelease: false
46
- name: capybara
47
- type: :development
48
45
  version_requirements: *id002
46
+ name: capybara
47
+ prerelease: false
49
48
  - !ruby/object:Gem::Dependency
49
+ type: :development
50
50
  requirement: &id003 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
@@ -58,11 +58,11 @@ dependencies:
58
58
  - 10
59
59
  - 0
60
60
  version: 0.10.0
61
- prerelease: false
62
- name: cucumber
63
- type: :development
64
61
  version_requirements: *id003
62
+ name: cucumber
63
+ prerelease: false
65
64
  - !ruby/object:Gem::Dependency
65
+ type: :development
66
66
  requirement: &id004 !ruby/object:Gem::Requirement
67
67
  none: false
68
68
  requirements:
@@ -74,11 +74,11 @@ dependencies:
74
74
  - 5
75
75
  - 2
76
76
  version: 0.5.2
77
- prerelease: false
78
- name: cucumber-rails
79
- type: :development
80
77
  version_requirements: *id004
78
+ name: cucumber-rails
79
+ prerelease: false
81
80
  - !ruby/object:Gem::Dependency
81
+ type: :development
82
82
  requirement: &id005 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
@@ -88,11 +88,11 @@ dependencies:
88
88
  segments:
89
89
  - 0
90
90
  version: "0"
91
- prerelease: false
92
- name: database_cleaner
93
- type: :development
94
91
  version_requirements: *id005
92
+ name: database_cleaner
93
+ prerelease: false
95
94
  - !ruby/object:Gem::Dependency
95
+ type: :development
96
96
  requirement: &id006 !ruby/object:Gem::Requirement
97
97
  none: false
98
98
  requirements:
@@ -104,11 +104,11 @@ dependencies:
104
104
  - 5
105
105
  - 2
106
106
  version: 1.5.2
107
- prerelease: false
108
- name: jeweler
109
- type: :development
110
107
  version_requirements: *id006
108
+ name: jeweler
109
+ prerelease: false
111
110
  - !ruby/object:Gem::Dependency
111
+ type: :development
112
112
  requirement: &id007 !ruby/object:Gem::Requirement
113
113
  none: false
114
114
  requirements:
@@ -118,11 +118,11 @@ dependencies:
118
118
  segments:
119
119
  - 0
120
120
  version: "0"
121
- prerelease: false
122
- name: fog
123
- type: :development
124
121
  version_requirements: *id007
122
+ name: fog
123
+ prerelease: false
125
124
  - !ruby/object:Gem::Dependency
125
+ type: :development
126
126
  requirement: &id008 !ruby/object:Gem::Requirement
127
127
  none: false
128
128
  requirements:
@@ -132,11 +132,11 @@ dependencies:
132
132
  segments:
133
133
  - 0
134
134
  version: "0"
135
- prerelease: false
136
- name: mongo
137
- type: :development
138
135
  version_requirements: *id008
136
+ name: mongo
137
+ prerelease: false
139
138
  - !ruby/object:Gem::Dependency
139
+ type: :development
140
140
  requirement: &id009 !ruby/object:Gem::Requirement
141
141
  none: false
142
142
  requirements:
@@ -147,11 +147,11 @@ dependencies:
147
147
  - 1
148
148
  - 0
149
149
  version: "1.0"
150
- prerelease: false
151
- name: couchrest
152
- type: :development
153
150
  version_requirements: *id009
151
+ name: couchrest
152
+ prerelease: false
154
153
  - !ruby/object:Gem::Dependency
154
+ type: :development
155
155
  requirement: &id010 !ruby/object:Gem::Requirement
156
156
  none: false
157
157
  requirements:
@@ -161,44 +161,28 @@ dependencies:
161
161
  segments:
162
162
  - 0
163
163
  version: "0"
164
- prerelease: false
165
- name: rack-cache
166
- type: :development
167
164
  version_requirements: *id010
165
+ name: rack-cache
166
+ prerelease: false
168
167
  - !ruby/object:Gem::Dependency
168
+ type: :development
169
169
  requirement: &id011 !ruby/object:Gem::Requirement
170
170
  none: false
171
171
  requirements:
172
- - - "="
172
+ - - ~>
173
173
  - !ruby/object:Gem::Version
174
- hash: 21
174
+ hash: 3
175
175
  segments:
176
176
  - 3
177
+ - 1
177
178
  - 0
178
- - 9
179
- version: 3.0.9
180
- prerelease: false
181
- name: rails
182
- type: :development
179
+ version: 3.1.0
183
180
  version_requirements: *id011
184
- - !ruby/object:Gem::Dependency
185
- requirement: &id012 !ruby/object:Gem::Requirement
186
- none: false
187
- requirements:
188
- - - "="
189
- - !ruby/object:Gem::Version
190
- hash: 49
191
- segments:
192
- - 0
193
- - 8
194
- - 7
195
- version: 0.8.7
181
+ name: rails
196
182
  prerelease: false
197
- name: rake
198
- type: :development
199
- version_requirements: *id012
200
183
  - !ruby/object:Gem::Dependency
201
- requirement: &id013 !ruby/object:Gem::Requirement
184
+ type: :development
185
+ requirement: &id012 !ruby/object:Gem::Requirement
202
186
  none: false
203
187
  requirements:
204
188
  - - ~>
@@ -208,12 +192,12 @@ dependencies:
208
192
  - 2
209
193
  - 5
210
194
  version: "2.5"
211
- prerelease: false
195
+ version_requirements: *id012
212
196
  name: rspec
213
- type: :development
214
- version_requirements: *id013
197
+ prerelease: false
215
198
  - !ruby/object:Gem::Dependency
216
- requirement: &id014 !ruby/object:Gem::Requirement
199
+ type: :development
200
+ requirement: &id013 !ruby/object:Gem::Requirement
217
201
  none: false
218
202
  requirements:
219
203
  - - ">="
@@ -222,12 +206,12 @@ dependencies:
222
206
  segments:
223
207
  - 0
224
208
  version: "0"
225
- prerelease: false
209
+ version_requirements: *id013
226
210
  name: webmock
227
- type: :development
228
- version_requirements: *id014
211
+ prerelease: false
229
212
  - !ruby/object:Gem::Dependency
230
- requirement: &id015 !ruby/object:Gem::Requirement
213
+ type: :development
214
+ requirement: &id014 !ruby/object:Gem::Requirement
231
215
  none: false
232
216
  requirements:
233
217
  - - ">="
@@ -236,12 +220,12 @@ dependencies:
236
220
  segments:
237
221
  - 0
238
222
  version: "0"
239
- prerelease: false
223
+ version_requirements: *id014
240
224
  name: yard
241
- type: :development
242
- version_requirements: *id015
225
+ prerelease: false
243
226
  - !ruby/object:Gem::Dependency
244
- requirement: &id016 !ruby/object:Gem::Requirement
227
+ type: :development
228
+ requirement: &id015 !ruby/object:Gem::Requirement
245
229
  none: false
246
230
  requirements:
247
231
  - - ">="
@@ -250,12 +234,12 @@ dependencies:
250
234
  segments:
251
235
  - 0
252
236
  version: "0"
253
- prerelease: false
237
+ version_requirements: *id015
254
238
  name: bluecloth
255
- type: :development
256
- version_requirements: *id016
239
+ prerelease: false
257
240
  - !ruby/object:Gem::Dependency
258
- requirement: &id017 !ruby/object:Gem::Requirement
241
+ type: :development
242
+ requirement: &id016 !ruby/object:Gem::Requirement
259
243
  none: false
260
244
  requirements:
261
245
  - - ">="
@@ -264,12 +248,12 @@ dependencies:
264
248
  segments:
265
249
  - 0
266
250
  version: "0"
267
- prerelease: false
251
+ version_requirements: *id016
268
252
  name: bson_ext
269
- type: :development
270
- version_requirements: *id017
253
+ prerelease: false
271
254
  - !ruby/object:Gem::Dependency
272
- requirement: &id018 !ruby/object:Gem::Requirement
255
+ type: :development
256
+ requirement: &id017 !ruby/object:Gem::Requirement
273
257
  none: false
274
258
  requirements:
275
259
  - - ">="
@@ -278,10 +262,9 @@ dependencies:
278
262
  segments:
279
263
  - 0
280
264
  version: "0"
281
- prerelease: false
265
+ version_requirements: *id017
282
266
  name: sqlite3-ruby
283
- type: :development
284
- version_requirements: *id018
267
+ prerelease: false
285
268
  description: |-
286
269
  Dragonfly is a framework that enables on-the-fly processing for any content type.
287
270
  It is especially suited to image handling. Its uses range from image thumbnails to standard attachments to on-demand text generation.
@@ -399,6 +382,7 @@ files:
399
382
  - lib/dragonfly/routed_endpoint.rb
400
383
  - lib/dragonfly/serializer.rb
401
384
  - lib/dragonfly/server.rb
385
+ - lib/dragonfly/shell.rb
402
386
  - lib/dragonfly/simple_cache.rb
403
387
  - lib/dragonfly/temp_object.rb
404
388
  - lib/dragonfly/url_mapper.rb
@@ -430,7 +414,6 @@ files:
430
414
  - spec/dragonfly/image_magick/encoder_spec.rb
431
415
  - spec/dragonfly/image_magick/generator_spec.rb
432
416
  - spec/dragonfly/image_magick/processor_spec.rb
433
- - spec/dragonfly/image_magick/utils_spec.rb
434
417
  - spec/dragonfly/job_builder_spec.rb
435
418
  - spec/dragonfly/job_definitions_spec.rb
436
419
  - spec/dragonfly/job_endpoint_spec.rb
@@ -440,6 +423,7 @@ files:
440
423
  - spec/dragonfly/routed_endpoint_spec.rb
441
424
  - spec/dragonfly/serializer_spec.rb
442
425
  - spec/dragonfly/server_spec.rb
426
+ - spec/dragonfly/shell_spec.rb
443
427
  - spec/dragonfly/simple_cache_spec.rb
444
428
  - spec/dragonfly/temp_object_spec.rb
445
429
  - spec/dragonfly/url_mapper_spec.rb
@@ -447,19 +431,20 @@ files:
447
431
  - spec/functional/image_magick_app_spec.rb
448
432
  - spec/functional/model_urls_spec.rb
449
433
  - spec/functional/remote_on_the_fly_spec.rb
434
+ - spec/functional/shell_commands_spec.rb
450
435
  - spec/functional/to_response_spec.rb
451
436
  - spec/spec_helper.rb
452
437
  - spec/support/argument_matchers.rb
453
438
  - spec/support/image_matchers.rb
454
439
  - spec/support/simple_matchers.rb
455
440
  - spec/test_imagemagick.ru
441
+ - tmp/.gitignore
456
442
  - yard/handlers/configurable_attr_handler.rb
457
443
  - yard/setup.rb
458
444
  - yard/templates/default/fulldoc/html/css/common.css
459
445
  - yard/templates/default/layout/html/layout.erb
460
446
  - yard/templates/default/module/html/configuration_summary.erb
461
447
  - yard/templates/default/module/setup.rb
462
- has_rdoc: true
463
448
  homepage: http://github.com/markevans/dragonfly
464
449
  licenses:
465
450
  - MIT
@@ -489,7 +474,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
489
474
  requirements: []
490
475
 
491
476
  rubyforge_project:
492
- rubygems_version: 1.5.2
477
+ rubygems_version: 1.8.6
493
478
  signing_key:
494
479
  specification_version: 3
495
480
  summary: Ideal gem for handling attachments in Rails, Sinatra and Rack applications.
@@ -516,7 +501,6 @@ test_files:
516
501
  - spec/dragonfly/image_magick/encoder_spec.rb
517
502
  - spec/dragonfly/image_magick/generator_spec.rb
518
503
  - spec/dragonfly/image_magick/processor_spec.rb
519
- - spec/dragonfly/image_magick/utils_spec.rb
520
504
  - spec/dragonfly/job_builder_spec.rb
521
505
  - spec/dragonfly/job_definitions_spec.rb
522
506
  - spec/dragonfly/job_endpoint_spec.rb
@@ -526,6 +510,7 @@ test_files:
526
510
  - spec/dragonfly/routed_endpoint_spec.rb
527
511
  - spec/dragonfly/serializer_spec.rb
528
512
  - spec/dragonfly/server_spec.rb
513
+ - spec/dragonfly/shell_spec.rb
529
514
  - spec/dragonfly/simple_cache_spec.rb
530
515
  - spec/dragonfly/temp_object_spec.rb
531
516
  - spec/dragonfly/url_mapper_spec.rb
@@ -533,6 +518,7 @@ test_files:
533
518
  - spec/functional/image_magick_app_spec.rb
534
519
  - spec/functional/model_urls_spec.rb
535
520
  - spec/functional/remote_on_the_fly_spec.rb
521
+ - spec/functional/shell_commands_spec.rb
536
522
  - spec/functional/to_response_spec.rb
537
523
  - spec/spec_helper.rb
538
524
  - spec/support/argument_matchers.rb