dragonfly 1.0.7 → 1.0.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.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0c7ef9f7d15b8aa06c44ce7e52c5da69be5c43ee
4
- data.tar.gz: 9daf8a467a894251790c3f2a40ddfde9fcc36808
3
+ metadata.gz: a9dca04f47fde05feeb3cb2192ae1568e491194f
4
+ data.tar.gz: fe028ae883c750d8dc32dcb1feca6c1880dcb94e
5
5
  SHA512:
6
- metadata.gz: 3ba7140e8176f2bc9609343fe5b73be21c9e0a010dc91498faff2fe7b87622ca7f143cd26230884a162635669d968c02c2e309eaa8ccd19fdb2738ab98679cf5
7
- data.tar.gz: cdadf8324dae8dc6cf359bbb0fb106e859d418edd95a177844146a6edd11d8bd8affa48432de8116aca2eb8b738dae615874f8c7b8e32394d17f291872817370
6
+ metadata.gz: ca794e9db454392290f4425fa07d321afd2246e3020197ce4b05bcd8204fce5c38d5c263201f261139dd1647fbac57738c2829424aadd4686291e3c7f06ef2b9
7
+ data.tar.gz: 5210c6cc3dc87058b977485c1587ff53a60bb45d5ff9d964e75cb5f19a0c1eb0ba0c3fc8f9315c235c4cf9a4093c23a53975b0a7b7d49e43fd43384df643766a
data/History.md CHANGED
@@ -1,3 +1,10 @@
1
+ 1.0.8 (2015-04-23)
2
+ ===================
3
+ Fixes
4
+ --------
5
+ - Job#close re-added, so that tempfiles are immediately removed after each request
6
+ - Specs passing for 1.8.7, 1.9.2 (i18n gem version specified)
7
+
1
8
  1.0.7 (2014-08-26)
2
9
  ===================
3
10
  Changes
data/README.md CHANGED
@@ -37,16 +37,6 @@ Documentation
37
37
 
38
38
  <a href="http://rubydoc.info/github/markevans/dragonfly/frames">RDoc documentation is here</a>
39
39
 
40
- Upgrading from v0.9 to v1.0
41
- ===========================
42
- Dragonfly has changed somewhat since version 0.9.
43
- See [the Upgrading wiki](http://github.com/markevans/dragonfly/wiki/Upgrading-from-0.9-to-1.0) for notes on changes, and feel free to add anything you come across while upgrading!
44
-
45
- Changes are listed in [History.md](https://github.com/markevans/dragonfly/blob/master/History.md)
46
-
47
- If for whatever reason you can't upgrade, then
48
- <a href="http://markevans.github.io/dragonfly/v0.9.15">the docs for version 0.9.x are here</a>.
49
-
50
40
  Installation
51
41
  ============
52
42
 
@@ -54,17 +44,18 @@ Installation
54
44
 
55
45
  or in your Gemfile
56
46
  ```ruby
57
- gem 'dragonfly', '~> 1.0.7'
47
+ gem 'dragonfly', '~> 1.0.8'
58
48
  ```
59
49
 
60
50
  Require with
61
51
  ```ruby
62
52
  require 'dragonfly'
63
53
  ```
54
+ Articles
55
+ ========
56
+ See [the Articles wiki](http://github.com/markevans/dragonfly/wiki/Articles) for articles and tutorials.
64
57
 
65
- Ruby Versions
66
- =============
67
- Dragonfly has been tested with ruby versions 1.8.7, 1.9.2, 1.9.3, 2.0.0, jruby 1.7.8 and rubinius 2.2.
58
+ Please feel free to contribute!!
68
59
 
69
60
  Plugins / add-ons
70
61
  =================
@@ -80,6 +71,20 @@ Suggestions/Questions
80
71
  =====================
81
72
  <a href="http://groups.google.com/group/dragonfly-users">Google group dragonfly-users</a>
82
73
 
74
+ Ruby Versions
75
+ =============
76
+ Dragonfly has been tested with ruby versions 1.8.7, 1.9.2, 1.9.3, 2.0.0, jruby 1.7.8 and rubinius 2.2.
77
+
78
+ Upgrading from v0.9 to v1.0
79
+ ===========================
80
+ Dragonfly has changed somewhat since version 0.9.
81
+ See [the Upgrading wiki](http://github.com/markevans/dragonfly/wiki/Upgrading-from-0.9-to-1.0) for notes on changes, and feel free to add anything you come across while upgrading!
82
+
83
+ Changes are listed in [History.md](https://github.com/markevans/dragonfly/blob/master/History.md)
84
+
85
+ If for whatever reason you can't upgrade, then
86
+ <a href="http://markevans.github.io/dragonfly/v0.9.15">the docs for version 0.9.x are here</a>.
87
+
83
88
  Credits
84
89
  =======
85
90
  [Mark Evans](http://github.com/markevans) (author) with awesome contributions from
data/dragonfly.gemspec CHANGED
@@ -29,6 +29,7 @@ Gem::Specification.new do |spec|
29
29
  spec.add_development_dependency("webmock")
30
30
  if RUBY_VERSION < '1.9.3'
31
31
  spec.add_development_dependency("activemodel", '~> 3.2')
32
+ spec.add_development_dependency("i18n", '~> 0.6.11')
32
33
  else
33
34
  spec.add_development_dependency("activemodel")
34
35
  end
data/lib/dragonfly/job.rb CHANGED
@@ -22,7 +22,8 @@ module Dragonfly
22
22
  :data, :file, :tempfile, :path, :to_file, :size, :each,
23
23
  :meta, :meta=, :add_meta, :name, :name=, :basename, :basename=, :ext, :ext=, :mime_type,
24
24
  :analyse, :shell_eval, :store,
25
- :b64_data
25
+ :b64_data,
26
+ :close
26
27
 
27
28
  require 'dragonfly/job/fetch'
28
29
  require 'dragonfly/job/fetch_file'
@@ -1,3 +1,3 @@
1
1
  module Dragonfly
2
- VERSION = '1.0.7'
2
+ VERSION = '1.0.8'
3
3
  end
@@ -9,11 +9,11 @@ describe Dragonfly::FileDataStore do
9
9
  end
10
10
 
11
11
  def assert_exists(path)
12
- File.exists?(path).should be_true
12
+ File.exists?(path).should be_truthy
13
13
  end
14
14
 
15
15
  def assert_does_not_exist(path)
16
- File.exists?(path).should be_false
16
+ File.exists?(path).should be_falsey
17
17
  end
18
18
 
19
19
  def assert_contains(dir, filepattern)
@@ -37,13 +37,13 @@ describe "a configured imagemagick app" do
37
37
  end
38
38
 
39
39
  it "should say if it's portrait" do
40
- image.portrait?.should be_true
41
- image.portrait.should be_true # for using with magic attributes
40
+ image.portrait?.should be_truthy
41
+ image.portrait.should be_truthy # for using with magic attributes
42
42
  end
43
43
 
44
44
  it "should say if it's landscape" do
45
- image.landscape?.should be_false
46
- image.landscape.should be_false # for using with magic attributes
45
+ image.landscape?.should be_falsey
46
+ image.landscape.should be_falsey # for using with magic attributes
47
47
  end
48
48
 
49
49
  it "should return the format" do
@@ -51,16 +51,16 @@ describe "a configured imagemagick app" do
51
51
  end
52
52
 
53
53
  it "should say if it's an image" do
54
- image.image?.should be_true
55
- image.image.should be_true # for using with magic attributes
54
+ image.image?.should be_truthy
55
+ image.image.should be_truthy # for using with magic attributes
56
56
  end
57
57
 
58
58
  it "should say if it's not an image" do
59
- app.create("blah").image?.should be_false
59
+ app.create("blah").image?.should be_falsey
60
60
  end
61
61
 
62
62
  it "should return false for pdfs" do
63
- image.encode('pdf').image?.should be_false
63
+ image.encode('pdf').image?.should be_falsey
64
64
  end
65
65
  end
66
66
 
@@ -268,7 +268,7 @@ describe "models" do
268
268
  end
269
269
 
270
270
  it 'should mark the attribute as changed' do
271
- @item.preview_image_uid_changed?.should be_true
271
+ @item.preview_image_uid_changed?.should be_truthy
272
272
  end
273
273
  end
274
274
 
@@ -293,7 +293,7 @@ describe "models" do
293
293
  end
294
294
 
295
295
  it 'should mark the attribute as changed' do
296
- @item.preview_image_uid_changed?.should be_true
296
+ @item.preview_image_uid_changed?.should be_truthy
297
297
  end
298
298
 
299
299
  end
@@ -463,7 +463,7 @@ describe "models" do
463
463
  @item.preview_image.number_of_As.should == 2
464
464
  end
465
465
  it "should report that it responds to analyser methods" do
466
- @item.preview_image.respond_to?(:number_of_As).should be_true
466
+ @item.preview_image.respond_to?(:number_of_As).should be_truthy
467
467
  end
468
468
  it "should include analyser methods in methods" do
469
469
  @item.preview_image.methods.map{|m| m.to_sym }.should include(:number_of_As)
@@ -673,7 +673,7 @@ describe "models" do
673
673
 
674
674
  it "should return true when called if set with #{value.inspect}" do
675
675
  @item.remove_preview_image = value
676
- @item.remove_preview_image.should be_true
676
+ @item.remove_preview_image.should be_truthy
677
677
  end
678
678
  end
679
679
 
@@ -692,12 +692,12 @@ describe "models" do
692
692
 
693
693
  it "should return false when called if set with #{value.inspect}" do
694
694
  @item.remove_preview_image = value
695
- @item.remove_preview_image.should be_false
695
+ @item.remove_preview_image.should be_falsey
696
696
  end
697
697
  end
698
698
 
699
699
  it "should return false by default for the getter" do
700
- @item.remove_preview_image.should be_false
700
+ @item.remove_preview_image.should be_falsey
701
701
  end
702
702
 
703
703
  end
@@ -955,9 +955,9 @@ describe "models" do
955
955
  end
956
956
 
957
957
  it "should be changed when assigned" do
958
- expect( @item.preview_image_changed? ).to be_false
958
+ expect( @item.preview_image_changed? ).to be_falsey
959
959
  @item.preview_image = 'ggg'
960
- expect( @item.preview_image_changed? ).to be_true
960
+ expect( @item.preview_image_changed? ).to be_truthy
961
961
  end
962
962
 
963
963
  describe "after saving" do
@@ -967,22 +967,22 @@ describe "models" do
967
967
  end
968
968
 
969
969
  it "should not be changed" do
970
- expect( @item.preview_image_changed? ).to be_false
970
+ expect( @item.preview_image_changed? ).to be_falsey
971
971
  end
972
972
 
973
973
  it "should be changed when set to nil" do
974
974
  @item.preview_image = nil
975
- expect( @item.preview_image_changed? ).to be_true
975
+ expect( @item.preview_image_changed? ).to be_truthy
976
976
  end
977
977
 
978
978
  it "should be changed when changed" do
979
979
  @item.preview_image = "asdf"
980
- expect( @item.preview_image_changed? ).to be_true
980
+ expect( @item.preview_image_changed? ).to be_truthy
981
981
  end
982
982
 
983
983
  it "should not be changed when reloaded" do
984
984
  item = @item_class.find(@item.id)
985
- expect( @item.preview_image_changed? ).to be_false
985
+ expect( @item.preview_image_changed? ).to be_falsey
986
986
  end
987
987
 
988
988
  end
@@ -1213,18 +1213,18 @@ describe "models" do
1213
1213
  end
1214
1214
 
1215
1215
  it "returns false if unassigned" do
1216
- @item.photo_stored?.should be_false
1216
+ @item.photo_stored?.should be_falsey
1217
1217
  end
1218
1218
 
1219
1219
  it "returns false if assigned but not stored" do
1220
1220
  @item.photo = "Asdf"
1221
- @item.photo_stored?.should be_false
1221
+ @item.photo_stored?.should be_falsey
1222
1222
  end
1223
1223
 
1224
1224
  it "returns true if stored" do
1225
1225
  @item.photo = "Asdf"
1226
1226
  @item.save!
1227
- @item.photo_stored?.should be_true
1227
+ @item.photo_stored?.should be_truthy
1228
1228
  end
1229
1229
  end
1230
1230
 
@@ -118,7 +118,7 @@ describe Dragonfly::TempObject do
118
118
  end
119
119
  it "should write to a file" do
120
120
  @temp_object.to_file(@filename)
121
- File.exists?(@filename).should be_true
121
+ File.exists?(@filename).should be_truthy
122
122
  end
123
123
  it "should write the correct data to the file" do
124
124
  @temp_object.to_file(@filename)
@@ -140,7 +140,7 @@ describe Dragonfly::TempObject do
140
140
  it "should create intermediate subdirs" do
141
141
  filename = 'tmp/gog/mcgee'
142
142
  @temp_object.to_file(filename)
143
- File.exists?(filename).should be_true
143
+ File.exists?(filename).should be_truthy
144
144
  FileUtils.rm_rf('tmp/gog')
145
145
  end
146
146
  it "should allow not creating intermediate subdirs" do
@@ -211,9 +211,9 @@ describe Dragonfly::TempObject do
211
211
  it "should delete its internal tempfile on close" do
212
212
  temp_object = new_temp_object("HELLO")
213
213
  path = temp_object.path
214
- File.exist?(path).should be_true
214
+ File.exist?(path).should be_truthy
215
215
  temp_object.close
216
- File.exist?(path).should be_false
216
+ File.exist?(path).should be_falsey
217
217
  end
218
218
 
219
219
  end
@@ -240,9 +240,9 @@ describe Dragonfly::TempObject do
240
240
  it "should delete its internal tempfile on close" do
241
241
  temp_object = new_temp_object("HELLO")
242
242
  path = temp_object.path
243
- File.exist?(path).should be_true
243
+ File.exist?(path).should be_truthy
244
244
  temp_object.close
245
- File.exist?(path).should be_false
245
+ File.exist?(path).should be_falsey
246
246
  end
247
247
  end
248
248
 
@@ -281,7 +281,7 @@ describe Dragonfly::TempObject do
281
281
  it "doesn't remove the file on close" do
282
282
  temp_object = new_temp_object("HELLO")
283
283
  temp_object.close
284
- File.exist?(temp_object.path).should be_true
284
+ File.exist?(temp_object.path).should be_truthy
285
285
  end
286
286
  end
287
287
 
@@ -319,7 +319,7 @@ describe Dragonfly::TempObject do
319
319
  it "doesn't remove the file on close" do
320
320
  temp_object = new_temp_object("HELLO")
321
321
  temp_object.close
322
- File.exist?(temp_object.path).should be_true
322
+ File.exist?(temp_object.path).should be_truthy
323
323
  end
324
324
 
325
325
  end
@@ -6,17 +6,17 @@ describe Dragonfly::UrlAttributes do
6
6
 
7
7
  describe "empty" do
8
8
  it "returns true when empty" do
9
- url_attributes.empty?.should be_true
9
+ url_attributes.empty?.should be_truthy
10
10
  end
11
11
 
12
12
  it "returns false when not empty" do
13
13
  url_attributes.some = 'thing'
14
- url_attributes.empty?.should be_false
14
+ url_attributes.empty?.should be_falsey
15
15
  end
16
16
 
17
17
  it "returns true if all values are nil" do
18
18
  url_attributes.some = nil
19
- url_attributes.empty?.should be_true
19
+ url_attributes.empty?.should be_truthy
20
20
  end
21
21
  end
22
22
 
@@ -11,7 +11,7 @@ describe Dragonfly::Utils do
11
11
  {}
12
12
  ].each do |obj|
13
13
  it "returns true for #{obj.inspect}" do
14
- obj.blank?.should be_true
14
+ obj.blank?.should be_truthy
15
15
  end
16
16
  end
17
17
 
@@ -24,7 +24,7 @@ describe Dragonfly::Utils do
24
24
  7.3
25
25
  ].each do |obj|
26
26
  it "returns false for #{obj.inspect}" do
27
- obj.blank?.should be_false
27
+ obj.blank?.should be_falsey
28
28
  end
29
29
  end
30
30
  end
@@ -3,21 +3,21 @@ require 'spec_helper'
3
3
  describe Dragonfly::Whitelist do
4
4
  it "matches regexps" do
5
5
  whitelist = Dragonfly::Whitelist.new([/platipus/])
6
- whitelist.include?("platipus").should be_true
7
- whitelist.include?("small platipus in the bath").should be_true
8
- whitelist.include?("baloney").should be_false
6
+ whitelist.include?("platipus").should be_truthy
7
+ whitelist.include?("small platipus in the bath").should be_truthy
8
+ whitelist.include?("baloney").should be_falsey
9
9
  end
10
10
 
11
11
  it "matches strings" do
12
12
  whitelist = Dragonfly::Whitelist.new(["platipus"])
13
- whitelist.include?("platipus").should be_true
14
- whitelist.include?("small platipus in the bath").should be_false
15
- whitelist.include?("baloney").should be_false
13
+ whitelist.include?("platipus").should be_truthy
14
+ whitelist.include?("small platipus in the bath").should be_falsey
15
+ whitelist.include?("baloney").should be_falsey
16
16
  end
17
17
 
18
18
  it "only needs one match" do
19
- Dragonfly::Whitelist.new(%w(a b)).include?("c").should be_false
20
- Dragonfly::Whitelist.new(%w(a b c)).include?("c").should be_true
19
+ Dragonfly::Whitelist.new(%w(a b)).include?("c").should be_falsey
20
+ Dragonfly::Whitelist.new(%w(a b c)).include?("c").should be_truthy
21
21
  end
22
22
 
23
23
  it "allows pushing" do
@@ -0,0 +1,22 @@
1
+ require 'spec_helper'
2
+
3
+ describe "cleaning up tempfiles" do
4
+
5
+ let (:app) {
6
+ test_app.configure{
7
+ processor :copy do |content|
8
+ content.shell_update do |old_path, new_path|
9
+ "cp #{old_path} #{new_path}"
10
+ end
11
+ end
12
+ }
13
+ }
14
+
15
+ it "unlinks tempfiles on each request" do
16
+ expect {
17
+ uid = app.store("blug")
18
+ url = app.fetch(uid).copy.url
19
+ request(app, url)
20
+ }.not_to increase_num_tempfiles
21
+ end
22
+ end
@@ -36,7 +36,7 @@ describe "remote on-the-fly urls" do
36
36
  end
37
37
 
38
38
  it "should store the content when first called" do
39
- File.exist?('tmp/dragonfly_test_urls/yay.txt').should be_false
39
+ File.exist?('tmp/dragonfly_test_urls/yay.txt').should be_falsey
40
40
  request(@app, @job.url)
41
41
  File.read('tmp/dragonfly_test_urls/yay.txt').should == 'TEST'
42
42
  end
@@ -11,7 +11,7 @@ describe "using the shell" do
11
11
  app.generate(:plain, 10, 10, 'white').convert("-resize 5x5 ; touch tmp/stuff").apply
12
12
  rescue Dragonfly::Shell::CommandFailed
13
13
  end
14
- File.exist?('tmp/stuff').should be_false
14
+ File.exist?('tmp/stuff').should be_falsey
15
15
  end
16
16
  end
17
17
 
@@ -19,22 +19,6 @@ RSpec::Matchers.define :include_hash do |hash|
19
19
  end
20
20
  end
21
21
 
22
- def memory_usage
23
- GC.start # Garbage collect
24
- `ps -o rss= -p #{$$}`.strip.to_i
25
- end
26
-
27
- RSpec::Matchers.define :leak_memory do
28
- match do |given|
29
- memory_before = memory_usage
30
- given.call
31
- memory_after = memory_usage
32
- result = memory_after > memory_before
33
- puts "#{memory_after} > #{memory_before}" if result
34
- result
35
- end
36
- end
37
-
38
22
  RSpec::Matchers.define :match_attachment_classes do |classes|
39
23
  match do |given_classes|
40
24
  given_classes.length == classes.length &&
@@ -63,3 +47,14 @@ RSpec::Matchers.define :match_steps do |steps|
63
47
  given.map{|step| step.class } == steps
64
48
  end
65
49
  end
50
+
51
+ RSpec::Matchers.define :increase_num_tempfiles do
52
+ match do |block|
53
+ num_tempfiles_before = Dir.entries(Dir.tmpdir).size
54
+ block.call
55
+ num_tempfiles_after = Dir.entries(Dir.tmpdir).size
56
+ increased = num_tempfiles_after > num_tempfiles_before
57
+ puts "Num tempfiles increased: #{num_tempfiles_before} -> #{num_tempfiles_after}" if increased
58
+ increased
59
+ end
60
+ 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.0.7
4
+ version: 1.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Evans
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-26 00:00:00.000000000 Z
11
+ date: 2015-04-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -224,6 +224,7 @@ files:
224
224
  - spec/dragonfly_spec.rb
225
225
  - spec/fixtures/deprecated_stored_content/eggs.bonus
226
226
  - spec/fixtures/deprecated_stored_content/eggs.bonus.meta
227
+ - spec/functional/cleanup_spec.rb
227
228
  - spec/functional/configuration_spec.rb
228
229
  - spec/functional/model_urls_spec.rb
229
230
  - spec/functional/remote_on_the_fly_spec.rb
@@ -266,7 +267,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
266
267
  version: '0'
267
268
  requirements: []
268
269
  rubyforge_project:
269
- rubygems_version: 2.2.2
270
+ rubygems_version: 2.2.1
270
271
  signing_key:
271
272
  specification_version: 4
272
273
  summary: Ideal gem for handling attachments in Rails, Sinatra and Rack applications.
@@ -312,6 +313,7 @@ test_files:
312
313
  - spec/dragonfly_spec.rb
313
314
  - spec/fixtures/deprecated_stored_content/eggs.bonus
314
315
  - spec/fixtures/deprecated_stored_content/eggs.bonus.meta
316
+ - spec/functional/cleanup_spec.rb
315
317
  - spec/functional/configuration_spec.rb
316
318
  - spec/functional/model_urls_spec.rb
317
319
  - spec/functional/remote_on_the_fly_spec.rb