dragonfly 1.2.1 → 1.3.0

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.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4de8c2fdfcbd31e9e81550bda591c3a72f33a33dad988a176bea232c38768029
4
- data.tar.gz: c3ed8cf808992154674c1abc4902502a34281ae18c759de4e351610f29aed775
3
+ metadata.gz: 5385c46218c68349adc9f33a89600ed52901b483fc4b8b7ad3bab0ea1e3aa579
4
+ data.tar.gz: bd4341674548d3526d786be990912b527745000b6d887148e91bfe88e7a9618c
5
5
  SHA512:
6
- metadata.gz: 69007250136c7d8aba75e0f32244a30fe7cc7aeb351a36a4515dc94ec53baff8084d950137e293623170b7310f41b6b1849375bc9d7ab062a017f595fca9d395
7
- data.tar.gz: 5fe9075b447c6c9013542742282c1e529f3143fc288ece1afd05139ffb17f95da9fd2af982b11f7a989c8faf85c738915dc1de0b7f110c31d188107a2b87e3d6
6
+ metadata.gz: 28b284e2ca3d15914787357c2035f900a2c0c61c5fdc0b36302b2bcd24b01683b073774b70a9583ef446ba764dbb7019e3e92eab8cd83b042d428236498ccaf4
7
+ data.tar.gz: 2fc17f0f4587fe85ccf6af91798a0a89aa58086a9518445d2684abcffd16ab9d53c10fdea2e7f0a5cb2f07a24774b3865b80e7ddd293f5a53bfea4f04b0b24bd
@@ -1,8 +1,5 @@
1
1
  language: ruby
2
2
  rvm:
3
- - "1.9.3"
4
- - "2.0"
5
- - "2.1"
6
3
  - "2.2"
7
4
  - "2.3"
8
5
  - "2.4"
data/History.md CHANGED
@@ -1,69 +1,66 @@
1
+ # 1.3.0 (2021-01-09)
2
+
3
+ ## Changes
4
+
5
+ - Dropped official support for ruby < 2.2 - too annoying to maintain
6
+
7
+ ## Fixes
8
+
9
+ - Fixed losing attachment when transaction rolled back on destroy (dlibanori)
10
+ - Fixed fetch_url edge case when redirect url includes special chars (thedanbob)
11
+
1
12
  # 1.2.1 (2020-07-24)
2
13
 
3
14
  ## Features
4
15
 
5
16
  - Allow having no logger (setting to `nil`) (kaimou1357)
6
- Fixes
7
17
 
8
- ---
18
+ ## Fixes
9
19
 
10
20
  - Fix URI.unescape deprecation warning (alberto-mota)
11
21
 
12
- # 1.2.0 (2018-11-13)
13
-
14
- Fixes
22
+ # 1.2.0 (2018-11-13)
15
23
 
16
- ---
24
+ ## Fixes
17
25
 
18
26
  - Replaced `quote` with `escape` for escaping shell commands - works with paths with apostrophes
19
- Changes
20
27
 
21
- ---
28
+ ## Changes
22
29
 
23
30
  - Replaced Open3.popen3 with now recommended Open3.capture3 (tomasc)
24
31
 
25
- # 1.1.5 (2018-03-23)
26
-
27
- Fixes
32
+ # 1.1.5 (2018-03-23)
28
33
 
29
- ---
34
+ ## Fixes
30
35
 
31
36
  - Moved `destroy_dragonfly_attachments` into an `after_destroy` - issue #477 (eldotz)
32
37
 
33
- # 1.1.4 (2017-12-31)
38
+ # 1.1.4 (2017-12-31)
34
39
 
35
- Fixes
36
-
37
- ---
40
+ ## Fixes
38
41
 
39
42
  - Fixed data uris not working for long strings (reported dlibanori)
40
43
  - Removed syntax warnings (swamp09)
41
44
  - Correct ActiveRecord hook with `ActiveSupport.on_load` (efatsi)
42
45
 
43
- # 1.1.3 (2017-06-02)
44
-
45
- Fixes
46
+ # 1.1.3 (2017-06-02)
46
47
 
47
- ---
48
+ ## Fixes
48
49
 
49
50
  - Make sure imagemagick convert processor updates mime_type correctly when format is changed
50
51
 
51
- # 1.1.2 (2017-05-06)
52
-
53
- Fixes
52
+ # 1.1.2 (2017-05-06)
54
53
 
55
- ---
54
+ ## Fixes
56
55
 
57
56
  - Allow relative redirect urls in `fetch_url` (zorec)
58
57
  - Fixed Forwardable deprecation warnings (neodude)
59
58
  - Fixed incorrect detection of empty directories in ruby 2.4 (yuszuv)
60
59
  - Store content type in meta if it's available so we don't lose information (Lukas Svoboda)
61
60
 
62
- # 1.1.1 (2016-10-26)
61
+ # 1.1.1 (2016-10-26)
63
62
 
64
- Features
65
-
66
- ---
63
+ ## Features
67
64
 
68
65
  - Added delegate option for imagemagick (Will Fisher)
69
66
 
@@ -87,67 +84,52 @@
87
84
 
88
85
  - Dropped official support for Ruby &lt;= 1.9.2 and Rubinius
89
86
 
90
- # 1.0.12 (2015-09-16)
91
-
92
- Features
87
+ # 1.0.12 (2015-09-16)
93
88
 
94
- ---
89
+ ## Features
95
90
 
96
91
  - Made thumb processor args for a specific geometry publicly accesible
97
92
 
98
- # 1.0.11 (2015-09-04)
99
-
100
- Fixes
93
+ # 1.0.11 (2015-09-04)
101
94
 
102
- ---
95
+ ## Fixes
103
96
 
104
97
  - Make sure tempfiles are created with paths matching the meta name
105
98
 
106
- # 1.0.10 (2015-05-14)
99
+ # 1.0.10 (2015-05-14)
107
100
 
108
- Features
109
-
110
- ---
101
+ ## Features
111
102
 
112
103
  - Allow method signified by symbol in storage_options to take an attachment object
113
104
  - Allow passing in "input_args" to convert processor
114
- Fixes
115
105
 
116
- ---
106
+ ## Fixes
117
107
 
118
108
  - correct Rack version
119
109
 
120
- # 1.0.9 (2015-04-29)
110
+ # 1.0.9 (2015-04-29)
121
111
 
122
- Fixes
123
-
124
- ---
112
+ ## Fixes
125
113
 
126
114
  - Remove sha parameter being echoed back on error for better security
127
115
 
128
- # 1.0.8 (2015-04-23)
129
-
130
- Fixes
116
+ # 1.0.8 (2015-04-23)
131
117
 
132
- ---
118
+ ## Fixes
133
119
 
134
120
  - Job#close re-added, so that tempfiles are immediately removed after each request
135
121
  - Specs passing for 1.8.7, 1.9.2 (i18n gem version specified)
136
122
 
137
- # 1.0.7 (2014-08-26)
138
-
139
- Changes
123
+ # 1.0.7 (2014-08-26)
140
124
 
141
- ---
125
+ ## Changes
142
126
 
143
127
  - Job#sha uses better algorithm
144
128
  - renamed `protect_from_dos_attacks` -> `verify_urls` and turn on by default
145
129
 
146
- # 1.0.6 (2014-08-22)
130
+ # 1.0.6 (2014-08-22)
147
131
 
148
- Features
149
-
150
- ---
132
+ ## Features
151
133
 
152
134
  - env can be accessed by routed endpoint blocks
153
135
 
@@ -157,44 +139,34 @@
157
139
  - removed default secret, forcing user to specify one explicitly
158
140
  - deal with "[" character problems in urls https://github.com/markevans/dragonfly/pull/337
159
141
 
160
- # 1.0.5 (2014-05-15)
161
-
162
- Fixes
142
+ # 1.0.5 (2014-05-15)
163
143
 
164
- ---
144
+ ## Fixes
165
145
 
166
146
  - fetch_url wasn't correctly getting https endpoints on Ruby approx < 2
167
147
 
168
- # 1.0.4 (2014-04-11)
169
-
170
- Fixes
148
+ # 1.0.4 (2014-04-11)
171
149
 
172
- ---
150
+ ## Fixes
173
151
 
174
152
  - fetch_url is more forgiving - assume escaped, if not escape
175
153
 
176
- # 1.0.3 (2014-01-28)
154
+ # 1.0.3 (2014-01-28)
177
155
 
178
- Fixes
179
-
180
- ---
156
+ ## Fixes
181
157
 
182
158
  - changing meta on a job (e.g. `fetch('blah').encode('jpg')`) was interfering with meta on its parent job (e.g. `fetch('blah')`)
183
159
 
184
- # 1.0.2 (2013-12-20)
185
-
186
- Fixes
160
+ # 1.0.2 (2013-12-20)
187
161
 
188
- ---
162
+ ## Fixes
189
163
 
190
164
  - more secure generation of secret in rails generator
191
165
  - ensure popen3 doesn't hang
192
166
 
193
- # 1.0.1 (2013-11-28)
194
-
195
- Changes
167
+ # 1.0.1 (2013-11-28)
196
168
 
197
- ---
169
+ ## Changes
198
170
 
199
171
  - FileDataStore doesn't use hours_minutes_seconds in its path - it uses a random string instead (12_15_59_saf4fs_file.png -> sdf4c2G_file.png)
200
172
 
@@ -209,11 +181,9 @@
209
181
  - default Content-Disposition header doesn't url-encode filename unless the request is from IE
210
182
  - `fetch_url` deals with urls that redirect to https (previously was blowing up)
211
183
 
212
- # 1.0.0 (2013-11-24)
184
+ # 1.0.0 (2013-11-24)
213
185
 
214
- Changes
215
-
216
- ---
186
+ ## Changes
217
187
 
218
188
  - configuration
219
189
  - `Dragonfly[:images]` -> `Dragonfly.app` and `Dragonfly.app(:named_app)`
@@ -261,11 +231,9 @@
261
231
  - shell commands don't print warnings to stderr
262
232
  - ability to assign attachment/job from other app
263
233
 
264
- # 0.9.15 (2013-05-04)
265
-
266
- Features
234
+ # 0.9.15 (2013-05-04)
267
235
 
268
- ---
236
+ ## Features
269
237
 
270
238
  - Allow turning off support of legacy urls
271
239
 
@@ -274,11 +242,9 @@
274
242
  - More conservative URL escaping - back to Rack::Utils.escape_path
275
243
  - Don't check for malicious strings when deserializing from datastores (they're to be trusted)
276
244
 
277
- # 0.9.14 (2013-02-13)
278
-
279
- Features
245
+ # 0.9.14 (2013-02-13)
280
246
 
281
- ---
247
+ ## Features
282
248
 
283
249
  - Attachment#b64_data
284
250
 
@@ -288,19 +254,15 @@
288
254
  - Support old-style deprecated urls (with a check for malicious ones)
289
255
  - Handle case where uid is an empty string
290
256
 
291
- # 0.9.13 (2013-01-30)
292
-
293
- Changes
257
+ # 0.9.13 (2013-01-30)
294
258
 
295
- ---
259
+ ## Changes
296
260
 
297
261
  - URLS are encoded/decoded with JSON, not with Marshal
298
262
 
299
- # 0.9.12 (2012-04-08)
300
-
301
- Features
263
+ # 0.9.12 (2012-04-08)
302
264
 
303
- ---
265
+ ## Features
304
266
 
305
267
  - Allow using a mongo replica set with mongo datastore
306
268
 
@@ -308,11 +270,9 @@
308
270
 
309
271
  - `define_macro_on_include` was giving a stack error with multiple accessors on same app
310
272
 
311
- # 0.9.11 (2012-03-12)
273
+ # 0.9.11 (2012-03-12)
312
274
 
313
- Features
314
-
315
- ---
275
+ ## Features
316
276
 
317
277
  - Allow the S3 base URL to be customised with `url_host` (or per-request)
318
278
  - Added App#name (name as per `Dragonfly[:app_name]`)
@@ -329,19 +289,15 @@
329
289
  - Use fog's `sync_clock` to overcome potential S3 time skew problems
330
290
  - Using :name in urls was causing problems when filenames had dashes in them
331
291
 
332
- # 0.9.10 (2012-01-11)
333
-
334
- Fixes
292
+ # 0.9.10 (2012-01-11)
335
293
 
336
- ---
294
+ ## Fixes
337
295
 
338
296
  - FileDataStore was causing errors when the storage path was flat (not in a directory structure)
339
297
 
340
- # 0.9.9 (2011-12-30)
341
-
342
- Features
298
+ # 0.9.9 (2011-12-30)
343
299
 
344
- ---
300
+ ## Features
345
301
 
346
302
  - Created tempfiles use the original file extension if known
347
303
  - Added `:case_sensitive` option to `validates_property` for dealing with upper-case extensions and mime-types.
@@ -371,27 +327,21 @@
371
327
  - S3DataStore was breaking on bucket_exists? when using AWS IAM
372
328
  - Put CookieMonster before ActionDispatch::Cookies in rack middleware stack - that way Rack::Cache won't come between them and mess things up
373
329
 
374
- # 0.9.8 (2011-09-08)
330
+ # 0.9.8 (2011-09-08)
375
331
 
376
- Fixes
377
-
378
- ---
332
+ ## Fixes
379
333
 
380
334
  - Regenerated gemspec again with ruby 1.8.7 - didn't seem to be fixed
381
335
 
382
- # 0.9.7 (2011-09-08)
383
-
384
- Fixes
336
+ # 0.9.7 (2011-09-08)
385
337
 
386
- ---
338
+ ## Fixes
387
339
 
388
340
  - Regenerated gemspec to overcome annoying yaml issue (http://blog.rubygems.org/2011/08/31/shaving-the-yaml-yacc.html)
389
341
 
390
- # 0.9.6 (2011-09-06)
391
-
392
- Features
342
+ # 0.9.6 (2011-09-06)
393
343
 
394
- ---
344
+ ## Features
395
345
 
396
346
  - Allow setting `content_type` when storing in Mongo GridFS
397
347
 
@@ -406,11 +356,9 @@
406
356
  - Tests working in Windows (except feature that uses FileCommandAnalyser)
407
357
  - Better shell quoting
408
358
 
409
- # 0.9.5 (2011-07-27)
359
+ # 0.9.5 (2011-07-27)
410
360
 
411
- Features
412
-
413
- ---
361
+ ## Features
414
362
 
415
363
  - Added reflection method `app.analyser_methods`
416
364
 
@@ -419,30 +367,24 @@
419
367
  - Fixed `convert` and `identify` for files with spaces
420
368
  - Fixed size validations for Rails 3.0.7
421
369
 
422
- # 0.9.4 (2011-06-10)
423
-
424
- Fixes
370
+ # 0.9.4 (2011-06-10)
425
371
 
426
- ---
372
+ ## Fixes
427
373
 
428
374
  - Made use of Rack calling `close` on the response body to clean up tempfiles.
429
375
  The response body is now the job, which delegates `each` to the temp_object.
430
376
 
431
- # 0.9.3 (2011-06-03)
432
-
433
- Fixes
377
+ # 0.9.3 (2011-06-03)
434
378
 
435
- ---
379
+ ## Fixes
436
380
 
437
381
  - TempObject#to_file sets file permissions 644 - copying wasn't previously guaranteeing this
438
382
  - Added TempObject#close and closed?, which Rack uses to clean up tempfiles
439
383
  - replaced '/' characters with '~' in base64 encoded urls (they were confusing url recognition)
440
384
 
441
- # 0.9.2 (2011-05-19)
385
+ # 0.9.2 (2011-05-19)
442
386
 
443
- Features
444
-
445
- ---
387
+ ## Features
446
388
 
447
389
  - Added env['dragonfly.job'] for use in other Rack middlewares
448
390
  - Added CookieMonster middleware for removing 'Set-Cookie' headers
@@ -451,11 +393,9 @@
451
393
 
452
394
  - Remove 'Set-Cookie' header from any requests coming from a rails route
453
395
 
454
- # 0.9.1 (2011-05-11)
455
-
456
- Features
396
+ # 0.9.1 (2011-05-11)
457
397
 
458
- ---
398
+ ## Features
459
399
 
460
400
  - Added reflection methods `app.processor_methods`, `app.generator_methods` and `app.job_methods`
461
401
 
@@ -466,11 +406,9 @@
466
406
  - Deal with Excon::Errors::SocketError: EOFError errors which get thrown sometimes from S3 connection
467
407
  - Allow files with '..' (but not '../') in the middle of their name in file data store
468
408
 
469
- # 0.9.0 (2011-04-27)
470
-
471
- Features
409
+ # 0.9.0 (2011-04-27)
472
410
 
473
- ---
411
+ ## Features
474
412
 
475
413
  - Model accessors are configurable
476
414
  - added `after_assign` callback
@@ -519,39 +457,31 @@
519
457
 
520
458
  - Performance tweaks regarding temp_objects model accessors and job objects
521
459
 
522
- # 0.8.5 (2011-05-11)
460
+ # 0.8.5 (2011-05-11)
523
461
 
524
- Fixes
525
-
526
- ---
462
+ ## Fixes
527
463
 
528
464
  - Allow filenames that have '..' in them (but not '../') in the filedatastore
529
465
  - Better security for server
530
466
 
531
- # 0.8.4 (2011-04-27)
532
-
533
- Fixes
467
+ # 0.8.4 (2011-04-27)
534
468
 
535
- ---
469
+ ## Fixes
536
470
 
537
471
  - Security fix for file data store
538
472
 
539
- # 0.8.2 (2011-01-11)
540
-
541
- Fixes
473
+ # 0.8.2 (2011-01-11)
542
474
 
543
- ---
475
+ ## Fixes
544
476
 
545
477
  - Renamed ActiveModel methods like 'attachments' to avoid name clashes
546
478
  - Respond properly to HEAD, POST, PUT and DELETE requests
547
479
  - Got it working with jRuby and Rubinius
548
480
  - Made DOS protection SHA (and ETag) consistent
549
481
 
550
- # 0.8.1 (2010-11-22)
482
+ # 0.8.1 (2010-11-22)
551
483
 
552
- Fixes
553
-
554
- ---
484
+ ## Fixes
555
485
 
556
486
  Removed runtime dependencies that Jeweler automatically takes from the Gemfile
557
487
 
@@ -607,35 +537,27 @@ Removed runtime dependencies that Jeweler automatically takes from the Gemfile
607
537
  They can be configured to use in-memory strings with the use_filesystem config option.
608
538
  - Upgraded support from Rails 3.0.0.rc -> Rails.3.0.0
609
539
 
610
- # 0.7.4 (2010-08-28)
611
-
612
- Features
540
+ # 0.7.4 (2010-08-28)
613
541
 
614
- ---
542
+ ## Features
615
543
 
616
544
  - Gave model accessors bang methods process! and encode!
617
545
 
618
- # 0.7.3 (2010-08-27)
619
-
620
- Fixes
546
+ # 0.7.3 (2010-08-27)
621
547
 
622
- ---
548
+ ## Fixes
623
549
 
624
550
  - Seems as though inserting after Rails' Rack::Lock was worth it after all
625
551
 
626
- # 0.7.2 (2010-08-27)
552
+ # 0.7.2 (2010-08-27)
627
553
 
628
- Fixes
629
-
630
- ---
554
+ ## Fixes
631
555
 
632
556
  - S3DataStore was breaking if previous data hadn't stored meta
633
557
 
634
- # 0.7.1 (2010-08-26)
635
-
636
- Fixes
558
+ # 0.7.1 (2010-08-26)
637
559
 
638
- ---
560
+ ## Fixes
639
561
 
640
562
  - SimpleEndpoint was modifying env path_info so wasn't creating proper cache keys
641
563
  - to_response accepts env, so can use if-not-modified, etc.
@@ -648,7 +570,7 @@ Removed runtime dependencies that Jeweler automatically takes from the Gemfile
648
570
 
649
571
  - ETags generated by hash of job.serialize - was getting a bit long
650
572
 
651
- # 0.7.0 (2010-08-25)
573
+ # 0.7.0 (2010-08-25)
652
574
 
653
575
  ## Features
654
576
 
@@ -702,15 +624,13 @@ Removed runtime dependencies that Jeweler automatically takes from the Gemfile
702
624
 
703
625
  - Added ability for custom error messages in validations
704
626
 
705
- # 0.6.1 (2010-05-16)
706
-
707
- Fixes
627
+ # 0.6.1 (2010-05-16)
708
628
 
709
- ---
629
+ ## Fixes
710
630
 
711
631
  - STI was breaking when the model had a mixin too
712
632
 
713
- # 0.6.0 (2010-05-11)
633
+ # 0.6.0 (2010-05-11)
714
634
 
715
635
  ## Features
716
636
 
@@ -736,25 +656,25 @@ Removed runtime dependencies that Jeweler automatically takes from the Gemfile
736
656
  - Imagemagick errors in RMagick processor/analyser/encoder now throw unable_to_handle and log a warning
737
657
  - Removed Rails generators - better being more explicit with saved configurations which are more concise now
738
658
 
739
- # 0.5.7 (2010-04-18)
659
+ # 0.5.7 (2010-04-18)
740
660
 
741
661
  ## Fixes
742
662
 
743
663
  - Strip file command mime_type value because some versions of file command were appending a line-break
744
664
 
745
- # 0.5.6 (2010-04-13)
665
+ # 0.5.6 (2010-04-13)
746
666
 
747
667
  ## Fixes
748
668
 
749
669
  - Wasn't working properly with Single-Table Inheritance
750
670
 
751
- # 0.5.5 (2010-04-13)
671
+ # 0.5.5 (2010-04-13)
752
672
 
753
673
  ## Fixes
754
674
 
755
675
  - Rails 3 has changed 'metaclass' -> 'singleton_class' so adapt accordingly
756
676
 
757
- # 0.5.4 (2010-04-12)
677
+ # 0.5.4 (2010-04-12)
758
678
 
759
679
  ## Features
760
680
 
@@ -787,7 +707,7 @@ Removed runtime dependencies that Jeweler automatically takes from the Gemfile
787
707
 
788
708
  - Fixed 'broken pipe' errors in FileCommandAnalyser due to outputting loads of stuff to the command line stdin
789
709
 
790
- # 0.5.0 (2010-02-20)
710
+ # 0.5.0 (2010-02-20)
791
711
 
792
712
  ## Added support
793
713
 
data/README.md CHANGED
@@ -47,7 +47,7 @@ Installation
47
47
 
48
48
  or in your Gemfile
49
49
  ```ruby
50
- gem 'dragonfly', '~> 1.2.1'
50
+ gem 'dragonfly', '~> 1.2.2'
51
51
  ```
52
52
 
53
53
  Require with
@@ -1,40 +1,42 @@
1
- gem 'dragonfly', :path => File.expand_path('../..', __FILE__)
2
- generate "dragonfly"
3
- generate "scaffold", "photo image_uid:string image_name:string"
4
- rake "db:migrate"
5
- route %(
6
- get "text/:text" => Dragonfly.app.endpoint { |params, app|
7
- app.generate(:text, params[:text])
8
- }
9
- )
10
- route "root :to => 'photos#index'"
11
- run "rm -rf public/index.html"
1
+ after_bundle do
2
+ gem 'dragonfly', :path => File.expand_path('../..', __FILE__)
3
+ generate "dragonfly"
4
+ generate "scaffold", "photo image_uid:string image_name:string"
5
+ rake "db:migrate"
6
+ route %(
7
+ get "text/:text" => Dragonfly.app.endpoint { |params, app|
8
+ app.generate(:text, params[:text])
9
+ }
10
+ )
11
+ route "root :to => 'photos#index'"
12
+ run "rm -rf public/index.html"
12
13
 
13
- possible_base_classes = ['ActiveRecord::Base', 'ApplicationRecord']
14
- possible_base_classes.each do |base_class|
15
- inject_into_file 'app/models/photo.rb', :after => "class Photo < #{base_class}\n" do
16
- %(
17
- attr_accessible :image rescue nil
18
- dragonfly_accessor :image
19
- )
14
+ possible_base_classes = ['ActiveRecord::Base', 'ApplicationRecord']
15
+ possible_base_classes.each do |base_class|
16
+ inject_into_file 'app/models/photo.rb', :after => "class Photo < #{base_class}\n" do
17
+ %(
18
+ attr_accessible :image rescue nil
19
+ dragonfly_accessor :image
20
+ )
21
+ end
20
22
  end
21
- end
22
23
 
23
- gsub_file 'app/views/photos/_form.html.erb', /^.*:image_.*$/, ''
24
+ gsub_file 'app/views/photos/_form.html.erb', /^.*:image_.*$/, ''
24
25
 
25
- inject_into_file 'app/views/photos/_form.html.erb', :before => %(<div class="actions">\n) do
26
- %(
27
- <div class="field">
28
- <%= form.label :image %><br>
29
- <%= form.file_field :image %>
30
- </div>
26
+ inject_into_file 'app/views/photos/_form.html.erb', :before => %(<div class="actions">\n) do
27
+ %(
28
+ <div class="field">
29
+ <%= form.label :image %><br>
30
+ <%= form.file_field :image %>
31
+ </div>
31
32
 
32
- <%= image_tag @photo.image.thumb('100x100').url if @photo.image_stored? %>
33
- )
34
- end
33
+ <%= image_tag @photo.image.thumb('100x100').url if @photo.image_stored? %>
34
+ )
35
+ end
35
36
 
36
- gsub_file "app/controllers/photos_controller.rb", "permit(", "permit(:image, "
37
+ gsub_file "app/controllers/photos_controller.rb", "permit(", "permit(:image, "
37
38
 
38
- append_file 'app/views/photos/show.html.erb', %(
39
- <%= image_tag @photo.image.thumb('300x300').url if @photo.image_stored? %>
40
- )
39
+ append_file 'app/views/photos/show.html.erb', %(
40
+ <%= image_tag @photo.image.thumb('300x300').url if @photo.image_stored? %>
41
+ )
42
+ end
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
2
+ lib = File.expand_path("../lib", __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'dragonfly/version'
4
+ require "dragonfly/version"
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "dragonfly"
@@ -13,33 +13,27 @@ Gem::Specification.new do |spec|
13
13
  spec.homepage = "http://github.com/markevans/dragonfly"
14
14
  spec.license = "MIT"
15
15
  spec.files = `git ls-files`.split($/)
16
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
18
  spec.require_paths = ["lib"]
19
19
  spec.extra_rdoc_files = [
20
20
  "LICENSE",
21
- "README.md"
21
+ "README.md",
22
22
  ]
23
23
 
24
- # Rack 2.0 only works with ruby >= 2.2.2
25
- if RUBY_VERSION < "2.2.2"
26
- rack_version = "~> 1.3"
27
- activemodel_version = "~> 4.2"
28
- else
29
- rack_version = ">= 1.3"
30
- activemodel_version = nil
31
- end
32
-
33
24
  # Runtime dependencies
34
- spec.add_runtime_dependency("rack", rack_version)
25
+ spec.add_runtime_dependency("rack", ">= 1.3")
35
26
  spec.add_runtime_dependency("multi_json", "~> 1.0")
36
27
  spec.add_runtime_dependency("addressable", "~> 2.3")
37
28
 
38
29
  # Development dependencies
39
30
  spec.add_development_dependency("rspec", "~> 2.5")
40
31
  spec.add_development_dependency("webmock")
41
- spec.add_development_dependency("activemodel", activemodel_version)
32
+ spec.add_development_dependency("activemodel")
42
33
  if RUBY_PLATFORM == "java"
43
34
  spec.add_development_dependency("jruby-openssl")
35
+ else
36
+ spec.add_development_dependency("activerecord")
37
+ spec.add_development_dependency("sqlite3")
44
38
  end
45
39
  end
@@ -91,7 +91,7 @@ module Dragonfly
91
91
  end
92
92
 
93
93
  def parse_url(url)
94
- URI.parse(url)
94
+ URI.parse(url.to_s)
95
95
  rescue URI::InvalidURIError
96
96
  begin
97
97
  encoded_uri = Addressable::URI.parse(url).normalize.to_s
@@ -30,7 +30,12 @@ module Dragonfly
30
30
 
31
31
  # Add callbacks
32
32
  before_save :save_dragonfly_attachments if respond_to?(:before_save)
33
- after_destroy :destroy_dragonfly_attachments if respond_to?(:after_destroy)
33
+ case
34
+ when respond_to?(:after_commit)
35
+ after_commit :destroy_dragonfly_attachments, on: :destroy
36
+ when respond_to?(:after_destroy)
37
+ after_destroy :destroy_dragonfly_attachments
38
+ end
34
39
 
35
40
  # Register the new attribute
36
41
  dragonfly_attachment_classes << new_dragonfly_attachment_class(attribute, app, config_block)
@@ -1,3 +1,3 @@
1
1
  module Dragonfly
2
- VERSION = '1.2.1'
2
+ VERSION = "1.3.0"
3
3
  end
@@ -0,0 +1,62 @@
1
+ # jruby has problems with installing sqlite3 - don't bother with these tests for jruby
2
+ unless RUBY_PLATFORM == "java"
3
+ require "spec_helper"
4
+ require "active_record"
5
+ require "sqlite3"
6
+
7
+ # ActiveRecord specific stuff goes here (there should be very little!)
8
+ describe "ActiveRecord models" do
9
+ let! :dragonfly_app do test_app(:test_ar) end
10
+
11
+ before :all do
12
+ @connection = ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:")
13
+
14
+ ActiveRecord::Migration.verbose = false
15
+
16
+ ActiveRecord::Schema.define(:version => 1) do
17
+ create_table :photos do |t|
18
+ t.string :image_uid
19
+ end
20
+ end
21
+
22
+ class Photo < ActiveRecord::Base
23
+ extend Dragonfly::Model
24
+ dragonfly_accessor :image, app: :test_ar
25
+ end
26
+ end
27
+
28
+ after :all do
29
+ Photo.destroy_all
30
+ ActiveRecord::Base.remove_connection(@connection)
31
+ end
32
+
33
+ describe "destroying" do
34
+ before do
35
+ Photo.destroy_all
36
+ @photo = Photo.create(image: "some data")
37
+ end
38
+
39
+ def data_exists(uid)
40
+ !!dragonfly_app.datastore.read(uid)
41
+ end
42
+
43
+ it "should not remove the attachment if a transaction is cancelled" do
44
+ Photo.transaction do
45
+ @photo.destroy
46
+ raise ActiveRecord::Rollback
47
+ end
48
+ photo = Photo.last
49
+ expect(photo.image_uid).not_to be_nil
50
+ expect(data_exists(photo.image_uid)).to eq(true)
51
+ end
52
+
53
+ it "should remove the attachment as per usual otherwise" do
54
+ uid = @photo.image_uid
55
+ @photo.destroy
56
+ photo = Photo.last
57
+ expect(photo).to be_nil
58
+ expect(data_exists(uid)).to eq(false)
59
+ end
60
+ end
61
+ end
62
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dragonfly
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Evans
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-24 00:00:00.000000000 Z
11
+ date: 2021-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -94,6 +94,34 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: activerecord
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: sqlite3
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
97
125
  description: |-
98
126
  Dragonfly is a framework that enables on-the-fly processing for any content type.
99
127
  It is especially suited to image handling. Its uses range from image thumbnails to standard attachments to on-demand text generation.
@@ -208,6 +236,7 @@ files:
208
236
  - spec/dragonfly/job_spec.rb
209
237
  - spec/dragonfly/memory_data_store_spec.rb
210
238
  - spec/dragonfly/middleware_spec.rb
239
+ - spec/dragonfly/model/active_record_spec.rb
211
240
  - spec/dragonfly/model/model_spec.rb
212
241
  - spec/dragonfly/model/validations_spec.rb
213
242
  - spec/dragonfly/register_spec.rb
@@ -288,6 +317,7 @@ test_files:
288
317
  - spec/dragonfly/job_spec.rb
289
318
  - spec/dragonfly/memory_data_store_spec.rb
290
319
  - spec/dragonfly/middleware_spec.rb
320
+ - spec/dragonfly/model/active_record_spec.rb
291
321
  - spec/dragonfly/model/model_spec.rb
292
322
  - spec/dragonfly/model/validations_spec.rb
293
323
  - spec/dragonfly/register_spec.rb