marcel 0.3.2 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/APACHE-LICENSE +202 -0
- data/README.md +39 -21
- data/lib/marcel/magic.rb +147 -0
- data/lib/marcel/mime_type/definitions.rb +30 -3
- data/lib/marcel/mime_type.rb +68 -67
- data/lib/marcel/tables.rb +2525 -0
- data/lib/marcel/version.rb +1 -1
- data/lib/marcel.rb +3 -2
- metadata +39 -230
- data/.gitignore +0 -1
- data/.travis.yml +0 -7
- data/Gemfile +0 -4
- data/Gemfile.lock +0 -26
- data/Rakefile +0 -33
- data/marcel.gemspec +0 -28
- data/test/declared_type_test.rb +0 -17
- data/test/extension_test.rb +0 -25
- data/test/fixtures/image.gif +0 -0
- data/test/fixtures/magic/application/msword/msword.doc +0 -0
- data/test/fixtures/magic/application/pdf/illustrator-seen-as-pdf.ai +22 -6302
- data/test/fixtures/magic/application/pdf/pdf.pdf +0 -0
- data/test/fixtures/magic/application/rtf/rtf.rtf +0 -1
- data/test/fixtures/magic/application/vnd.adobe.flash.movie/flash.swf +0 -0
- data/test/fixtures/magic/application/vnd.openxmlformats-officedocument.presentationml.presentation/vnd.openxmlformats-officedocument.presentationml.presentation.pptx +0 -0
- data/test/fixtures/magic/application/vnd.openxmlformats-officedocument.spreadsheetml.sheet/vnd.openxmlformats-officedocument.spreadsheetml.sheet.xlsx +0 -0
- data/test/fixtures/magic/application/vnd.openxmlformats-officedocument.wordprocessingml.document/vnd.openxmlformats-officedocument.wordprocessingml.document.docx +0 -0
- data/test/fixtures/magic/application/x-font-ttf.ttf +0 -0
- data/test/fixtures/magic/application/xml/xml.xml +0 -1
- data/test/fixtures/magic/application/zip/sketch.sketch +0 -0
- data/test/fixtures/magic/application/zip/zip.zip +0 -0
- data/test/fixtures/magic/audio/flac/flac.flac +0 -0
- data/test/fixtures/magic/audio/mp4/m4a.m4a +0 -0
- data/test/fixtures/magic/audio/mp4/mp4.m4a +0 -0
- data/test/fixtures/magic/audio/mpeg/mpeg.mp3 +0 -0
- data/test/fixtures/magic/audio/x-wav/wav.wav +0 -0
- data/test/fixtures/magic/audio/x-wav/x-wav.wav +0 -0
- data/test/fixtures/magic/image/bmp/bmp.bmp +0 -0
- data/test/fixtures/magic/image/gif/gif.gif +0 -0
- data/test/fixtures/magic/image/jpeg/jpeg.jpg +0 -0
- data/test/fixtures/magic/image/png/png.png +0 -0
- data/test/fixtures/magic/image/svg+xml/svg.svg +0 -1
- data/test/fixtures/magic/image/tiff/tiff.tif +0 -0
- data/test/fixtures/magic/image/vnd.adobe.photoshop/photoshop-large-document-format.psb +0 -0
- data/test/fixtures/magic/image/vnd.adobe.photoshop/vnd.adobe.photoshop.psd +0 -0
- data/test/fixtures/magic/image/vnd.dwg/x-dwg.dwg +0 -0
- data/test/fixtures/magic/image/vnd.microsoft.icon/ico.ico +0 -0
- data/test/fixtures/magic/image/webp/webp.webp +0 -0
- data/test/fixtures/magic/image/x-eps/postscript/postscript.eps +0 -0
- data/test/fixtures/magic/image/x-eps/x-eps.eps +0 -0
- data/test/fixtures/magic/text/html/html.html +0 -3
- data/test/fixtures/magic/video/mp4/m4v.m4v +0 -0
- data/test/fixtures/magic/video/mp4/mp4.mp4 +0 -0
- data/test/fixtures/magic/video/quicktime/quicktime.mov +0 -0
- data/test/fixtures/magic/video/webm/webm.mkv +0 -0
- data/test/fixtures/name/application/illustrator/illustrator.ai +27 -6301
- data/test/fixtures/name/application/javascript/javascript.js +0 -3
- data/test/fixtures/name/application/json/json.json +0 -3
- data/test/fixtures/name/application/msword/msword.doc +0 -0
- data/test/fixtures/name/application/pdf/pdf.pdf +0 -0
- data/test/fixtures/name/application/rtf/rtf.rtf +0 -1
- data/test/fixtures/name/application/sql/sql.sql +0 -0
- data/test/fixtures/name/application/vnd.adobe.flash.movie/flash.swf +0 -0
- data/test/fixtures/name/application/vnd.android.package-archive/vnd.android.package-archive.apk +0 -0
- data/test/fixtures/name/application/vnd.apple.keynote/vnd.apple.keynote.key +0 -0
- data/test/fixtures/name/application/vnd.apple.numbers/vnd.apple.numbers.numbers +0 -0
- data/test/fixtures/name/application/vnd.apple.pages/vnd.apple.pages.pages +0 -0
- data/test/fixtures/name/application/vnd.ms-excel/vnd.ms-excel.xls +0 -0
- data/test/fixtures/name/application/vnd.ms-excel.sheet.binary.macroenabled.12/vnd.ms-excel.sheet.binary.macroenabled.12.xlsb +0 -0
- data/test/fixtures/name/application/vnd.ms-excel.sheet.macroenabled.12/vnd.ms-excel.sheet.macroenabled.12.xlsm +0 -0
- data/test/fixtures/name/application/vnd.ms-excel.template.macroenabled.12/vnd.ms-excel.template.macroenabled.12.xltm +0 -0
- data/test/fixtures/name/application/vnd.ms-powerpoint/vnd.ms-powerpoint.ppt +0 -0
- data/test/fixtures/name/application/vnd.ms-powerpoint.presentation.macroenabled.12/vnd.ms-powerpoint.presentation.macroenabled.12.pptm +0 -0
- data/test/fixtures/name/application/vnd.ms-powerpoint.slideshow.macroenabled.12/vnd.ms-powerpoint.slideshow.macroenabled.12.ppsm +0 -0
- data/test/fixtures/name/application/vnd.ms-powerpoint.template.macroenabled.12/vnd.ms-powerpoint.template.macroenabled.12.potm +0 -0
- data/test/fixtures/name/application/vnd.ms-word.document.macroenabled.12/vnd.ms-word.document.macroenabled.12.docm +0 -0
- data/test/fixtures/name/application/vnd.ms-word.template.macroenabled.12/vnd.ms-word.template.macroenabled.12.dotm +0 -0
- data/test/fixtures/name/application/vnd.openxmlformats-officedocument.presentationml.presentation/vnd.openxmlformats-officedocument.presentationml.presentation.pptx +0 -0
- data/test/fixtures/name/application/vnd.openxmlformats-officedocument.presentationml.slideshow/vnd.openxmlformats-officedocument.presentationml.slideshow.ppsx +0 -0
- data/test/fixtures/name/application/vnd.openxmlformats-officedocument.presentationml.template/vnd.openxmlformats-officedocument.presentationml.template.potx +0 -0
- data/test/fixtures/name/application/vnd.openxmlformats-officedocument.spreadsheetml.sheet/downloaded-from-google-docs.xlsx +0 -0
- data/test/fixtures/name/application/vnd.openxmlformats-officedocument.spreadsheetml.sheet/vnd.openxmlformats-officedocument.spreadsheetml.sheet.xlsx +0 -0
- data/test/fixtures/name/application/vnd.openxmlformats-officedocument.wordprocessingml.document/vnd.openxmlformats-officedocument.wordprocessingml.document.docx +0 -0
- data/test/fixtures/name/application/vnd.openxmlformats-officedocument.wordprocessingml.template/vnd.openxmlformats-officedocument.wordprocessingml.template.dotx +0 -0
- data/test/fixtures/name/application/x-font-ttf.ttf +0 -0
- data/test/fixtures/name/application/zip/zip.zip +0 -0
- data/test/fixtures/name/audio/flac/flac.flac +0 -0
- data/test/fixtures/name/audio/mp4/mp4.m4a +0 -0
- data/test/fixtures/name/audio/mpeg/mpeg.mp3 +0 -0
- data/test/fixtures/name/audio/x-wav/x-wav.wav +0 -0
- data/test/fixtures/name/image/bmp/bmp.bmp +0 -0
- data/test/fixtures/name/image/gif/gif.gif +0 -0
- data/test/fixtures/name/image/heic.heic +0 -0
- data/test/fixtures/name/image/heif.heif +0 -0
- data/test/fixtures/name/image/jpeg/jpeg.jpg +0 -0
- data/test/fixtures/name/image/png/png.png +0 -0
- data/test/fixtures/name/image/svg+xml/svg.svg +0 -1
- data/test/fixtures/name/image/tiff/tiff.tif +0 -0
- data/test/fixtures/name/image/tiff/tiff.tiff +0 -0
- data/test/fixtures/name/image/vnd.adobe.photoshop/saved-as-large-document-format.psb +0 -0
- data/test/fixtures/name/image/vnd.adobe.photoshop/vnd.adobe.photoshop.psd +0 -0
- data/test/fixtures/name/image/x-eps/postscript/postscript.eps +0 -0
- data/test/fixtures/name/image/x-eps/x-eps.eps +0 -0
- data/test/fixtures/name/message/rfc822/rfc822.eml +0 -34
- data/test/fixtures/name/text/csv/csv.csv +0 -2
- data/test/fixtures/name/text/html/html.html +0 -3
- data/test/fixtures/name/text/plain/plain.asc +0 -1
- data/test/fixtures/name/text/plain/plain.txt +0 -1
- data/test/fixtures/name/text/x-log/x-log.log +0 -1
- data/test/fixtures/name/video/mp4/mp4.mp4 +0 -0
- data/test/fixtures/name/video/quicktime/quicktime.mov +0 -0
- data/test/magic_and_declared_type_test.rb +0 -10
- data/test/magic_and_name_test.rb +0 -13
- data/test/magic_test.rb +0 -13
- data/test/mime_type_test.rb +0 -47
- data/test/name_test.rb +0 -10
- data/test/test_helper.rb +0 -49
data/lib/marcel/version.rb
CHANGED
data/lib/marcel.rb
CHANGED
metadata
CHANGED
@@ -1,85 +1,99 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: marcel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Ward
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-09-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: minitest
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
20
|
-
type: :
|
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:
|
26
|
+
version: '5.11'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
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: '
|
40
|
+
version: '1.7'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
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: '
|
54
|
+
version: '13.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: rack
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
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: '
|
68
|
+
version: '2.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
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:
|
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:
|
96
|
+
version: 10.0.2
|
83
97
|
description:
|
84
98
|
email:
|
85
99
|
- tom@basecamp.com
|
@@ -87,122 +101,19 @@ executables: []
|
|
87
101
|
extensions: []
|
88
102
|
extra_rdoc_files: []
|
89
103
|
files:
|
90
|
-
-
|
91
|
-
- ".travis.yml"
|
92
|
-
- Gemfile
|
93
|
-
- Gemfile.lock
|
104
|
+
- APACHE-LICENSE
|
94
105
|
- MIT-LICENSE
|
95
106
|
- README.md
|
96
|
-
- Rakefile
|
97
107
|
- lib/marcel.rb
|
108
|
+
- lib/marcel/magic.rb
|
98
109
|
- lib/marcel/mime_type.rb
|
99
110
|
- lib/marcel/mime_type/definitions.rb
|
111
|
+
- lib/marcel/tables.rb
|
100
112
|
- lib/marcel/version.rb
|
101
|
-
|
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
|
113
|
+
homepage: https://github.com/rails/marcel
|
204
114
|
licenses:
|
205
115
|
- MIT
|
116
|
+
- Apache-2.0
|
206
117
|
metadata: {}
|
207
118
|
post_install_message:
|
208
119
|
rdoc_options: []
|
@@ -219,110 +130,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
219
130
|
- !ruby/object:Gem::Version
|
220
131
|
version: '0'
|
221
132
|
requirements: []
|
222
|
-
|
223
|
-
rubygems_version: 2.7.3
|
133
|
+
rubygems_version: 3.1.6
|
224
134
|
signing_key:
|
225
135
|
specification_version: 4
|
226
136
|
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
|
137
|
+
test_files: []
|
data/.gitignore
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
*.gem
|
data/.travis.yml
DELETED
data/Gemfile
DELETED
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/Rakefile
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
require 'bundler/gem_tasks'
|
2
|
-
require 'rake/testtask'
|
3
|
-
|
4
|
-
Rake::TestTask.new do |t|
|
5
|
-
t.libs << "test"
|
6
|
-
t.test_files = FileList['test/**/*_test.rb']
|
7
|
-
end
|
8
|
-
|
9
|
-
task default: :test
|
10
|
-
|
11
|
-
task :types do
|
12
|
-
fixture_path = File.expand_path("../test/fixtures", __FILE__)
|
13
|
-
|
14
|
-
tested_by_data = Dir["#{fixture_path}/magic/*/*"].map do |path|
|
15
|
-
type = path.split("#{fixture_path}/magic/").last
|
16
|
-
end
|
17
|
-
|
18
|
-
tested_by_filename = Dir["#{fixture_path}/name/*/*"].sort.map do |path|
|
19
|
-
type = path.split("#{fixture_path}/name/").last
|
20
|
-
extensions = Dir["#{path}/*.*"].map { |file| File.extname(file) }
|
21
|
-
[type, extensions]
|
22
|
-
end
|
23
|
-
|
24
|
-
puts "Test fixtures exist for the following types: "
|
25
|
-
|
26
|
-
tested_by_filename.each do |(type, extensions)|
|
27
|
-
if tested_by_data.include?(type)
|
28
|
-
puts " #{type} by (#{extensions.join(", ")}) and by file data"
|
29
|
-
else
|
30
|
-
puts " #{type} by (#{extensions.join(", ")})"
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
data/marcel.gemspec
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'marcel/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = 'marcel'
|
8
|
-
spec.version = Marcel::VERSION
|
9
|
-
spec.authors = ['Tom Ward']
|
10
|
-
spec.email = ['tom@basecamp.com']
|
11
|
-
spec.summary = %q{Simple mime type detection using magic numbers, filenames, and extensions}
|
12
|
-
spec.homepage = 'https://github.com/basecamp/marcel'
|
13
|
-
spec.license = 'MIT'
|
14
|
-
|
15
|
-
spec.files = `git ls-files -z`.split("\x0")
|
16
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
-
spec.require_paths = ['lib']
|
19
|
-
|
20
|
-
spec.required_ruby_version = '>= 2.2'
|
21
|
-
|
22
|
-
spec.add_dependency 'mimemagic', '~> 0.3.2'
|
23
|
-
|
24
|
-
spec.add_development_dependency 'minitest'
|
25
|
-
spec.add_development_dependency 'bundler', '~> 1.7'
|
26
|
-
spec.add_development_dependency 'rake', '~> 10.0'
|
27
|
-
spec.add_development_dependency 'rack', '~> 2.0.1'
|
28
|
-
end
|
data/test/declared_type_test.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
require 'rack'
|
3
|
-
|
4
|
-
class Marcel::MimeType::DeclaredTypeTest < Marcel::TestCase
|
5
|
-
test "returns declared type as last resort" do
|
6
|
-
assert_equal "text/html", Marcel::MimeType.for(name: "unrecognisable", declared_type: "text/html")
|
7
|
-
end
|
8
|
-
|
9
|
-
test "returns application/octet-stream if declared type empty or unrecognised" do
|
10
|
-
assert_equal "application/octet-stream", Marcel::MimeType.for(declared_type: "")
|
11
|
-
assert_equal "application/octet-stream", Marcel::MimeType.for(declared_type: "unrecognised")
|
12
|
-
end
|
13
|
-
|
14
|
-
test "ignores charset declarations" do
|
15
|
-
assert_equal "text/html", Marcel::MimeType.for(declared_type: "text/html; charset=utf-8")
|
16
|
-
end
|
17
|
-
end
|
data/test/extension_test.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
require 'rack'
|
3
|
-
|
4
|
-
class Marcel::MimeType::ExtensionTest < Marcel::TestCase
|
5
|
-
test "ignores case and any preceding dot" do
|
6
|
-
assert_equal "application/pdf", Marcel::MimeType.for(extension: "PDF")
|
7
|
-
assert_equal "application/pdf", Marcel::MimeType.for(extension: ".PDF")
|
8
|
-
assert_equal "application/pdf", Marcel::MimeType.for(extension: "pdf")
|
9
|
-
assert_equal "application/pdf", Marcel::MimeType.for(extension: ".pdf")
|
10
|
-
end
|
11
|
-
|
12
|
-
extensions = []
|
13
|
-
|
14
|
-
each_content_type_fixture('name') do |file, name, content_type|
|
15
|
-
extension = File.extname(name)
|
16
|
-
|
17
|
-
unless extensions.include?(extension)
|
18
|
-
test "gets type for #{content_type} given file extension #{extension}" do
|
19
|
-
assert_equal content_type, Marcel::MimeType.for(extension: extension)
|
20
|
-
end
|
21
|
-
|
22
|
-
extensions << extension
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
data/test/fixtures/image.gif
DELETED
Binary file
|
Binary file
|