marcel 0.3.2 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) 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 +68 -67
  5. data/lib/marcel/mime_type/definitions.rb +8 -3
  6. data/lib/marcel/tables.rb +2515 -0
  7. data/lib/marcel/version.rb +1 -1
  8. metadata +42 -235
  9. data/.gitignore +0 -1
  10. data/.travis.yml +0 -7
  11. data/Gemfile +0 -4
  12. data/Gemfile.lock +0 -26
  13. data/README.md +0 -50
  14. data/Rakefile +0 -33
  15. data/marcel.gemspec +0 -28
  16. data/test/declared_type_test.rb +0 -17
  17. data/test/extension_test.rb +0 -25
  18. data/test/fixtures/image.gif +0 -0
  19. data/test/fixtures/magic/application/msword/msword.doc +0 -0
  20. data/test/fixtures/magic/application/pdf/illustrator-seen-as-pdf.ai +22 -6302
  21. data/test/fixtures/magic/application/pdf/pdf.pdf +0 -0
  22. data/test/fixtures/magic/application/rtf/rtf.rtf +0 -1
  23. data/test/fixtures/magic/application/vnd.adobe.flash.movie/flash.swf +0 -0
  24. data/test/fixtures/magic/application/vnd.openxmlformats-officedocument.presentationml.presentation/vnd.openxmlformats-officedocument.presentationml.presentation.pptx +0 -0
  25. data/test/fixtures/magic/application/vnd.openxmlformats-officedocument.spreadsheetml.sheet/vnd.openxmlformats-officedocument.spreadsheetml.sheet.xlsx +0 -0
  26. data/test/fixtures/magic/application/vnd.openxmlformats-officedocument.wordprocessingml.document/vnd.openxmlformats-officedocument.wordprocessingml.document.docx +0 -0
  27. data/test/fixtures/magic/application/x-font-ttf.ttf +0 -0
  28. data/test/fixtures/magic/application/xml/xml.xml +0 -1
  29. data/test/fixtures/magic/application/zip/sketch.sketch +0 -0
  30. data/test/fixtures/magic/application/zip/zip.zip +0 -0
  31. data/test/fixtures/magic/audio/flac/flac.flac +0 -0
  32. data/test/fixtures/magic/audio/mp4/m4a.m4a +0 -0
  33. data/test/fixtures/magic/audio/mp4/mp4.m4a +0 -0
  34. data/test/fixtures/magic/audio/mpeg/mpeg.mp3 +0 -0
  35. data/test/fixtures/magic/audio/x-wav/wav.wav +0 -0
  36. data/test/fixtures/magic/audio/x-wav/x-wav.wav +0 -0
  37. data/test/fixtures/magic/image/bmp/bmp.bmp +0 -0
  38. data/test/fixtures/magic/image/gif/gif.gif +0 -0
  39. data/test/fixtures/magic/image/jpeg/jpeg.jpg +0 -0
  40. data/test/fixtures/magic/image/png/png.png +0 -0
  41. data/test/fixtures/magic/image/svg+xml/svg.svg +0 -1
  42. data/test/fixtures/magic/image/tiff/tiff.tif +0 -0
  43. data/test/fixtures/magic/image/vnd.adobe.photoshop/photoshop-large-document-format.psb +0 -0
  44. data/test/fixtures/magic/image/vnd.adobe.photoshop/vnd.adobe.photoshop.psd +0 -0
  45. data/test/fixtures/magic/image/vnd.dwg/x-dwg.dwg +0 -0
  46. data/test/fixtures/magic/image/vnd.microsoft.icon/ico.ico +0 -0
  47. data/test/fixtures/magic/image/webp/webp.webp +0 -0
  48. data/test/fixtures/magic/image/x-eps/postscript/postscript.eps +0 -0
  49. data/test/fixtures/magic/image/x-eps/x-eps.eps +0 -0
  50. data/test/fixtures/magic/text/html/html.html +0 -3
  51. data/test/fixtures/magic/video/mp4/m4v.m4v +0 -0
  52. data/test/fixtures/magic/video/mp4/mp4.mp4 +0 -0
  53. data/test/fixtures/magic/video/quicktime/quicktime.mov +0 -0
  54. data/test/fixtures/magic/video/webm/webm.mkv +0 -0
  55. data/test/fixtures/name/application/illustrator/illustrator.ai +27 -6301
  56. data/test/fixtures/name/application/javascript/javascript.js +0 -3
  57. data/test/fixtures/name/application/json/json.json +0 -3
  58. data/test/fixtures/name/application/msword/msword.doc +0 -0
  59. data/test/fixtures/name/application/pdf/pdf.pdf +0 -0
  60. data/test/fixtures/name/application/rtf/rtf.rtf +0 -1
  61. data/test/fixtures/name/application/sql/sql.sql +0 -0
  62. data/test/fixtures/name/application/vnd.adobe.flash.movie/flash.swf +0 -0
  63. data/test/fixtures/name/application/vnd.android.package-archive/vnd.android.package-archive.apk +0 -0
  64. data/test/fixtures/name/application/vnd.apple.keynote/vnd.apple.keynote.key +0 -0
  65. data/test/fixtures/name/application/vnd.apple.numbers/vnd.apple.numbers.numbers +0 -0
  66. data/test/fixtures/name/application/vnd.apple.pages/vnd.apple.pages.pages +0 -0
  67. data/test/fixtures/name/application/vnd.ms-excel.sheet.binary.macroenabled.12/vnd.ms-excel.sheet.binary.macroenabled.12.xlsb +0 -0
  68. data/test/fixtures/name/application/vnd.ms-excel.sheet.macroenabled.12/vnd.ms-excel.sheet.macroenabled.12.xlsm +0 -0
  69. data/test/fixtures/name/application/vnd.ms-excel.template.macroenabled.12/vnd.ms-excel.template.macroenabled.12.xltm +0 -0
  70. data/test/fixtures/name/application/vnd.ms-excel/vnd.ms-excel.xls +0 -0
  71. data/test/fixtures/name/application/vnd.ms-powerpoint.presentation.macroenabled.12/vnd.ms-powerpoint.presentation.macroenabled.12.pptm +0 -0
  72. data/test/fixtures/name/application/vnd.ms-powerpoint.slideshow.macroenabled.12/vnd.ms-powerpoint.slideshow.macroenabled.12.ppsm +0 -0
  73. data/test/fixtures/name/application/vnd.ms-powerpoint.template.macroenabled.12/vnd.ms-powerpoint.template.macroenabled.12.potm +0 -0
  74. data/test/fixtures/name/application/vnd.ms-powerpoint/vnd.ms-powerpoint.ppt +0 -0
  75. data/test/fixtures/name/application/vnd.ms-word.document.macroenabled.12/vnd.ms-word.document.macroenabled.12.docm +0 -0
  76. data/test/fixtures/name/application/vnd.ms-word.template.macroenabled.12/vnd.ms-word.template.macroenabled.12.dotm +0 -0
  77. data/test/fixtures/name/application/vnd.openxmlformats-officedocument.presentationml.presentation/vnd.openxmlformats-officedocument.presentationml.presentation.pptx +0 -0
  78. data/test/fixtures/name/application/vnd.openxmlformats-officedocument.presentationml.slideshow/vnd.openxmlformats-officedocument.presentationml.slideshow.ppsx +0 -0
  79. data/test/fixtures/name/application/vnd.openxmlformats-officedocument.presentationml.template/vnd.openxmlformats-officedocument.presentationml.template.potx +0 -0
  80. data/test/fixtures/name/application/vnd.openxmlformats-officedocument.spreadsheetml.sheet/downloaded-from-google-docs.xlsx +0 -0
  81. data/test/fixtures/name/application/vnd.openxmlformats-officedocument.spreadsheetml.sheet/vnd.openxmlformats-officedocument.spreadsheetml.sheet.xlsx +0 -0
  82. data/test/fixtures/name/application/vnd.openxmlformats-officedocument.wordprocessingml.document/vnd.openxmlformats-officedocument.wordprocessingml.document.docx +0 -0
  83. data/test/fixtures/name/application/vnd.openxmlformats-officedocument.wordprocessingml.template/vnd.openxmlformats-officedocument.wordprocessingml.template.dotx +0 -0
  84. data/test/fixtures/name/application/x-font-ttf.ttf +0 -0
  85. data/test/fixtures/name/application/zip/zip.zip +0 -0
  86. data/test/fixtures/name/audio/flac/flac.flac +0 -0
  87. data/test/fixtures/name/audio/mp4/mp4.m4a +0 -0
  88. data/test/fixtures/name/audio/mpeg/mpeg.mp3 +0 -0
  89. data/test/fixtures/name/audio/x-wav/x-wav.wav +0 -0
  90. data/test/fixtures/name/image/bmp/bmp.bmp +0 -0
  91. data/test/fixtures/name/image/gif/gif.gif +0 -0
  92. data/test/fixtures/name/image/heic.heic +0 -0
  93. data/test/fixtures/name/image/heif.heif +0 -0
  94. data/test/fixtures/name/image/jpeg/jpeg.jpg +0 -0
  95. data/test/fixtures/name/image/png/png.png +0 -0
  96. data/test/fixtures/name/image/svg+xml/svg.svg +0 -1
  97. data/test/fixtures/name/image/tiff/tiff.tif +0 -0
  98. data/test/fixtures/name/image/tiff/tiff.tiff +0 -0
  99. data/test/fixtures/name/image/vnd.adobe.photoshop/saved-as-large-document-format.psb +0 -0
  100. data/test/fixtures/name/image/vnd.adobe.photoshop/vnd.adobe.photoshop.psd +0 -0
  101. data/test/fixtures/name/image/x-eps/postscript/postscript.eps +0 -0
  102. data/test/fixtures/name/image/x-eps/x-eps.eps +0 -0
  103. data/test/fixtures/name/message/rfc822/rfc822.eml +0 -34
  104. data/test/fixtures/name/text/csv/csv.csv +0 -2
  105. data/test/fixtures/name/text/html/html.html +0 -3
  106. data/test/fixtures/name/text/plain/plain.asc +0 -1
  107. data/test/fixtures/name/text/plain/plain.txt +0 -1
  108. data/test/fixtures/name/text/x-log/x-log.log +0 -1
  109. data/test/fixtures/name/video/mp4/mp4.mp4 +0 -0
  110. data/test/fixtures/name/video/quicktime/quicktime.mov +0 -0
  111. data/test/magic_and_declared_type_test.rb +0 -10
  112. data/test/magic_and_name_test.rb +0 -13
  113. data/test/magic_test.rb +0 -13
  114. data/test/mime_type_test.rb +0 -47
  115. data/test/name_test.rb +0 -10
  116. data/test/test_helper.rb +0 -49
@@ -1,3 +1,3 @@
1
1
  module Marcel
2
- VERSION = "0.3.2"
2
+ VERSION = "1.0.1"
3
3
  end
metadata CHANGED
@@ -1,210 +1,119 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: marcel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
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-03-26 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
- - ".travis.yml"
92
- - Gemfile
93
- - Gemfile.lock
94
104
  - MIT-LICENSE
95
- - README.md
96
- - Rakefile
97
105
  - lib/marcel.rb
106
+ - lib/marcel/magic.rb
98
107
  - lib/marcel/mime_type.rb
99
108
  - lib/marcel/mime_type/definitions.rb
109
+ - lib/marcel/tables.rb
100
110
  - lib/marcel/version.rb
101
- - marcel.gemspec
102
- - test/declared_type_test.rb
103
- - test/extension_test.rb
104
- - test/fixtures/image.gif
105
- - test/fixtures/magic/application/msword/msword.doc
106
- - test/fixtures/magic/application/pdf/illustrator-seen-as-pdf.ai
107
- - test/fixtures/magic/application/pdf/pdf.pdf
108
- - test/fixtures/magic/application/rtf/rtf.rtf
109
- - test/fixtures/magic/application/vnd.adobe.flash.movie/flash.swf
110
- - test/fixtures/magic/application/vnd.openxmlformats-officedocument.presentationml.presentation/vnd.openxmlformats-officedocument.presentationml.presentation.pptx
111
- - test/fixtures/magic/application/vnd.openxmlformats-officedocument.spreadsheetml.sheet/vnd.openxmlformats-officedocument.spreadsheetml.sheet.xlsx
112
- - test/fixtures/magic/application/vnd.openxmlformats-officedocument.wordprocessingml.document/vnd.openxmlformats-officedocument.wordprocessingml.document.docx
113
- - test/fixtures/magic/application/x-font-ttf.ttf
114
- - test/fixtures/magic/application/xml/xml.xml
115
- - test/fixtures/magic/application/zip/sketch.sketch
116
- - test/fixtures/magic/application/zip/zip.zip
117
- - test/fixtures/magic/audio/flac/flac.flac
118
- - test/fixtures/magic/audio/mp4/m4a.m4a
119
- - test/fixtures/magic/audio/mp4/mp4.m4a
120
- - test/fixtures/magic/audio/mpeg/mpeg.mp3
121
- - test/fixtures/magic/audio/x-wav/wav.wav
122
- - test/fixtures/magic/audio/x-wav/x-wav.wav
123
- - test/fixtures/magic/image/bmp/bmp.bmp
124
- - test/fixtures/magic/image/gif/gif.gif
125
- - test/fixtures/magic/image/jpeg/jpeg.jpg
126
- - test/fixtures/magic/image/png/png.png
127
- - test/fixtures/magic/image/svg+xml/svg.svg
128
- - test/fixtures/magic/image/tiff/tiff.tif
129
- - test/fixtures/magic/image/vnd.adobe.photoshop/photoshop-large-document-format.psb
130
- - test/fixtures/magic/image/vnd.adobe.photoshop/vnd.adobe.photoshop.psd
131
- - test/fixtures/magic/image/vnd.dwg/x-dwg.dwg
132
- - test/fixtures/magic/image/vnd.microsoft.icon/ico.ico
133
- - test/fixtures/magic/image/webp/webp.webp
134
- - test/fixtures/magic/image/x-eps/postscript/postscript.eps
135
- - test/fixtures/magic/image/x-eps/x-eps.eps
136
- - test/fixtures/magic/text/html/html.html
137
- - test/fixtures/magic/video/mp4/m4v.m4v
138
- - test/fixtures/magic/video/mp4/mp4.mp4
139
- - test/fixtures/magic/video/quicktime/quicktime.mov
140
- - test/fixtures/magic/video/webm/webm.mkv
141
- - test/fixtures/name/application/illustrator/illustrator.ai
142
- - test/fixtures/name/application/javascript/javascript.js
143
- - test/fixtures/name/application/json/json.json
144
- - test/fixtures/name/application/msword/msword.doc
145
- - test/fixtures/name/application/pdf/pdf.pdf
146
- - test/fixtures/name/application/rtf/rtf.rtf
147
- - test/fixtures/name/application/sql/sql.sql
148
- - test/fixtures/name/application/vnd.adobe.flash.movie/flash.swf
149
- - test/fixtures/name/application/vnd.android.package-archive/vnd.android.package-archive.apk
150
- - test/fixtures/name/application/vnd.apple.keynote/vnd.apple.keynote.key
151
- - test/fixtures/name/application/vnd.apple.numbers/vnd.apple.numbers.numbers
152
- - test/fixtures/name/application/vnd.apple.pages/vnd.apple.pages.pages
153
- - test/fixtures/name/application/vnd.ms-excel.sheet.binary.macroenabled.12/vnd.ms-excel.sheet.binary.macroenabled.12.xlsb
154
- - test/fixtures/name/application/vnd.ms-excel.sheet.macroenabled.12/vnd.ms-excel.sheet.macroenabled.12.xlsm
155
- - test/fixtures/name/application/vnd.ms-excel.template.macroenabled.12/vnd.ms-excel.template.macroenabled.12.xltm
156
- - test/fixtures/name/application/vnd.ms-excel/vnd.ms-excel.xls
157
- - test/fixtures/name/application/vnd.ms-powerpoint.presentation.macroenabled.12/vnd.ms-powerpoint.presentation.macroenabled.12.pptm
158
- - test/fixtures/name/application/vnd.ms-powerpoint.slideshow.macroenabled.12/vnd.ms-powerpoint.slideshow.macroenabled.12.ppsm
159
- - test/fixtures/name/application/vnd.ms-powerpoint.template.macroenabled.12/vnd.ms-powerpoint.template.macroenabled.12.potm
160
- - test/fixtures/name/application/vnd.ms-powerpoint/vnd.ms-powerpoint.ppt
161
- - test/fixtures/name/application/vnd.ms-word.document.macroenabled.12/vnd.ms-word.document.macroenabled.12.docm
162
- - test/fixtures/name/application/vnd.ms-word.template.macroenabled.12/vnd.ms-word.template.macroenabled.12.dotm
163
- - test/fixtures/name/application/vnd.openxmlformats-officedocument.presentationml.presentation/vnd.openxmlformats-officedocument.presentationml.presentation.pptx
164
- - test/fixtures/name/application/vnd.openxmlformats-officedocument.presentationml.slideshow/vnd.openxmlformats-officedocument.presentationml.slideshow.ppsx
165
- - test/fixtures/name/application/vnd.openxmlformats-officedocument.presentationml.template/vnd.openxmlformats-officedocument.presentationml.template.potx
166
- - test/fixtures/name/application/vnd.openxmlformats-officedocument.spreadsheetml.sheet/downloaded-from-google-docs.xlsx
167
- - test/fixtures/name/application/vnd.openxmlformats-officedocument.spreadsheetml.sheet/vnd.openxmlformats-officedocument.spreadsheetml.sheet.xlsx
168
- - test/fixtures/name/application/vnd.openxmlformats-officedocument.wordprocessingml.document/vnd.openxmlformats-officedocument.wordprocessingml.document.docx
169
- - test/fixtures/name/application/vnd.openxmlformats-officedocument.wordprocessingml.template/vnd.openxmlformats-officedocument.wordprocessingml.template.dotx
170
- - test/fixtures/name/application/x-font-ttf.ttf
171
- - test/fixtures/name/application/zip/zip.zip
172
- - test/fixtures/name/audio/flac/flac.flac
173
- - test/fixtures/name/audio/mp4/mp4.m4a
174
- - test/fixtures/name/audio/mpeg/mpeg.mp3
175
- - test/fixtures/name/audio/x-wav/x-wav.wav
176
- - test/fixtures/name/image/bmp/bmp.bmp
177
- - test/fixtures/name/image/gif/gif.gif
178
- - test/fixtures/name/image/heic.heic
179
- - test/fixtures/name/image/heif.heif
180
- - test/fixtures/name/image/jpeg/jpeg.jpg
181
- - test/fixtures/name/image/png/png.png
182
- - test/fixtures/name/image/svg+xml/svg.svg
183
- - test/fixtures/name/image/tiff/tiff.tif
184
- - test/fixtures/name/image/tiff/tiff.tiff
185
- - test/fixtures/name/image/vnd.adobe.photoshop/saved-as-large-document-format.psb
186
- - test/fixtures/name/image/vnd.adobe.photoshop/vnd.adobe.photoshop.psd
187
- - test/fixtures/name/image/x-eps/postscript/postscript.eps
188
- - test/fixtures/name/image/x-eps/x-eps.eps
189
- - test/fixtures/name/message/rfc822/rfc822.eml
190
- - test/fixtures/name/text/csv/csv.csv
191
- - test/fixtures/name/text/html/html.html
192
- - test/fixtures/name/text/plain/plain.asc
193
- - test/fixtures/name/text/plain/plain.txt
194
- - test/fixtures/name/text/x-log/x-log.log
195
- - test/fixtures/name/video/mp4/mp4.mp4
196
- - test/fixtures/name/video/quicktime/quicktime.mov
197
- - test/magic_and_declared_type_test.rb
198
- - test/magic_and_name_test.rb
199
- - test/magic_test.rb
200
- - test/mime_type_test.rb
201
- - test/name_test.rb
202
- - test/test_helper.rb
203
- homepage: https://github.com/basecamp/marcel
111
+ homepage: https://github.com/rails/marcel
204
112
  licenses:
205
113
  - MIT
114
+ - Apache-2.0
206
115
  metadata: {}
207
- post_install_message:
116
+ post_install_message:
208
117
  rdoc_options: []
209
118
  require_paths:
210
119
  - lib
@@ -219,110 +128,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
219
128
  - !ruby/object:Gem::Version
220
129
  version: '0'
221
130
  requirements: []
222
- rubyforge_project:
223
- rubygems_version: 2.7.3
224
- signing_key:
131
+ rubygems_version: 3.2.3
132
+ signing_key:
225
133
  specification_version: 4
226
134
  summary: Simple mime type detection using magic numbers, filenames, and extensions
227
- test_files:
228
- - test/declared_type_test.rb
229
- - test/extension_test.rb
230
- - test/fixtures/image.gif
231
- - test/fixtures/magic/application/msword/msword.doc
232
- - test/fixtures/magic/application/pdf/illustrator-seen-as-pdf.ai
233
- - test/fixtures/magic/application/pdf/pdf.pdf
234
- - test/fixtures/magic/application/rtf/rtf.rtf
235
- - test/fixtures/magic/application/vnd.adobe.flash.movie/flash.swf
236
- - test/fixtures/magic/application/vnd.openxmlformats-officedocument.presentationml.presentation/vnd.openxmlformats-officedocument.presentationml.presentation.pptx
237
- - test/fixtures/magic/application/vnd.openxmlformats-officedocument.spreadsheetml.sheet/vnd.openxmlformats-officedocument.spreadsheetml.sheet.xlsx
238
- - test/fixtures/magic/application/vnd.openxmlformats-officedocument.wordprocessingml.document/vnd.openxmlformats-officedocument.wordprocessingml.document.docx
239
- - test/fixtures/magic/application/x-font-ttf.ttf
240
- - test/fixtures/magic/application/xml/xml.xml
241
- - test/fixtures/magic/application/zip/sketch.sketch
242
- - test/fixtures/magic/application/zip/zip.zip
243
- - test/fixtures/magic/audio/flac/flac.flac
244
- - test/fixtures/magic/audio/mp4/m4a.m4a
245
- - test/fixtures/magic/audio/mp4/mp4.m4a
246
- - test/fixtures/magic/audio/mpeg/mpeg.mp3
247
- - test/fixtures/magic/audio/x-wav/wav.wav
248
- - test/fixtures/magic/audio/x-wav/x-wav.wav
249
- - test/fixtures/magic/image/bmp/bmp.bmp
250
- - test/fixtures/magic/image/gif/gif.gif
251
- - test/fixtures/magic/image/jpeg/jpeg.jpg
252
- - test/fixtures/magic/image/png/png.png
253
- - test/fixtures/magic/image/svg+xml/svg.svg
254
- - test/fixtures/magic/image/tiff/tiff.tif
255
- - test/fixtures/magic/image/vnd.adobe.photoshop/photoshop-large-document-format.psb
256
- - test/fixtures/magic/image/vnd.adobe.photoshop/vnd.adobe.photoshop.psd
257
- - test/fixtures/magic/image/vnd.dwg/x-dwg.dwg
258
- - test/fixtures/magic/image/vnd.microsoft.icon/ico.ico
259
- - test/fixtures/magic/image/webp/webp.webp
260
- - test/fixtures/magic/image/x-eps/postscript/postscript.eps
261
- - test/fixtures/magic/image/x-eps/x-eps.eps
262
- - test/fixtures/magic/text/html/html.html
263
- - test/fixtures/magic/video/mp4/m4v.m4v
264
- - test/fixtures/magic/video/mp4/mp4.mp4
265
- - test/fixtures/magic/video/quicktime/quicktime.mov
266
- - test/fixtures/magic/video/webm/webm.mkv
267
- - test/fixtures/name/application/illustrator/illustrator.ai
268
- - test/fixtures/name/application/javascript/javascript.js
269
- - test/fixtures/name/application/json/json.json
270
- - test/fixtures/name/application/msword/msword.doc
271
- - test/fixtures/name/application/pdf/pdf.pdf
272
- - test/fixtures/name/application/rtf/rtf.rtf
273
- - test/fixtures/name/application/sql/sql.sql
274
- - test/fixtures/name/application/vnd.adobe.flash.movie/flash.swf
275
- - test/fixtures/name/application/vnd.android.package-archive/vnd.android.package-archive.apk
276
- - test/fixtures/name/application/vnd.apple.keynote/vnd.apple.keynote.key
277
- - test/fixtures/name/application/vnd.apple.numbers/vnd.apple.numbers.numbers
278
- - test/fixtures/name/application/vnd.apple.pages/vnd.apple.pages.pages
279
- - test/fixtures/name/application/vnd.ms-excel.sheet.binary.macroenabled.12/vnd.ms-excel.sheet.binary.macroenabled.12.xlsb
280
- - test/fixtures/name/application/vnd.ms-excel.sheet.macroenabled.12/vnd.ms-excel.sheet.macroenabled.12.xlsm
281
- - test/fixtures/name/application/vnd.ms-excel.template.macroenabled.12/vnd.ms-excel.template.macroenabled.12.xltm
282
- - test/fixtures/name/application/vnd.ms-excel/vnd.ms-excel.xls
283
- - test/fixtures/name/application/vnd.ms-powerpoint.presentation.macroenabled.12/vnd.ms-powerpoint.presentation.macroenabled.12.pptm
284
- - test/fixtures/name/application/vnd.ms-powerpoint.slideshow.macroenabled.12/vnd.ms-powerpoint.slideshow.macroenabled.12.ppsm
285
- - test/fixtures/name/application/vnd.ms-powerpoint.template.macroenabled.12/vnd.ms-powerpoint.template.macroenabled.12.potm
286
- - test/fixtures/name/application/vnd.ms-powerpoint/vnd.ms-powerpoint.ppt
287
- - test/fixtures/name/application/vnd.ms-word.document.macroenabled.12/vnd.ms-word.document.macroenabled.12.docm
288
- - test/fixtures/name/application/vnd.ms-word.template.macroenabled.12/vnd.ms-word.template.macroenabled.12.dotm
289
- - test/fixtures/name/application/vnd.openxmlformats-officedocument.presentationml.presentation/vnd.openxmlformats-officedocument.presentationml.presentation.pptx
290
- - test/fixtures/name/application/vnd.openxmlformats-officedocument.presentationml.slideshow/vnd.openxmlformats-officedocument.presentationml.slideshow.ppsx
291
- - test/fixtures/name/application/vnd.openxmlformats-officedocument.presentationml.template/vnd.openxmlformats-officedocument.presentationml.template.potx
292
- - test/fixtures/name/application/vnd.openxmlformats-officedocument.spreadsheetml.sheet/downloaded-from-google-docs.xlsx
293
- - test/fixtures/name/application/vnd.openxmlformats-officedocument.spreadsheetml.sheet/vnd.openxmlformats-officedocument.spreadsheetml.sheet.xlsx
294
- - test/fixtures/name/application/vnd.openxmlformats-officedocument.wordprocessingml.document/vnd.openxmlformats-officedocument.wordprocessingml.document.docx
295
- - test/fixtures/name/application/vnd.openxmlformats-officedocument.wordprocessingml.template/vnd.openxmlformats-officedocument.wordprocessingml.template.dotx
296
- - test/fixtures/name/application/x-font-ttf.ttf
297
- - test/fixtures/name/application/zip/zip.zip
298
- - test/fixtures/name/audio/flac/flac.flac
299
- - test/fixtures/name/audio/mp4/mp4.m4a
300
- - test/fixtures/name/audio/mpeg/mpeg.mp3
301
- - test/fixtures/name/audio/x-wav/x-wav.wav
302
- - test/fixtures/name/image/bmp/bmp.bmp
303
- - test/fixtures/name/image/gif/gif.gif
304
- - test/fixtures/name/image/heic.heic
305
- - test/fixtures/name/image/heif.heif
306
- - test/fixtures/name/image/jpeg/jpeg.jpg
307
- - test/fixtures/name/image/png/png.png
308
- - test/fixtures/name/image/svg+xml/svg.svg
309
- - test/fixtures/name/image/tiff/tiff.tif
310
- - test/fixtures/name/image/tiff/tiff.tiff
311
- - test/fixtures/name/image/vnd.adobe.photoshop/saved-as-large-document-format.psb
312
- - test/fixtures/name/image/vnd.adobe.photoshop/vnd.adobe.photoshop.psd
313
- - test/fixtures/name/image/x-eps/postscript/postscript.eps
314
- - test/fixtures/name/image/x-eps/x-eps.eps
315
- - test/fixtures/name/message/rfc822/rfc822.eml
316
- - test/fixtures/name/text/csv/csv.csv
317
- - test/fixtures/name/text/html/html.html
318
- - test/fixtures/name/text/plain/plain.asc
319
- - test/fixtures/name/text/plain/plain.txt
320
- - test/fixtures/name/text/x-log/x-log.log
321
- - test/fixtures/name/video/mp4/mp4.mp4
322
- - test/fixtures/name/video/quicktime/quicktime.mov
323
- - test/magic_and_declared_type_test.rb
324
- - test/magic_and_name_test.rb
325
- - test/magic_test.rb
326
- - test/mime_type_test.rb
327
- - test/name_test.rb
328
- - test/test_helper.rb
135
+ test_files: []
data/.gitignore DELETED
@@ -1 +0,0 @@
1
- *.gem
data/.travis.yml DELETED
@@ -1,7 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.2
4
- - 2.3
5
- - 2.4
6
- - 2.5
7
- before_install: gem update --system
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.2)
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.16.1
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.