dragonfly 0.1.6 → 0.2.1

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 (69) hide show
  1. data/.yardopts +4 -0
  2. data/{README.markdown → README.md} +12 -24
  3. data/Rakefile +6 -6
  4. data/VERSION +1 -1
  5. data/config.rb +1 -3
  6. data/docs.watchr +1 -1
  7. data/dragonfly-rails.gemspec +2 -5
  8. data/dragonfly.gemspec +32 -12
  9. data/extra_docs/ActiveRecord.md +195 -0
  10. data/extra_docs/Analysers.md +63 -0
  11. data/extra_docs/DataStorage.md +33 -0
  12. data/extra_docs/Encoding.md +58 -0
  13. data/extra_docs/GettingStarted.md +114 -0
  14. data/extra_docs/Processing.md +58 -0
  15. data/extra_docs/Shortcuts.md +118 -0
  16. data/extra_docs/UsingWithRails.md +104 -0
  17. data/features/{dragonfly.feature → images.feature} +14 -4
  18. data/features/no_processing.feature +20 -0
  19. data/features/steps/dragonfly_steps.rb +29 -8
  20. data/features/support/env.rb +20 -8
  21. data/generators/dragonfly_app/USAGE +0 -1
  22. data/generators/dragonfly_app/dragonfly_app_generator.rb +1 -13
  23. data/generators/dragonfly_app/templates/metal_file.erb +1 -1
  24. data/lib/dragonfly/active_record_extensions.rb +1 -0
  25. data/lib/dragonfly/active_record_extensions/attachment.rb +52 -6
  26. data/lib/dragonfly/active_record_extensions/validations.rb +26 -6
  27. data/lib/dragonfly/analysis/base.rb +6 -3
  28. data/lib/dragonfly/analysis/r_magick_analyser.rb +0 -6
  29. data/lib/dragonfly/app.rb +53 -35
  30. data/lib/dragonfly/configurable.rb +1 -1
  31. data/lib/dragonfly/data_storage/file_data_store.rb +8 -8
  32. data/lib/dragonfly/delegatable.rb +14 -0
  33. data/lib/dragonfly/delegator.rb +50 -0
  34. data/lib/dragonfly/encoding/base.rb +7 -7
  35. data/lib/dragonfly/encoding/r_magick_encoder.rb +3 -0
  36. data/lib/dragonfly/encoding/transparent_encoder.rb +1 -1
  37. data/lib/dragonfly/extended_temp_object.rb +13 -7
  38. data/lib/dragonfly/parameters.rb +17 -11
  39. data/lib/dragonfly/processing/base.rb +9 -0
  40. data/lib/dragonfly/processing/r_magick_processor.rb +15 -1
  41. data/lib/dragonfly/r_magick_configuration.rb +12 -8
  42. data/lib/dragonfly/rails/images.rb +1 -1
  43. data/lib/dragonfly/temp_object.rb +14 -2
  44. data/lib/dragonfly/url_handler.rb +5 -6
  45. data/samples/sample.docx +0 -0
  46. data/spec/dragonfly/active_record_extensions/model_spec.rb +175 -84
  47. data/spec/dragonfly/analysis/r_magick_analyser_spec.rb +0 -8
  48. data/spec/dragonfly/app_spec.rb +3 -3
  49. data/spec/dragonfly/configurable_spec.rb +1 -1
  50. data/spec/dragonfly/data_storage/file_data_store_spec.rb +55 -40
  51. data/spec/dragonfly/delegatable_spec.rb +32 -0
  52. data/spec/dragonfly/delegator_spec.rb +133 -0
  53. data/spec/dragonfly/encoding/r_magick_encoder_spec.rb +28 -0
  54. data/spec/dragonfly/extended_temp_object_spec.rb +5 -5
  55. data/spec/dragonfly/parameters_spec.rb +22 -32
  56. data/spec/dragonfly/processing/rmagick_processor_spec.rb +1 -2
  57. data/spec/dragonfly/temp_object_spec.rb +51 -0
  58. data/spec/dragonfly/url_handler_spec.rb +10 -15
  59. data/yard/handlers/configurable_attr_handler.rb +38 -0
  60. data/yard/setup.rb +9 -0
  61. data/yard/templates/default/fulldoc/html/css/common.css +27 -0
  62. data/yard/templates/default/module/html/configuration_summary.erb +31 -0
  63. data/yard/templates/default/module/setup.rb +17 -0
  64. metadata +31 -12
  65. data/features/support/image_helpers.rb +0 -9
  66. data/generators/dragonfly_app/templates/custom_processing.erb +0 -13
  67. data/lib/dragonfly/analysis/analyser.rb +0 -45
  68. data/lib/dragonfly/processing/processor.rb +0 -14
  69. data/spec/dragonfly/analysis/analyser_spec.rb +0 -85
@@ -1,14 +0,0 @@
1
- module Dragonfly
2
- module Processing
3
- class Processor
4
-
5
- include Configurable
6
-
7
- def register(mod)
8
- self.extend(mod)
9
- end
10
- configuration_method :register
11
-
12
- end
13
- end
14
- end
@@ -1,85 +0,0 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
2
-
3
- class ImageAnalyser < Dragonfly::Analysis::Base
4
-
5
- def width(temp_object)
6
- temp_object.data.length
7
- end
8
-
9
- def mime_type(temp_object)
10
- return 'image/fart' if temp_object.data == 'THIS IS AN IMAGE'
11
- return 'image/pdf' if temp_object.data == 'THIS IS A PDF'
12
- end
13
-
14
- end
15
-
16
- class PdfAnalyser < Dragonfly::Analysis::Base
17
-
18
- def pdf_type(temp_object)
19
- 'egg'
20
- end
21
-
22
- def mime_type(temp_object)
23
- 'application/pdf' if temp_object.data == 'THIS IS A PDF'
24
- end
25
-
26
- end
27
-
28
- describe Dragonfly::Analysis::Analyser do
29
-
30
- describe "mime_type" do
31
-
32
- before(:each) do
33
- @analyser = Dragonfly::Analysis::Analyser.new
34
- @image = Dragonfly::TempObject.new("THIS IS AN IMAGE")
35
- @pdf = Dragonfly::TempObject.new("THIS IS A PDF")
36
- end
37
-
38
- describe "when no analysers have been registered" do
39
-
40
- it "should return nil when no modules have been registered" do
41
- @analyser.mime_type(@image).should be_nil
42
- end
43
-
44
- it "should should return analysis methods as an empty array" do
45
- @analyser.analysis_methods.should == []
46
- end
47
-
48
- end
49
-
50
- describe "after registering a number of modules" do
51
-
52
- before(:each) do
53
- @analyser.register(ImageAnalyser.new)
54
- @analyser.register(PdfAnalyser.new)
55
- end
56
-
57
- it "should return the correct value when one of the modules returns non-nil" do
58
- @analyser.mime_type(@image).should == 'image/fart'
59
- end
60
-
61
- it "should override the first registered modules's value with the second, when they both return non-nil" do
62
- @analyser.mime_type(@pdf).should == 'application/pdf'
63
- end
64
-
65
- it "should return all the analysis methods" do
66
- @analyser.analysis_methods.sort.should == ['mime_type', 'pdf_type', 'width']
67
- end
68
-
69
- it "should say if if has an analysis method (as a symbol)" do
70
- @analyser.has_analysis_method?('pdf_type').should be_true
71
- end
72
-
73
- it "should say if if has an analysis method (as a string)" do
74
- @analyser.has_analysis_method?(:pdf_type).should be_true
75
- end
76
-
77
- it "should delegate the call of a method to the registered analysers" do
78
- @analyser.width(@image).should == 16
79
- end
80
-
81
- end
82
-
83
- end
84
-
85
- end