jmcnevin-paperclip 2.4.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. data/LICENSE +26 -0
  2. data/README.md +414 -0
  3. data/Rakefile +86 -0
  4. data/generators/paperclip/USAGE +5 -0
  5. data/generators/paperclip/paperclip_generator.rb +27 -0
  6. data/generators/paperclip/templates/paperclip_migration.rb.erb +19 -0
  7. data/init.rb +4 -0
  8. data/lib/generators/paperclip/USAGE +8 -0
  9. data/lib/generators/paperclip/paperclip_generator.rb +33 -0
  10. data/lib/generators/paperclip/templates/paperclip_migration.rb.erb +19 -0
  11. data/lib/paperclip.rb +480 -0
  12. data/lib/paperclip/attachment.rb +520 -0
  13. data/lib/paperclip/callback_compatibility.rb +61 -0
  14. data/lib/paperclip/geometry.rb +155 -0
  15. data/lib/paperclip/interpolations.rb +171 -0
  16. data/lib/paperclip/iostream.rb +45 -0
  17. data/lib/paperclip/matchers.rb +33 -0
  18. data/lib/paperclip/matchers/have_attached_file_matcher.rb +57 -0
  19. data/lib/paperclip/matchers/validate_attachment_content_type_matcher.rb +81 -0
  20. data/lib/paperclip/matchers/validate_attachment_presence_matcher.rb +54 -0
  21. data/lib/paperclip/matchers/validate_attachment_size_matcher.rb +95 -0
  22. data/lib/paperclip/missing_attachment_styles.rb +87 -0
  23. data/lib/paperclip/options.rb +78 -0
  24. data/lib/paperclip/processor.rb +58 -0
  25. data/lib/paperclip/railtie.rb +26 -0
  26. data/lib/paperclip/storage.rb +3 -0
  27. data/lib/paperclip/storage/filesystem.rb +81 -0
  28. data/lib/paperclip/storage/fog.rb +163 -0
  29. data/lib/paperclip/storage/s3.rb +270 -0
  30. data/lib/paperclip/style.rb +95 -0
  31. data/lib/paperclip/thumbnail.rb +105 -0
  32. data/lib/paperclip/upfile.rb +62 -0
  33. data/lib/paperclip/version.rb +3 -0
  34. data/lib/tasks/paperclip.rake +101 -0
  35. data/rails/init.rb +2 -0
  36. data/shoulda_macros/paperclip.rb +124 -0
  37. data/test/attachment_test.rb +1161 -0
  38. data/test/database.yml +4 -0
  39. data/test/fixtures/12k.png +0 -0
  40. data/test/fixtures/50x50.png +0 -0
  41. data/test/fixtures/5k.png +0 -0
  42. data/test/fixtures/animated.gif +0 -0
  43. data/test/fixtures/bad.png +1 -0
  44. data/test/fixtures/double spaces in name.png +0 -0
  45. data/test/fixtures/fog.yml +8 -0
  46. data/test/fixtures/s3.yml +8 -0
  47. data/test/fixtures/spaced file.png +0 -0
  48. data/test/fixtures/text.txt +1 -0
  49. data/test/fixtures/twopage.pdf +0 -0
  50. data/test/fixtures/uppercase.PNG +0 -0
  51. data/test/fog_test.rb +192 -0
  52. data/test/geometry_test.rb +206 -0
  53. data/test/helper.rb +158 -0
  54. data/test/integration_test.rb +781 -0
  55. data/test/interpolations_test.rb +202 -0
  56. data/test/iostream_test.rb +71 -0
  57. data/test/matchers/have_attached_file_matcher_test.rb +24 -0
  58. data/test/matchers/validate_attachment_content_type_matcher_test.rb +87 -0
  59. data/test/matchers/validate_attachment_presence_matcher_test.rb +26 -0
  60. data/test/matchers/validate_attachment_size_matcher_test.rb +51 -0
  61. data/test/options_test.rb +75 -0
  62. data/test/paperclip_missing_attachment_styles_test.rb +80 -0
  63. data/test/paperclip_test.rb +340 -0
  64. data/test/processor_test.rb +10 -0
  65. data/test/storage/filesystem_test.rb +56 -0
  66. data/test/storage/s3_live_test.rb +88 -0
  67. data/test/storage/s3_test.rb +689 -0
  68. data/test/style_test.rb +180 -0
  69. data/test/thumbnail_test.rb +383 -0
  70. data/test/upfile_test.rb +53 -0
  71. metadata +294 -0
@@ -0,0 +1,53 @@
1
+ require './test/helper'
2
+
3
+ class UpfileTest < Test::Unit::TestCase
4
+ { %w(jpg jpe jpeg) => 'image/jpeg',
5
+ %w(tif tiff) => 'image/tiff',
6
+ %w(png) => 'image/png',
7
+ %w(gif) => 'image/gif',
8
+ %w(bmp) => 'image/bmp',
9
+ %w(svg) => 'image/svg+xml',
10
+ %w(txt) => 'text/plain',
11
+ %w(htm html) => 'text/html',
12
+ %w(csv) => 'text/csv',
13
+ %w(xml) => 'application/xml',
14
+ %w(css) => 'text/css',
15
+ %w(js) => 'application/javascript',
16
+ %w(foo) => 'application/x-foo'
17
+ }.each do |extensions, content_type|
18
+ extensions.each do |extension|
19
+ should "return a content_type of #{content_type} for a file with extension .#{extension}" do
20
+ file = stub('file', :path => "basename.#{extension}")
21
+ class << file
22
+ include Paperclip::Upfile
23
+ end
24
+
25
+ assert_equal content_type, file.content_type
26
+ end
27
+ end
28
+ end
29
+
30
+ should "return a content_type of text/plain on a real file whose content_type is determined with the file command" do
31
+ file = File.new(File.join(File.dirname(__FILE__), "..", "LICENSE"))
32
+ class << file
33
+ include Paperclip::Upfile
34
+ end
35
+ assert_equal 'text/plain', file.content_type
36
+ end
37
+
38
+ { '5k.png' => 'image/png',
39
+ 'animated.gif' => 'image/gif',
40
+ 'text.txt' => 'text/plain',
41
+ 'twopage.pdf' => 'application/pdf'
42
+ }.each do |filename, content_type|
43
+ should "return a content type of #{content_type} from a file command for file #{filename}" do
44
+ file = File.new(File.join(File.dirname(__FILE__), "fixtures", filename))
45
+ class << file
46
+ include Paperclip::Upfile
47
+ end
48
+
49
+ assert_equal content_type, file.type_from_file_command
50
+ end
51
+ end
52
+
53
+ end
metadata ADDED
@@ -0,0 +1,294 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jmcnevin-paperclip
3
+ version: !ruby/object:Gem::Version
4
+ hash: 21
5
+ prerelease:
6
+ segments:
7
+ - 2
8
+ - 4
9
+ - 5
10
+ version: 2.4.5
11
+ platform: ruby
12
+ authors:
13
+ - Jon Yurek
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-11-16 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: activerecord
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 3
29
+ segments:
30
+ - 2
31
+ - 3
32
+ - 0
33
+ version: 2.3.0
34
+ type: :runtime
35
+ version_requirements: *id001
36
+ - !ruby/object:Gem::Dependency
37
+ name: activesupport
38
+ prerelease: false
39
+ requirement: &id002 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ hash: 7
45
+ segments:
46
+ - 2
47
+ - 3
48
+ - 2
49
+ version: 2.3.2
50
+ type: :runtime
51
+ version_requirements: *id002
52
+ - !ruby/object:Gem::Dependency
53
+ name: cocaine
54
+ prerelease: false
55
+ requirement: &id003 !ruby/object:Gem::Requirement
56
+ none: false
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ hash: 27
61
+ segments:
62
+ - 0
63
+ - 0
64
+ - 2
65
+ version: 0.0.2
66
+ type: :runtime
67
+ version_requirements: *id003
68
+ - !ruby/object:Gem::Dependency
69
+ name: mime-types
70
+ prerelease: false
71
+ requirement: &id004 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ hash: 3
77
+ segments:
78
+ - 0
79
+ version: "0"
80
+ type: :runtime
81
+ version_requirements: *id004
82
+ - !ruby/object:Gem::Dependency
83
+ name: shoulda
84
+ prerelease: false
85
+ requirement: &id005 !ruby/object:Gem::Requirement
86
+ none: false
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ hash: 3
91
+ segments:
92
+ - 0
93
+ version: "0"
94
+ type: :development
95
+ version_requirements: *id005
96
+ - !ruby/object:Gem::Dependency
97
+ name: appraisal
98
+ prerelease: false
99
+ requirement: &id006 !ruby/object:Gem::Requirement
100
+ none: false
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ hash: 3
105
+ segments:
106
+ - 0
107
+ version: "0"
108
+ type: :development
109
+ version_requirements: *id006
110
+ - !ruby/object:Gem::Dependency
111
+ name: mocha
112
+ prerelease: false
113
+ requirement: &id007 !ruby/object:Gem::Requirement
114
+ none: false
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ hash: 3
119
+ segments:
120
+ - 0
121
+ version: "0"
122
+ type: :development
123
+ version_requirements: *id007
124
+ - !ruby/object:Gem::Dependency
125
+ name: aws-s3
126
+ prerelease: false
127
+ requirement: &id008 !ruby/object:Gem::Requirement
128
+ none: false
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ hash: 3
133
+ segments:
134
+ - 0
135
+ version: "0"
136
+ type: :development
137
+ version_requirements: *id008
138
+ - !ruby/object:Gem::Dependency
139
+ name: sqlite3
140
+ prerelease: false
141
+ requirement: &id009 !ruby/object:Gem::Requirement
142
+ none: false
143
+ requirements:
144
+ - - ">="
145
+ - !ruby/object:Gem::Version
146
+ hash: 3
147
+ segments:
148
+ - 0
149
+ version: "0"
150
+ type: :development
151
+ version_requirements: *id009
152
+ - !ruby/object:Gem::Dependency
153
+ name: cucumber
154
+ prerelease: false
155
+ requirement: &id010 !ruby/object:Gem::Requirement
156
+ none: false
157
+ requirements:
158
+ - - ">="
159
+ - !ruby/object:Gem::Version
160
+ hash: 3
161
+ segments:
162
+ - 0
163
+ version: "0"
164
+ type: :development
165
+ version_requirements: *id010
166
+ - !ruby/object:Gem::Dependency
167
+ name: capybara
168
+ prerelease: false
169
+ requirement: &id011 !ruby/object:Gem::Requirement
170
+ none: false
171
+ requirements:
172
+ - - ">="
173
+ - !ruby/object:Gem::Version
174
+ hash: 3
175
+ segments:
176
+ - 0
177
+ version: "0"
178
+ type: :development
179
+ version_requirements: *id011
180
+ description: Latest version of paperclip merged with width/height additions in kennon fork.
181
+ email: jyurek@thoughtbot.com
182
+ executables: []
183
+
184
+ extensions: []
185
+
186
+ extra_rdoc_files:
187
+ - README.md
188
+ files:
189
+ - README.md
190
+ - LICENSE
191
+ - Rakefile
192
+ - init.rb
193
+ - lib/generators/paperclip/paperclip_generator.rb
194
+ - lib/generators/paperclip/templates/paperclip_migration.rb.erb
195
+ - lib/generators/paperclip/USAGE
196
+ - lib/paperclip/attachment.rb
197
+ - lib/paperclip/callback_compatibility.rb
198
+ - lib/paperclip/geometry.rb
199
+ - lib/paperclip/interpolations.rb
200
+ - lib/paperclip/iostream.rb
201
+ - lib/paperclip/matchers/have_attached_file_matcher.rb
202
+ - lib/paperclip/matchers/validate_attachment_content_type_matcher.rb
203
+ - lib/paperclip/matchers/validate_attachment_presence_matcher.rb
204
+ - lib/paperclip/matchers/validate_attachment_size_matcher.rb
205
+ - lib/paperclip/matchers.rb
206
+ - lib/paperclip/missing_attachment_styles.rb
207
+ - lib/paperclip/options.rb
208
+ - lib/paperclip/processor.rb
209
+ - lib/paperclip/railtie.rb
210
+ - lib/paperclip/storage/filesystem.rb
211
+ - lib/paperclip/storage/fog.rb
212
+ - lib/paperclip/storage/s3.rb
213
+ - lib/paperclip/storage.rb
214
+ - lib/paperclip/style.rb
215
+ - lib/paperclip/thumbnail.rb
216
+ - lib/paperclip/upfile.rb
217
+ - lib/paperclip/version.rb
218
+ - lib/paperclip.rb
219
+ - lib/tasks/paperclip.rake
220
+ - test/attachment_test.rb
221
+ - test/database.yml
222
+ - test/fixtures/12k.png
223
+ - test/fixtures/50x50.png
224
+ - test/fixtures/5k.png
225
+ - test/fixtures/animated.gif
226
+ - test/fixtures/bad.png
227
+ - test/fixtures/double spaces in name.png
228
+ - test/fixtures/fog.yml
229
+ - test/fixtures/s3.yml
230
+ - test/fixtures/spaced file.png
231
+ - test/fixtures/text.txt
232
+ - test/fixtures/twopage.pdf
233
+ - test/fixtures/uppercase.PNG
234
+ - test/fog_test.rb
235
+ - test/geometry_test.rb
236
+ - test/helper.rb
237
+ - test/integration_test.rb
238
+ - test/interpolations_test.rb
239
+ - test/iostream_test.rb
240
+ - test/matchers/have_attached_file_matcher_test.rb
241
+ - test/matchers/validate_attachment_content_type_matcher_test.rb
242
+ - test/matchers/validate_attachment_presence_matcher_test.rb
243
+ - test/matchers/validate_attachment_size_matcher_test.rb
244
+ - test/options_test.rb
245
+ - test/paperclip_missing_attachment_styles_test.rb
246
+ - test/paperclip_test.rb
247
+ - test/processor_test.rb
248
+ - test/storage/filesystem_test.rb
249
+ - test/storage/s3_live_test.rb
250
+ - test/storage/s3_test.rb
251
+ - test/style_test.rb
252
+ - test/thumbnail_test.rb
253
+ - test/upfile_test.rb
254
+ - rails/init.rb
255
+ - generators/paperclip/paperclip_generator.rb
256
+ - generators/paperclip/templates/paperclip_migration.rb.erb
257
+ - generators/paperclip/USAGE
258
+ - shoulda_macros/paperclip.rb
259
+ homepage: https://github.com/thoughtbot/paperclip
260
+ licenses: []
261
+
262
+ post_install_message:
263
+ rdoc_options:
264
+ - --line-numbers
265
+ - --inline-source
266
+ require_paths:
267
+ - lib
268
+ required_ruby_version: !ruby/object:Gem::Requirement
269
+ none: false
270
+ requirements:
271
+ - - ">="
272
+ - !ruby/object:Gem::Version
273
+ hash: 3
274
+ segments:
275
+ - 0
276
+ version: "0"
277
+ required_rubygems_version: !ruby/object:Gem::Requirement
278
+ none: false
279
+ requirements:
280
+ - - ">="
281
+ - !ruby/object:Gem::Version
282
+ hash: 3
283
+ segments:
284
+ - 0
285
+ version: "0"
286
+ requirements:
287
+ - ImageMagick
288
+ rubyforge_project: paperclip
289
+ rubygems_version: 1.8.11
290
+ signing_key:
291
+ specification_version: 3
292
+ summary: File attachments as attributes for ActiveRecord
293
+ test_files: []
294
+