oahu-dragonfly 0.8.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (159) hide show
  1. data/.rspec +1 -0
  2. data/.yardopts +24 -0
  3. data/Gemfile +30 -0
  4. data/History.md +323 -0
  5. data/LICENSE +20 -0
  6. data/README.md +88 -0
  7. data/Rakefile +50 -0
  8. data/VERSION +1 -0
  9. data/config.ru +14 -0
  10. data/docs.watchr +1 -0
  11. data/dragonfly.gemspec +297 -0
  12. data/extra_docs/Analysers.md +66 -0
  13. data/extra_docs/Caching.md +23 -0
  14. data/extra_docs/Configuration.md +124 -0
  15. data/extra_docs/Couch.md +49 -0
  16. data/extra_docs/DataStorage.md +153 -0
  17. data/extra_docs/Encoding.md +67 -0
  18. data/extra_docs/GeneralUsage.md +121 -0
  19. data/extra_docs/Generators.md +60 -0
  20. data/extra_docs/Heroku.md +50 -0
  21. data/extra_docs/ImageMagick.md +125 -0
  22. data/extra_docs/Index.md +33 -0
  23. data/extra_docs/MimeTypes.md +40 -0
  24. data/extra_docs/Models.md +272 -0
  25. data/extra_docs/Mongo.md +45 -0
  26. data/extra_docs/Processing.md +77 -0
  27. data/extra_docs/Rack.md +52 -0
  28. data/extra_docs/Rails2.md +57 -0
  29. data/extra_docs/Rails3.md +62 -0
  30. data/extra_docs/Sinatra.md +25 -0
  31. data/extra_docs/URLs.md +169 -0
  32. data/features/images.feature +47 -0
  33. data/features/no_processing.feature +14 -0
  34. data/features/rails_3.0.5.feature +8 -0
  35. data/features/steps/common_steps.rb +8 -0
  36. data/features/steps/dragonfly_steps.rb +66 -0
  37. data/features/steps/rails_steps.rb +28 -0
  38. data/features/support/env.rb +13 -0
  39. data/features/support/setup.rb +32 -0
  40. data/fixtures/rails_3.0.5/files/app/models/album.rb +7 -0
  41. data/fixtures/rails_3.0.5/files/app/views/albums/new.html.erb +7 -0
  42. data/fixtures/rails_3.0.5/files/app/views/albums/show.html.erb +6 -0
  43. data/fixtures/rails_3.0.5/files/config/initializers/dragonfly.rb +4 -0
  44. data/fixtures/rails_3.0.5/files/features/manage_album_images.feature +38 -0
  45. data/fixtures/rails_3.0.5/files/features/step_definitions/helper_steps.rb +7 -0
  46. data/fixtures/rails_3.0.5/files/features/step_definitions/image_steps.rb +25 -0
  47. data/fixtures/rails_3.0.5/files/features/support/paths.rb +17 -0
  48. data/fixtures/rails_3.0.5/files/features/text_images.feature +7 -0
  49. data/fixtures/rails_3.0.5/template.rb +20 -0
  50. data/irbrc.rb +18 -0
  51. data/lib/dragonfly.rb +55 -0
  52. data/lib/dragonfly/active_model_extensions.rb +13 -0
  53. data/lib/dragonfly/active_model_extensions/attachment.rb +250 -0
  54. data/lib/dragonfly/active_model_extensions/attachment_class_methods.rb +148 -0
  55. data/lib/dragonfly/active_model_extensions/class_methods.rb +95 -0
  56. data/lib/dragonfly/active_model_extensions/instance_methods.rb +28 -0
  57. data/lib/dragonfly/active_model_extensions/validations.rb +41 -0
  58. data/lib/dragonfly/analyser.rb +58 -0
  59. data/lib/dragonfly/analysis/file_command_analyser.rb +32 -0
  60. data/lib/dragonfly/analysis/image_magick_analyser.rb +6 -0
  61. data/lib/dragonfly/app.rb +172 -0
  62. data/lib/dragonfly/config/heroku.rb +19 -0
  63. data/lib/dragonfly/config/image_magick.rb +6 -0
  64. data/lib/dragonfly/config/rails.rb +20 -0
  65. data/lib/dragonfly/configurable.rb +207 -0
  66. data/lib/dragonfly/core_ext/array.rb +7 -0
  67. data/lib/dragonfly/core_ext/hash.rb +7 -0
  68. data/lib/dragonfly/core_ext/object.rb +12 -0
  69. data/lib/dragonfly/core_ext/string.rb +9 -0
  70. data/lib/dragonfly/core_ext/symbol.rb +9 -0
  71. data/lib/dragonfly/data_storage.rb +9 -0
  72. data/lib/dragonfly/data_storage/couch_data_store.rb +64 -0
  73. data/lib/dragonfly/data_storage/file_data_store.rb +141 -0
  74. data/lib/dragonfly/data_storage/mongo_data_store.rb +86 -0
  75. data/lib/dragonfly/data_storage/s3data_store.rb +145 -0
  76. data/lib/dragonfly/encoder.rb +13 -0
  77. data/lib/dragonfly/encoding/image_magick_encoder.rb +6 -0
  78. data/lib/dragonfly/function_manager.rb +71 -0
  79. data/lib/dragonfly/generation/image_magick_generator.rb +6 -0
  80. data/lib/dragonfly/generator.rb +9 -0
  81. data/lib/dragonfly/hash_with_css_style_keys.rb +21 -0
  82. data/lib/dragonfly/image_magick/analyser.rb +51 -0
  83. data/lib/dragonfly/image_magick/config.rb +41 -0
  84. data/lib/dragonfly/image_magick/encoder.rb +57 -0
  85. data/lib/dragonfly/image_magick/generator.rb +145 -0
  86. data/lib/dragonfly/image_magick/processor.rb +99 -0
  87. data/lib/dragonfly/image_magick/utils.rb +72 -0
  88. data/lib/dragonfly/image_magick_utils.rb +4 -0
  89. data/lib/dragonfly/job.rb +451 -0
  90. data/lib/dragonfly/job_builder.rb +39 -0
  91. data/lib/dragonfly/job_definitions.rb +26 -0
  92. data/lib/dragonfly/job_endpoint.rb +15 -0
  93. data/lib/dragonfly/loggable.rb +28 -0
  94. data/lib/dragonfly/middleware.rb +20 -0
  95. data/lib/dragonfly/processing/image_magick_processor.rb +6 -0
  96. data/lib/dragonfly/processor.rb +9 -0
  97. data/lib/dragonfly/rails/images.rb +27 -0
  98. data/lib/dragonfly/response.rb +97 -0
  99. data/lib/dragonfly/routed_endpoint.rb +40 -0
  100. data/lib/dragonfly/serializer.rb +32 -0
  101. data/lib/dragonfly/server.rb +113 -0
  102. data/lib/dragonfly/simple_cache.rb +23 -0
  103. data/lib/dragonfly/temp_object.rb +175 -0
  104. data/lib/dragonfly/url_mapper.rb +78 -0
  105. data/samples/beach.png +0 -0
  106. data/samples/egg.png +0 -0
  107. data/samples/round.gif +0 -0
  108. data/samples/sample.docx +0 -0
  109. data/samples/taj.jpg +0 -0
  110. data/spec/dragonfly/active_model_extensions/model_spec.rb +1426 -0
  111. data/spec/dragonfly/active_model_extensions/spec_helper.rb +91 -0
  112. data/spec/dragonfly/analyser_spec.rb +123 -0
  113. data/spec/dragonfly/analysis/file_command_analyser_spec.rb +48 -0
  114. data/spec/dragonfly/app_spec.rb +135 -0
  115. data/spec/dragonfly/configurable_spec.rb +461 -0
  116. data/spec/dragonfly/core_ext/array_spec.rb +19 -0
  117. data/spec/dragonfly/core_ext/hash_spec.rb +19 -0
  118. data/spec/dragonfly/core_ext/string_spec.rb +17 -0
  119. data/spec/dragonfly/core_ext/symbol_spec.rb +17 -0
  120. data/spec/dragonfly/data_storage/couch_data_store_spec.rb +76 -0
  121. data/spec/dragonfly/data_storage/file_data_store_spec.rb +296 -0
  122. data/spec/dragonfly/data_storage/mongo_data_store_spec.rb +57 -0
  123. data/spec/dragonfly/data_storage/s3_data_store_spec.rb +258 -0
  124. data/spec/dragonfly/data_storage/shared_data_store_examples.rb +77 -0
  125. data/spec/dragonfly/function_manager_spec.rb +154 -0
  126. data/spec/dragonfly/hash_with_css_style_keys_spec.rb +24 -0
  127. data/spec/dragonfly/image_magick/analyser_spec.rb +64 -0
  128. data/spec/dragonfly/image_magick/encoder_spec.rb +41 -0
  129. data/spec/dragonfly/image_magick/generator_spec.rb +172 -0
  130. data/spec/dragonfly/image_magick/processor_spec.rb +233 -0
  131. data/spec/dragonfly/image_magick/utils_spec.rb +18 -0
  132. data/spec/dragonfly/job_builder_spec.rb +37 -0
  133. data/spec/dragonfly/job_definitions_spec.rb +35 -0
  134. data/spec/dragonfly/job_endpoint_spec.rb +173 -0
  135. data/spec/dragonfly/job_spec.rb +1046 -0
  136. data/spec/dragonfly/loggable_spec.rb +80 -0
  137. data/spec/dragonfly/middleware_spec.rb +47 -0
  138. data/spec/dragonfly/routed_endpoint_spec.rb +48 -0
  139. data/spec/dragonfly/serializer_spec.rb +61 -0
  140. data/spec/dragonfly/server_spec.rb +278 -0
  141. data/spec/dragonfly/simple_cache_spec.rb +27 -0
  142. data/spec/dragonfly/temp_object_spec.rb +306 -0
  143. data/spec/dragonfly/url_mapper_spec.rb +126 -0
  144. data/spec/functional/deprecations_spec.rb +51 -0
  145. data/spec/functional/image_magick_app_spec.rb +27 -0
  146. data/spec/functional/model_urls_spec.rb +85 -0
  147. data/spec/functional/remote_on_the_fly_spec.rb +51 -0
  148. data/spec/functional/to_response_spec.rb +31 -0
  149. data/spec/spec_helper.rb +51 -0
  150. data/spec/support/argument_matchers.rb +19 -0
  151. data/spec/support/image_matchers.rb +47 -0
  152. data/spec/support/simple_matchers.rb +53 -0
  153. data/yard/handlers/configurable_attr_handler.rb +38 -0
  154. data/yard/setup.rb +15 -0
  155. data/yard/templates/default/fulldoc/html/css/common.css +107 -0
  156. data/yard/templates/default/layout/html/layout.erb +89 -0
  157. data/yard/templates/default/module/html/configuration_summary.erb +31 -0
  158. data/yard/templates/default/module/setup.rb +17 -0
  159. metadata +544 -0
@@ -0,0 +1,50 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require 'rake'
11
+
12
+ require 'jeweler'
13
+ Jeweler::Tasks.new do |gem|
14
+ gem.name = "oahu-dragonfly"
15
+ gem.email = "mark@new-bamboo.co.uk"
16
+ gem.summary = %Q{Ideal gem for handling attachments in Rails, Sinatra and Rack applications.}
17
+ gem.description = %Q{Dragonfly is a framework that enables on-the-fly processing for any content type.
18
+ It is especially suited to image handling. Its uses range from image thumbnails to standard attachments to on-demand text generation.}
19
+ gem.homepage = "http://github.com/markevans/dragonfly"
20
+ gem.license = "MIT"
21
+ gem.authors = ["Mark Evans"]
22
+ gem.add_runtime_dependency('rack')
23
+ end
24
+ Jeweler::RubygemsDotOrgTasks.new
25
+
26
+ require 'rspec/core'
27
+ require 'rspec/core/rake_task'
28
+ RSpec::Core::RakeTask.new(:spec) do |spec|
29
+ spec.pattern = FileList['spec/**/*_spec.rb']
30
+ end
31
+
32
+ RSpec::Core::RakeTask.new(:rcov) do |spec|
33
+ spec.pattern = 'spec/**/*_spec.rb'
34
+ spec.rcov = true
35
+ end
36
+
37
+ require 'cucumber/rake/task'
38
+ Cucumber::Rake::Task.new(:features)
39
+
40
+ task :default => [:spec, :features]
41
+
42
+ require 'yard'
43
+ YARD::Rake::YardocTask.new do |t|
44
+ t.files = ['lib/**/*.rb']
45
+ t.options = []
46
+ end
47
+ YARD::Rake::YardocTask.new 'yard:changed' do |t|
48
+ t.files = `git status | grep '.rb' | grep modified | grep -v yard | cut -d' ' -f4`.split
49
+ t.options = []
50
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.8.2
@@ -0,0 +1,14 @@
1
+ require "rubygems"
2
+ require "bundler/setup"
3
+ $:.unshift(File.expand_path('../lib', __FILE__))
4
+ require 'dragonfly'
5
+ require 'rack/cache'
6
+
7
+ APP = Dragonfly[:images].configure_with(:imagemagick)
8
+
9
+ use Rack::Cache,
10
+ :verbose => true,
11
+ :metastore => 'file:/var/cache/rack/meta',
12
+ :entitystore => 'file:/var/cache/rack/body'
13
+
14
+ run APP
@@ -0,0 +1 @@
1
+ watch('lib/.*\.rb|yard/.*|extra_docs/.*') {|md| system("rake yard:changed") }
@@ -0,0 +1,297 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{dragonfly}
8
+ s.version = "0.8.2"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Mark Evans"]
12
+ s.date = %q{2011-01-11}
13
+ s.email = %q{mark@new-bamboo.co.uk}
14
+ s.extra_rdoc_files = [
15
+ "LICENSE",
16
+ "README.md"
17
+ ]
18
+ s.files = [
19
+ ".specopts",
20
+ ".yardopts",
21
+ "Gemfile",
22
+ "Gemfile.rails.2.3.5",
23
+ "History.md",
24
+ "LICENSE",
25
+ "README.md",
26
+ "Rakefile",
27
+ "VERSION",
28
+ "config.ru",
29
+ "docs.watchr",
30
+ "dragonfly.gemspec",
31
+ "extra_docs/Analysers.md",
32
+ "extra_docs/Caching.md",
33
+ "extra_docs/Configuration.md",
34
+ "extra_docs/DataStorage.md",
35
+ "extra_docs/Encoding.md",
36
+ "extra_docs/GeneralUsage.md",
37
+ "extra_docs/Generators.md",
38
+ "extra_docs/Heroku.md",
39
+ "extra_docs/Index.md",
40
+ "extra_docs/MimeTypes.md",
41
+ "extra_docs/Models.md",
42
+ "extra_docs/Mongo.md",
43
+ "extra_docs/Processing.md",
44
+ "extra_docs/Rack.md",
45
+ "extra_docs/Rails2.md",
46
+ "extra_docs/Rails3.md",
47
+ "extra_docs/Sinatra.md",
48
+ "extra_docs/URLs.md",
49
+ "features/3.0.3.feature",
50
+ "features/images.feature",
51
+ "features/no_processing.feature",
52
+ "features/rails_2.3.5.feature",
53
+ "features/steps/common_steps.rb",
54
+ "features/steps/dragonfly_steps.rb",
55
+ "features/steps/rails_steps.rb",
56
+ "features/support/env.rb",
57
+ "fixtures/files/app/models/album.rb",
58
+ "fixtures/files/app/views/albums/new.html.erb",
59
+ "fixtures/files/app/views/albums/show.html.erb",
60
+ "fixtures/files/config/initializers/dragonfly.rb",
61
+ "fixtures/files/features/manage_album_images.feature",
62
+ "fixtures/files/features/step_definitions/image_steps.rb",
63
+ "fixtures/files/features/support/paths.rb",
64
+ "fixtures/files/features/text_images.feature",
65
+ "fixtures/rails_2.3.5/template.rb",
66
+ "fixtures/rails_3.0.3/template.rb",
67
+ "irbrc.rb",
68
+ "lib/dragonfly.rb",
69
+ "lib/dragonfly/active_model_extensions.rb",
70
+ "lib/dragonfly/active_model_extensions/attachment.rb",
71
+ "lib/dragonfly/active_model_extensions/class_methods.rb",
72
+ "lib/dragonfly/active_model_extensions/instance_methods.rb",
73
+ "lib/dragonfly/active_model_extensions/validations.rb",
74
+ "lib/dragonfly/analyser.rb",
75
+ "lib/dragonfly/analysis/file_command_analyser.rb",
76
+ "lib/dragonfly/analysis/image_magick_analyser.rb",
77
+ "lib/dragonfly/analysis/r_magick_analyser.rb",
78
+ "lib/dragonfly/app.rb",
79
+ "lib/dragonfly/config/heroku.rb",
80
+ "lib/dragonfly/config/image_magick.rb",
81
+ "lib/dragonfly/config/r_magick.rb",
82
+ "lib/dragonfly/config/rails.rb",
83
+ "lib/dragonfly/configurable.rb",
84
+ "lib/dragonfly/core_ext/array.rb",
85
+ "lib/dragonfly/core_ext/hash.rb",
86
+ "lib/dragonfly/core_ext/object.rb",
87
+ "lib/dragonfly/core_ext/string.rb",
88
+ "lib/dragonfly/core_ext/symbol.rb",
89
+ "lib/dragonfly/data_storage.rb",
90
+ "lib/dragonfly/data_storage/file_data_store.rb",
91
+ "lib/dragonfly/data_storage/mongo_data_store.rb",
92
+ "lib/dragonfly/data_storage/s3data_store.rb",
93
+ "lib/dragonfly/encoder.rb",
94
+ "lib/dragonfly/encoding/image_magick_encoder.rb",
95
+ "lib/dragonfly/encoding/r_magick_encoder.rb",
96
+ "lib/dragonfly/function_manager.rb",
97
+ "lib/dragonfly/generation/hash_with_css_style_keys.rb",
98
+ "lib/dragonfly/generation/image_magick_generator.rb",
99
+ "lib/dragonfly/generation/r_magick_generator.rb",
100
+ "lib/dragonfly/generator.rb",
101
+ "lib/dragonfly/image_magick_utils.rb",
102
+ "lib/dragonfly/job.rb",
103
+ "lib/dragonfly/job_builder.rb",
104
+ "lib/dragonfly/job_definitions.rb",
105
+ "lib/dragonfly/job_endpoint.rb",
106
+ "lib/dragonfly/loggable.rb",
107
+ "lib/dragonfly/middleware.rb",
108
+ "lib/dragonfly/processing/image_magick_processor.rb",
109
+ "lib/dragonfly/processing/r_magick_processor.rb",
110
+ "lib/dragonfly/processor.rb",
111
+ "lib/dragonfly/r_magick_utils.rb",
112
+ "lib/dragonfly/rails/images.rb",
113
+ "lib/dragonfly/response.rb",
114
+ "lib/dragonfly/routed_endpoint.rb",
115
+ "lib/dragonfly/serializer.rb",
116
+ "lib/dragonfly/simple_cache.rb",
117
+ "lib/dragonfly/simple_endpoint.rb",
118
+ "lib/dragonfly/temp_object.rb",
119
+ "samples/beach.png",
120
+ "samples/egg.png",
121
+ "samples/round.gif",
122
+ "samples/sample.docx",
123
+ "samples/taj.jpg",
124
+ "spec/argument_matchers.rb",
125
+ "spec/dragonfly/active_model_extensions/active_model_setup.rb",
126
+ "spec/dragonfly/active_model_extensions/active_record_setup.rb",
127
+ "spec/dragonfly/active_model_extensions/model_spec.rb",
128
+ "spec/dragonfly/active_model_extensions/spec_helper.rb",
129
+ "spec/dragonfly/analyser_spec.rb",
130
+ "spec/dragonfly/analysis/file_command_analyser_spec.rb",
131
+ "spec/dragonfly/analysis/image_magick_analyser_spec.rb",
132
+ "spec/dragonfly/analysis/r_magick_analyser_spec.rb",
133
+ "spec/dragonfly/analysis/shared_analyser_spec.rb",
134
+ "spec/dragonfly/app_spec.rb",
135
+ "spec/dragonfly/config/r_magick_spec.rb",
136
+ "spec/dragonfly/configurable_spec.rb",
137
+ "spec/dragonfly/core_ext/array_spec.rb",
138
+ "spec/dragonfly/core_ext/hash_spec.rb",
139
+ "spec/dragonfly/core_ext/string_spec.rb",
140
+ "spec/dragonfly/core_ext/symbol_spec.rb",
141
+ "spec/dragonfly/data_storage/data_store_spec.rb",
142
+ "spec/dragonfly/data_storage/file_data_store_spec.rb",
143
+ "spec/dragonfly/data_storage/mongo_data_store_spec.rb",
144
+ "spec/dragonfly/data_storage/s3_data_store_spec.rb",
145
+ "spec/dragonfly/encoding/image_magick_encoder_spec.rb",
146
+ "spec/dragonfly/encoding/r_magick_encoder_spec.rb",
147
+ "spec/dragonfly/function_manager_spec.rb",
148
+ "spec/dragonfly/generation/hash_with_css_style_keys_spec.rb",
149
+ "spec/dragonfly/generation/image_magick_generator_spec.rb",
150
+ "spec/dragonfly/generation/r_magick_generator_spec.rb",
151
+ "spec/dragonfly/generation/shared_generator_spec.rb",
152
+ "spec/dragonfly/image_magick_utils_spec.rb",
153
+ "spec/dragonfly/job_builder_spec.rb",
154
+ "spec/dragonfly/job_definitions_spec.rb",
155
+ "spec/dragonfly/job_endpoint_spec.rb",
156
+ "spec/dragonfly/job_spec.rb",
157
+ "spec/dragonfly/loggable_spec.rb",
158
+ "spec/dragonfly/middleware_spec.rb",
159
+ "spec/dragonfly/processing/image_magick_processor_spec.rb",
160
+ "spec/dragonfly/processing/r_magick_processor_spec.rb",
161
+ "spec/dragonfly/processing/shared_processing_spec.rb",
162
+ "spec/dragonfly/routed_endpoint_spec.rb",
163
+ "spec/dragonfly/serializer_spec.rb",
164
+ "spec/dragonfly/simple_cache_spec.rb",
165
+ "spec/dragonfly/simple_endpoint_spec.rb",
166
+ "spec/dragonfly/temp_object_spec.rb",
167
+ "spec/image_matchers.rb",
168
+ "spec/simple_matchers.rb",
169
+ "spec/spec_helper.rb",
170
+ "yard/handlers/configurable_attr_handler.rb",
171
+ "yard/setup.rb",
172
+ "yard/templates/default/fulldoc/html/css/common.css",
173
+ "yard/templates/default/layout/html/layout.erb",
174
+ "yard/templates/default/module/html/configuration_summary.erb",
175
+ "yard/templates/default/module/setup.rb"
176
+ ]
177
+ s.homepage = %q{http://github.com/markevans/dragonfly}
178
+ s.require_paths = ["lib"]
179
+ s.rubygems_version = %q{1.3.7}
180
+ s.summary = %q{Dragonfly is an on-the-fly Rack-based image handling framework. It is suitable for use with Rails, Sinatra and other web frameworks. Although it's mainly used for images, it can handle any content type.}
181
+ s.test_files = [
182
+ "spec/argument_matchers.rb",
183
+ "spec/dragonfly/active_model_extensions/active_model_setup.rb",
184
+ "spec/dragonfly/active_model_extensions/active_record_setup.rb",
185
+ "spec/dragonfly/active_model_extensions/model_spec.rb",
186
+ "spec/dragonfly/active_model_extensions/spec_helper.rb",
187
+ "spec/dragonfly/analyser_spec.rb",
188
+ "spec/dragonfly/analysis/file_command_analyser_spec.rb",
189
+ "spec/dragonfly/analysis/image_magick_analyser_spec.rb",
190
+ "spec/dragonfly/analysis/r_magick_analyser_spec.rb",
191
+ "spec/dragonfly/analysis/shared_analyser_spec.rb",
192
+ "spec/dragonfly/app_spec.rb",
193
+ "spec/dragonfly/config/r_magick_spec.rb",
194
+ "spec/dragonfly/configurable_spec.rb",
195
+ "spec/dragonfly/core_ext/array_spec.rb",
196
+ "spec/dragonfly/core_ext/hash_spec.rb",
197
+ "spec/dragonfly/core_ext/string_spec.rb",
198
+ "spec/dragonfly/core_ext/symbol_spec.rb",
199
+ "spec/dragonfly/data_storage/data_store_spec.rb",
200
+ "spec/dragonfly/data_storage/file_data_store_spec.rb",
201
+ "spec/dragonfly/data_storage/mongo_data_store_spec.rb",
202
+ "spec/dragonfly/data_storage/s3_data_store_spec.rb",
203
+ "spec/dragonfly/encoding/image_magick_encoder_spec.rb",
204
+ "spec/dragonfly/encoding/r_magick_encoder_spec.rb",
205
+ "spec/dragonfly/function_manager_spec.rb",
206
+ "spec/dragonfly/generation/hash_with_css_style_keys_spec.rb",
207
+ "spec/dragonfly/generation/image_magick_generator_spec.rb",
208
+ "spec/dragonfly/generation/r_magick_generator_spec.rb",
209
+ "spec/dragonfly/generation/shared_generator_spec.rb",
210
+ "spec/dragonfly/image_magick_utils_spec.rb",
211
+ "spec/dragonfly/job_builder_spec.rb",
212
+ "spec/dragonfly/job_definitions_spec.rb",
213
+ "spec/dragonfly/job_endpoint_spec.rb",
214
+ "spec/dragonfly/job_spec.rb",
215
+ "spec/dragonfly/loggable_spec.rb",
216
+ "spec/dragonfly/middleware_spec.rb",
217
+ "spec/dragonfly/processing/image_magick_processor_spec.rb",
218
+ "spec/dragonfly/processing/r_magick_processor_spec.rb",
219
+ "spec/dragonfly/processing/shared_processing_spec.rb",
220
+ "spec/dragonfly/routed_endpoint_spec.rb",
221
+ "spec/dragonfly/serializer_spec.rb",
222
+ "spec/dragonfly/simple_cache_spec.rb",
223
+ "spec/dragonfly/simple_endpoint_spec.rb",
224
+ "spec/dragonfly/temp_object_spec.rb",
225
+ "spec/image_matchers.rb",
226
+ "spec/simple_matchers.rb",
227
+ "spec/spec_helper.rb"
228
+ ]
229
+
230
+ if s.respond_to? :specification_version then
231
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
232
+ s.specification_version = 3
233
+
234
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
235
+ s.add_development_dependency(%q<aws-s3>, [">= 0"])
236
+ s.add_development_dependency(%q<capybara>, [">= 0"])
237
+ s.add_development_dependency(%q<cucumber>, ["= 0.8.5"])
238
+ s.add_development_dependency(%q<cucumber-rails>, [">= 0"])
239
+ s.add_development_dependency(%q<database_cleaner>, [">= 0.5.0"])
240
+ s.add_development_dependency(%q<jeweler>, ["~> 1.4"])
241
+ s.add_development_dependency(%q<gherkin>, ["= 2.1.4"])
242
+ s.add_development_dependency(%q<mongo>, [">= 0"])
243
+ s.add_development_dependency(%q<nokogiri>, ["= 1.5.0.beta.2"])
244
+ s.add_development_dependency(%q<rack>, ["~> 1.1"])
245
+ s.add_development_dependency(%q<rack-cache>, [">= 0"])
246
+ s.add_development_dependency(%q<rails>, ["= 3.0.3"])
247
+ s.add_development_dependency(%q<rake>, [">= 0"])
248
+ s.add_development_dependency(%q<rspec>, ["~> 1.3"])
249
+ s.add_development_dependency(%q<yard>, [">= 0"])
250
+ s.add_development_dependency(%q<bson_ext>, [">= 0"])
251
+ s.add_development_dependency(%q<rmagick>, ["= 2.12.2"])
252
+ s.add_development_dependency(%q<sqlite3-ruby>, ["= 1.3.0"])
253
+ s.add_runtime_dependency(%q<rack>, [">= 0"])
254
+ else
255
+ s.add_dependency(%q<aws-s3>, [">= 0"])
256
+ s.add_dependency(%q<capybara>, [">= 0"])
257
+ s.add_dependency(%q<cucumber>, ["= 0.8.5"])
258
+ s.add_dependency(%q<cucumber-rails>, [">= 0"])
259
+ s.add_dependency(%q<database_cleaner>, [">= 0.5.0"])
260
+ s.add_dependency(%q<jeweler>, ["~> 1.4"])
261
+ s.add_dependency(%q<gherkin>, ["= 2.1.4"])
262
+ s.add_dependency(%q<mongo>, [">= 0"])
263
+ s.add_dependency(%q<nokogiri>, ["= 1.5.0.beta.2"])
264
+ s.add_dependency(%q<rack>, ["~> 1.1"])
265
+ s.add_dependency(%q<rack-cache>, [">= 0"])
266
+ s.add_dependency(%q<rails>, ["= 3.0.3"])
267
+ s.add_dependency(%q<rake>, [">= 0"])
268
+ s.add_dependency(%q<rspec>, ["~> 1.3"])
269
+ s.add_dependency(%q<yard>, [">= 0"])
270
+ s.add_dependency(%q<bson_ext>, [">= 0"])
271
+ s.add_dependency(%q<rmagick>, ["= 2.12.2"])
272
+ s.add_dependency(%q<sqlite3-ruby>, ["= 1.3.0"])
273
+ s.add_dependency(%q<rack>, [">= 0"])
274
+ end
275
+ else
276
+ s.add_dependency(%q<aws-s3>, [">= 0"])
277
+ s.add_dependency(%q<capybara>, [">= 0"])
278
+ s.add_dependency(%q<cucumber>, ["= 0.8.5"])
279
+ s.add_dependency(%q<cucumber-rails>, [">= 0"])
280
+ s.add_dependency(%q<database_cleaner>, [">= 0.5.0"])
281
+ s.add_dependency(%q<jeweler>, ["~> 1.4"])
282
+ s.add_dependency(%q<gherkin>, ["= 2.1.4"])
283
+ s.add_dependency(%q<mongo>, [">= 0"])
284
+ s.add_dependency(%q<nokogiri>, ["= 1.5.0.beta.2"])
285
+ s.add_dependency(%q<rack>, ["~> 1.1"])
286
+ s.add_dependency(%q<rack-cache>, [">= 0"])
287
+ s.add_dependency(%q<rails>, ["= 3.0.3"])
288
+ s.add_dependency(%q<rake>, [">= 0"])
289
+ s.add_dependency(%q<rspec>, ["~> 1.3"])
290
+ s.add_dependency(%q<yard>, [">= 0"])
291
+ s.add_dependency(%q<bson_ext>, [">= 0"])
292
+ s.add_dependency(%q<rmagick>, ["= 2.12.2"])
293
+ s.add_dependency(%q<sqlite3-ruby>, ["= 1.3.0"])
294
+ s.add_dependency(%q<rack>, [">= 0"])
295
+ end
296
+ end
297
+
@@ -0,0 +1,66 @@
1
+ Analysers
2
+ =========
3
+ Analysers are registered with Dragonfly apps for adding methods to {file:GeneralUsage Job} objects and {file:Models model attachments} such as `width`, `height`, etc.
4
+
5
+ ImageMagick Analyser
6
+ --------------------
7
+ See {file:ImageMagick}.
8
+
9
+ FileCommandAnalyser
10
+ -------------------
11
+ The {Dragonfly::Analysis::FileCommandAnalyser FileCommandAnalyser} is registered by default by the
12
+ {Dragonfly::Config::Rails Rails configuration} used by 'dragonfly/rails/images'.
13
+
14
+ As the name suggests, it uses the UNIX 'file' command.
15
+
16
+ If not already registered:
17
+
18
+ app.analyser.register(Dragonfly::Analysis::FileCommandAnalyser)
19
+
20
+ gives us:
21
+
22
+ image.mime_type # => 'image/png'
23
+
24
+ It doesn't use the filesystem by default (it operates on in-memory strings), but we can make it do so by using
25
+
26
+ app.analyser.register(Dragonfly::Analysis::FileCommandAnalyser) do |a|
27
+ a.use_filesystem = true
28
+ end
29
+
30
+ Custom Analysers
31
+ ----------------
32
+
33
+ To register a single custom analyser:
34
+
35
+ app.analyser.add :wobbliness do |temp_object|
36
+ # can use temp_object.data, temp_object.path, temp_object.file, etc.
37
+ SomeLibrary.assess_wobbliness(temp_object.data)
38
+ end
39
+
40
+ image.wobbliness # => 71
41
+
42
+ You can create a class like the ImageMagick one above, in which case all public methods will be counted as analysis methods.
43
+ Each method takes the temp_object as its argument.
44
+
45
+ class MyAnalyser
46
+
47
+ def coolness(temp_object)
48
+ temp_object.size / 30
49
+ end
50
+
51
+ def uglyness(temp_object)
52
+ `ugly -i #{temp_object.path}`
53
+ end
54
+
55
+ private
56
+
57
+ def my_helper_method
58
+ # do stuff
59
+ end
60
+
61
+ end
62
+
63
+ app.analyser.register(MyAnalyser)
64
+
65
+ image.coolness # => -4.1
66
+ image.uglyness # => "VERY"
@@ -0,0 +1,23 @@
1
+ Caching
2
+ =======
3
+
4
+ Processing and encoding can be an expensive operation. The first time we visit the url,
5
+ the image is processed, and there might be a short delay and getting the response.
6
+
7
+ However, dragonfly apps send `Cache-Control` and `ETag` headers in the response, so we can easily put a caching
8
+ proxy like {http://varnish.projects.linpro.no Varnish}, {http://www.squid-cache.org Squid},
9
+ {http://tomayko.com/src/rack-cache/ Rack::Cache}, etc. in front of the app, so that subsequent requests are served
10
+ super-quickly straight out of the cache.
11
+
12
+ The file 'dragonfly/rails/images' puts Rack::Cache in front of Dragonfly by default, but for better performance
13
+ you may wish to look into something like Varnish.
14
+
15
+ Given a dragonfly app
16
+
17
+ app = Dragonfly[:images]
18
+
19
+ You can configure the 'Cache-Control' header with
20
+
21
+ app.cache_duration = 3600*24*365*3 # time in seconds
22
+
23
+ For a well-written discussion of Cache-Control and ETag headers, see {http://tomayko.com/writings/things-caches-do}.