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.
Files changed (155) hide show
  1. data/.specopts +2 -0
  2. data/.yardopts +23 -0
  3. data/Gemfile +23 -0
  4. data/Gemfile.rails.2.3.5 +14 -0
  5. data/History.md +266 -0
  6. data/LICENSE +20 -0
  7. data/README.md +88 -0
  8. data/Rakefile +92 -0
  9. data/VERSION +1 -0
  10. data/config.ru +13 -0
  11. data/docs.watchr +1 -0
  12. data/dragonfly.gemspec +293 -0
  13. data/extra_docs/Analysers.md +108 -0
  14. data/extra_docs/Caching.md +23 -0
  15. data/extra_docs/Configuration.md +138 -0
  16. data/extra_docs/DataStorage.md +136 -0
  17. data/extra_docs/Encoding.md +96 -0
  18. data/extra_docs/GeneralUsage.md +121 -0
  19. data/extra_docs/Generators.md +102 -0
  20. data/extra_docs/Heroku.md +50 -0
  21. data/extra_docs/Index.md +36 -0
  22. data/extra_docs/MimeTypes.md +40 -0
  23. data/extra_docs/Models.md +266 -0
  24. data/extra_docs/Mongo.md +45 -0
  25. data/extra_docs/Processing.md +130 -0
  26. data/extra_docs/Rack.md +52 -0
  27. data/extra_docs/Rails2.md +55 -0
  28. data/extra_docs/Rails3.md +62 -0
  29. data/extra_docs/Sinatra.md +25 -0
  30. data/extra_docs/URLs.md +169 -0
  31. data/features/3.0.3.feature +8 -0
  32. data/features/images.feature +47 -0
  33. data/features/no_processing.feature +14 -0
  34. data/features/rails_2.3.5.feature +7 -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 +39 -0
  38. data/features/support/env.rb +40 -0
  39. data/fixtures/files/app/models/album.rb +3 -0
  40. data/fixtures/files/app/views/albums/new.html.erb +4 -0
  41. data/fixtures/files/app/views/albums/show.html.erb +4 -0
  42. data/fixtures/files/config/initializers/dragonfly.rb +4 -0
  43. data/fixtures/files/features/manage_album_images.feature +12 -0
  44. data/fixtures/files/features/step_definitions/image_steps.rb +15 -0
  45. data/fixtures/files/features/support/paths.rb +15 -0
  46. data/fixtures/files/features/text_images.feature +7 -0
  47. data/fixtures/rails_2.3.5/template.rb +10 -0
  48. data/fixtures/rails_3.0.3/template.rb +20 -0
  49. data/irbrc.rb +17 -0
  50. data/lib/dragonfly.rb +45 -0
  51. data/lib/dragonfly/active_model_extensions.rb +13 -0
  52. data/lib/dragonfly/active_model_extensions/attachment.rb +169 -0
  53. data/lib/dragonfly/active_model_extensions/class_methods.rb +45 -0
  54. data/lib/dragonfly/active_model_extensions/instance_methods.rb +28 -0
  55. data/lib/dragonfly/active_model_extensions/validations.rb +37 -0
  56. data/lib/dragonfly/analyser.rb +59 -0
  57. data/lib/dragonfly/analysis/file_command_analyser.rb +32 -0
  58. data/lib/dragonfly/analysis/image_magick_analyser.rb +47 -0
  59. data/lib/dragonfly/analysis/r_magick_analyser.rb +63 -0
  60. data/lib/dragonfly/app.rb +182 -0
  61. data/lib/dragonfly/config/heroku.rb +19 -0
  62. data/lib/dragonfly/config/image_magick.rb +41 -0
  63. data/lib/dragonfly/config/r_magick.rb +46 -0
  64. data/lib/dragonfly/config/rails.rb +17 -0
  65. data/lib/dragonfly/configurable.rb +119 -0
  66. data/lib/dragonfly/core_ext/object.rb +8 -0
  67. data/lib/dragonfly/core_ext/string.rb +9 -0
  68. data/lib/dragonfly/core_ext/symbol.rb +9 -0
  69. data/lib/dragonfly/data_storage.rb +9 -0
  70. data/lib/dragonfly/data_storage/file_data_store.rb +114 -0
  71. data/lib/dragonfly/data_storage/mongo_data_store.rb +82 -0
  72. data/lib/dragonfly/data_storage/s3data_store.rb +115 -0
  73. data/lib/dragonfly/encoder.rb +13 -0
  74. data/lib/dragonfly/encoding/image_magick_encoder.rb +57 -0
  75. data/lib/dragonfly/encoding/r_magick_encoder.rb +61 -0
  76. data/lib/dragonfly/function_manager.rb +69 -0
  77. data/lib/dragonfly/generation/hash_with_css_style_keys.rb +23 -0
  78. data/lib/dragonfly/generation/image_magick_generator.rb +140 -0
  79. data/lib/dragonfly/generation/r_magick_generator.rb +155 -0
  80. data/lib/dragonfly/generator.rb +9 -0
  81. data/lib/dragonfly/image_magick_utils.rb +81 -0
  82. data/lib/dragonfly/job.rb +371 -0
  83. data/lib/dragonfly/job_builder.rb +39 -0
  84. data/lib/dragonfly/job_definitions.rb +26 -0
  85. data/lib/dragonfly/job_endpoint.rb +15 -0
  86. data/lib/dragonfly/loggable.rb +28 -0
  87. data/lib/dragonfly/middleware.rb +34 -0
  88. data/lib/dragonfly/processing/image_magick_processor.rb +99 -0
  89. data/lib/dragonfly/processing/r_magick_processor.rb +126 -0
  90. data/lib/dragonfly/processor.rb +9 -0
  91. data/lib/dragonfly/r_magick_utils.rb +48 -0
  92. data/lib/dragonfly/rails/images.rb +22 -0
  93. data/lib/dragonfly/response.rb +82 -0
  94. data/lib/dragonfly/routed_endpoint.rb +40 -0
  95. data/lib/dragonfly/serializer.rb +32 -0
  96. data/lib/dragonfly/simple_cache.rb +23 -0
  97. data/lib/dragonfly/simple_endpoint.rb +63 -0
  98. data/lib/dragonfly/temp_object.rb +220 -0
  99. data/samples/beach.png +0 -0
  100. data/samples/egg.png +0 -0
  101. data/samples/round.gif +0 -0
  102. data/samples/sample.docx +0 -0
  103. data/samples/taj.jpg +0 -0
  104. data/spec/argument_matchers.rb +19 -0
  105. data/spec/dragonfly/active_model_extensions/active_model_setup.rb +97 -0
  106. data/spec/dragonfly/active_model_extensions/active_record_setup.rb +85 -0
  107. data/spec/dragonfly/active_model_extensions/model_spec.rb +723 -0
  108. data/spec/dragonfly/active_model_extensions/spec_helper.rb +11 -0
  109. data/spec/dragonfly/analyser_spec.rb +123 -0
  110. data/spec/dragonfly/analysis/file_command_analyser_spec.rb +57 -0
  111. data/spec/dragonfly/analysis/image_magick_analyser_spec.rb +15 -0
  112. data/spec/dragonfly/analysis/r_magick_analyser_spec.rb +27 -0
  113. data/spec/dragonfly/analysis/shared_analyser_spec.rb +51 -0
  114. data/spec/dragonfly/app_spec.rb +280 -0
  115. data/spec/dragonfly/config/r_magick_spec.rb +25 -0
  116. data/spec/dragonfly/configurable_spec.rb +220 -0
  117. data/spec/dragonfly/core_ext/string_spec.rb +17 -0
  118. data/spec/dragonfly/core_ext/symbol_spec.rb +17 -0
  119. data/spec/dragonfly/data_storage/data_store_spec.rb +76 -0
  120. data/spec/dragonfly/data_storage/file_data_store_spec.rb +169 -0
  121. data/spec/dragonfly/data_storage/mongo_data_store_spec.rb +38 -0
  122. data/spec/dragonfly/data_storage/s3_data_store_spec.rb +94 -0
  123. data/spec/dragonfly/deprecation_spec.rb +20 -0
  124. data/spec/dragonfly/encoding/image_magick_encoder_spec.rb +41 -0
  125. data/spec/dragonfly/encoding/r_magick_encoder_spec.rb +37 -0
  126. data/spec/dragonfly/function_manager_spec.rb +154 -0
  127. data/spec/dragonfly/generation/hash_with_css_style_keys_spec.rb +24 -0
  128. data/spec/dragonfly/generation/image_magick_generator_spec.rb +12 -0
  129. data/spec/dragonfly/generation/r_magick_generator_spec.rb +24 -0
  130. data/spec/dragonfly/generation/shared_generator_spec.rb +91 -0
  131. data/spec/dragonfly/image_magick_utils_spec.rb +16 -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 +120 -0
  135. data/spec/dragonfly/job_spec.rb +773 -0
  136. data/spec/dragonfly/loggable_spec.rb +80 -0
  137. data/spec/dragonfly/middleware_spec.rb +68 -0
  138. data/spec/dragonfly/processing/image_magick_processor_spec.rb +29 -0
  139. data/spec/dragonfly/processing/r_magick_processor_spec.rb +26 -0
  140. data/spec/dragonfly/processing/shared_processing_spec.rb +215 -0
  141. data/spec/dragonfly/routed_endpoint_spec.rb +48 -0
  142. data/spec/dragonfly/serializer_spec.rb +61 -0
  143. data/spec/dragonfly/simple_cache_spec.rb +27 -0
  144. data/spec/dragonfly/simple_endpoint_spec.rb +89 -0
  145. data/spec/dragonfly/temp_object_spec.rb +352 -0
  146. data/spec/image_matchers.rb +47 -0
  147. data/spec/simple_matchers.rb +44 -0
  148. data/spec/spec_helper.rb +58 -0
  149. data/yard/handlers/configurable_attr_handler.rb +38 -0
  150. data/yard/setup.rb +15 -0
  151. data/yard/templates/default/fulldoc/html/css/common.css +107 -0
  152. data/yard/templates/default/layout/html/layout.erb +87 -0
  153. data/yard/templates/default/module/html/configuration_summary.erb +31 -0
  154. data/yard/templates/default/module/setup.rb +17 -0
  155. metadata +550 -0
@@ -0,0 +1,52 @@
1
+ Rack
2
+ ====
3
+ For more info about using Rack applications, see the docs at {http://rack.rubyforge.org/}
4
+
5
+ Basic usage involves storing data (e.g. images),
6
+ then serving it in some form.
7
+
8
+ A basic rackup file `config.ru`:
9
+
10
+ require 'rubygems'
11
+ require 'dragonfly'
12
+
13
+ Dragonfly[:my_app_name].configure do |c|
14
+ # ... configuration here
15
+ end
16
+
17
+ run Dragonfly:App[:my_app_name]
18
+
19
+ See {file:Configuration} for more details.
20
+
21
+ The basic flow is instantiate an app -> configure it -> run it.
22
+
23
+ Example: Using to serve resized images
24
+ --------------------------------------
25
+
26
+ `config.ru`:
27
+
28
+ require 'rubygems'
29
+ require 'dragonfly'
30
+
31
+ app = Dragonfly[:images].configure_with(:imagemagick)
32
+
33
+ run app
34
+
35
+ This enables the app to use all the ImageMagick goodies provided by Dragonfly (see {file:Configuration}).
36
+ By default the {Dragonfly::DataStorage::FileDataStore file data store} is used.
37
+
38
+ In the console:
39
+
40
+ app = Dragonfly[:images]
41
+
42
+ # Store
43
+ uid = app.store(File.new('path/to/image.png')) # ===> unique uid
44
+
45
+ # Get the url for a thumbnail
46
+ url = app.fetch(uid).thumb('400x300').url # ===> "/media/BAhbBlsHOgZmIg9hc..."
47
+
48
+ Now when we visit the url `/media/BAhbBlsHOgZmIg9hc...` in the browser, we get a resized image!
49
+
50
+ Mounting in Rack
51
+ ----------------
52
+ See {file:URLs}
@@ -0,0 +1,55 @@
1
+ Using With Rails 2.3
2
+ ====================
3
+
4
+ Setting up the quick way
5
+ ------------------------
6
+ config/initializers/dragonfly.rb:
7
+
8
+ require 'dragonfly/rails/images'
9
+
10
+ Setting up the more explicit way
11
+ --------------------------------
12
+ You can do the above explicitly.
13
+
14
+ config/initializers/dragonfly.rb:
15
+
16
+ require 'dragonfly'
17
+
18
+ app = Dragonfly[:images]
19
+ app.configure_with(:imagemagick)
20
+ app.configure_with(:rails)
21
+
22
+ app.define_macro(ActiveRecord::Base, :image_accessor)
23
+
24
+ environment.rb:
25
+
26
+ config.middleware.insert_after 'Rack::Lock', 'Dragonfly::Middleware', :images, '/media'
27
+ config.middleware.insert_before 'Dragonfly::Middleware', 'Rack::Cache', {
28
+ :verbose => true,
29
+ :metastore => "file:#{Rails.root}/tmp/dragonfly/cache/meta",
30
+ :entitystore => "file:#{Rails.root}/tmp/dragonfly/cache/body"
31
+ }
32
+
33
+ Gems
34
+ ----
35
+ environment.rb
36
+
37
+ config.gem 'dragonfly', '~>0.8.1'
38
+ config.gem 'rack-cache', :lib => 'rack/cache'
39
+
40
+ Capistrano
41
+ ----------
42
+ If using Capistrano with the above, you probably will want to keep the cache between deploys, so in deploy.rb:
43
+
44
+ namespace :dragonfly do
45
+ desc "Symlink the Rack::Cache files"
46
+ task :symlink, :roles => [:app] do
47
+ run "mkdir -p #{shared_path}/tmp/dragonfly && ln -nfs #{shared_path}/tmp/dragonfly #{release_path}/tmp/dragonfly"
48
+ end
49
+ end
50
+ after 'deploy:update_code', 'dragonfly:symlink'
51
+
52
+ Use it!
53
+ -------
54
+
55
+ To see what you can do with the model accessors, see {file:Models}.
@@ -0,0 +1,62 @@
1
+ Using With Rails 3
2
+ ==================
3
+
4
+ Setting up the quick way
5
+ ------------------------
6
+ config/initializers/dragonfly.rb:
7
+
8
+ require 'dragonfly/rails/images'
9
+
10
+ Setting up the more explicit way
11
+ --------------------------------
12
+ You can do the above explicitly.
13
+
14
+ config/initializers/dragonfly.rb:
15
+
16
+ require 'dragonfly'
17
+
18
+ app = Dragonfly[:images]
19
+ app.configure_with(:imagemagick)
20
+ app.configure_with(:rails)
21
+
22
+ app.define_macro(ActiveRecord::Base, :image_accessor)
23
+
24
+ application.rb:
25
+
26
+ config.middleware.insert_after 'Rack::Lock', 'Dragonfly::Middleware', :images, '/media'
27
+ config.middleware.insert_before 'Dragonfly::Middleware', 'Rack::Cache', {
28
+ :verbose => true,
29
+ :metastore => "file:#{Rails.root}/tmp/dragonfly/cache/meta",
30
+ :entitystore => "file:#{Rails.root}/tmp/dragonfly/cache/body"
31
+ }
32
+
33
+ Gemfile
34
+ -------
35
+
36
+ gem 'dragonfly', '~>0.8.1'
37
+ gem 'rack-cache', :require => 'rack/cache'
38
+
39
+ Capistrano
40
+ ----------
41
+ If using Capistrano with the above, you probably will want to keep the cache between deploys, so in deploy.rb:
42
+
43
+ namespace :dragonfly do
44
+ desc "Symlink the Rack::Cache files"
45
+ task :symlink, :roles => [:app] do
46
+ run "mkdir -p #{shared_path}/tmp/dragonfly && ln -nfs #{shared_path}/tmp/dragonfly #{release_path}/tmp/dragonfly"
47
+ end
48
+ end
49
+ after 'deploy:update_code', 'dragonfly:symlink'
50
+
51
+ Use it!
52
+ -------
53
+
54
+ To see what you can do with the model accessors, see {file:Models}.
55
+
56
+ Mounting in routes.rb
57
+ ---------------------
58
+ Instead of mounting as a middleware, you could skip that bit and mount directly in the routes.rb file:
59
+
60
+ match '/media(/:dragonfly)', :to => Dragonfly[:images]
61
+
62
+ Make sure the the path prefix matches the Dragonfly app's configured url_path_prefix (which is /media by default for Rails).
@@ -0,0 +1,25 @@
1
+ Sinatra
2
+ =======
3
+ You can use {Dragonfly::Job Job}'s `to_response` method like so:
4
+
5
+ app = Dragonfly[:images].configure_with(:imagemagick)
6
+
7
+ get '/images/:size.:format' do |size, format|
8
+ app.fetch_file('~/some/image.png').thumb(size).encode(format).to_response(env)
9
+ end
10
+
11
+ `to_response` returns a rack-style response array with status, headers and body.
12
+
13
+ NOTE: uids from the datastore currently have slashes and dots in them so may cause problems when using ':uid' as
14
+ a path segment.
15
+
16
+ or you can mount as a middleware, like in rails:
17
+
18
+ Dragonfly[:images].configure_with(:imagemagick) do |c|
19
+ c.url_path_prefix = '/media'
20
+ end
21
+
22
+ use Dragonfly::Middleware, :images, '/media'
23
+
24
+ get '/' #... do
25
+ # ...
@@ -0,0 +1,169 @@
1
+ URLs
2
+ ====
3
+
4
+ We can get urls for any kind of job:
5
+
6
+ app = Dragonfly[:images]
7
+
8
+ app.fetch('my_uid').process(:flip).url # "/BAhbBlsH..."
9
+ app.generate(:text, 'hello').thumb('500x302').gif.url # "/BAhbCFsHOgZ..."
10
+
11
+ Path prefix
12
+ -----------
13
+ If the app is mounted with a path prefix (such as when using in Rails), then we need to add this prefix
14
+ to the urls:
15
+
16
+ app.url_path_prefix = '/media'
17
+
18
+ (or done in a configuration block).
19
+
20
+ app.fetch('my_uid').url # "/media/BAhbBlsH..."
21
+
22
+ This is done for you when using {file:Configuration Rails defaults}.
23
+
24
+ You can override it using
25
+
26
+ app.fetch('my_uid').url(:path_prefix => '/images') # "/images/BAhbBlsH..."
27
+
28
+ Host
29
+ ----
30
+ You can also set a host for the urls
31
+
32
+ app.url_host = 'http://some.host'
33
+ app.fetch('my_uid').url # "http://some.host/BAhb..."
34
+
35
+ app.fetch('my_uid').url(:host => 'http://localhost:80') # "http://localhost:80/BAh..."
36
+
37
+ Suffix
38
+ ------
39
+ You can set a suffix for the urls (for example if some other component behaves badly with urls that have no file extension).
40
+
41
+ Note that this has no effect on the response.
42
+
43
+ app.url_suffix = '.jpg'
44
+ app.fetch('some/uid').url # "...b21lL3VpZA.jpg"
45
+
46
+ You can also pass it a block, that yields the {Dragonfly::Job Job}, for example:
47
+
48
+ app.url_suffix = proc{|job|
49
+ "/#{job.uid_basename}#{job.encoded_extname || job.uid_extname}"
50
+ }
51
+
52
+ app.fetch('2007/painting.pdf').url # "...eS5ib2R5/painting.pdf"
53
+ app.fetch('2007/painting.pdf').encode(:png).url # "...gZlOgbmc/painting.png"
54
+
55
+ And you can override it:
56
+
57
+ app.fetch('some/uid').url(:suffix => '/yellowbelly') # "...b21lL3VpZA/yellowbelly"
58
+
59
+ Content-Disposition
60
+ -------------------
61
+ You can manually set the content-disposition of the response:
62
+
63
+ app.content_disposition = :attachment # should be :inline or :attachment (or :hidden)
64
+
65
+ `:attachment` tells the browser to download it, `:inline` tells it to display in-browser if possible.
66
+
67
+ You can also use a block:
68
+
69
+ app.content_disposition = proc{|job, request|
70
+ if job.format == :jpg || request['d'] == 'inline' # request is a Rack::Request object
71
+ :inline
72
+ else
73
+ :attachment
74
+ end
75
+ }
76
+
77
+ Downloaded filename
78
+ -------------------
79
+ To specify the filename the browser uses for 'Save As' dialogues:
80
+
81
+ app.content_filename = proc{|job, request|
82
+ "#{job.basename}_#{job.process_steps.first.name}.#{job.encoded_format || job.ext}"
83
+ }
84
+
85
+ This will for example give the following filenames for the following jobs:
86
+
87
+ app.fetch('some/tree.png').process(:greyscale) # -> 'tree_greyscale.png'
88
+ app.fetch('some/tree.png').process(:greyscale).gif # -> 'tree_greyscale.gif'
89
+
90
+ By default the original filename is used, with a modified extension if it's been encoded.
91
+
92
+ Routed Endpoints
93
+ ----------------
94
+ You can also use a number of Rack-based routers and create Dragonfly endpoints.
95
+
96
+ If we have an app set up for using ImageMagick:
97
+
98
+ app = Dragonfly[:images].configure_with(:imagemagick)
99
+
100
+ Then to get the url '/text/hello' to display the text "hello"...
101
+
102
+ Rails 3 (routes.rb):
103
+
104
+ match '/text/:text' => app.endpoint{|params, app|
105
+ app.generate(:text, params[:text])
106
+ }
107
+
108
+ {http://github.com/josh/rack-mount Rack-Mount}:
109
+
110
+ Routes = Rack::Mount::RouteSet.new do |set|
111
+
112
+ set.add_route app.endpoint{|params, a| a.generate(:text, params[:text]) },
113
+ :path_info => %r{/text/(?:<text>.+)}
114
+
115
+ # ...
116
+
117
+ end
118
+
119
+ {http://github.com/joshbuddy/usher Usher}:
120
+
121
+ routes = Usher::Interface.for(:rack) do
122
+ add('/text/:text').to app.endpoint{|params, app|
123
+ app.generate(:text, params[:text])
124
+ }
125
+ end
126
+
127
+ {http://github.com/joshbuddy/http_router HTTP Router}:
128
+
129
+ r = HttpRouter.new
130
+ r.add('/text/:text').to app.endpoint{|params, app|
131
+ app.generate(:text, params[:text])
132
+ }
133
+
134
+ In each case the url will need to be generated by the router of choice, or manually.
135
+
136
+ Simple Endpoints
137
+ ----------------
138
+ {Dragonfly::Job Job} objects can also be turned straight into Rack endpoints using `to_app`, e.g. in Rails 3:
139
+
140
+ match '/beach' => app.fetch_file('~/some/image.png').thumb('100x100#').jpg.to_app
141
+
142
+
143
+ Denial-of-service attacks
144
+ -------------------------
145
+ Although the standard urls are fairly cryptic, a malicious person who knows the Dragonfly source code could potentially
146
+ work out how to generate urls to spam your server with heavy requests, e.g. resize to 100000 by 100000 pixels.
147
+
148
+ Therefore the app can be protected by requiring the presence of a "DOS-protection" SHA in the urls:
149
+
150
+ app.configure do |c|
151
+ c.protect_from_dos_attacks = true
152
+ c.secret = 'You should supply some random secret here'
153
+ end
154
+
155
+ Then the standard generated urls will have a SHA query parameter attached:
156
+
157
+ app.fetch('my_uid').url # "/BAhbBlsHOgZmIghzZGY?s=df76ba27"
158
+
159
+ Any requests without the correct SHA parameter result in a 400 (bad parameters) error response.
160
+
161
+ You can also validate for a correct SHA using routed endpoints:
162
+
163
+ match '/text/:text' => app.endpoint{|params, app|
164
+ app.generate(:text, params[:text]).validate_sha!(params[:sha])
165
+ }
166
+
167
+ ... where obviously you need to pass in a 'sha' parameter to the url, which can be found using
168
+
169
+ app.generate(:text, 'some text').sha
@@ -0,0 +1,8 @@
1
+ Feature: champion uses dragonfly in his Rails 3.0.3 application
2
+ In order to be a champion
3
+ A user uses dragonfly in his Rails 3.0.3 application
4
+
5
+ Scenario: Set up dragonfly using initializer
6
+ Given a Rails 3.0.3 application set up for using dragonfly
7
+ Then the manage_album_images cucumber features in my Rails 3.0.3 app should pass
8
+ And the text_images cucumber features in my Rails 3.0.3 app should pass
@@ -0,0 +1,47 @@
1
+ Feature: champion uses dragonfly to process images
2
+ In order to be a champion
3
+ A user uses dragonfly
4
+
5
+ Background:
6
+ Given we are using the app for images
7
+ Given a stored image "beach.png" with dimensions 200x100
8
+
9
+ Scenario: Go to url for original
10
+ When I go to the url for "beach.png", with format 'png'
11
+ Then the response should be OK
12
+ And the response should have mime-type 'image/png'
13
+ And the image should have width '200'
14
+ And the image should have height '100'
15
+ And the image should have format 'png'
16
+
17
+ Scenario: Go to url for changed format version
18
+ When I go to the url for "beach.png", with format 'gif'
19
+ Then the response should be OK
20
+ And the response should have mime-type 'image/gif'
21
+ And the image should have width '200'
22
+ And the image should have height '100'
23
+ And the image should have format 'gif'
24
+
25
+ Scenario: Go to url for soft resized version
26
+ When I go to the url for "beach.png", with format 'png' and resize geometry '100x150'
27
+ Then the response should be OK
28
+ And the response should have mime-type 'image/png'
29
+ And the image should have width '100'
30
+ And the image should have height '50'
31
+ And the image should have format 'png'
32
+
33
+ Scenario: Go to url for hard resized version
34
+ When I go to the url for "beach.png", with format 'png' and resize geometry '100x150!'
35
+ Then the response should be OK
36
+ And the response should have mime-type 'image/png'
37
+ And the image should have width '100'
38
+ And the image should have height '150'
39
+ And the image should have format 'png'
40
+
41
+ Scenario: use a parameters shortcut
42
+ When I go to the url for "beach.png", with shortcut '100x150!'
43
+ Then the response should be OK
44
+ And the response should have mime-type 'image/png'
45
+ And the image should have width '100'
46
+ And the image should have height '150'
47
+ And the image should have format 'png'
@@ -0,0 +1,14 @@
1
+ Feature: winner uses dragonfly to serve different kinds of files
2
+ In order to be a winner
3
+ As a potential loser
4
+ I want to be a winner
5
+
6
+ Background:
7
+ Given we are using the app for files
8
+
9
+ Scenario: Go to url for original, without extension
10
+ Given a stored file "sample.docx"
11
+ When I go to the url for "sample.docx"
12
+ Then the response should be OK
13
+ And the response should have mime-type 'application/zip'
14
+ And the response should have the same content as the file "sample.docx"
@@ -0,0 +1,7 @@
1
+ Feature: champion uses dragonfly in his Rails 2.3.5 application
2
+ In order to be a champion
3
+ A user uses dragonfly in his Rails 2.3.5 application
4
+
5
+ Scenario: Set up dragonfly using the provided initializer
6
+ Given a Rails 2.3.5 application set up for using dragonfly
7
+ Then the manage_album_images cucumber features in my Rails 2.3.5 app should pass