fleximage 1.0.0

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 (132) hide show
  1. data/.gitignore +27 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +257 -0
  4. data/Rakefile +49 -0
  5. data/VERSION +1 -0
  6. data/autotest.rb +5 -0
  7. data/fleximage.gemspec +235 -0
  8. data/init.rb +1 -0
  9. data/lib/dsl_accessor.rb +52 -0
  10. data/lib/fleximage.rb +59 -0
  11. data/lib/fleximage/aviary_controller.rb +75 -0
  12. data/lib/fleximage/blank.rb +70 -0
  13. data/lib/fleximage/helper.rb +41 -0
  14. data/lib/fleximage/image_proxy.rb +69 -0
  15. data/lib/fleximage/legacy_view.rb +63 -0
  16. data/lib/fleximage/model.rb +689 -0
  17. data/lib/fleximage/operator/background.rb +62 -0
  18. data/lib/fleximage/operator/base.rb +189 -0
  19. data/lib/fleximage/operator/border.rb +50 -0
  20. data/lib/fleximage/operator/crop.rb +58 -0
  21. data/lib/fleximage/operator/image_overlay.rb +85 -0
  22. data/lib/fleximage/operator/resize.rb +92 -0
  23. data/lib/fleximage/operator/shadow.rb +87 -0
  24. data/lib/fleximage/operator/text.rb +104 -0
  25. data/lib/fleximage/operator/trim.rb +14 -0
  26. data/lib/fleximage/operator/unsharp_mask.rb +36 -0
  27. data/lib/fleximage/rmagick_image_patch.rb +5 -0
  28. data/lib/fleximage/string_patch.rb +5 -0
  29. data/lib/fleximage/view.rb +57 -0
  30. data/tasks/fleximage_tasks.rake +154 -0
  31. data/test/fixtures/100x1.jpg +0 -0
  32. data/test/fixtures/100x100.jpg +0 -0
  33. data/test/fixtures/1x1.jpg +0 -0
  34. data/test/fixtures/1x100.jpg +0 -0
  35. data/test/fixtures/cmyk.jpg +0 -0
  36. data/test/fixtures/not_a_photo.xml +1 -0
  37. data/test/fixtures/photo.jpg +0 -0
  38. data/test/mock_file.rb +21 -0
  39. data/test/rails_root/app/controllers/application.rb +10 -0
  40. data/test/rails_root/app/controllers/avatars_controller.rb +85 -0
  41. data/test/rails_root/app/controllers/photo_bares_controller.rb +85 -0
  42. data/test/rails_root/app/controllers/photo_dbs_controller.rb +85 -0
  43. data/test/rails_root/app/controllers/photo_files_controller.rb +85 -0
  44. data/test/rails_root/app/helpers/application_helper.rb +3 -0
  45. data/test/rails_root/app/helpers/avatars_helper.rb +2 -0
  46. data/test/rails_root/app/helpers/photo_bares_helper.rb +2 -0
  47. data/test/rails_root/app/helpers/photo_dbs_helper.rb +2 -0
  48. data/test/rails_root/app/helpers/photo_files_helper.rb +2 -0
  49. data/test/rails_root/app/locales/de.yml +7 -0
  50. data/test/rails_root/app/locales/en.yml +8 -0
  51. data/test/rails_root/app/models/abstract.rb +8 -0
  52. data/test/rails_root/app/models/avatar.rb +4 -0
  53. data/test/rails_root/app/models/photo_bare.rb +7 -0
  54. data/test/rails_root/app/models/photo_custom_error.rb +10 -0
  55. data/test/rails_root/app/models/photo_db.rb +3 -0
  56. data/test/rails_root/app/models/photo_file.rb +3 -0
  57. data/test/rails_root/app/views/avatars/edit.html.erb +17 -0
  58. data/test/rails_root/app/views/avatars/index.html.erb +20 -0
  59. data/test/rails_root/app/views/avatars/new.html.erb +16 -0
  60. data/test/rails_root/app/views/avatars/show.html.erb +8 -0
  61. data/test/rails_root/app/views/layouts/avatars.html.erb +17 -0
  62. data/test/rails_root/app/views/layouts/photo_bares.html.erb +17 -0
  63. data/test/rails_root/app/views/layouts/photo_dbs.html.erb +17 -0
  64. data/test/rails_root/app/views/layouts/photo_files.html.erb +17 -0
  65. data/test/rails_root/app/views/photo_bares/edit.html.erb +12 -0
  66. data/test/rails_root/app/views/photo_bares/index.html.erb +18 -0
  67. data/test/rails_root/app/views/photo_bares/new.html.erb +11 -0
  68. data/test/rails_root/app/views/photo_bares/show.html.erb +3 -0
  69. data/test/rails_root/app/views/photo_dbs/edit.html.erb +32 -0
  70. data/test/rails_root/app/views/photo_dbs/index.html.erb +26 -0
  71. data/test/rails_root/app/views/photo_dbs/new.html.erb +31 -0
  72. data/test/rails_root/app/views/photo_dbs/show.html.erb +23 -0
  73. data/test/rails_root/app/views/photo_files/edit.html.erb +27 -0
  74. data/test/rails_root/app/views/photo_files/index.html.erb +24 -0
  75. data/test/rails_root/app/views/photo_files/new.html.erb +26 -0
  76. data/test/rails_root/app/views/photo_files/show.html.erb +18 -0
  77. data/test/rails_root/config/boot.rb +109 -0
  78. data/test/rails_root/config/database.yml +7 -0
  79. data/test/rails_root/config/environment.rb +66 -0
  80. data/test/rails_root/config/environments/development.rb +18 -0
  81. data/test/rails_root/config/environments/production.rb +19 -0
  82. data/test/rails_root/config/environments/sqlite3.rb +0 -0
  83. data/test/rails_root/config/environments/test.rb +22 -0
  84. data/test/rails_root/config/initializers/inflections.rb +10 -0
  85. data/test/rails_root/config/initializers/load_translations.rb +4 -0
  86. data/test/rails_root/config/initializers/mime_types.rb +5 -0
  87. data/test/rails_root/config/routes.rb +43 -0
  88. data/test/rails_root/db/migrate/001_create_photo_files.rb +15 -0
  89. data/test/rails_root/db/migrate/002_create_photo_dbs.rb +16 -0
  90. data/test/rails_root/db/migrate/003_create_photo_bares.rb +12 -0
  91. data/test/rails_root/db/migrate/004_create_avatars.rb +13 -0
  92. data/test/rails_root/public/.htaccess +40 -0
  93. data/test/rails_root/public/404.html +30 -0
  94. data/test/rails_root/public/422.html +30 -0
  95. data/test/rails_root/public/500.html +30 -0
  96. data/test/rails_root/public/dispatch.cgi +10 -0
  97. data/test/rails_root/public/dispatch.fcgi +24 -0
  98. data/test/rails_root/public/dispatch.rb +10 -0
  99. data/test/rails_root/public/favicon.ico +0 -0
  100. data/test/rails_root/public/images/rails.png +0 -0
  101. data/test/rails_root/public/index.html +277 -0
  102. data/test/rails_root/public/javascripts/application.js +2 -0
  103. data/test/rails_root/public/javascripts/controls.js +963 -0
  104. data/test/rails_root/public/javascripts/dragdrop.js +972 -0
  105. data/test/rails_root/public/javascripts/effects.js +1120 -0
  106. data/test/rails_root/public/javascripts/prototype.js +4225 -0
  107. data/test/rails_root/public/robots.txt +5 -0
  108. data/test/rails_root/public/stylesheets/scaffold.css +74 -0
  109. data/test/rails_root/vendor/plugins/fleximage/init.rb +2 -0
  110. data/test/test_helper.rb +81 -0
  111. data/test/unit/abstract_test.rb +20 -0
  112. data/test/unit/basic_model_test.rb +30 -0
  113. data/test/unit/blank_test.rb +23 -0
  114. data/test/unit/default_image_path_option_test.rb +16 -0
  115. data/test/unit/dsl_accessor_test.rb +120 -0
  116. data/test/unit/file_upload_from_local_test.rb +31 -0
  117. data/test/unit/file_upload_from_strings_test.rb +23 -0
  118. data/test/unit/file_upload_from_url_test.rb +35 -0
  119. data/test/unit/file_upload_to_db_test.rb +41 -0
  120. data/test/unit/i18n_messages_test.rb +49 -0
  121. data/test/unit/image_directory_option_test.rb +18 -0
  122. data/test/unit/image_proxy_test.rb +17 -0
  123. data/test/unit/image_storage_format_option_test.rb +31 -0
  124. data/test/unit/magic_columns_test.rb +30 -0
  125. data/test/unit/minimum_image_size_test.rb +56 -0
  126. data/test/unit/operator_base_test.rb +124 -0
  127. data/test/unit/operator_resize_test.rb +18 -0
  128. data/test/unit/preprocess_image_option_test.rb +21 -0
  129. data/test/unit/require_image_option_test.rb +30 -0
  130. data/test/unit/temp_image_test.rb +17 -0
  131. data/test/unit/use_creation_date_based_directories_option_test.rb +16 -0
  132. metadata +279 -0
@@ -0,0 +1,17 @@
1
+ require File.dirname(__FILE__) + '/../../test/test_helper'
2
+
3
+ class FleximageTempImageTest < Test::Unit::TestCase
4
+ def test_should_save_and_use_a_temp_image
5
+ a1 = Avatar.new(:image_file => files(:photo))
6
+ assert !a1.save
7
+ assert_match /^\d+_\d+$/, a1.image_file_temp
8
+ assert File.exists?("#{RAILS_ROOT}/tmp/fleximage/#{a1.image_file_temp}")
9
+ temp_file_path = a1.image_file_temp
10
+
11
+ a2 = Avatar.new(:username => 'Alex Wayne', :image_file_temp => temp_file_path)
12
+
13
+ assert a2.save
14
+ assert File.exists?(a2.file_path)
15
+ assert !File.exists?("#{RAILS_ROOT}/tmp/fleximage/#{temp_file_path}")
16
+ end
17
+ end
@@ -0,0 +1,16 @@
1
+ require File.dirname(__FILE__) + '/../../test/test_helper'
2
+
3
+ class FleximageUseCreationDateBasedDirectoriesOptionTest < Test::Unit::TestCase
4
+ def test_should_store_images_with_creation_date_based_directories
5
+ p = PhotoBare.create(:image_file => files(:photo))
6
+ assert_match %r{public/uploads/\d+/\d+/\d+/\d+}, p.file_path
7
+ end
8
+
9
+ def test_should_store_images_without_creation_date_based_directories
10
+ PhotoBare.use_creation_date_based_directories = false
11
+ p = PhotoBare.create(:image_file => files(:photo))
12
+ assert_no_match %r{public/uploads/\d+/\d+/\d+/\d+}, p.file_path
13
+ ensure
14
+ PhotoBare.use_creation_date_based_directories = true
15
+ end
16
+ end
metadata ADDED
@@ -0,0 +1,279 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fleximage
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Alex Wayne
8
+ - Andrew White
9
+ - JJ Buckley
10
+ - Jason Lee
11
+ - Joshua Abbott
12
+ - "Lo\xC3\xAFc Guitaut"
13
+ - Martin Vielsmaier
14
+ - Squeegy
15
+ - Vannoy
16
+ autorequire:
17
+ bindir: bin
18
+ cert_chain: []
19
+
20
+ date: 2009-12-13 00:00:00 -08:00
21
+ default_executable:
22
+ dependencies:
23
+ - !ruby/object:Gem::Dependency
24
+ name: rmagick
25
+ type: :runtime
26
+ version_requirement:
27
+ version_requirements: !ruby/object:Gem::Requirement
28
+ requirements:
29
+ - - ">="
30
+ - !ruby/object:Gem::Version
31
+ version: "0"
32
+ version:
33
+ - !ruby/object:Gem::Dependency
34
+ name: aws-s3
35
+ type: :runtime
36
+ version_requirement:
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: "0"
42
+ version:
43
+ - !ruby/object:Gem::Dependency
44
+ name: rails
45
+ type: :development
46
+ version_requirement:
47
+ version_requirements: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - "="
50
+ - !ruby/object:Gem::Version
51
+ version: 2.2.2
52
+ version:
53
+ description: |
54
+ Fleximage is a Rails plugin that tries to make image uploading and rendering
55
+ super easy.
56
+
57
+ email: ruby@beautifulpixel.com
58
+ executables: []
59
+
60
+ extensions: []
61
+
62
+ extra_rdoc_files:
63
+ - README.rdoc
64
+ files:
65
+ - .gitignore
66
+ - MIT-LICENSE
67
+ - README.rdoc
68
+ - Rakefile
69
+ - VERSION
70
+ - autotest.rb
71
+ - fleximage.gemspec
72
+ - init.rb
73
+ - lib/dsl_accessor.rb
74
+ - lib/fleximage.rb
75
+ - lib/fleximage/aviary_controller.rb
76
+ - lib/fleximage/blank.rb
77
+ - lib/fleximage/helper.rb
78
+ - lib/fleximage/image_proxy.rb
79
+ - lib/fleximage/legacy_view.rb
80
+ - lib/fleximage/model.rb
81
+ - lib/fleximage/operator/background.rb
82
+ - lib/fleximage/operator/base.rb
83
+ - lib/fleximage/operator/border.rb
84
+ - lib/fleximage/operator/crop.rb
85
+ - lib/fleximage/operator/image_overlay.rb
86
+ - lib/fleximage/operator/resize.rb
87
+ - lib/fleximage/operator/shadow.rb
88
+ - lib/fleximage/operator/text.rb
89
+ - lib/fleximage/operator/trim.rb
90
+ - lib/fleximage/operator/unsharp_mask.rb
91
+ - lib/fleximage/rmagick_image_patch.rb
92
+ - lib/fleximage/string_patch.rb
93
+ - lib/fleximage/view.rb
94
+ - tasks/fleximage_tasks.rake
95
+ - test/fixtures/100x1.jpg
96
+ - test/fixtures/100x100.jpg
97
+ - test/fixtures/1x1.jpg
98
+ - test/fixtures/1x100.jpg
99
+ - test/fixtures/cmyk.jpg
100
+ - test/fixtures/not_a_photo.xml
101
+ - test/fixtures/photo.jpg
102
+ - test/mock_file.rb
103
+ - test/rails_root/app/controllers/application.rb
104
+ - test/rails_root/app/controllers/avatars_controller.rb
105
+ - test/rails_root/app/controllers/photo_bares_controller.rb
106
+ - test/rails_root/app/controllers/photo_dbs_controller.rb
107
+ - test/rails_root/app/controllers/photo_files_controller.rb
108
+ - test/rails_root/app/helpers/application_helper.rb
109
+ - test/rails_root/app/helpers/avatars_helper.rb
110
+ - test/rails_root/app/helpers/photo_bares_helper.rb
111
+ - test/rails_root/app/helpers/photo_dbs_helper.rb
112
+ - test/rails_root/app/helpers/photo_files_helper.rb
113
+ - test/rails_root/app/locales/de.yml
114
+ - test/rails_root/app/locales/en.yml
115
+ - test/rails_root/app/models/abstract.rb
116
+ - test/rails_root/app/models/avatar.rb
117
+ - test/rails_root/app/models/photo_bare.rb
118
+ - test/rails_root/app/models/photo_custom_error.rb
119
+ - test/rails_root/app/models/photo_db.rb
120
+ - test/rails_root/app/models/photo_file.rb
121
+ - test/rails_root/app/views/avatars/edit.html.erb
122
+ - test/rails_root/app/views/avatars/index.html.erb
123
+ - test/rails_root/app/views/avatars/new.html.erb
124
+ - test/rails_root/app/views/avatars/show.html.erb
125
+ - test/rails_root/app/views/layouts/avatars.html.erb
126
+ - test/rails_root/app/views/layouts/photo_bares.html.erb
127
+ - test/rails_root/app/views/layouts/photo_dbs.html.erb
128
+ - test/rails_root/app/views/layouts/photo_files.html.erb
129
+ - test/rails_root/app/views/photo_bares/edit.html.erb
130
+ - test/rails_root/app/views/photo_bares/index.html.erb
131
+ - test/rails_root/app/views/photo_bares/new.html.erb
132
+ - test/rails_root/app/views/photo_bares/show.html.erb
133
+ - test/rails_root/app/views/photo_dbs/edit.html.erb
134
+ - test/rails_root/app/views/photo_dbs/index.html.erb
135
+ - test/rails_root/app/views/photo_dbs/new.html.erb
136
+ - test/rails_root/app/views/photo_dbs/show.html.erb
137
+ - test/rails_root/app/views/photo_files/edit.html.erb
138
+ - test/rails_root/app/views/photo_files/index.html.erb
139
+ - test/rails_root/app/views/photo_files/new.html.erb
140
+ - test/rails_root/app/views/photo_files/show.html.erb
141
+ - test/rails_root/config/boot.rb
142
+ - test/rails_root/config/database.yml
143
+ - test/rails_root/config/environment.rb
144
+ - test/rails_root/config/environments/development.rb
145
+ - test/rails_root/config/environments/production.rb
146
+ - test/rails_root/config/environments/sqlite3.rb
147
+ - test/rails_root/config/environments/test.rb
148
+ - test/rails_root/config/initializers/inflections.rb
149
+ - test/rails_root/config/initializers/load_translations.rb
150
+ - test/rails_root/config/initializers/mime_types.rb
151
+ - test/rails_root/config/routes.rb
152
+ - test/rails_root/db/migrate/001_create_photo_files.rb
153
+ - test/rails_root/db/migrate/002_create_photo_dbs.rb
154
+ - test/rails_root/db/migrate/003_create_photo_bares.rb
155
+ - test/rails_root/db/migrate/004_create_avatars.rb
156
+ - test/rails_root/public/.htaccess
157
+ - test/rails_root/public/404.html
158
+ - test/rails_root/public/422.html
159
+ - test/rails_root/public/500.html
160
+ - test/rails_root/public/dispatch.cgi
161
+ - test/rails_root/public/dispatch.fcgi
162
+ - test/rails_root/public/dispatch.rb
163
+ - test/rails_root/public/favicon.ico
164
+ - test/rails_root/public/images/rails.png
165
+ - test/rails_root/public/index.html
166
+ - test/rails_root/public/javascripts/application.js
167
+ - test/rails_root/public/javascripts/controls.js
168
+ - test/rails_root/public/javascripts/dragdrop.js
169
+ - test/rails_root/public/javascripts/effects.js
170
+ - test/rails_root/public/javascripts/prototype.js
171
+ - test/rails_root/public/robots.txt
172
+ - test/rails_root/public/stylesheets/scaffold.css
173
+ - test/rails_root/vendor/plugins/fleximage/init.rb
174
+ - test/test_helper.rb
175
+ - test/unit/abstract_test.rb
176
+ - test/unit/basic_model_test.rb
177
+ - test/unit/blank_test.rb
178
+ - test/unit/default_image_path_option_test.rb
179
+ - test/unit/dsl_accessor_test.rb
180
+ - test/unit/file_upload_from_local_test.rb
181
+ - test/unit/file_upload_from_strings_test.rb
182
+ - test/unit/file_upload_from_url_test.rb
183
+ - test/unit/file_upload_to_db_test.rb
184
+ - test/unit/i18n_messages_test.rb
185
+ - test/unit/image_directory_option_test.rb
186
+ - test/unit/image_proxy_test.rb
187
+ - test/unit/image_storage_format_option_test.rb
188
+ - test/unit/magic_columns_test.rb
189
+ - test/unit/minimum_image_size_test.rb
190
+ - test/unit/operator_base_test.rb
191
+ - test/unit/operator_resize_test.rb
192
+ - test/unit/preprocess_image_option_test.rb
193
+ - test/unit/require_image_option_test.rb
194
+ - test/unit/temp_image_test.rb
195
+ - test/unit/use_creation_date_based_directories_option_test.rb
196
+ has_rdoc: true
197
+ homepage: http://github.com/Squeegy/fleximage
198
+ licenses: []
199
+
200
+ post_install_message:
201
+ rdoc_options:
202
+ - --charset=UTF-8
203
+ require_paths:
204
+ - lib
205
+ required_ruby_version: !ruby/object:Gem::Requirement
206
+ requirements:
207
+ - - ">="
208
+ - !ruby/object:Gem::Version
209
+ version: "0"
210
+ version:
211
+ required_rubygems_version: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - ">="
214
+ - !ruby/object:Gem::Version
215
+ version: "0"
216
+ version:
217
+ requirements: []
218
+
219
+ rubyforge_project:
220
+ rubygems_version: 1.3.5
221
+ signing_key:
222
+ specification_version: 3
223
+ summary: Rails plugin for uploading images as resources, with support for resizing, text stamping, and other special effects.
224
+ test_files:
225
+ - test/mock_file.rb
226
+ - test/rails_root/app/controllers/application.rb
227
+ - test/rails_root/app/controllers/avatars_controller.rb
228
+ - test/rails_root/app/controllers/photo_bares_controller.rb
229
+ - test/rails_root/app/controllers/photo_dbs_controller.rb
230
+ - test/rails_root/app/controllers/photo_files_controller.rb
231
+ - test/rails_root/app/helpers/application_helper.rb
232
+ - test/rails_root/app/helpers/avatars_helper.rb
233
+ - test/rails_root/app/helpers/photo_bares_helper.rb
234
+ - test/rails_root/app/helpers/photo_dbs_helper.rb
235
+ - test/rails_root/app/helpers/photo_files_helper.rb
236
+ - test/rails_root/app/models/abstract.rb
237
+ - test/rails_root/app/models/avatar.rb
238
+ - test/rails_root/app/models/photo_bare.rb
239
+ - test/rails_root/app/models/photo_custom_error.rb
240
+ - test/rails_root/app/models/photo_db.rb
241
+ - test/rails_root/app/models/photo_file.rb
242
+ - test/rails_root/config/boot.rb
243
+ - test/rails_root/config/environment.rb
244
+ - test/rails_root/config/environments/development.rb
245
+ - test/rails_root/config/environments/production.rb
246
+ - test/rails_root/config/environments/sqlite3.rb
247
+ - test/rails_root/config/environments/test.rb
248
+ - test/rails_root/config/initializers/inflections.rb
249
+ - test/rails_root/config/initializers/load_translations.rb
250
+ - test/rails_root/config/initializers/mime_types.rb
251
+ - test/rails_root/config/routes.rb
252
+ - test/rails_root/db/migrate/001_create_photo_files.rb
253
+ - test/rails_root/db/migrate/002_create_photo_dbs.rb
254
+ - test/rails_root/db/migrate/003_create_photo_bares.rb
255
+ - test/rails_root/db/migrate/004_create_avatars.rb
256
+ - test/rails_root/public/dispatch.rb
257
+ - test/rails_root/vendor/plugins/fleximage/init.rb
258
+ - test/test_helper.rb
259
+ - test/unit/abstract_test.rb
260
+ - test/unit/basic_model_test.rb
261
+ - test/unit/blank_test.rb
262
+ - test/unit/default_image_path_option_test.rb
263
+ - test/unit/dsl_accessor_test.rb
264
+ - test/unit/file_upload_from_local_test.rb
265
+ - test/unit/file_upload_from_strings_test.rb
266
+ - test/unit/file_upload_from_url_test.rb
267
+ - test/unit/file_upload_to_db_test.rb
268
+ - test/unit/i18n_messages_test.rb
269
+ - test/unit/image_directory_option_test.rb
270
+ - test/unit/image_proxy_test.rb
271
+ - test/unit/image_storage_format_option_test.rb
272
+ - test/unit/magic_columns_test.rb
273
+ - test/unit/minimum_image_size_test.rb
274
+ - test/unit/operator_base_test.rb
275
+ - test/unit/operator_resize_test.rb
276
+ - test/unit/preprocess_image_option_test.rb
277
+ - test/unit/require_image_option_test.rb
278
+ - test/unit/temp_image_test.rb
279
+ - test/unit/use_creation_date_based_directories_option_test.rb