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
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --colour
@@ -0,0 +1,24 @@
1
+ --main extra_docs/Index.md
2
+ -e ./yard/setup.rb
3
+ -
4
+ README.md
5
+ extra_docs/GeneralUsage.md
6
+ extra_docs/Rails2.md
7
+ extra_docs/Rails3.md
8
+ extra_docs/ImageMagick.md
9
+ extra_docs/Rack.md
10
+ extra_docs/Sinatra.md
11
+ extra_docs/Heroku.md
12
+ extra_docs/Mongo.md
13
+ extra_docs/Models.md
14
+ extra_docs/DataStorage.md
15
+ extra_docs/Analysers.md
16
+ extra_docs/Processing.md
17
+ extra_docs/Encoding.md
18
+ extra_docs/Generators.md
19
+ extra_docs/Configuration.md
20
+ extra_docs/URLs.md
21
+ extra_docs/Caching.md
22
+ extra_docs/MimeTypes.md
23
+ LICENSE
24
+ History.md
data/Gemfile ADDED
@@ -0,0 +1,30 @@
1
+ source :rubygems
2
+
3
+ gem "rack"
4
+
5
+ # These gems are needed for development and testing
6
+ group :development, :test, :cucumber do
7
+ gem 'capybara'
8
+ gem 'cucumber', '~>0.10.0'
9
+ gem 'cucumber-rails', '~>0.3.2'
10
+ gem 'database_cleaner'
11
+ gem 'jeweler', '~> 1.5.2'
12
+ gem 'fog'
13
+ gem 'mongo'
14
+ gem 'couchrest', '~> 1.0'
15
+ gem 'rack-cache'
16
+ gem 'rails', '3.0.5', :require => nil
17
+ gem 'rake'
18
+ gem 'rspec', '~> 2.5'
19
+ gem 'webmock'
20
+ gem 'yard'
21
+ if RUBY_PLATFORM == "java"
22
+ gem "jdbc-sqlite3"
23
+ gem "activerecord-jdbcsqlite3-adapter"
24
+ gem "jruby-openssl"
25
+ else
26
+ gem 'bluecloth'
27
+ gem 'bson_ext'
28
+ gem 'sqlite3-ruby'
29
+ end
30
+ end
@@ -0,0 +1,323 @@
1
+ 0.9.0 (2011-04-19)
2
+ ==================
3
+ Features
4
+ --------
5
+ - Model accessors are configurable
6
+ - added `after_assign` callback
7
+ - added `after_unassign` callback
8
+ - added `copy_to` for e.g. up-front thumbnailing
9
+ - added `storage_opts` and `storage_xxx`
10
+ - Added model `remove_xxxxx` for using with checkboxes
11
+ - Added model `xxxx_url` for assigning content from a url
12
+ - Added job step `fetch_url`
13
+ - Added `retain` and `retain!` for avoiding multiple uploads when validations fail
14
+ - Added `image?` to imagemagick analyser
15
+ - Added imagemagick `plain` generator
16
+ - Added CouchDataStore that uses a CouchDB as a data storage engine
17
+ - Added `before_serve` callback
18
+ - Made url re-definable with `define_url`
19
+ - `validates_property` can take a proc for the message
20
+ - Saved configs can be registered now so they can be used with `configure_with(:symbol)`
21
+ - Configurable objects can fallback to a parent configuration, so e.g. the server can be configured through the parent app's configure block.
22
+ - Allowed initializing data by using a pathname
23
+ - `convert_command` and `identify_command` can be configured on a per-app basis
24
+ - Added `remote_url` and ability for datastores to form urls
25
+ - Added for File and S3 datastores
26
+ - Models automatically copy magic attributes into meta
27
+ - S3DataStore configurable headers
28
+ - 'dragonfly/rails/images' slightly smarter and added `file_accessor` for more semantic use of non-image attachments
29
+ - Made dragonfly response configurable
30
+ - Mongo datastore can reuse an existing connection/db
31
+ - FileDataStore can be configured not to store meta (save on extra file)
32
+
33
+ Changes
34
+ -------
35
+ - Removed `url_path_prefix` and `url_suffix` in favour of `url_format`
36
+ - Middleware doesn't need mount point argument now
37
+ - Removed support for rails 2.3
38
+ - Removed RMagick support (and extracted into a plugin)
39
+ - ImageMagick processors etc. moved into the ImageMagick namespace
40
+ - moved from aws/s3 -> fog for S3 support
41
+ - Renamed SimpleEndpoint -> Server
42
+ - moved name and meta into Job, simplified, and now they don't cause the job to be applied
43
+ - FileDataStore stores metadata in xxx.meta now, not xxx.extra
44
+
45
+ Fixes
46
+ -----
47
+ - Performance tweaks regarding temp_objects model accessors and job objects
48
+
49
+ 0.8.2 (2010-01-11)
50
+ ==================
51
+ Fixes
52
+ -----
53
+ - Renamed ActiveModel methods like 'attachments' to avoid name clashes
54
+ - Respond properly to HEAD, POST, PUT and DELETE requests
55
+ - Got it working with jRuby and Rubinius
56
+ - Made DOS protection SHA (and ETag) consistent
57
+
58
+ 0.8.1 (2010-11-22)
59
+ ==================
60
+ Fixes
61
+ -----
62
+ Removed runtime dependencies that Jeweler automatically takes from the Gemfile
63
+
64
+ 0.8.0 (2010-11-21)
65
+ ==================
66
+ Features
67
+ --------
68
+ - New ImageMagick generator, processor, encoder and analyser, which are now defaults
69
+ (thanks to Henry Phan for work on this)
70
+
71
+ Fixes
72
+ -----
73
+ - Works with Rails 3.0.2 uploaded files (which has a changed API)
74
+
75
+
76
+ 0.7.7 (2010-10-31)
77
+ ==================
78
+ Features
79
+ --------
80
+ - Added username/password authentication to mongo data store
81
+
82
+ Fixes
83
+ -----
84
+ - Fixes for Windows, inc. tempfile binmode and closing files
85
+ - "IOError: closed stream" fix (hopefully!)
86
+
87
+
88
+ 0.7.6 (2010-09-12)
89
+ ==================
90
+ Features
91
+ --------
92
+ - Added methods for querying job steps, and Job#uid, Job#uid_basename, etc.
93
+ - Added Job#b64_data
94
+ - Added configurable url_suffix
95
+ - Added configurable content_disposition and content_filename
96
+ - Can pass extra GET params to url_for
97
+ - Can manually set uid on FileDataStore and S3DataStore
98
+ (not yet documented because attachments have no way to pass it on yet)
99
+ - Model attachments store meta info about themselves
100
+
101
+ Changes
102
+ -------
103
+ - Configurable module doesn't implicitly call 'call' if attribute set as proc
104
+ - Refactored Endpoint module -> Response object
105
+
106
+ Fixes
107
+ -----
108
+ - Ruby 1.9.2-p0 was raising encoding errors due to Tempfiles not being in binmode
109
+
110
+
111
+ 0.7.5 (2010-09-01)
112
+ ==================
113
+ Changes
114
+ --------
115
+ - RMagick processor, encoder, analyser and generator all use the filesystem now
116
+ They can be configured to use in-memory strings with the use_filesystem config option.
117
+ - Upgraded support from Rails 3.0.0.rc -> Rails.3.0.0
118
+
119
+ 0.7.4 (2010-08-28)
120
+ ==================
121
+ Features
122
+ --------
123
+ - Gave model accessors bang methods process! and encode!
124
+
125
+ 0.7.3 (2010-08-27)
126
+ ==================
127
+ Fixes
128
+ -----
129
+ - Seems as though inserting after Rails' Rack::Lock was worth it after all
130
+
131
+ 0.7.2 (2010-08-27)
132
+ ==================
133
+ Fixes
134
+ -----
135
+ - S3DataStore was breaking if previous data hadn't stored meta
136
+
137
+ 0.7.1 (2010-08-26)
138
+ ==================
139
+ Fixes
140
+ -----
141
+ - SimpleEndpoint was modifying env path_info so wasn't creating proper cache keys
142
+ - to_response accepts env, so can use if-not-modified, etc.
143
+
144
+ Features
145
+ --------
146
+ - Doc tweaks: Added mongo page, notes about Capistrano
147
+
148
+ Changes
149
+ -------
150
+ - ETags generated by hash of job.serialize - was getting a bit long
151
+
152
+ 0.7.0 (2010-08-25)
153
+ ==================
154
+
155
+ Features
156
+ --------
157
+ - Ability to chain processing, encoding
158
+ - Added Generators for arbitrary content generation
159
+ - 'fetch_file' method for easily getting local files
160
+ - ActiveModel support
161
+ - Mongoid support
162
+ - Better Sinatra, etc. support (using 'to_response')
163
+ - Data stores now store meta, name and format information too
164
+ - Added Mongo Data Store
165
+ - temp_objects maintain name, meta, etc. across processing, encoding, etc.
166
+ - added portrait? and landscape? to RMagick analyser
167
+ - Ability to add single custom processor/encoder/analyser/generator
168
+ - added flip and flop to RMagick processor
169
+ - ability to configure whether it trusts the file extension
170
+ - nice text response for root path
171
+ - ability to configure url host
172
+ - ability to override path_prefix/host when calling url
173
+ - routed endpoints
174
+ - simple endpoints
175
+ - more intelligent working out of Content-Type to send back
176
+
177
+ Fixes
178
+ -----
179
+ - proper use of ETags
180
+ - remove whitespace from file/s3 datastore uids
181
+ - dragonfly/rails/images url-encodes rack-cache config for windows users
182
+ - Ruby 1.9.2 support
183
+ - Better RMagick memory management using image.destroy!
184
+
185
+ Changes
186
+ -------
187
+ - Dragonfly::App[:images] -> Dragonfly[:images]
188
+ - Moved text/plasma generation into Generator
189
+ - Use of lazy 'Job' objects
190
+ - simplified shortcuts interface
191
+ - changed interface for attaching to ActiveRecord
192
+ - simplified saved configurations and allow referring to them as symbols
193
+ - Removed need for Base class for datastores, processors, analysers and encoders
194
+ - FileCommandAnalyser included in Rails config, not RMagick
195
+ - better use of logging module for sharing logs between classes
196
+ - mounting the app is down the middleware/elsewhere, not the app itself
197
+ - DOS protection off by default
198
+ - encoded urls
199
+ - got rid of unnecessary configurable sha_length
200
+
201
+
202
+
203
+ 0.6.2 (2010-06-24)
204
+ ==================
205
+ Features
206
+ -----
207
+ - Added ability for custom error messages in validations
208
+
209
+ 0.6.1 (2010-05-16)
210
+ ==================
211
+ Fixes
212
+ -----
213
+ - STI was breaking when the model had a mixin too
214
+
215
+ 0.6.0 (2010-05-11)
216
+ ==================
217
+
218
+ Features
219
+ --------
220
+ - Added 'scale factor' for text generation, which gives better quality font rendering for smaller fonts
221
+ - Configurable objects allow for passing args, and passing a block for extra config
222
+ - Added more 'saved configurations', for easier setting up on e.g. Heroku
223
+ - Added RMagickAnalyser#format
224
+ - Added greyscale to RMagickProcessor
225
+ - S3DataStore is configurable as to whether it uses the filesystem or not (to save a tempfile)
226
+
227
+ Fixes
228
+ -----
229
+ - Some specs refactoring, including making text processing specs less brittle
230
+ - RMagickEncoder::SUPPORTED_FORMATS was proving problematic - now we use a configurable list instead
231
+ - Got Rails 3 beta3 cucumber features working
232
+ - Added check to see if bucket already exists in S3DataStore - apparently this was problematic in EU
233
+
234
+ Changes
235
+ -------
236
+ - temp_object.tempfile now returns a closed tempfile, which temp_object.file returns an open file.
237
+ Can also pass a block to temp_object.file which closes the file automatically
238
+ - Processors/Analysers/Encoders know about app now so can log to app's log
239
+ - Imagemagick errors in RMagick processor/analyser/encoder now throw unable_to_handle and log a warning
240
+ - Removed Rails generators - better being more explicit with saved configurations which are more concise now
241
+
242
+ 0.5.7 (2010-04-18)
243
+ ==================
244
+
245
+ Fixes
246
+ --------
247
+ - Strip file command mime_type value because some versions of file command were appending a line-break
248
+
249
+ 0.5.6 (2010-04-13)
250
+ ==================
251
+
252
+ Fixes
253
+ --------
254
+ - Wasn't working properly with Single-Table Inheritance
255
+
256
+ 0.5.5 (2010-04-13)
257
+ ==================
258
+
259
+ Fixes
260
+ --------
261
+ - Rails 3 has changed 'metaclass' -> 'singleton_class' so adapt accordingly
262
+
263
+ 0.5.4 (2010-04-12)
264
+ ==================
265
+
266
+ Features
267
+ --------
268
+ - Allow setting the uid manually
269
+
270
+ Fixes
271
+ -----
272
+ - Assigning an accessor to nil wasn't working properly
273
+
274
+
275
+ 0.5.3 (2010-03-27)
276
+ ==================
277
+
278
+ Fixes
279
+ -----
280
+ - Assigning an accessor to nil wasn't working properly
281
+
282
+
283
+ 0.5.2 (2010-03-04)
284
+ ==================
285
+
286
+ Features
287
+ --------
288
+ - Added 'registered mime-types'
289
+ - Enhanced docs
290
+
291
+ Fixes
292
+ -----
293
+ - RMagickEncoder only encodes if not already in that format
294
+
295
+
296
+ 0.5.1 (2010-02-20)
297
+ ==================
298
+
299
+ Fixes
300
+ -----
301
+ - Fixed 'broken pipe' errors in FileCommandAnalyser due to outputting loads of stuff to the command line stdin
302
+
303
+ 0.5.0 (2010-02-20)
304
+ ==================
305
+
306
+ Added support
307
+ -------------
308
+ - support for Rails 3
309
+
310
+
311
+ 0.4.4 (2010-02-16)
312
+ ==================
313
+
314
+ Better late than never to start logging change history...
315
+
316
+ New features
317
+ ------------
318
+ - added aspect_ratio to rmagick_analyser
319
+
320
+ Added support
321
+ -------------
322
+ - support for ruby 1.9
323
+ - added development dependencies to gemspec for easier setting up
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009-2010 Mark Evans
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,88 @@
1
+ Dragonfly
2
+ ===========
3
+
4
+ Dragonfly is a <a href="http://rack.rubyforge.org">Rack</a> framework for on-the-fly image handling.
5
+
6
+ Ideal for using with Ruby on Rails (2.3 and 3), Sinatra and all that gubbins.
7
+
8
+ For the lazy Rails user...
9
+ --------------------------
10
+ **Gemfile**:
11
+
12
+ gem 'rack-cache', :require => 'rack/cache'
13
+ gem 'dragonfly', '~>0.8.2'
14
+
15
+ **Initializer** (e.g. config/initializers/dragonfly.rb):
16
+
17
+ require 'dragonfly/rails/images'
18
+
19
+ **Migration**:
20
+
21
+ add_column :albums, :cover_image_uid, :string
22
+
23
+ **Model**:
24
+
25
+ class Album < ActiveRecord::Base
26
+ image_accessor :cover_image # 'image_accessor' is provided by Dragonfly
27
+ # this defines a reader/writer for cover_image
28
+ # ...
29
+ end
30
+
31
+ **View** (for uploading via a file field):
32
+
33
+ <% form_for @album, :html => {:multipart => true} do |f| %>
34
+ ...
35
+ <%= f.file_field :cover_image %>
36
+ ...
37
+ <% end %>
38
+
39
+ NB: REMEMBER THE MULTIPART BIT!!!
40
+
41
+ **View** (to display):
42
+
43
+ <%= image_tag @album.cover_image.url %>
44
+ <%= image_tag @album.cover_image.thumb('400x200#').url %>
45
+ <%= image_tag @album.cover_image.jpg.url %>
46
+ <%= image_tag @album.cover_image.process(:greyscale).encode(:tiff).url %>
47
+ ...etc.
48
+
49
+ The above relies on imagemagick being installed. Dragonfly doesn't depend on it per se, but the default configuration `'dragonfly/rails/images'`
50
+ uses it. For alternative configurations, see below.
51
+
52
+ If using Capistrano with the above, you probably will want to keep the cache between deploys, so in deploy.rb:
53
+
54
+ namespace :dragonfly do
55
+ desc "Symlink the Rack::Cache files"
56
+ task :symlink, :roles => [:app] do
57
+ run "mkdir -p #{shared_path}/tmp/dragonfly && ln -nfs #{shared_path}/tmp/dragonfly #{release_path}/tmp/dragonfly"
58
+ end
59
+ end
60
+ after 'deploy:update_code', 'dragonfly:symlink'
61
+
62
+ Using outside of rails, custom storage/processing/encoding/analysis, and more...
63
+ --------------------------------------------------------------------------------
64
+ Dragonfly is primarily a Rack app, so you can use it as a standalone app, or with Sinatra, Merb, etc.
65
+
66
+ It's highly customizable, and works with any data type (not just images).
67
+
68
+ For more info, consult the <a href="http://markevans.github.com/dragonfly"><big><strong>DOCUMENTATION</strong></big></a>
69
+
70
+ Add-ons
71
+ =======
72
+ For third-party add-ons, see [the Add-ons wiki](http://github.com/markevans/dragonfly/wiki/Dragonfly-add-ons)
73
+
74
+ Issues
75
+ ======
76
+ Please use the <a href="http://github.com/markevans/dragonfly/issues">github issue tracker</a> if you have any issues.
77
+
78
+ Suggestions/Questions
79
+ =====================
80
+ <a href="http://groups.google.com/group/dragonfly-users">Google group dragonfly-users</a>
81
+
82
+ Credits
83
+ =======
84
+ - [Mark Evans](http://github.com/markevans) (author)
85
+
86
+ Copyright
87
+ ========
88
+ Copyright (c) 2009-2010 Mark Evans. See LICENSE for details.