card 1.19.3 → 1.19.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (190) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -0
  3. data/VERSION +1 -1
  4. data/card.gemspec +1 -3
  5. data/db/migrate_core_cards/20160914132636_fix_mod_files.rb +25 -0
  6. data/lib/card.rb +0 -2
  7. data/lib/card/content/diff.rb +3 -4
  8. data/lib/card/format/error.rb +1 -1
  9. data/mod/admin/set/self/admin.rb +2 -2
  10. data/mod/admin/set/self/trash.rb +9 -3
  11. data/mod/basic_types/set/type/html.rb +1 -1
  12. data/mod/bootstrap/set/all/bootstrap/layout.rb +58 -0
  13. data/mod/bootstrap/spec/set/all/bootstrap/layout_spec.rb +32 -0
  14. data/mod/carrierwave/lib/carrier_wave/cardmount.rb +0 -2
  15. data/mod/carrierwave/set/abstract/attachment/upload_cache.rb +2 -1
  16. data/mod/core/set/all/stages.rb +6 -4
  17. data/mod/history/lib/card/act.rb +8 -7
  18. data/mod/history/set/all/history.rb +10 -8
  19. data/mod/machines/set/abstract/script.rb +1 -1
  20. data/mod/machines/set/type/css.rb +1 -1
  21. data/mod/pointer/set/abstract/01_pointer.rb +1 -1
  22. data/mod/standard/file/credit_image/image-icon.png +0 -0
  23. data/mod/standard/file/credit_image/image-large.png +0 -0
  24. data/mod/standard/file/credit_image/image-medium.png +0 -0
  25. data/mod/standard/file/credit_image/image-small.png +0 -0
  26. data/mod/standard/file/favicon/image-icon.png +0 -0
  27. data/mod/standard/file/favicon/image-large.png +0 -0
  28. data/mod/standard/file/favicon/image-medium.png +0 -0
  29. data/mod/standard/file/favicon/image-small.png +0 -0
  30. data/mod/standard/file/logo/image-icon.png +0 -0
  31. data/mod/standard/file/logo/image-large.png +0 -0
  32. data/mod/standard/file/logo/image-medium.png +0 -0
  33. data/mod/standard/file/logo/image-small.png +0 -0
  34. data/mod/standard/set/self/recent.rb +2 -2
  35. data/spec/lib/card/diff_spec.rb +9 -9
  36. metadata +19 -156
  37. data/vendor/carrierwave/.gitignore +0 -19
  38. data/vendor/carrierwave/.rubocop.yml +0 -262
  39. data/vendor/carrierwave/.travis.yml +0 -58
  40. data/vendor/carrierwave/CHANGELOG.md +0 -81
  41. data/vendor/carrierwave/CONTRIBUTING.md +0 -37
  42. data/vendor/carrierwave/Gemfile +0 -5
  43. data/vendor/carrierwave/README.md +0 -995
  44. data/vendor/carrierwave/Rakefile +0 -26
  45. data/vendor/carrierwave/carrierwave.gemspec +0 -45
  46. data/vendor/carrierwave/cucumber.yml +0 -2
  47. data/vendor/carrierwave/features/caching.feature +0 -28
  48. data/vendor/carrierwave/features/download.feature +0 -20
  49. data/vendor/carrierwave/features/file_storage.feature +0 -37
  50. data/vendor/carrierwave/features/file_storage_overridden_filename.feature +0 -38
  51. data/vendor/carrierwave/features/file_storage_overridden_store_dir.feature +0 -38
  52. data/vendor/carrierwave/features/file_storage_reversing_processor.feature +0 -43
  53. data/vendor/carrierwave/features/fixtures/bork.txt +0 -1
  54. data/vendor/carrierwave/features/fixtures/monkey.txt +0 -1
  55. data/vendor/carrierwave/features/fixtures/upcased_bork.txt +0 -1
  56. data/vendor/carrierwave/features/mount_activerecord.feature +0 -46
  57. data/vendor/carrierwave/features/step_definitions/activerecord_steps.rb +0 -20
  58. data/vendor/carrierwave/features/step_definitions/caching_steps.rb +0 -12
  59. data/vendor/carrierwave/features/step_definitions/datamapper_steps.rb +0 -27
  60. data/vendor/carrierwave/features/step_definitions/download_steps.rb +0 -8
  61. data/vendor/carrierwave/features/step_definitions/file_steps.rb +0 -51
  62. data/vendor/carrierwave/features/step_definitions/general_steps.rb +0 -102
  63. data/vendor/carrierwave/features/step_definitions/mount_steps.rb +0 -17
  64. data/vendor/carrierwave/features/step_definitions/store_steps.rb +0 -16
  65. data/vendor/carrierwave/features/support/activerecord.rb +0 -18
  66. data/vendor/carrierwave/features/support/env.rb +0 -19
  67. data/vendor/carrierwave/features/versions_basics.feature +0 -50
  68. data/vendor/carrierwave/features/versions_caching_from_versions.feature +0 -32
  69. data/vendor/carrierwave/features/versions_nested_versions.feature +0 -70
  70. data/vendor/carrierwave/features/versions_overridden_filename.feature +0 -51
  71. data/vendor/carrierwave/features/versions_overriden_store_dir.feature +0 -41
  72. data/vendor/carrierwave/gemfiles/rails-4-0-stable.gemfile +0 -5
  73. data/vendor/carrierwave/gemfiles/rails-4-1-stable.gemfile +0 -5
  74. data/vendor/carrierwave/gemfiles/rails-4-2-stable.gemfile +0 -5
  75. data/vendor/carrierwave/gemfiles/rails-master.gemfile +0 -11
  76. data/vendor/carrierwave/lib/carrierwave.rb +0 -93
  77. data/vendor/carrierwave/lib/carrierwave/compatibility/paperclip.rb +0 -103
  78. data/vendor/carrierwave/lib/carrierwave/error.rb +0 -8
  79. data/vendor/carrierwave/lib/carrierwave/locale/cs.yml +0 -14
  80. data/vendor/carrierwave/lib/carrierwave/locale/de.yml +0 -14
  81. data/vendor/carrierwave/lib/carrierwave/locale/el.yml +0 -14
  82. data/vendor/carrierwave/lib/carrierwave/locale/en.yml +0 -14
  83. data/vendor/carrierwave/lib/carrierwave/locale/es.yml +0 -14
  84. data/vendor/carrierwave/lib/carrierwave/locale/fr-CA.yml +0 -14
  85. data/vendor/carrierwave/lib/carrierwave/locale/fr.yml +0 -14
  86. data/vendor/carrierwave/lib/carrierwave/locale/id.yml +0 -14
  87. data/vendor/carrierwave/lib/carrierwave/locale/ja.yml +0 -14
  88. data/vendor/carrierwave/lib/carrierwave/locale/nb.yml +0 -14
  89. data/vendor/carrierwave/lib/carrierwave/locale/nl.yml +0 -14
  90. data/vendor/carrierwave/lib/carrierwave/locale/pl.yml +0 -14
  91. data/vendor/carrierwave/lib/carrierwave/locale/pt-BR.yml +0 -14
  92. data/vendor/carrierwave/lib/carrierwave/locale/pt-PT.yml +0 -14
  93. data/vendor/carrierwave/lib/carrierwave/locale/ru.yml +0 -14
  94. data/vendor/carrierwave/lib/carrierwave/locale/sk.yml +0 -14
  95. data/vendor/carrierwave/lib/carrierwave/locale/tr.yml +0 -14
  96. data/vendor/carrierwave/lib/carrierwave/locale/zh-CN.yml +0 -14
  97. data/vendor/carrierwave/lib/carrierwave/locale/zh-TW.yml +0 -14
  98. data/vendor/carrierwave/lib/carrierwave/mount.rb +0 -444
  99. data/vendor/carrierwave/lib/carrierwave/mounter.rb +0 -163
  100. data/vendor/carrierwave/lib/carrierwave/orm/activerecord.rb +0 -103
  101. data/vendor/carrierwave/lib/carrierwave/processing.rb +0 -2
  102. data/vendor/carrierwave/lib/carrierwave/processing/mini_magick.rb +0 -328
  103. data/vendor/carrierwave/lib/carrierwave/processing/rmagick.rb +0 -379
  104. data/vendor/carrierwave/lib/carrierwave/sanitized_file.rb +0 -348
  105. data/vendor/carrierwave/lib/carrierwave/storage.rb +0 -2
  106. data/vendor/carrierwave/lib/carrierwave/storage/abstract.rb +0 -43
  107. data/vendor/carrierwave/lib/carrierwave/storage/file.rb +0 -118
  108. data/vendor/carrierwave/lib/carrierwave/storage/fog.rb +0 -462
  109. data/vendor/carrierwave/lib/carrierwave/test/matchers.rb +0 -394
  110. data/vendor/carrierwave/lib/carrierwave/uploader.rb +0 -67
  111. data/vendor/carrierwave/lib/carrierwave/uploader/cache.rb +0 -207
  112. data/vendor/carrierwave/lib/carrierwave/uploader/callbacks.rb +0 -33
  113. data/vendor/carrierwave/lib/carrierwave/uploader/configuration.rb +0 -203
  114. data/vendor/carrierwave/lib/carrierwave/uploader/content_type_blacklist.rb +0 -48
  115. data/vendor/carrierwave/lib/carrierwave/uploader/content_type_whitelist.rb +0 -48
  116. data/vendor/carrierwave/lib/carrierwave/uploader/default_url.rb +0 -17
  117. data/vendor/carrierwave/lib/carrierwave/uploader/download.rb +0 -92
  118. data/vendor/carrierwave/lib/carrierwave/uploader/extension_blacklist.rb +0 -51
  119. data/vendor/carrierwave/lib/carrierwave/uploader/extension_whitelist.rb +0 -51
  120. data/vendor/carrierwave/lib/carrierwave/uploader/file_size.rb +0 -41
  121. data/vendor/carrierwave/lib/carrierwave/uploader/magic_mime_blacklist.rb +0 -94
  122. data/vendor/carrierwave/lib/carrierwave/uploader/magic_mime_whitelist.rb +0 -94
  123. data/vendor/carrierwave/lib/carrierwave/uploader/mountable.rb +0 -38
  124. data/vendor/carrierwave/lib/carrierwave/uploader/processing.rb +0 -88
  125. data/vendor/carrierwave/lib/carrierwave/uploader/proxy.rb +0 -86
  126. data/vendor/carrierwave/lib/carrierwave/uploader/remove.rb +0 -21
  127. data/vendor/carrierwave/lib/carrierwave/uploader/serialization.rb +0 -28
  128. data/vendor/carrierwave/lib/carrierwave/uploader/store.rb +0 -93
  129. data/vendor/carrierwave/lib/carrierwave/uploader/url.rb +0 -41
  130. data/vendor/carrierwave/lib/carrierwave/uploader/versions.rb +0 -295
  131. data/vendor/carrierwave/lib/carrierwave/utilities.rb +0 -6
  132. data/vendor/carrierwave/lib/carrierwave/utilities/uri.rb +0 -21
  133. data/vendor/carrierwave/lib/carrierwave/validations/active_model.rb +0 -78
  134. data/vendor/carrierwave/lib/carrierwave/version.rb +0 -3
  135. data/vendor/carrierwave/lib/generators/templates/uploader.rb +0 -49
  136. data/vendor/carrierwave/lib/generators/uploader_generator.rb +0 -7
  137. data/vendor/carrierwave/script/console +0 -10
  138. data/vendor/carrierwave/script/destroy +0 -14
  139. data/vendor/carrierwave/script/generate +0 -14
  140. data/vendor/carrierwave/spec/compatibility/paperclip_spec.rb +0 -138
  141. data/vendor/carrierwave/spec/fixtures/Uppercase.jpg +0 -1
  142. data/vendor/carrierwave/spec/fixtures/bork.ttxt +0 -1
  143. data/vendor/carrierwave/spec/fixtures/bork.txt +0 -1
  144. data/vendor/carrierwave/spec/fixtures/bork.txtt +0 -1
  145. data/vendor/carrierwave/spec/fixtures/case.JPG +0 -1
  146. data/vendor/carrierwave/spec/fixtures/landscape.jpg +0 -0
  147. data/vendor/carrierwave/spec/fixtures/multi_page.pdf +0 -0
  148. data/vendor/carrierwave/spec/fixtures/new.jpeg +0 -1
  149. data/vendor/carrierwave/spec/fixtures/new.txt +0 -1
  150. data/vendor/carrierwave/spec/fixtures/old.jpeg +0 -1
  151. data/vendor/carrierwave/spec/fixtures/old.txt +0 -1
  152. data/vendor/carrierwave/spec/fixtures/portrait.jpg +0 -0
  153. data/vendor/carrierwave/spec/fixtures/ruby.gif +0 -0
  154. data/vendor/carrierwave/spec/fixtures/sponsored.doc +0 -1
  155. data/vendor/carrierwave/spec/fixtures/test+.jpg +0 -1
  156. data/vendor/carrierwave/spec/fixtures/test.jpeg +0 -1
  157. data/vendor/carrierwave/spec/fixtures/test.jpg +0 -1
  158. data/vendor/carrierwave/spec/generators/uploader_generator_spec.rb +0 -19
  159. data/vendor/carrierwave/spec/mount_multiple_spec.rb +0 -913
  160. data/vendor/carrierwave/spec/mount_single_spec.rb +0 -793
  161. data/vendor/carrierwave/spec/orm/activerecord_spec.rb +0 -1556
  162. data/vendor/carrierwave/spec/processing/mini_magick_spec.rb +0 -210
  163. data/vendor/carrierwave/spec/processing/rmagick_spec.rb +0 -250
  164. data/vendor/carrierwave/spec/sanitized_file_spec.rb +0 -805
  165. data/vendor/carrierwave/spec/spec_helper.rb +0 -105
  166. data/vendor/carrierwave/spec/storage/file_spec.rb +0 -82
  167. data/vendor/carrierwave/spec/storage/fog_credentials.rb +0 -46
  168. data/vendor/carrierwave/spec/storage/fog_helper.rb +0 -428
  169. data/vendor/carrierwave/spec/storage/fog_spec.rb +0 -48
  170. data/vendor/carrierwave/spec/support/activerecord.rb +0 -31
  171. data/vendor/carrierwave/spec/support/file_utils_helper.rb +0 -15
  172. data/vendor/carrierwave/spec/uploader/cache_spec.rb +0 -324
  173. data/vendor/carrierwave/spec/uploader/callback_spec.rb +0 -30
  174. data/vendor/carrierwave/spec/uploader/configuration_spec.rb +0 -133
  175. data/vendor/carrierwave/spec/uploader/content_type_blacklist_spec.rb +0 -61
  176. data/vendor/carrierwave/spec/uploader/content_type_whitelist_spec.rb +0 -63
  177. data/vendor/carrierwave/spec/uploader/default_url_spec.rb +0 -77
  178. data/vendor/carrierwave/spec/uploader/download_spec.rb +0 -204
  179. data/vendor/carrierwave/spec/uploader/extension_blacklist_spec.rb +0 -112
  180. data/vendor/carrierwave/spec/uploader/extension_whitelist_spec.rb +0 -102
  181. data/vendor/carrierwave/spec/uploader/file_size_spec.rb +0 -52
  182. data/vendor/carrierwave/spec/uploader/mountable_spec.rb +0 -26
  183. data/vendor/carrierwave/spec/uploader/overrides_spec.rb +0 -71
  184. data/vendor/carrierwave/spec/uploader/paths_spec.rb +0 -18
  185. data/vendor/carrierwave/spec/uploader/processing_spec.rb +0 -159
  186. data/vendor/carrierwave/spec/uploader/proxy_spec.rb +0 -79
  187. data/vendor/carrierwave/spec/uploader/remove_spec.rb +0 -71
  188. data/vendor/carrierwave/spec/uploader/store_spec.rb +0 -400
  189. data/vendor/carrierwave/spec/uploader/url_spec.rb +0 -273
  190. data/vendor/carrierwave/spec/uploader/versions_spec.rb +0 -633
@@ -1,394 +0,0 @@
1
- module CarrierWave
2
- module Test
3
-
4
- ##
5
- # These are some matchers that can be used in RSpec specs, to simplify the testing
6
- # of uploaders.
7
- #
8
- module Matchers
9
-
10
- class BeIdenticalTo # :nodoc:
11
- def initialize(expected)
12
- @expected = expected
13
- end
14
-
15
- def matches?(actual)
16
- @actual = actual
17
- FileUtils.identical?(@actual, @expected)
18
- end
19
-
20
- def failure_message
21
- "expected #{@actual.inspect} to be identical to #{@expected.inspect}"
22
- end
23
-
24
- def failure_message_when_negated
25
- "expected #{@actual.inspect} to not be identical to #{@expected.inspect}"
26
- end
27
-
28
- def description
29
- "be identical to #{@expected.inspect}"
30
- end
31
-
32
- # RSpec 2 compatibility:
33
- alias_method :negative_failure_message, :failure_message_when_negated
34
- end
35
-
36
- def be_identical_to(expected)
37
- BeIdenticalTo.new(expected)
38
- end
39
-
40
- class HavePermissions # :nodoc:
41
- def initialize(expected)
42
- @expected = expected
43
- end
44
-
45
- def matches?(actual)
46
- @actual = actual
47
- # Satisfy expectation here. Return false or raise an error if it's not met.
48
- (File.stat(@actual.path).mode & 0777) == @expected
49
- end
50
-
51
- def failure_message
52
- "expected #{@actual.current_path.inspect} to have permissions #{@expected.to_s(8)}, but they were #{(File.stat(@actual.path).mode & 0777).to_s(8)}"
53
- end
54
-
55
- def failure_message_when_negated
56
- "expected #{@actual.current_path.inspect} not to have permissions #{@expected.to_s(8)}, but it did"
57
- end
58
-
59
- def description
60
- "have permissions #{@expected.to_s(8)}"
61
- end
62
-
63
- # RSpec 2 compatibility:
64
- alias_method :negative_failure_message, :failure_message_when_negated
65
- end
66
-
67
- def have_permissions(expected)
68
- HavePermissions.new(expected)
69
- end
70
-
71
- class HaveDirectoryPermissions # :nodoc:
72
- def initialize(expected)
73
- @expected = expected
74
- end
75
-
76
- def matches?(actual)
77
- @actual = actual
78
- # Satisfy expectation here. Return false or raise an error if it's not met.
79
- (File.stat(File.dirname @actual.path).mode & 0777) == @expected
80
- end
81
-
82
- def failure_message
83
- "expected #{File.dirname @actual.current_path.inspect} to have permissions #{@expected.to_s(8)}, but they were #{(File.stat(@actual.path).mode & 0777).to_s(8)}"
84
- end
85
-
86
- def failure_message_when_negated
87
- "expected #{File.dirname @actual.current_path.inspect} not to have permissions #{@expected.to_s(8)}, but it did"
88
- end
89
-
90
- def description
91
- "have permissions #{@expected.to_s(8)}"
92
- end
93
-
94
- # RSpec 2 compatibility:
95
- alias_method :negative_failure_message, :failure_message_when_negated
96
- end
97
-
98
- def have_directory_permissions(expected)
99
- HaveDirectoryPermissions.new(expected)
100
- end
101
-
102
- class BeNoLargerThan # :nodoc:
103
- def initialize(width, height)
104
- @width, @height = width, height
105
- end
106
-
107
- def matches?(actual)
108
- @actual = actual
109
- # Satisfy expectation here. Return false or raise an error if it's not met.
110
- image = ImageLoader.load_image(@actual.current_path)
111
- @actual_width = image.width
112
- @actual_height = image.height
113
- @actual_width <= @width && @actual_height <= @height
114
- end
115
-
116
- def failure_message
117
- "expected #{@actual.current_path.inspect} to be no larger than #{@width} by #{@height}, but it was #{@actual_width} by #{@actual_height}."
118
- end
119
-
120
- def failure_message_when_negated
121
- "expected #{@actual.current_path.inspect} to be larger than #{@width} by #{@height}, but it wasn't."
122
- end
123
-
124
- def description
125
- "be no larger than #{@width} by #{@height}"
126
- end
127
-
128
- # RSpec 2 compatibility:
129
- alias_method :negative_failure_message, :failure_message_when_negated
130
- end
131
-
132
- def be_no_larger_than(width, height)
133
- BeNoLargerThan.new(width, height)
134
- end
135
-
136
- class HaveDimensions # :nodoc:
137
- def initialize(width, height)
138
- @width, @height = width, height
139
- end
140
-
141
- def matches?(actual)
142
- @actual = actual
143
- # Satisfy expectation here. Return false or raise an error if it's not met.
144
- image = ImageLoader.load_image(@actual.current_path)
145
- @actual_width = image.width
146
- @actual_height = image.height
147
- @actual_width == @width && @actual_height == @height
148
- end
149
-
150
- def failure_message
151
- "expected #{@actual.current_path.inspect} to have an exact size of #{@width} by #{@height}, but it was #{@actual_width} by #{@actual_height}."
152
- end
153
-
154
- def failure_message_when_negated
155
- "expected #{@actual.current_path.inspect} not to have an exact size of #{@width} by #{@height}, but it did."
156
- end
157
-
158
- def description
159
- "have an exact size of #{@width} by #{@height}"
160
- end
161
-
162
- # RSpec 2 compatibility:
163
- alias_method :negative_failure_message, :failure_message_when_negated
164
- end
165
-
166
- def have_dimensions(width, height)
167
- HaveDimensions.new(width, height)
168
- end
169
-
170
- class HaveHeight # :nodoc:
171
- def initialize(height)
172
- @height = height
173
- end
174
-
175
- def matches?(actual)
176
- @actual = actual
177
- # Satisfy expectation here. Return false or raise an error if it's not met.
178
- image = ImageLoader.load_image(@actual.current_path)
179
- @actual_height = image.height
180
- @actual_height == @height
181
- end
182
-
183
- def failure_message
184
- "expected #{@actual.current_path.inspect} to have an exact size of #{@height}, but it was #{@actual_height}."
185
- end
186
-
187
- def failure_message_when_negated
188
- "expected #{@actual.current_path.inspect} not to have an exact size of #{@height}, but it did."
189
- end
190
-
191
- def description
192
- "have an exact height of #{@height}"
193
- end
194
-
195
- # RSpec 2 compatibility:
196
- alias_method :negative_failure_message, :failure_message_when_negated
197
- end
198
-
199
- def have_height(height)
200
- HaveHeight.new(height)
201
- end
202
-
203
- class HaveWidth # :nodoc:
204
- def initialize(width)
205
- @width = width
206
- end
207
-
208
- def matches?(actual)
209
- @actual = actual
210
- # Satisfy expectation here. Return false or raise an error if it's not met.
211
- image = ImageLoader.load_image(@actual.current_path)
212
- @actual_width = image.width
213
- @actual_width == @width
214
- end
215
-
216
- def failure_message
217
- "expected #{@actual.current_path.inspect} to have an exact size of #{@width}, but it was #{@actual_width}."
218
- end
219
-
220
- def failure_message_when_negated
221
- "expected #{@actual.current_path.inspect} not to have an exact size of #{@width}, but it did."
222
- end
223
-
224
- def description
225
- "have an exact width of #{@width}"
226
- end
227
-
228
- # RSpec 2 compatibility:
229
- alias_method :negative_failure_message, :failure_message_when_negated
230
- end
231
-
232
- def have_width(width)
233
- HaveWidth.new(width)
234
- end
235
-
236
- class BeNoWiderThan # :nodoc:
237
- def initialize(width)
238
- @width = width
239
- end
240
-
241
- def matches?(actual)
242
- @actual = actual
243
- # Satisfy expectation here. Return false or raise an error if it's not met.
244
- image = ImageLoader.load_image(@actual.current_path)
245
- @actual_width = image.width
246
- @actual_width <= @width
247
- end
248
-
249
- def failure_message
250
- "expected #{@actual.current_path.inspect} to be no wider than #{@width}, but it was #{@actual_width}."
251
- end
252
-
253
- def failure_message_when_negated
254
- "expected #{@actual.current_path.inspect} not to be wider than #{@width}, but it is."
255
- end
256
-
257
- def description
258
- "have a width less than or equal to #{@width}"
259
- end
260
-
261
- # RSpec 2 compatibility:
262
- alias_method :negative_failure_message, :failure_message_when_negated
263
- end
264
-
265
- def be_no_wider_than(width)
266
- BeNoWiderThan.new(width)
267
- end
268
-
269
- class BeNoTallerThan # :nodoc:
270
- def initialize(height)
271
- @height = height
272
- end
273
-
274
- def matches?(actual)
275
- @actual = actual
276
- # Satisfy expectation here. Return false or raise an error if it's not met.
277
- image = ImageLoader.load_image(@actual.current_path)
278
- @actual_height = image.height
279
- @actual_height <= @height
280
- end
281
-
282
- def failure_message
283
- "expected #{@actual.current_path.inspect} to be no taller than #{@height}, but it was #{@actual_height}."
284
- end
285
-
286
- def failure_message_when_negated
287
- "expected #{@actual.current_path.inspect} not to be taller than #{@height}, but it is."
288
- end
289
-
290
- def description
291
- "have a height less than or equal to #{@height}"
292
- end
293
-
294
- # RSpec 2 compatibility:
295
- alias_method :negative_failure_message, :failure_message_when_negated
296
- end
297
-
298
- def be_no_taller_than(height)
299
- BeNoTallerThan.new(height)
300
- end
301
-
302
- class BeFormat # :nodoc:
303
- def initialize(expected)
304
- @expected = expected
305
- end
306
-
307
- def matches?(actual)
308
- @actual = actual
309
- # Satisfy expectation here. Return false or raise an error if it's not met.
310
- image = ImageLoader.load_image(@actual.current_path)
311
- @actual_expected = image.format
312
- !@expected.nil? && @actual_expected.casecmp(@expected).zero?
313
- end
314
-
315
- def failure_message
316
- "expected #{@actual.current_path.inspect} to have #{@expected} format, but it was #{@actual_expected}."
317
- end
318
-
319
- def failure_message_when_negated
320
- "expected #{@actual.current_path.inspect} not to have #{@expected} format, but it did."
321
- end
322
-
323
- def description
324
- "have #{@expected} format"
325
- end
326
-
327
- # RSpec 2 compatibility:
328
- alias_method :negative_failure_message, :failure_message_when_negated
329
- end
330
-
331
- def be_format(expected)
332
- BeFormat.new(expected)
333
- end
334
-
335
- class ImageLoader # :nodoc:
336
- def self.load_image(filename)
337
- if defined? ::MiniMagick
338
- MiniMagickWrapper.new(filename)
339
- else
340
- unless defined? ::Magick
341
- begin
342
- require 'rmagick'
343
- rescue LoadError
344
- require 'RMagick'
345
- rescue LoadError
346
- puts "WARNING: Failed to require rmagick, image processing may fail!"
347
- end
348
- end
349
- MagickWrapper.new(filename)
350
- end
351
- end
352
- end
353
-
354
- class MagickWrapper # :nodoc:
355
- attr_reader :image
356
- def width
357
- image.columns
358
- end
359
-
360
- def height
361
- image.rows
362
- end
363
-
364
- def format
365
- image.format
366
- end
367
-
368
- def initialize(filename)
369
- @image = ::Magick::Image.read(filename).first
370
- end
371
- end
372
-
373
- class MiniMagickWrapper # :nodoc:
374
- attr_reader :image
375
- def width
376
- image[:width]
377
- end
378
-
379
- def height
380
- image[:height]
381
- end
382
-
383
- def format
384
- image[:format]
385
- end
386
-
387
- def initialize(filename)
388
- @image = ::MiniMagick::Image.open(filename)
389
- end
390
- end
391
-
392
- end # Matchers
393
- end # Test
394
- end # CarrierWave
@@ -1,67 +0,0 @@
1
- require "carrierwave/uploader/configuration"
2
- require "carrierwave/uploader/callbacks"
3
- require "carrierwave/uploader/proxy"
4
- require "carrierwave/uploader/url"
5
- require "carrierwave/uploader/mountable"
6
- require "carrierwave/uploader/cache"
7
- require "carrierwave/uploader/store"
8
- require "carrierwave/uploader/download"
9
- require "carrierwave/uploader/remove"
10
- require "carrierwave/uploader/extension_whitelist"
11
- require "carrierwave/uploader/extension_blacklist"
12
- require "carrierwave/uploader/content_type_whitelist"
13
- require "carrierwave/uploader/content_type_blacklist"
14
- require "carrierwave/uploader/file_size"
15
- require "carrierwave/uploader/processing"
16
- require "carrierwave/uploader/versions"
17
- require "carrierwave/uploader/default_url"
18
-
19
- require "carrierwave/uploader/serialization"
20
-
21
- module CarrierWave
22
-
23
- ##
24
- # See CarrierWave::Uploader::Base
25
- #
26
- module Uploader
27
-
28
- ##
29
- # An uploader is a class that allows you to easily handle the caching and storage of
30
- # uploaded files. Please refer to the README for configuration options.
31
- #
32
- # Once you have an uploader you can use it in isolation:
33
- #
34
- # my_uploader = MyUploader.new
35
- # my_uploader.cache!(File.open(path_to_file))
36
- # my_uploader.retrieve_from_store!('monkey.png')
37
- #
38
- # Alternatively, you can mount it on an ORM or other persistence layer, with
39
- # +CarrierWave::Mount#mount_uploader+. There are extensions for activerecord and datamapper
40
- # these are *very* simple (they are only a dozen lines of code), so adding your own should
41
- # be trivial.
42
- #
43
- class Base
44
- attr_reader :file
45
-
46
- include CarrierWave::Uploader::Configuration
47
- include CarrierWave::Uploader::Callbacks
48
- include CarrierWave::Uploader::Proxy
49
- include CarrierWave::Uploader::Url
50
- include CarrierWave::Uploader::Mountable
51
- include CarrierWave::Uploader::Cache
52
- include CarrierWave::Uploader::Store
53
- include CarrierWave::Uploader::Download
54
- include CarrierWave::Uploader::Remove
55
- include CarrierWave::Uploader::ExtensionWhitelist
56
- include CarrierWave::Uploader::ExtensionBlacklist
57
- include CarrierWave::Uploader::ContentTypeWhitelist
58
- include CarrierWave::Uploader::ContentTypeBlacklist
59
- include CarrierWave::Uploader::FileSize
60
- include CarrierWave::Uploader::Processing
61
- include CarrierWave::Uploader::Versions
62
- include CarrierWave::Uploader::DefaultUrl
63
- include CarrierWave::Uploader::Serialization
64
- end # Base
65
-
66
- end # Uploader
67
- end # CarrierWave