fog-dragonfly 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.specopts +2 -0
- data/.yardopts +23 -0
- data/Gemfile +23 -0
- data/Gemfile.rails.2.3.5 +14 -0
- data/History.md +266 -0
- data/LICENSE +20 -0
- data/README.md +88 -0
- data/Rakefile +92 -0
- data/VERSION +1 -0
- data/config.ru +13 -0
- data/docs.watchr +1 -0
- data/dragonfly.gemspec +293 -0
- data/extra_docs/Analysers.md +108 -0
- data/extra_docs/Caching.md +23 -0
- data/extra_docs/Configuration.md +138 -0
- data/extra_docs/DataStorage.md +136 -0
- data/extra_docs/Encoding.md +96 -0
- data/extra_docs/GeneralUsage.md +121 -0
- data/extra_docs/Generators.md +102 -0
- data/extra_docs/Heroku.md +50 -0
- data/extra_docs/Index.md +36 -0
- data/extra_docs/MimeTypes.md +40 -0
- data/extra_docs/Models.md +266 -0
- data/extra_docs/Mongo.md +45 -0
- data/extra_docs/Processing.md +130 -0
- data/extra_docs/Rack.md +52 -0
- data/extra_docs/Rails2.md +55 -0
- data/extra_docs/Rails3.md +62 -0
- data/extra_docs/Sinatra.md +25 -0
- data/extra_docs/URLs.md +169 -0
- data/features/3.0.3.feature +8 -0
- data/features/images.feature +47 -0
- data/features/no_processing.feature +14 -0
- data/features/rails_2.3.5.feature +7 -0
- data/features/steps/common_steps.rb +8 -0
- data/features/steps/dragonfly_steps.rb +66 -0
- data/features/steps/rails_steps.rb +39 -0
- data/features/support/env.rb +40 -0
- data/fixtures/files/app/models/album.rb +3 -0
- data/fixtures/files/app/views/albums/new.html.erb +4 -0
- data/fixtures/files/app/views/albums/show.html.erb +4 -0
- data/fixtures/files/config/initializers/dragonfly.rb +4 -0
- data/fixtures/files/features/manage_album_images.feature +12 -0
- data/fixtures/files/features/step_definitions/image_steps.rb +15 -0
- data/fixtures/files/features/support/paths.rb +15 -0
- data/fixtures/files/features/text_images.feature +7 -0
- data/fixtures/rails_2.3.5/template.rb +10 -0
- data/fixtures/rails_3.0.3/template.rb +20 -0
- data/irbrc.rb +17 -0
- data/lib/dragonfly.rb +45 -0
- data/lib/dragonfly/active_model_extensions.rb +13 -0
- data/lib/dragonfly/active_model_extensions/attachment.rb +169 -0
- data/lib/dragonfly/active_model_extensions/class_methods.rb +45 -0
- data/lib/dragonfly/active_model_extensions/instance_methods.rb +28 -0
- data/lib/dragonfly/active_model_extensions/validations.rb +37 -0
- data/lib/dragonfly/analyser.rb +59 -0
- data/lib/dragonfly/analysis/file_command_analyser.rb +32 -0
- data/lib/dragonfly/analysis/image_magick_analyser.rb +47 -0
- data/lib/dragonfly/analysis/r_magick_analyser.rb +63 -0
- data/lib/dragonfly/app.rb +182 -0
- data/lib/dragonfly/config/heroku.rb +19 -0
- data/lib/dragonfly/config/image_magick.rb +41 -0
- data/lib/dragonfly/config/r_magick.rb +46 -0
- data/lib/dragonfly/config/rails.rb +17 -0
- data/lib/dragonfly/configurable.rb +119 -0
- data/lib/dragonfly/core_ext/object.rb +8 -0
- data/lib/dragonfly/core_ext/string.rb +9 -0
- data/lib/dragonfly/core_ext/symbol.rb +9 -0
- data/lib/dragonfly/data_storage.rb +9 -0
- data/lib/dragonfly/data_storage/file_data_store.rb +114 -0
- data/lib/dragonfly/data_storage/mongo_data_store.rb +82 -0
- data/lib/dragonfly/data_storage/s3data_store.rb +115 -0
- data/lib/dragonfly/encoder.rb +13 -0
- data/lib/dragonfly/encoding/image_magick_encoder.rb +57 -0
- data/lib/dragonfly/encoding/r_magick_encoder.rb +61 -0
- data/lib/dragonfly/function_manager.rb +69 -0
- data/lib/dragonfly/generation/hash_with_css_style_keys.rb +23 -0
- data/lib/dragonfly/generation/image_magick_generator.rb +140 -0
- data/lib/dragonfly/generation/r_magick_generator.rb +155 -0
- data/lib/dragonfly/generator.rb +9 -0
- data/lib/dragonfly/image_magick_utils.rb +81 -0
- data/lib/dragonfly/job.rb +371 -0
- data/lib/dragonfly/job_builder.rb +39 -0
- data/lib/dragonfly/job_definitions.rb +26 -0
- data/lib/dragonfly/job_endpoint.rb +15 -0
- data/lib/dragonfly/loggable.rb +28 -0
- data/lib/dragonfly/middleware.rb +34 -0
- data/lib/dragonfly/processing/image_magick_processor.rb +99 -0
- data/lib/dragonfly/processing/r_magick_processor.rb +126 -0
- data/lib/dragonfly/processor.rb +9 -0
- data/lib/dragonfly/r_magick_utils.rb +48 -0
- data/lib/dragonfly/rails/images.rb +22 -0
- data/lib/dragonfly/response.rb +82 -0
- data/lib/dragonfly/routed_endpoint.rb +40 -0
- data/lib/dragonfly/serializer.rb +32 -0
- data/lib/dragonfly/simple_cache.rb +23 -0
- data/lib/dragonfly/simple_endpoint.rb +63 -0
- data/lib/dragonfly/temp_object.rb +220 -0
- data/samples/beach.png +0 -0
- data/samples/egg.png +0 -0
- data/samples/round.gif +0 -0
- data/samples/sample.docx +0 -0
- data/samples/taj.jpg +0 -0
- data/spec/argument_matchers.rb +19 -0
- data/spec/dragonfly/active_model_extensions/active_model_setup.rb +97 -0
- data/spec/dragonfly/active_model_extensions/active_record_setup.rb +85 -0
- data/spec/dragonfly/active_model_extensions/model_spec.rb +723 -0
- data/spec/dragonfly/active_model_extensions/spec_helper.rb +11 -0
- data/spec/dragonfly/analyser_spec.rb +123 -0
- data/spec/dragonfly/analysis/file_command_analyser_spec.rb +57 -0
- data/spec/dragonfly/analysis/image_magick_analyser_spec.rb +15 -0
- data/spec/dragonfly/analysis/r_magick_analyser_spec.rb +27 -0
- data/spec/dragonfly/analysis/shared_analyser_spec.rb +51 -0
- data/spec/dragonfly/app_spec.rb +280 -0
- data/spec/dragonfly/config/r_magick_spec.rb +25 -0
- data/spec/dragonfly/configurable_spec.rb +220 -0
- data/spec/dragonfly/core_ext/string_spec.rb +17 -0
- data/spec/dragonfly/core_ext/symbol_spec.rb +17 -0
- data/spec/dragonfly/data_storage/data_store_spec.rb +76 -0
- data/spec/dragonfly/data_storage/file_data_store_spec.rb +169 -0
- data/spec/dragonfly/data_storage/mongo_data_store_spec.rb +38 -0
- data/spec/dragonfly/data_storage/s3_data_store_spec.rb +94 -0
- data/spec/dragonfly/deprecation_spec.rb +20 -0
- data/spec/dragonfly/encoding/image_magick_encoder_spec.rb +41 -0
- data/spec/dragonfly/encoding/r_magick_encoder_spec.rb +37 -0
- data/spec/dragonfly/function_manager_spec.rb +154 -0
- data/spec/dragonfly/generation/hash_with_css_style_keys_spec.rb +24 -0
- data/spec/dragonfly/generation/image_magick_generator_spec.rb +12 -0
- data/spec/dragonfly/generation/r_magick_generator_spec.rb +24 -0
- data/spec/dragonfly/generation/shared_generator_spec.rb +91 -0
- data/spec/dragonfly/image_magick_utils_spec.rb +16 -0
- data/spec/dragonfly/job_builder_spec.rb +37 -0
- data/spec/dragonfly/job_definitions_spec.rb +35 -0
- data/spec/dragonfly/job_endpoint_spec.rb +120 -0
- data/spec/dragonfly/job_spec.rb +773 -0
- data/spec/dragonfly/loggable_spec.rb +80 -0
- data/spec/dragonfly/middleware_spec.rb +68 -0
- data/spec/dragonfly/processing/image_magick_processor_spec.rb +29 -0
- data/spec/dragonfly/processing/r_magick_processor_spec.rb +26 -0
- data/spec/dragonfly/processing/shared_processing_spec.rb +215 -0
- data/spec/dragonfly/routed_endpoint_spec.rb +48 -0
- data/spec/dragonfly/serializer_spec.rb +61 -0
- data/spec/dragonfly/simple_cache_spec.rb +27 -0
- data/spec/dragonfly/simple_endpoint_spec.rb +89 -0
- data/spec/dragonfly/temp_object_spec.rb +352 -0
- data/spec/image_matchers.rb +47 -0
- data/spec/simple_matchers.rb +44 -0
- data/spec/spec_helper.rb +58 -0
- data/yard/handlers/configurable_attr_handler.rb +38 -0
- data/yard/setup.rb +15 -0
- data/yard/templates/default/fulldoc/html/css/common.css +107 -0
- data/yard/templates/default/layout/html/layout.erb +87 -0
- data/yard/templates/default/module/html/configuration_summary.erb +31 -0
- data/yard/templates/default/module/setup.rb +17 -0
- metadata +550 -0
data/VERSION
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.8.1
|
data/config.ru
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
require 'rubygems'
|
|
2
|
+
require 'rack/cache'
|
|
3
|
+
require File.dirname(__FILE__) + '/lib/dragonfly'
|
|
4
|
+
|
|
5
|
+
APP = Dragonfly[:images].configure_with(:imagemagick) do |c|
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
use Rack::Cache,
|
|
9
|
+
:verbose => true,
|
|
10
|
+
:metastore => 'file:/var/cache/rack/meta',
|
|
11
|
+
:entitystore => 'file:/var/cache/rack/body'
|
|
12
|
+
|
|
13
|
+
run APP
|
data/docs.watchr
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
watch('lib/.*\.rb|yard/.*|extra_docs/.*') {|md| system("rake yard:changed") }
|
data/dragonfly.gemspec
ADDED
|
@@ -0,0 +1,293 @@
|
|
|
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.1"
|
|
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{2010-11-22}
|
|
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/object.rb",
|
|
85
|
+
"lib/dragonfly/core_ext/string.rb",
|
|
86
|
+
"lib/dragonfly/core_ext/symbol.rb",
|
|
87
|
+
"lib/dragonfly/data_storage.rb",
|
|
88
|
+
"lib/dragonfly/data_storage/file_data_store.rb",
|
|
89
|
+
"lib/dragonfly/data_storage/mongo_data_store.rb",
|
|
90
|
+
"lib/dragonfly/data_storage/s3data_store.rb",
|
|
91
|
+
"lib/dragonfly/encoder.rb",
|
|
92
|
+
"lib/dragonfly/encoding/image_magick_encoder.rb",
|
|
93
|
+
"lib/dragonfly/encoding/r_magick_encoder.rb",
|
|
94
|
+
"lib/dragonfly/function_manager.rb",
|
|
95
|
+
"lib/dragonfly/generation/hash_with_css_style_keys.rb",
|
|
96
|
+
"lib/dragonfly/generation/image_magick_generator.rb",
|
|
97
|
+
"lib/dragonfly/generation/r_magick_generator.rb",
|
|
98
|
+
"lib/dragonfly/generator.rb",
|
|
99
|
+
"lib/dragonfly/image_magick_utils.rb",
|
|
100
|
+
"lib/dragonfly/job.rb",
|
|
101
|
+
"lib/dragonfly/job_builder.rb",
|
|
102
|
+
"lib/dragonfly/job_definitions.rb",
|
|
103
|
+
"lib/dragonfly/job_endpoint.rb",
|
|
104
|
+
"lib/dragonfly/loggable.rb",
|
|
105
|
+
"lib/dragonfly/middleware.rb",
|
|
106
|
+
"lib/dragonfly/processing/image_magick_processor.rb",
|
|
107
|
+
"lib/dragonfly/processing/r_magick_processor.rb",
|
|
108
|
+
"lib/dragonfly/processor.rb",
|
|
109
|
+
"lib/dragonfly/r_magick_utils.rb",
|
|
110
|
+
"lib/dragonfly/rails/images.rb",
|
|
111
|
+
"lib/dragonfly/response.rb",
|
|
112
|
+
"lib/dragonfly/routed_endpoint.rb",
|
|
113
|
+
"lib/dragonfly/serializer.rb",
|
|
114
|
+
"lib/dragonfly/simple_cache.rb",
|
|
115
|
+
"lib/dragonfly/simple_endpoint.rb",
|
|
116
|
+
"lib/dragonfly/temp_object.rb",
|
|
117
|
+
"samples/beach.png",
|
|
118
|
+
"samples/egg.png",
|
|
119
|
+
"samples/round.gif",
|
|
120
|
+
"samples/sample.docx",
|
|
121
|
+
"samples/taj.jpg",
|
|
122
|
+
"spec/argument_matchers.rb",
|
|
123
|
+
"spec/dragonfly/active_model_extensions/active_model_setup.rb",
|
|
124
|
+
"spec/dragonfly/active_model_extensions/active_record_setup.rb",
|
|
125
|
+
"spec/dragonfly/active_model_extensions/model_spec.rb",
|
|
126
|
+
"spec/dragonfly/active_model_extensions/spec_helper.rb",
|
|
127
|
+
"spec/dragonfly/analyser_spec.rb",
|
|
128
|
+
"spec/dragonfly/analysis/file_command_analyser_spec.rb",
|
|
129
|
+
"spec/dragonfly/analysis/image_magick_analyser_spec.rb",
|
|
130
|
+
"spec/dragonfly/analysis/r_magick_analyser_spec.rb",
|
|
131
|
+
"spec/dragonfly/analysis/shared_analyser_spec.rb",
|
|
132
|
+
"spec/dragonfly/app_spec.rb",
|
|
133
|
+
"spec/dragonfly/config/r_magick_spec.rb",
|
|
134
|
+
"spec/dragonfly/configurable_spec.rb",
|
|
135
|
+
"spec/dragonfly/core_ext/string_spec.rb",
|
|
136
|
+
"spec/dragonfly/core_ext/symbol_spec.rb",
|
|
137
|
+
"spec/dragonfly/data_storage/data_store_spec.rb",
|
|
138
|
+
"spec/dragonfly/data_storage/file_data_store_spec.rb",
|
|
139
|
+
"spec/dragonfly/data_storage/mongo_data_store_spec.rb",
|
|
140
|
+
"spec/dragonfly/data_storage/s3_data_store_spec.rb",
|
|
141
|
+
"spec/dragonfly/deprecation_spec.rb",
|
|
142
|
+
"spec/dragonfly/encoding/image_magick_encoder_spec.rb",
|
|
143
|
+
"spec/dragonfly/encoding/r_magick_encoder_spec.rb",
|
|
144
|
+
"spec/dragonfly/function_manager_spec.rb",
|
|
145
|
+
"spec/dragonfly/generation/hash_with_css_style_keys_spec.rb",
|
|
146
|
+
"spec/dragonfly/generation/image_magick_generator_spec.rb",
|
|
147
|
+
"spec/dragonfly/generation/r_magick_generator_spec.rb",
|
|
148
|
+
"spec/dragonfly/generation/shared_generator_spec.rb",
|
|
149
|
+
"spec/dragonfly/image_magick_utils_spec.rb",
|
|
150
|
+
"spec/dragonfly/job_builder_spec.rb",
|
|
151
|
+
"spec/dragonfly/job_definitions_spec.rb",
|
|
152
|
+
"spec/dragonfly/job_endpoint_spec.rb",
|
|
153
|
+
"spec/dragonfly/job_spec.rb",
|
|
154
|
+
"spec/dragonfly/loggable_spec.rb",
|
|
155
|
+
"spec/dragonfly/middleware_spec.rb",
|
|
156
|
+
"spec/dragonfly/processing/image_magick_processor_spec.rb",
|
|
157
|
+
"spec/dragonfly/processing/r_magick_processor_spec.rb",
|
|
158
|
+
"spec/dragonfly/processing/shared_processing_spec.rb",
|
|
159
|
+
"spec/dragonfly/routed_endpoint_spec.rb",
|
|
160
|
+
"spec/dragonfly/serializer_spec.rb",
|
|
161
|
+
"spec/dragonfly/simple_cache_spec.rb",
|
|
162
|
+
"spec/dragonfly/simple_endpoint_spec.rb",
|
|
163
|
+
"spec/dragonfly/temp_object_spec.rb",
|
|
164
|
+
"spec/image_matchers.rb",
|
|
165
|
+
"spec/simple_matchers.rb",
|
|
166
|
+
"spec/spec_helper.rb",
|
|
167
|
+
"yard/handlers/configurable_attr_handler.rb",
|
|
168
|
+
"yard/setup.rb",
|
|
169
|
+
"yard/templates/default/fulldoc/html/css/common.css",
|
|
170
|
+
"yard/templates/default/layout/html/layout.erb",
|
|
171
|
+
"yard/templates/default/module/html/configuration_summary.erb",
|
|
172
|
+
"yard/templates/default/module/setup.rb"
|
|
173
|
+
]
|
|
174
|
+
s.homepage = %q{http://github.com/markevans/dragonfly}
|
|
175
|
+
s.require_paths = ["lib"]
|
|
176
|
+
s.rubygems_version = %q{1.3.7}
|
|
177
|
+
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.}
|
|
178
|
+
s.test_files = [
|
|
179
|
+
"spec/argument_matchers.rb",
|
|
180
|
+
"spec/dragonfly/active_model_extensions/active_model_setup.rb",
|
|
181
|
+
"spec/dragonfly/active_model_extensions/active_record_setup.rb",
|
|
182
|
+
"spec/dragonfly/active_model_extensions/model_spec.rb",
|
|
183
|
+
"spec/dragonfly/active_model_extensions/spec_helper.rb",
|
|
184
|
+
"spec/dragonfly/analyser_spec.rb",
|
|
185
|
+
"spec/dragonfly/analysis/file_command_analyser_spec.rb",
|
|
186
|
+
"spec/dragonfly/analysis/image_magick_analyser_spec.rb",
|
|
187
|
+
"spec/dragonfly/analysis/r_magick_analyser_spec.rb",
|
|
188
|
+
"spec/dragonfly/analysis/shared_analyser_spec.rb",
|
|
189
|
+
"spec/dragonfly/app_spec.rb",
|
|
190
|
+
"spec/dragonfly/config/r_magick_spec.rb",
|
|
191
|
+
"spec/dragonfly/configurable_spec.rb",
|
|
192
|
+
"spec/dragonfly/core_ext/string_spec.rb",
|
|
193
|
+
"spec/dragonfly/core_ext/symbol_spec.rb",
|
|
194
|
+
"spec/dragonfly/data_storage/data_store_spec.rb",
|
|
195
|
+
"spec/dragonfly/data_storage/file_data_store_spec.rb",
|
|
196
|
+
"spec/dragonfly/data_storage/mongo_data_store_spec.rb",
|
|
197
|
+
"spec/dragonfly/data_storage/s3_data_store_spec.rb",
|
|
198
|
+
"spec/dragonfly/deprecation_spec.rb",
|
|
199
|
+
"spec/dragonfly/encoding/image_magick_encoder_spec.rb",
|
|
200
|
+
"spec/dragonfly/encoding/r_magick_encoder_spec.rb",
|
|
201
|
+
"spec/dragonfly/function_manager_spec.rb",
|
|
202
|
+
"spec/dragonfly/generation/hash_with_css_style_keys_spec.rb",
|
|
203
|
+
"spec/dragonfly/generation/image_magick_generator_spec.rb",
|
|
204
|
+
"spec/dragonfly/generation/r_magick_generator_spec.rb",
|
|
205
|
+
"spec/dragonfly/generation/shared_generator_spec.rb",
|
|
206
|
+
"spec/dragonfly/image_magick_utils_spec.rb",
|
|
207
|
+
"spec/dragonfly/job_builder_spec.rb",
|
|
208
|
+
"spec/dragonfly/job_definitions_spec.rb",
|
|
209
|
+
"spec/dragonfly/job_endpoint_spec.rb",
|
|
210
|
+
"spec/dragonfly/job_spec.rb",
|
|
211
|
+
"spec/dragonfly/loggable_spec.rb",
|
|
212
|
+
"spec/dragonfly/middleware_spec.rb",
|
|
213
|
+
"spec/dragonfly/processing/image_magick_processor_spec.rb",
|
|
214
|
+
"spec/dragonfly/processing/r_magick_processor_spec.rb",
|
|
215
|
+
"spec/dragonfly/processing/shared_processing_spec.rb",
|
|
216
|
+
"spec/dragonfly/routed_endpoint_spec.rb",
|
|
217
|
+
"spec/dragonfly/serializer_spec.rb",
|
|
218
|
+
"spec/dragonfly/simple_cache_spec.rb",
|
|
219
|
+
"spec/dragonfly/simple_endpoint_spec.rb",
|
|
220
|
+
"spec/dragonfly/temp_object_spec.rb",
|
|
221
|
+
"spec/image_matchers.rb",
|
|
222
|
+
"spec/simple_matchers.rb",
|
|
223
|
+
"spec/spec_helper.rb"
|
|
224
|
+
]
|
|
225
|
+
|
|
226
|
+
if s.respond_to? :specification_version then
|
|
227
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
|
228
|
+
s.specification_version = 3
|
|
229
|
+
|
|
230
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
|
231
|
+
s.add_development_dependency(%q<aws-s3>, [">= 0"])
|
|
232
|
+
s.add_development_dependency(%q<bson_ext>, [">= 0"])
|
|
233
|
+
s.add_development_dependency(%q<capybara>, [">= 0"])
|
|
234
|
+
s.add_development_dependency(%q<cucumber>, ["= 0.8.5"])
|
|
235
|
+
s.add_development_dependency(%q<cucumber-rails>, [">= 0"])
|
|
236
|
+
s.add_development_dependency(%q<database_cleaner>, [">= 0.5.0"])
|
|
237
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.4"])
|
|
238
|
+
s.add_development_dependency(%q<gherkin>, ["= 2.1.4"])
|
|
239
|
+
s.add_development_dependency(%q<mongo>, [">= 0"])
|
|
240
|
+
s.add_development_dependency(%q<nokogiri>, ["= 1.5.0.beta.2"])
|
|
241
|
+
s.add_development_dependency(%q<rack>, ["~> 1.1"])
|
|
242
|
+
s.add_development_dependency(%q<rack-cache>, [">= 0"])
|
|
243
|
+
s.add_development_dependency(%q<rails>, ["= 3.0.3"])
|
|
244
|
+
s.add_development_dependency(%q<rake>, [">= 0"])
|
|
245
|
+
s.add_development_dependency(%q<rmagick>, ["= 2.12.2"])
|
|
246
|
+
s.add_development_dependency(%q<rspec>, ["~> 1.3"])
|
|
247
|
+
s.add_development_dependency(%q<sqlite3-ruby>, ["= 1.3.0"])
|
|
248
|
+
s.add_development_dependency(%q<yard>, [">= 0"])
|
|
249
|
+
s.add_runtime_dependency(%q<rack>, [">= 0"])
|
|
250
|
+
else
|
|
251
|
+
s.add_dependency(%q<aws-s3>, [">= 0"])
|
|
252
|
+
s.add_dependency(%q<bson_ext>, [">= 0"])
|
|
253
|
+
s.add_dependency(%q<capybara>, [">= 0"])
|
|
254
|
+
s.add_dependency(%q<cucumber>, ["= 0.8.5"])
|
|
255
|
+
s.add_dependency(%q<cucumber-rails>, [">= 0"])
|
|
256
|
+
s.add_dependency(%q<database_cleaner>, [">= 0.5.0"])
|
|
257
|
+
s.add_dependency(%q<jeweler>, ["~> 1.4"])
|
|
258
|
+
s.add_dependency(%q<gherkin>, ["= 2.1.4"])
|
|
259
|
+
s.add_dependency(%q<mongo>, [">= 0"])
|
|
260
|
+
s.add_dependency(%q<nokogiri>, ["= 1.5.0.beta.2"])
|
|
261
|
+
s.add_dependency(%q<rack>, ["~> 1.1"])
|
|
262
|
+
s.add_dependency(%q<rack-cache>, [">= 0"])
|
|
263
|
+
s.add_dependency(%q<rails>, ["= 3.0.3"])
|
|
264
|
+
s.add_dependency(%q<rake>, [">= 0"])
|
|
265
|
+
s.add_dependency(%q<rmagick>, ["= 2.12.2"])
|
|
266
|
+
s.add_dependency(%q<rspec>, ["~> 1.3"])
|
|
267
|
+
s.add_dependency(%q<sqlite3-ruby>, ["= 1.3.0"])
|
|
268
|
+
s.add_dependency(%q<yard>, [">= 0"])
|
|
269
|
+
s.add_dependency(%q<rack>, [">= 0"])
|
|
270
|
+
end
|
|
271
|
+
else
|
|
272
|
+
s.add_dependency(%q<aws-s3>, [">= 0"])
|
|
273
|
+
s.add_dependency(%q<bson_ext>, [">= 0"])
|
|
274
|
+
s.add_dependency(%q<capybara>, [">= 0"])
|
|
275
|
+
s.add_dependency(%q<cucumber>, ["= 0.8.5"])
|
|
276
|
+
s.add_dependency(%q<cucumber-rails>, [">= 0"])
|
|
277
|
+
s.add_dependency(%q<database_cleaner>, [">= 0.5.0"])
|
|
278
|
+
s.add_dependency(%q<jeweler>, ["~> 1.4"])
|
|
279
|
+
s.add_dependency(%q<gherkin>, ["= 2.1.4"])
|
|
280
|
+
s.add_dependency(%q<mongo>, [">= 0"])
|
|
281
|
+
s.add_dependency(%q<nokogiri>, ["= 1.5.0.beta.2"])
|
|
282
|
+
s.add_dependency(%q<rack>, ["~> 1.1"])
|
|
283
|
+
s.add_dependency(%q<rack-cache>, [">= 0"])
|
|
284
|
+
s.add_dependency(%q<rails>, ["= 3.0.3"])
|
|
285
|
+
s.add_dependency(%q<rake>, [">= 0"])
|
|
286
|
+
s.add_dependency(%q<rmagick>, ["= 2.12.2"])
|
|
287
|
+
s.add_dependency(%q<rspec>, ["~> 1.3"])
|
|
288
|
+
s.add_dependency(%q<sqlite3-ruby>, ["= 1.3.0"])
|
|
289
|
+
s.add_dependency(%q<yard>, [">= 0"])
|
|
290
|
+
s.add_dependency(%q<rack>, [">= 0"])
|
|
291
|
+
end
|
|
292
|
+
end
|
|
293
|
+
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
Analysers
|
|
2
|
+
=========
|
|
3
|
+
|
|
4
|
+
Analysing data for things like width, mime_type, etc. come under the banner of Analysis.
|
|
5
|
+
|
|
6
|
+
You can register as many analysers as you like.
|
|
7
|
+
|
|
8
|
+
Let's say we have a Dragonfly app
|
|
9
|
+
|
|
10
|
+
app = Dragonfly[:images]
|
|
11
|
+
|
|
12
|
+
and an image object (actually a {Dragonfly::Job Job} object)...
|
|
13
|
+
|
|
14
|
+
image = app.fetch('some/uid')
|
|
15
|
+
|
|
16
|
+
...OR a Dragonfly model accessor...
|
|
17
|
+
|
|
18
|
+
image = @album.cover_image
|
|
19
|
+
|
|
20
|
+
We can analyse it using any analysis methods that have been registered with the analyser.
|
|
21
|
+
|
|
22
|
+
ImageMagickAnalyser
|
|
23
|
+
-------------------
|
|
24
|
+
The {Dragonfly::Analysis::ImageMagickAnalyser ImageMagickAnalyser} is registered by default by the
|
|
25
|
+
{Dragonfly::Config::ImageMagick ImageMagick configuration} used by 'dragonfly/rails/images'.
|
|
26
|
+
|
|
27
|
+
If not already registered:
|
|
28
|
+
|
|
29
|
+
app.analyser.register(Dragonfly::Analysis::ImageMagickAnalyser)
|
|
30
|
+
|
|
31
|
+
gives us these methods:
|
|
32
|
+
|
|
33
|
+
image.width # => 280
|
|
34
|
+
image.height # => 355
|
|
35
|
+
image.aspect_ratio # => 0.788732394366197
|
|
36
|
+
image.portrait? # => true
|
|
37
|
+
image.landscape? # => false
|
|
38
|
+
image.depth # => 8
|
|
39
|
+
image.number_of_colours # => 34703
|
|
40
|
+
image.format # => :png
|
|
41
|
+
|
|
42
|
+
RMagickAnalyser
|
|
43
|
+
-------------------
|
|
44
|
+
The {Dragonfly::Analysis::RMagickAnalyser RMagickAnalyser} uses the {http://rmagick.rubyforge.org RMagick} library and provides methods `width`, `height`, `aspect_ratio`,
|
|
45
|
+
`portrait?`, `landscape?`, `depth`, `number_of_colours` and `format` like the ImageMagickAnalyser.
|
|
46
|
+
|
|
47
|
+
You can tell it not to use the file system when registering it
|
|
48
|
+
|
|
49
|
+
app.analyser.register(Dragonfly::Analysis::RMagickAnalyser){|a| a.use_filesystem = false }
|
|
50
|
+
|
|
51
|
+
FileCommandAnalyser
|
|
52
|
+
-------------------
|
|
53
|
+
The {Dragonfly::Analysis::FileCommandAnalyser FileCommandAnalyser} is registered by default by the
|
|
54
|
+
{Dragonfly::Config::Rails Rails configuration} used by 'dragonfly/rails/images'.
|
|
55
|
+
|
|
56
|
+
As the name suggests, it uses the UNIX 'file' command.
|
|
57
|
+
|
|
58
|
+
If not already registered:
|
|
59
|
+
|
|
60
|
+
app.analyser.register(Dragonfly::Analysis::FileCommandAnalyser)
|
|
61
|
+
|
|
62
|
+
gives us:
|
|
63
|
+
|
|
64
|
+
image.mime_type # => 'image/png'
|
|
65
|
+
|
|
66
|
+
It doesn't use the filesystem by default (it operates on in-memory strings), but we can make it do so by using
|
|
67
|
+
|
|
68
|
+
app.analyser.register(Dragonfly::Analysis::FileCommandAnalyser) do |a|
|
|
69
|
+
a.use_filesystem = true
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
Custom Analysers
|
|
73
|
+
----------------
|
|
74
|
+
|
|
75
|
+
To register a single custom analyser:
|
|
76
|
+
|
|
77
|
+
app.analyser.add :wobbliness do |temp_object|
|
|
78
|
+
# can use temp_object.data, temp_object.path, temp_object.file, etc.
|
|
79
|
+
SomeLibrary.assess_wobbliness(temp_object.data)
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
image.wobbliness # => 71
|
|
83
|
+
|
|
84
|
+
You can create a class like the ImageMagick one above, in which case all public methods will be counted as analysis methods.
|
|
85
|
+
Each method takes the temp_object as its argument.
|
|
86
|
+
|
|
87
|
+
class MyAnalyser
|
|
88
|
+
|
|
89
|
+
def coolness(temp_object)
|
|
90
|
+
temp_object.size / 30
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def uglyness(temp_object)
|
|
94
|
+
`ugly -i #{temp_object.path}`
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
private
|
|
98
|
+
|
|
99
|
+
def my_helper_method
|
|
100
|
+
# do stuff
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
app.analyser.register(MyAnalyser)
|
|
106
|
+
|
|
107
|
+
image.coolness # => -4.1
|
|
108
|
+
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}.
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
Configuration
|
|
2
|
+
=============
|
|
3
|
+
|
|
4
|
+
Given a Dragonfly app
|
|
5
|
+
|
|
6
|
+
app = Dragonfly[:app_name]
|
|
7
|
+
|
|
8
|
+
Configuration can either be done like so...
|
|
9
|
+
|
|
10
|
+
app.configure do |c|
|
|
11
|
+
c.url_path_prefix = '/media'
|
|
12
|
+
# ...
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
...or directly like so...
|
|
16
|
+
|
|
17
|
+
app.url_path_prefix = '/media'
|
|
18
|
+
|
|
19
|
+
The defaults should be fairly sensible, but you can tweak a number of things if you wish.
|
|
20
|
+
Here is an example of an app with all attributes configured:
|
|
21
|
+
|
|
22
|
+
app.configure do |c|
|
|
23
|
+
c.datastore = SomeCustomDataStore.new :egg => 'head' # defaults to FileDataStore
|
|
24
|
+
|
|
25
|
+
c.cache_duration = 3600*24*365*2 # defaults to 1 year # (1 year)
|
|
26
|
+
c.fallback_mime_type = 'something/mental' # defaults to application/octet-stream
|
|
27
|
+
c.log = Logger.new($stdout) # defaults to Logger.new('/var/tmp/dragonfly.log')
|
|
28
|
+
c.infer_mime_type_from_file_ext = false # defaults to true
|
|
29
|
+
|
|
30
|
+
c.url_path_prefix = '/images' # defaults to nil
|
|
31
|
+
c.url_host = 'http://some.domain.com:4000' # defaults to nil
|
|
32
|
+
c.url_suffix = '.jpg' # defaults to nil - has no effect other than change the url
|
|
33
|
+
|
|
34
|
+
c.content_filename = proc{|job, request| # defaults to the original name, with modified ext if encoded
|
|
35
|
+
"file.#{job.ext}"
|
|
36
|
+
}
|
|
37
|
+
c.content_disposition = :attachment # defaults to nil (use the browser default)
|
|
38
|
+
|
|
39
|
+
c.protect_from_dos_attacks = true # defaults to false - adds a SHA parameter on the end of urls
|
|
40
|
+
c.secret = 'This is my secret yeh!!' # should set this if concerned about DOS attacks
|
|
41
|
+
|
|
42
|
+
c.analyser.register(MyAnalyser) # See 'Analysers' for more details
|
|
43
|
+
c.processor.register(MyProcessor, :type => :fig) # See 'Processing' for more details
|
|
44
|
+
c.encoder.register(MyEncoder) do |e| # See 'Encoding' for more details
|
|
45
|
+
e.some_value = 'geg'
|
|
46
|
+
end
|
|
47
|
+
c.generator.register(MyGenerator) # See 'Generators' for more details
|
|
48
|
+
|
|
49
|
+
c.register_mime_type(:egg, 'fried/egg') # See 'MimeTypes' for more details
|
|
50
|
+
|
|
51
|
+
c.job :black_and_white do |size| # Job shortcut - lets you do image.black_and_white('30x30')
|
|
52
|
+
process :greyscale
|
|
53
|
+
process :thumb, size
|
|
54
|
+
encode :gif
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
Where is configuration done?
|
|
59
|
+
----------------------------
|
|
60
|
+
In Rails, it should be done in an initializer, e.g. 'config/initializers/dragonfly.rb'.
|
|
61
|
+
Otherwise it should be done anywhere where general setup is done, early on.
|
|
62
|
+
|
|
63
|
+
Saved configurations
|
|
64
|
+
====================
|
|
65
|
+
Saved configurations are useful if you often configure the app the same way.
|
|
66
|
+
There are a number that are provided with Dragonfly:
|
|
67
|
+
|
|
68
|
+
ImageMagick
|
|
69
|
+
-----------
|
|
70
|
+
|
|
71
|
+
app.configure_with(:imagemagick)
|
|
72
|
+
|
|
73
|
+
The {Dragonfly::Config::ImageMagick ImageMagick configuration} registers the app with the {Dragonfly::Analysis::ImageMagickAnalyser ImageMagickAnalyser}, {Dragonfly::Processing::ImageMagickProcessor ImageMagickProcessor},
|
|
74
|
+
{Dragonfly::Encoding::ImageMagickEncoder ImageMagickEncoder} and {Dragonfly::Generation::ImageMagickGenerator ImageMagickGenerator}, and adds the 'job shortcuts'
|
|
75
|
+
`thumb`, `jpg`, `png`, `gif` and `convert`.
|
|
76
|
+
|
|
77
|
+
The file 'dragonfly/rails/images' does this for you.
|
|
78
|
+
|
|
79
|
+
The processor, analyser, encoder and generator pass data around using tempfiles.
|
|
80
|
+
|
|
81
|
+
RMagick
|
|
82
|
+
-------
|
|
83
|
+
|
|
84
|
+
app.configure_with(:rmagick)
|
|
85
|
+
|
|
86
|
+
The {Dragonfly::Config::RMagick RMagick configuration} registers the app with the {Dragonfly::Analysis::RMagickAnalyser RMagickAnalyser}, {Dragonfly::Processing::RMagickProcessor RMagickProcessor},
|
|
87
|
+
{Dragonfly::Encoding::RMagickEncoder RMagickEncoder} and {Dragonfly::Generation::RMagickGenerator RMagickGenerator}, and adds the 'job shortcuts'
|
|
88
|
+
`thumb`, `jpg`, `png` and `gif`.
|
|
89
|
+
|
|
90
|
+
By default the processor, analyser, encoder and generator pass data around using tempfiles.
|
|
91
|
+
You can make it pass data around using in-memory strings using
|
|
92
|
+
|
|
93
|
+
app.configure_with(:rmagick, :use_filesystem => false)
|
|
94
|
+
|
|
95
|
+
Rails
|
|
96
|
+
-----
|
|
97
|
+
|
|
98
|
+
app.configure_with(:rails)
|
|
99
|
+
|
|
100
|
+
The {Dragonfly::Config::Rails Rails configuration} points the log to the Rails logger, configures the file data store root path, sets the url_path_prefix to /media, and
|
|
101
|
+
registers the {Dragonfly::Analysis::FileCommandAnalyser FileCommandAnalyser} for helping with mime_type validations.
|
|
102
|
+
|
|
103
|
+
The file 'dragonfly/rails/images' does this for you.
|
|
104
|
+
|
|
105
|
+
Heroku
|
|
106
|
+
------
|
|
107
|
+
|
|
108
|
+
app.configure_with(:heroku, 's3_bucket_name')
|
|
109
|
+
|
|
110
|
+
The {Dragonfly::Config::Heroku Heroku configuration} configures it to use the {Dragonfly::DataStorage::S3DataStore}, using Heroku's config attributes.
|
|
111
|
+
See {file:Heroku} for more info.
|
|
112
|
+
|
|
113
|
+
Custom Saved Configuration
|
|
114
|
+
--------------------------
|
|
115
|
+
You can create your own saved configuration with any object that responds to 'apply_configuration':
|
|
116
|
+
|
|
117
|
+
module MyConfiguration
|
|
118
|
+
|
|
119
|
+
def self.apply_configuration(app, *args)
|
|
120
|
+
app.configure do |c|
|
|
121
|
+
c.url_path_prefix = '/hello/beans'
|
|
122
|
+
c.processor.register(MyProcessor)
|
|
123
|
+
# ...
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
Then to configure:
|
|
130
|
+
|
|
131
|
+
app.configure_with(MyConfiguration, :any_other => :args) # other args get passed through to apply_configuration
|
|
132
|
+
|
|
133
|
+
You can also carry on configuring by passing a block
|
|
134
|
+
|
|
135
|
+
app.configure_with(MyConfiguration) do |c|
|
|
136
|
+
c.any_extra = :config_here
|
|
137
|
+
# ...
|
|
138
|
+
end
|