marcel 0.3.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. checksums.yaml +4 -4
  2. data/lib/marcel.rb +3 -2
  3. data/lib/marcel/magic.rb +147 -0
  4. data/lib/marcel/mime_type.rb +71 -65
  5. data/lib/marcel/mime_type/definitions.rb +9 -3
  6. data/lib/marcel/tables.rb +2515 -0
  7. data/lib/marcel/version.rb +1 -1
  8. metadata +44 -234
  9. data/.gitignore +0 -13
  10. data/Gemfile +0 -4
  11. data/Gemfile.lock +0 -26
  12. data/README.md +0 -50
  13. data/Rakefile +0 -33
  14. data/marcel.gemspec +0 -28
  15. data/test/declared_type_test.rb +0 -17
  16. data/test/extension_test.rb +0 -25
  17. data/test/fixtures/image.gif +0 -0
  18. data/test/fixtures/magic/application/msword/msword.doc +0 -0
  19. data/test/fixtures/magic/application/pdf/illustrator-seen-as-pdf.ai +22 -6302
  20. data/test/fixtures/magic/application/pdf/pdf.pdf +0 -0
  21. data/test/fixtures/magic/application/rtf/rtf.rtf +0 -1
  22. data/test/fixtures/magic/application/vnd.adobe.flash.movie/flash.swf +0 -0
  23. data/test/fixtures/magic/application/vnd.openxmlformats-officedocument.presentationml.presentation/vnd.openxmlformats-officedocument.presentationml.presentation.pptx +0 -0
  24. data/test/fixtures/magic/application/vnd.openxmlformats-officedocument.spreadsheetml.sheet/vnd.openxmlformats-officedocument.spreadsheetml.sheet.xlsx +0 -0
  25. data/test/fixtures/magic/application/vnd.openxmlformats-officedocument.wordprocessingml.document/vnd.openxmlformats-officedocument.wordprocessingml.document.docx +0 -0
  26. data/test/fixtures/magic/application/x-font-ttf.ttf +0 -0
  27. data/test/fixtures/magic/application/xml/xml.xml +0 -1
  28. data/test/fixtures/magic/application/zip/sketch.sketch +0 -0
  29. data/test/fixtures/magic/application/zip/zip.zip +0 -0
  30. data/test/fixtures/magic/audio/flac/flac.flac +0 -0
  31. data/test/fixtures/magic/audio/mp4/m4a.m4a +0 -0
  32. data/test/fixtures/magic/audio/mp4/mp4.m4a +0 -0
  33. data/test/fixtures/magic/audio/mpeg/mpeg.mp3 +0 -0
  34. data/test/fixtures/magic/audio/x-wav/wav.wav +0 -0
  35. data/test/fixtures/magic/audio/x-wav/x-wav.wav +0 -0
  36. data/test/fixtures/magic/image/bmp/bmp.bmp +0 -0
  37. data/test/fixtures/magic/image/gif/gif.gif +0 -0
  38. data/test/fixtures/magic/image/jpeg/jpeg.jpg +0 -0
  39. data/test/fixtures/magic/image/png/png.png +0 -0
  40. data/test/fixtures/magic/image/svg+xml/svg.svg +0 -1
  41. data/test/fixtures/magic/image/tiff/tiff.tif +0 -0
  42. data/test/fixtures/magic/image/vnd.adobe.photoshop/photoshop-large-document-format.psb +0 -0
  43. data/test/fixtures/magic/image/vnd.adobe.photoshop/vnd.adobe.photoshop.psd +0 -0
  44. data/test/fixtures/magic/image/vnd.dwg/x-dwg.dwg +0 -0
  45. data/test/fixtures/magic/image/vnd.microsoft.icon/ico.ico +0 -0
  46. data/test/fixtures/magic/image/webp/webp.webp +0 -0
  47. data/test/fixtures/magic/image/x-eps/postscript/postscript.eps +0 -0
  48. data/test/fixtures/magic/image/x-eps/x-eps.eps +0 -0
  49. data/test/fixtures/magic/text/html/html.html +0 -3
  50. data/test/fixtures/magic/video/mp4/m4v.m4v +0 -0
  51. data/test/fixtures/magic/video/mp4/mp4.mp4 +0 -0
  52. data/test/fixtures/magic/video/quicktime/quicktime.mov +0 -0
  53. data/test/fixtures/magic/video/webm/webm.mkv +0 -0
  54. data/test/fixtures/name/application/illustrator/illustrator.ai +27 -6301
  55. data/test/fixtures/name/application/javascript/javascript.js +0 -3
  56. data/test/fixtures/name/application/json/json.json +0 -3
  57. data/test/fixtures/name/application/msword/msword.doc +0 -0
  58. data/test/fixtures/name/application/pdf/pdf.pdf +0 -0
  59. data/test/fixtures/name/application/rtf/rtf.rtf +0 -1
  60. data/test/fixtures/name/application/sql/sql.sql +0 -0
  61. data/test/fixtures/name/application/vnd.adobe.flash.movie/flash.swf +0 -0
  62. data/test/fixtures/name/application/vnd.android.package-archive/vnd.android.package-archive.apk +0 -0
  63. data/test/fixtures/name/application/vnd.apple.keynote/vnd.apple.keynote.key +0 -0
  64. data/test/fixtures/name/application/vnd.apple.numbers/vnd.apple.numbers.numbers +0 -0
  65. data/test/fixtures/name/application/vnd.apple.pages/vnd.apple.pages.pages +0 -0
  66. data/test/fixtures/name/application/vnd.ms-excel.sheet.binary.macroenabled.12/vnd.ms-excel.sheet.binary.macroenabled.12.xlsb +0 -0
  67. data/test/fixtures/name/application/vnd.ms-excel.sheet.macroenabled.12/vnd.ms-excel.sheet.macroenabled.12.xlsm +0 -0
  68. data/test/fixtures/name/application/vnd.ms-excel.template.macroenabled.12/vnd.ms-excel.template.macroenabled.12.xltm +0 -0
  69. data/test/fixtures/name/application/vnd.ms-excel/vnd.ms-excel.xls +0 -0
  70. data/test/fixtures/name/application/vnd.ms-powerpoint.presentation.macroenabled.12/vnd.ms-powerpoint.presentation.macroenabled.12.pptm +0 -0
  71. data/test/fixtures/name/application/vnd.ms-powerpoint.slideshow.macroenabled.12/vnd.ms-powerpoint.slideshow.macroenabled.12.ppsm +0 -0
  72. data/test/fixtures/name/application/vnd.ms-powerpoint.template.macroenabled.12/vnd.ms-powerpoint.template.macroenabled.12.potm +0 -0
  73. data/test/fixtures/name/application/vnd.ms-word.document.macroenabled.12/vnd.ms-word.document.macroenabled.12.docm +0 -0
  74. data/test/fixtures/name/application/vnd.ms-word.template.macroenabled.12/vnd.ms-word.template.macroenabled.12.dotm +0 -0
  75. data/test/fixtures/name/application/vnd.openxmlformats-officedocument.presentationml.presentation/vnd.openxmlformats-officedocument.presentationml.presentation.pptx +0 -0
  76. data/test/fixtures/name/application/vnd.openxmlformats-officedocument.presentationml.slideshow/vnd.openxmlformats-officedocument.presentationml.slideshow.ppsx +0 -0
  77. data/test/fixtures/name/application/vnd.openxmlformats-officedocument.presentationml.template/vnd.openxmlformats-officedocument.presentationml.template.potx +0 -0
  78. data/test/fixtures/name/application/vnd.openxmlformats-officedocument.spreadsheetml.sheet/downloaded-from-google-docs.xlsx +0 -0
  79. data/test/fixtures/name/application/vnd.openxmlformats-officedocument.spreadsheetml.sheet/vnd.openxmlformats-officedocument.spreadsheetml.sheet.xlsx +0 -0
  80. data/test/fixtures/name/application/vnd.openxmlformats-officedocument.wordprocessingml.document/vnd.openxmlformats-officedocument.wordprocessingml.document.docx +0 -0
  81. data/test/fixtures/name/application/vnd.openxmlformats-officedocument.wordprocessingml.template/vnd.openxmlformats-officedocument.wordprocessingml.template.dotx +0 -0
  82. data/test/fixtures/name/application/x-font-ttf.ttf +0 -0
  83. data/test/fixtures/name/application/zip/zip.zip +0 -0
  84. data/test/fixtures/name/audio/flac/flac.flac +0 -0
  85. data/test/fixtures/name/audio/mp4/mp4.m4a +0 -0
  86. data/test/fixtures/name/audio/mpeg/mpeg.mp3 +0 -0
  87. data/test/fixtures/name/audio/x-wav/x-wav.wav +0 -0
  88. data/test/fixtures/name/image/bmp/bmp.bmp +0 -0
  89. data/test/fixtures/name/image/gif/gif.gif +0 -0
  90. data/test/fixtures/name/image/heic.heic +0 -0
  91. data/test/fixtures/name/image/heif.heif +0 -0
  92. data/test/fixtures/name/image/jpeg/jpeg.jpg +0 -0
  93. data/test/fixtures/name/image/png/png.png +0 -0
  94. data/test/fixtures/name/image/svg+xml/svg.svg +0 -1
  95. data/test/fixtures/name/image/tiff/tiff.tif +0 -0
  96. data/test/fixtures/name/image/tiff/tiff.tiff +0 -0
  97. data/test/fixtures/name/image/vnd.adobe.photoshop/saved-as-large-document-format.psb +0 -0
  98. data/test/fixtures/name/image/vnd.adobe.photoshop/vnd.adobe.photoshop.psd +0 -0
  99. data/test/fixtures/name/image/x-eps/postscript/postscript.eps +0 -0
  100. data/test/fixtures/name/image/x-eps/x-eps.eps +0 -0
  101. data/test/fixtures/name/message/rfc822/rfc822.eml +0 -34
  102. data/test/fixtures/name/text/csv/csv.csv +0 -2
  103. data/test/fixtures/name/text/html/html.html +0 -3
  104. data/test/fixtures/name/text/plain/plain.asc +0 -1
  105. data/test/fixtures/name/text/plain/plain.txt +0 -1
  106. data/test/fixtures/name/text/x-log/x-log.log +0 -1
  107. data/test/fixtures/name/video/mp4/mp4.mp4 +0 -0
  108. data/test/fixtures/name/video/quicktime/quicktime.mov +0 -0
  109. data/test/magic_and_declared_type_test.rb +0 -10
  110. data/test/magic_and_name_test.rb +0 -13
  111. data/test/magic_test.rb +0 -13
  112. data/test/mime_type_test.rb +0 -47
  113. data/test/name_test.rb +0 -10
  114. data/test/test_helper.rb +0 -49
@@ -1,3 +1,3 @@
1
1
  module Marcel
2
- VERSION = "0.3.0"
2
+ VERSION = "1.0.1"
3
3
  end
metadata CHANGED
@@ -1,325 +1,135 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: marcel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Ward
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-12 00:00:00.000000000 Z
11
+ date: 2021-04-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: mimemagic
14
+ name: minitest
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.3.2
20
- type: :runtime
19
+ version: '5.11'
20
+ type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.3.2
26
+ version: '5.11'
27
27
  - !ruby/object:Gem::Dependency
28
- name: minitest
28
+ name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: '1.7'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: '1.7'
41
41
  - !ruby/object:Gem::Dependency
42
- name: bundler
42
+ name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '1.7'
47
+ version: '13.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '1.7'
54
+ version: '13.0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: rake
56
+ name: rack
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '10.0'
61
+ version: '2.0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '10.0'
68
+ version: '2.0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: rack
70
+ name: nokogiri
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: 1.9.1
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: 1.9.1
83
+ - !ruby/object:Gem::Dependency
84
+ name: byebug
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
87
  - - "~>"
74
88
  - !ruby/object:Gem::Version
75
- version: 2.0.1
89
+ version: 10.0.2
76
90
  type: :development
77
91
  prerelease: false
78
92
  version_requirements: !ruby/object:Gem::Requirement
79
93
  requirements:
80
94
  - - "~>"
81
95
  - !ruby/object:Gem::Version
82
- version: 2.0.1
83
- description:
96
+ version: 10.0.2
97
+ description:
84
98
  email:
85
99
  - tom@basecamp.com
86
100
  executables: []
87
101
  extensions: []
88
102
  extra_rdoc_files: []
89
103
  files:
90
- - ".gitignore"
91
- - Gemfile
92
- - Gemfile.lock
93
104
  - MIT-LICENSE
94
- - README.md
95
- - Rakefile
96
105
  - lib/marcel.rb
106
+ - lib/marcel/magic.rb
97
107
  - lib/marcel/mime_type.rb
98
108
  - lib/marcel/mime_type/definitions.rb
109
+ - lib/marcel/tables.rb
99
110
  - lib/marcel/version.rb
100
- - marcel.gemspec
101
- - test/declared_type_test.rb
102
- - test/extension_test.rb
103
- - test/fixtures/image.gif
104
- - test/fixtures/magic/application/msword/msword.doc
105
- - test/fixtures/magic/application/pdf/illustrator-seen-as-pdf.ai
106
- - test/fixtures/magic/application/pdf/pdf.pdf
107
- - test/fixtures/magic/application/rtf/rtf.rtf
108
- - test/fixtures/magic/application/vnd.adobe.flash.movie/flash.swf
109
- - test/fixtures/magic/application/vnd.openxmlformats-officedocument.presentationml.presentation/vnd.openxmlformats-officedocument.presentationml.presentation.pptx
110
- - test/fixtures/magic/application/vnd.openxmlformats-officedocument.spreadsheetml.sheet/vnd.openxmlformats-officedocument.spreadsheetml.sheet.xlsx
111
- - test/fixtures/magic/application/vnd.openxmlformats-officedocument.wordprocessingml.document/vnd.openxmlformats-officedocument.wordprocessingml.document.docx
112
- - test/fixtures/magic/application/x-font-ttf.ttf
113
- - test/fixtures/magic/application/xml/xml.xml
114
- - test/fixtures/magic/application/zip/sketch.sketch
115
- - test/fixtures/magic/application/zip/zip.zip
116
- - test/fixtures/magic/audio/flac/flac.flac
117
- - test/fixtures/magic/audio/mp4/m4a.m4a
118
- - test/fixtures/magic/audio/mp4/mp4.m4a
119
- - test/fixtures/magic/audio/mpeg/mpeg.mp3
120
- - test/fixtures/magic/audio/x-wav/wav.wav
121
- - test/fixtures/magic/audio/x-wav/x-wav.wav
122
- - test/fixtures/magic/image/bmp/bmp.bmp
123
- - test/fixtures/magic/image/gif/gif.gif
124
- - test/fixtures/magic/image/jpeg/jpeg.jpg
125
- - test/fixtures/magic/image/png/png.png
126
- - test/fixtures/magic/image/svg+xml/svg.svg
127
- - test/fixtures/magic/image/tiff/tiff.tif
128
- - test/fixtures/magic/image/vnd.adobe.photoshop/photoshop-large-document-format.psb
129
- - test/fixtures/magic/image/vnd.adobe.photoshop/vnd.adobe.photoshop.psd
130
- - test/fixtures/magic/image/vnd.dwg/x-dwg.dwg
131
- - test/fixtures/magic/image/vnd.microsoft.icon/ico.ico
132
- - test/fixtures/magic/image/webp/webp.webp
133
- - test/fixtures/magic/image/x-eps/postscript/postscript.eps
134
- - test/fixtures/magic/image/x-eps/x-eps.eps
135
- - test/fixtures/magic/text/html/html.html
136
- - test/fixtures/magic/video/mp4/m4v.m4v
137
- - test/fixtures/magic/video/mp4/mp4.mp4
138
- - test/fixtures/magic/video/quicktime/quicktime.mov
139
- - test/fixtures/magic/video/webm/webm.mkv
140
- - test/fixtures/name/application/illustrator/illustrator.ai
141
- - test/fixtures/name/application/javascript/javascript.js
142
- - test/fixtures/name/application/json/json.json
143
- - test/fixtures/name/application/msword/msword.doc
144
- - test/fixtures/name/application/pdf/pdf.pdf
145
- - test/fixtures/name/application/rtf/rtf.rtf
146
- - test/fixtures/name/application/sql/sql.sql
147
- - test/fixtures/name/application/vnd.adobe.flash.movie/flash.swf
148
- - test/fixtures/name/application/vnd.android.package-archive/vnd.android.package-archive.apk
149
- - test/fixtures/name/application/vnd.apple.keynote/vnd.apple.keynote.key
150
- - test/fixtures/name/application/vnd.apple.numbers/vnd.apple.numbers.numbers
151
- - test/fixtures/name/application/vnd.apple.pages/vnd.apple.pages.pages
152
- - test/fixtures/name/application/vnd.ms-excel.sheet.binary.macroenabled.12/vnd.ms-excel.sheet.binary.macroenabled.12.xlsb
153
- - test/fixtures/name/application/vnd.ms-excel.sheet.macroenabled.12/vnd.ms-excel.sheet.macroenabled.12.xlsm
154
- - test/fixtures/name/application/vnd.ms-excel.template.macroenabled.12/vnd.ms-excel.template.macroenabled.12.xltm
155
- - test/fixtures/name/application/vnd.ms-excel/vnd.ms-excel.xls
156
- - test/fixtures/name/application/vnd.ms-powerpoint.presentation.macroenabled.12/vnd.ms-powerpoint.presentation.macroenabled.12.pptm
157
- - test/fixtures/name/application/vnd.ms-powerpoint.slideshow.macroenabled.12/vnd.ms-powerpoint.slideshow.macroenabled.12.ppsm
158
- - test/fixtures/name/application/vnd.ms-powerpoint.template.macroenabled.12/vnd.ms-powerpoint.template.macroenabled.12.potm
159
- - test/fixtures/name/application/vnd.ms-word.document.macroenabled.12/vnd.ms-word.document.macroenabled.12.docm
160
- - test/fixtures/name/application/vnd.ms-word.template.macroenabled.12/vnd.ms-word.template.macroenabled.12.dotm
161
- - test/fixtures/name/application/vnd.openxmlformats-officedocument.presentationml.presentation/vnd.openxmlformats-officedocument.presentationml.presentation.pptx
162
- - test/fixtures/name/application/vnd.openxmlformats-officedocument.presentationml.slideshow/vnd.openxmlformats-officedocument.presentationml.slideshow.ppsx
163
- - test/fixtures/name/application/vnd.openxmlformats-officedocument.presentationml.template/vnd.openxmlformats-officedocument.presentationml.template.potx
164
- - test/fixtures/name/application/vnd.openxmlformats-officedocument.spreadsheetml.sheet/downloaded-from-google-docs.xlsx
165
- - test/fixtures/name/application/vnd.openxmlformats-officedocument.spreadsheetml.sheet/vnd.openxmlformats-officedocument.spreadsheetml.sheet.xlsx
166
- - test/fixtures/name/application/vnd.openxmlformats-officedocument.wordprocessingml.document/vnd.openxmlformats-officedocument.wordprocessingml.document.docx
167
- - test/fixtures/name/application/vnd.openxmlformats-officedocument.wordprocessingml.template/vnd.openxmlformats-officedocument.wordprocessingml.template.dotx
168
- - test/fixtures/name/application/x-font-ttf.ttf
169
- - test/fixtures/name/application/zip/zip.zip
170
- - test/fixtures/name/audio/flac/flac.flac
171
- - test/fixtures/name/audio/mp4/mp4.m4a
172
- - test/fixtures/name/audio/mpeg/mpeg.mp3
173
- - test/fixtures/name/audio/x-wav/x-wav.wav
174
- - test/fixtures/name/image/bmp/bmp.bmp
175
- - test/fixtures/name/image/gif/gif.gif
176
- - test/fixtures/name/image/heic.heic
177
- - test/fixtures/name/image/heif.heif
178
- - test/fixtures/name/image/jpeg/jpeg.jpg
179
- - test/fixtures/name/image/png/png.png
180
- - test/fixtures/name/image/svg+xml/svg.svg
181
- - test/fixtures/name/image/tiff/tiff.tif
182
- - test/fixtures/name/image/tiff/tiff.tiff
183
- - test/fixtures/name/image/vnd.adobe.photoshop/saved-as-large-document-format.psb
184
- - test/fixtures/name/image/vnd.adobe.photoshop/vnd.adobe.photoshop.psd
185
- - test/fixtures/name/image/x-eps/postscript/postscript.eps
186
- - test/fixtures/name/image/x-eps/x-eps.eps
187
- - test/fixtures/name/message/rfc822/rfc822.eml
188
- - test/fixtures/name/text/csv/csv.csv
189
- - test/fixtures/name/text/html/html.html
190
- - test/fixtures/name/text/plain/plain.asc
191
- - test/fixtures/name/text/plain/plain.txt
192
- - test/fixtures/name/text/x-log/x-log.log
193
- - test/fixtures/name/video/mp4/mp4.mp4
194
- - test/fixtures/name/video/quicktime/quicktime.mov
195
- - test/magic_and_declared_type_test.rb
196
- - test/magic_and_name_test.rb
197
- - test/magic_test.rb
198
- - test/mime_type_test.rb
199
- - test/name_test.rb
200
- - test/test_helper.rb
201
- homepage: https://github.com/basecamp/marcel
111
+ homepage: https://github.com/rails/marcel
202
112
  licenses:
203
113
  - MIT
114
+ - Apache-2.0
204
115
  metadata: {}
205
- post_install_message:
116
+ post_install_message:
206
117
  rdoc_options: []
207
118
  require_paths:
208
119
  - lib
209
120
  required_ruby_version: !ruby/object:Gem::Requirement
210
121
  requirements:
211
- - - "~>"
122
+ - - ">="
212
123
  - !ruby/object:Gem::Version
213
- version: '2.3'
124
+ version: '2.2'
214
125
  required_rubygems_version: !ruby/object:Gem::Requirement
215
126
  requirements:
216
127
  - - ">="
217
128
  - !ruby/object:Gem::Version
218
129
  version: '0'
219
130
  requirements: []
220
- rubyforge_project:
221
- rubygems_version: 2.7.3
222
- signing_key:
131
+ rubygems_version: 3.2.3
132
+ signing_key:
223
133
  specification_version: 4
224
134
  summary: Simple mime type detection using magic numbers, filenames, and extensions
225
- test_files:
226
- - test/declared_type_test.rb
227
- - test/extension_test.rb
228
- - test/fixtures/image.gif
229
- - test/fixtures/magic/application/msword/msword.doc
230
- - test/fixtures/magic/application/pdf/illustrator-seen-as-pdf.ai
231
- - test/fixtures/magic/application/pdf/pdf.pdf
232
- - test/fixtures/magic/application/rtf/rtf.rtf
233
- - test/fixtures/magic/application/vnd.adobe.flash.movie/flash.swf
234
- - test/fixtures/magic/application/vnd.openxmlformats-officedocument.presentationml.presentation/vnd.openxmlformats-officedocument.presentationml.presentation.pptx
235
- - test/fixtures/magic/application/vnd.openxmlformats-officedocument.spreadsheetml.sheet/vnd.openxmlformats-officedocument.spreadsheetml.sheet.xlsx
236
- - test/fixtures/magic/application/vnd.openxmlformats-officedocument.wordprocessingml.document/vnd.openxmlformats-officedocument.wordprocessingml.document.docx
237
- - test/fixtures/magic/application/x-font-ttf.ttf
238
- - test/fixtures/magic/application/xml/xml.xml
239
- - test/fixtures/magic/application/zip/sketch.sketch
240
- - test/fixtures/magic/application/zip/zip.zip
241
- - test/fixtures/magic/audio/flac/flac.flac
242
- - test/fixtures/magic/audio/mp4/m4a.m4a
243
- - test/fixtures/magic/audio/mp4/mp4.m4a
244
- - test/fixtures/magic/audio/mpeg/mpeg.mp3
245
- - test/fixtures/magic/audio/x-wav/wav.wav
246
- - test/fixtures/magic/audio/x-wav/x-wav.wav
247
- - test/fixtures/magic/image/bmp/bmp.bmp
248
- - test/fixtures/magic/image/gif/gif.gif
249
- - test/fixtures/magic/image/jpeg/jpeg.jpg
250
- - test/fixtures/magic/image/png/png.png
251
- - test/fixtures/magic/image/svg+xml/svg.svg
252
- - test/fixtures/magic/image/tiff/tiff.tif
253
- - test/fixtures/magic/image/vnd.adobe.photoshop/photoshop-large-document-format.psb
254
- - test/fixtures/magic/image/vnd.adobe.photoshop/vnd.adobe.photoshop.psd
255
- - test/fixtures/magic/image/vnd.dwg/x-dwg.dwg
256
- - test/fixtures/magic/image/vnd.microsoft.icon/ico.ico
257
- - test/fixtures/magic/image/webp/webp.webp
258
- - test/fixtures/magic/image/x-eps/postscript/postscript.eps
259
- - test/fixtures/magic/image/x-eps/x-eps.eps
260
- - test/fixtures/magic/text/html/html.html
261
- - test/fixtures/magic/video/mp4/m4v.m4v
262
- - test/fixtures/magic/video/mp4/mp4.mp4
263
- - test/fixtures/magic/video/quicktime/quicktime.mov
264
- - test/fixtures/magic/video/webm/webm.mkv
265
- - test/fixtures/name/application/illustrator/illustrator.ai
266
- - test/fixtures/name/application/javascript/javascript.js
267
- - test/fixtures/name/application/json/json.json
268
- - test/fixtures/name/application/msword/msword.doc
269
- - test/fixtures/name/application/pdf/pdf.pdf
270
- - test/fixtures/name/application/rtf/rtf.rtf
271
- - test/fixtures/name/application/sql/sql.sql
272
- - test/fixtures/name/application/vnd.adobe.flash.movie/flash.swf
273
- - test/fixtures/name/application/vnd.android.package-archive/vnd.android.package-archive.apk
274
- - test/fixtures/name/application/vnd.apple.keynote/vnd.apple.keynote.key
275
- - test/fixtures/name/application/vnd.apple.numbers/vnd.apple.numbers.numbers
276
- - test/fixtures/name/application/vnd.apple.pages/vnd.apple.pages.pages
277
- - test/fixtures/name/application/vnd.ms-excel.sheet.binary.macroenabled.12/vnd.ms-excel.sheet.binary.macroenabled.12.xlsb
278
- - test/fixtures/name/application/vnd.ms-excel.sheet.macroenabled.12/vnd.ms-excel.sheet.macroenabled.12.xlsm
279
- - test/fixtures/name/application/vnd.ms-excel.template.macroenabled.12/vnd.ms-excel.template.macroenabled.12.xltm
280
- - test/fixtures/name/application/vnd.ms-excel/vnd.ms-excel.xls
281
- - test/fixtures/name/application/vnd.ms-powerpoint.presentation.macroenabled.12/vnd.ms-powerpoint.presentation.macroenabled.12.pptm
282
- - test/fixtures/name/application/vnd.ms-powerpoint.slideshow.macroenabled.12/vnd.ms-powerpoint.slideshow.macroenabled.12.ppsm
283
- - test/fixtures/name/application/vnd.ms-powerpoint.template.macroenabled.12/vnd.ms-powerpoint.template.macroenabled.12.potm
284
- - test/fixtures/name/application/vnd.ms-word.document.macroenabled.12/vnd.ms-word.document.macroenabled.12.docm
285
- - test/fixtures/name/application/vnd.ms-word.template.macroenabled.12/vnd.ms-word.template.macroenabled.12.dotm
286
- - test/fixtures/name/application/vnd.openxmlformats-officedocument.presentationml.presentation/vnd.openxmlformats-officedocument.presentationml.presentation.pptx
287
- - test/fixtures/name/application/vnd.openxmlformats-officedocument.presentationml.slideshow/vnd.openxmlformats-officedocument.presentationml.slideshow.ppsx
288
- - test/fixtures/name/application/vnd.openxmlformats-officedocument.presentationml.template/vnd.openxmlformats-officedocument.presentationml.template.potx
289
- - test/fixtures/name/application/vnd.openxmlformats-officedocument.spreadsheetml.sheet/downloaded-from-google-docs.xlsx
290
- - test/fixtures/name/application/vnd.openxmlformats-officedocument.spreadsheetml.sheet/vnd.openxmlformats-officedocument.spreadsheetml.sheet.xlsx
291
- - test/fixtures/name/application/vnd.openxmlformats-officedocument.wordprocessingml.document/vnd.openxmlformats-officedocument.wordprocessingml.document.docx
292
- - test/fixtures/name/application/vnd.openxmlformats-officedocument.wordprocessingml.template/vnd.openxmlformats-officedocument.wordprocessingml.template.dotx
293
- - test/fixtures/name/application/x-font-ttf.ttf
294
- - test/fixtures/name/application/zip/zip.zip
295
- - test/fixtures/name/audio/flac/flac.flac
296
- - test/fixtures/name/audio/mp4/mp4.m4a
297
- - test/fixtures/name/audio/mpeg/mpeg.mp3
298
- - test/fixtures/name/audio/x-wav/x-wav.wav
299
- - test/fixtures/name/image/bmp/bmp.bmp
300
- - test/fixtures/name/image/gif/gif.gif
301
- - test/fixtures/name/image/heic.heic
302
- - test/fixtures/name/image/heif.heif
303
- - test/fixtures/name/image/jpeg/jpeg.jpg
304
- - test/fixtures/name/image/png/png.png
305
- - test/fixtures/name/image/svg+xml/svg.svg
306
- - test/fixtures/name/image/tiff/tiff.tif
307
- - test/fixtures/name/image/tiff/tiff.tiff
308
- - test/fixtures/name/image/vnd.adobe.photoshop/saved-as-large-document-format.psb
309
- - test/fixtures/name/image/vnd.adobe.photoshop/vnd.adobe.photoshop.psd
310
- - test/fixtures/name/image/x-eps/postscript/postscript.eps
311
- - test/fixtures/name/image/x-eps/x-eps.eps
312
- - test/fixtures/name/message/rfc822/rfc822.eml
313
- - test/fixtures/name/text/csv/csv.csv
314
- - test/fixtures/name/text/html/html.html
315
- - test/fixtures/name/text/plain/plain.asc
316
- - test/fixtures/name/text/plain/plain.txt
317
- - test/fixtures/name/text/x-log/x-log.log
318
- - test/fixtures/name/video/mp4/mp4.mp4
319
- - test/fixtures/name/video/quicktime/quicktime.mov
320
- - test/magic_and_declared_type_test.rb
321
- - test/magic_and_name_test.rb
322
- - test/magic_test.rb
323
- - test/mime_type_test.rb
324
- - test/name_test.rb
325
- - test/test_helper.rb
135
+ test_files: []
data/.gitignore DELETED
@@ -1,13 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
9
- *.bundle
10
- *.so
11
- *.o
12
- *.a
13
- mkmf.log
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in letter_knife.gemspec
4
- gemspec
data/Gemfile.lock DELETED
@@ -1,26 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- marcel (0.3.0)
5
- mimemagic (~> 0.3.2)
6
-
7
- GEM
8
- remote: https://rubygems.org/
9
- specs:
10
- mimemagic (0.3.2)
11
- minitest (5.10.2)
12
- rack (2.0.3)
13
- rake (10.5.0)
14
-
15
- PLATFORMS
16
- ruby
17
-
18
- DEPENDENCIES
19
- bundler (~> 1.7)
20
- marcel!
21
- minitest
22
- rack (~> 2.0.1)
23
- rake (~> 10.0)
24
-
25
- BUNDLED WITH
26
- 1.14.6
data/README.md DELETED
@@ -1,50 +0,0 @@
1
- # Marcel
2
-
3
- Marcel attempts to choose the most appropriate content type for a given file by looking at the binary data, the filename, and any declared type (perhaps passed as a request header):
4
-
5
- It's used like this:
6
-
7
- Marcel::MimeType.for Pathname.new("example.gif")
8
- => "image/gif"
9
-
10
- File.open "example.gif" do |file|
11
- Marcel::MimeType.for file
12
- end
13
- => "image/gif"
14
-
15
- Marcel::MimeType.for Pathname.new("unrecognisable-data"), name: "example.pdf"
16
- => "application/pdf"
17
-
18
- Marcel::MimeType.for extension: ".pdf"
19
- => "application/pdf"
20
-
21
- Marcel::MimeType.for Pathname.new("unrecognisable-data"), name: "example", declared_type: "image/png"
22
- => "image/png"
23
-
24
- Marcel::MimeType.for StringIO.new(File.read "unrecognisable-data")
25
- => "application/octet-stream"
26
-
27
- By preference, the magic number data in any passed in file is used to determine the type. If this doesn't work, it uses the type gleaned from the filename, extension, and finally the declared type. If no valid type is found in any of these, "application/octet-stream" is returned.
28
-
29
- Some types aren't easily recognised solely by magic number data. For example Adobe Illustrator files have the same magic number as PDFs (and can usually even be viewed in PDF viewers!). For these types, Marcel uses both the magic number data and the file name to work out the type:
30
-
31
- Marcel::MimeType.for Pathname.new("example.ai"), name: "example.ai"
32
- => "application/illustrator"
33
-
34
- This only happens when the type from the filename is a more specific type of that from the magic number. If it isn't the magic number alone is used.
35
-
36
- Marcel::MimeType.for Pathname.new("example.png"), name: "example.ai"
37
- => "image/png"
38
- # As "application/illustrator" is not a more specific type of "image/png", the filename is ignored
39
-
40
- ## Motivation
41
-
42
- Marcel was extracted from Basecamp 3, in order to make our file detection logic both easily reusable but more importantly, easily testable. Test fixtures have been added for all of the most common file types uploaded to Basecamp, and other common file types too. We hope to expand this test coverage with other file types as and when problems are identified.
43
-
44
- ## Implementation
45
-
46
- At present, marcel is mainly a thin wrapper around the mimemagic gem. It adds priority logic (preferring magic over name when given both), some extra type definitions, and common type subclasses (including Keynote, Pages, etc).
47
-
48
- ## Testing
49
-
50
- The main test fixture files are split into two folders, those that can be recognised by magic numbers, and those that can only be recognised by name. Even though strictly unnecessary, the fixtures in both folders should all be valid files of the type they represent.