marcel 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +13 -0
  3. data/Gemfile +4 -0
  4. data/Gemfile.lock +26 -0
  5. data/MIT-LICENSE +20 -0
  6. data/README.md +50 -0
  7. data/Rakefile +33 -0
  8. data/lib/marcel.rb +4 -0
  9. data/lib/marcel/mime_type.rb +93 -0
  10. data/lib/marcel/mime_type/definitions.rb +38 -0
  11. data/lib/marcel/version.rb +3 -0
  12. data/marcel.gemspec +28 -0
  13. data/test/declared_type_test.rb +17 -0
  14. data/test/extension_test.rb +25 -0
  15. data/test/fixtures/image.gif +0 -0
  16. data/test/fixtures/magic/application/msword/msword.doc +0 -0
  17. data/test/fixtures/magic/application/pdf/illustrator-seen-as-pdf.ai +6302 -22
  18. data/test/fixtures/magic/application/pdf/pdf.pdf +0 -0
  19. data/test/fixtures/magic/application/rtf/rtf.rtf +1 -0
  20. data/test/fixtures/magic/application/vnd.adobe.flash.movie/flash.swf +0 -0
  21. data/test/fixtures/magic/application/vnd.openxmlformats-officedocument.presentationml.presentation/vnd.openxmlformats-officedocument.presentationml.presentation.pptx +0 -0
  22. data/test/fixtures/magic/application/vnd.openxmlformats-officedocument.spreadsheetml.sheet/vnd.openxmlformats-officedocument.spreadsheetml.sheet.xlsx +0 -0
  23. data/test/fixtures/magic/application/vnd.openxmlformats-officedocument.wordprocessingml.document/vnd.openxmlformats-officedocument.wordprocessingml.document.docx +0 -0
  24. data/test/fixtures/magic/application/x-font-ttf.ttf +0 -0
  25. data/test/fixtures/magic/application/xml/xml.xml +1 -0
  26. data/test/fixtures/magic/application/zip/sketch.sketch +0 -0
  27. data/test/fixtures/magic/application/zip/zip.zip +0 -0
  28. data/test/fixtures/magic/audio/flac/flac.flac +0 -0
  29. data/test/fixtures/magic/audio/mp4/m4a.m4a +0 -0
  30. data/test/fixtures/magic/audio/mp4/mp4.m4a +0 -0
  31. data/test/fixtures/magic/audio/mpeg/mpeg.mp3 +0 -0
  32. data/test/fixtures/magic/audio/x-wav/wav.wav +0 -0
  33. data/test/fixtures/magic/audio/x-wav/x-wav.wav +0 -0
  34. data/test/fixtures/magic/image/bmp/bmp.bmp +0 -0
  35. data/test/fixtures/magic/image/gif/gif.gif +0 -0
  36. data/test/fixtures/magic/image/jpeg/jpeg.jpg +0 -0
  37. data/test/fixtures/magic/image/png/png.png +0 -0
  38. data/test/fixtures/magic/image/svg+xml/svg.svg +1 -0
  39. data/test/fixtures/magic/image/tiff/tiff.tif +0 -0
  40. data/test/fixtures/magic/image/vnd.adobe.photoshop/photoshop-large-document-format.psb +0 -0
  41. data/test/fixtures/magic/image/vnd.adobe.photoshop/vnd.adobe.photoshop.psd +0 -0
  42. data/test/fixtures/magic/image/vnd.dwg/x-dwg.dwg +0 -0
  43. data/test/fixtures/magic/image/vnd.microsoft.icon/ico.ico +0 -0
  44. data/test/fixtures/magic/image/webp/webp.webp +0 -0
  45. data/test/fixtures/magic/image/x-eps/postscript/postscript.eps +0 -0
  46. data/test/fixtures/magic/image/x-eps/x-eps.eps +0 -0
  47. data/test/fixtures/magic/text/html/html.html +3 -0
  48. data/test/fixtures/magic/video/mp4/m4v.m4v +0 -0
  49. data/test/fixtures/magic/video/mp4/mp4.mp4 +0 -0
  50. data/test/fixtures/magic/video/quicktime/quicktime.mov +0 -0
  51. data/test/fixtures/magic/video/webm/webm.mkv +0 -0
  52. data/test/fixtures/name/application/illustrator/illustrator.ai +6304 -24
  53. data/test/fixtures/name/application/javascript/javascript.js +3 -0
  54. data/test/fixtures/name/application/json/json.json +3 -0
  55. data/test/fixtures/name/application/msword/msword.doc +0 -0
  56. data/test/fixtures/name/application/pdf/pdf.pdf +0 -0
  57. data/test/fixtures/name/application/rtf/rtf.rtf +1 -0
  58. data/test/fixtures/name/application/sql/sql.sql +0 -0
  59. data/test/fixtures/name/application/vnd.adobe.flash.movie/flash.swf +0 -0
  60. data/test/fixtures/name/application/vnd.android.package-archive/vnd.android.package-archive.apk +0 -0
  61. data/test/fixtures/name/application/vnd.apple.keynote/vnd.apple.keynote.key +0 -0
  62. data/test/fixtures/name/application/vnd.apple.numbers/vnd.apple.numbers.numbers +0 -0
  63. data/test/fixtures/name/application/vnd.apple.pages/vnd.apple.pages.pages +0 -0
  64. data/test/fixtures/name/application/vnd.ms-excel.sheet.binary.macroenabled.12/vnd.ms-excel.sheet.binary.macroenabled.12.xlsb +0 -0
  65. data/test/fixtures/name/application/vnd.ms-excel.sheet.macroenabled.12/vnd.ms-excel.sheet.macroenabled.12.xlsm +0 -0
  66. data/test/fixtures/name/application/vnd.ms-excel.template.macroenabled.12/vnd.ms-excel.template.macroenabled.12.xltm +0 -0
  67. data/test/fixtures/name/application/vnd.ms-excel/vnd.ms-excel.xls +0 -0
  68. data/test/fixtures/name/application/vnd.ms-powerpoint.presentation.macroenabled.12/vnd.ms-powerpoint.presentation.macroenabled.12.pptm +0 -0
  69. data/test/fixtures/name/application/vnd.ms-powerpoint.slideshow.macroenabled.12/vnd.ms-powerpoint.slideshow.macroenabled.12.ppsm +0 -0
  70. data/test/fixtures/name/application/vnd.ms-powerpoint.template.macroenabled.12/vnd.ms-powerpoint.template.macroenabled.12.potm +0 -0
  71. data/test/fixtures/name/application/vnd.ms-word.document.macroenabled.12/vnd.ms-word.document.macroenabled.12.docm +0 -0
  72. data/test/fixtures/name/application/vnd.ms-word.template.macroenabled.12/vnd.ms-word.template.macroenabled.12.dotm +0 -0
  73. data/test/fixtures/name/application/vnd.openxmlformats-officedocument.presentationml.presentation/vnd.openxmlformats-officedocument.presentationml.presentation.pptx +0 -0
  74. data/test/fixtures/name/application/vnd.openxmlformats-officedocument.presentationml.slideshow/vnd.openxmlformats-officedocument.presentationml.slideshow.ppsx +0 -0
  75. data/test/fixtures/name/application/vnd.openxmlformats-officedocument.presentationml.template/vnd.openxmlformats-officedocument.presentationml.template.potx +0 -0
  76. data/test/fixtures/name/application/vnd.openxmlformats-officedocument.spreadsheetml.sheet/downloaded-from-google-docs.xlsx +0 -0
  77. data/test/fixtures/name/application/vnd.openxmlformats-officedocument.spreadsheetml.sheet/vnd.openxmlformats-officedocument.spreadsheetml.sheet.xlsx +0 -0
  78. data/test/fixtures/name/application/vnd.openxmlformats-officedocument.wordprocessingml.document/vnd.openxmlformats-officedocument.wordprocessingml.document.docx +0 -0
  79. data/test/fixtures/name/application/vnd.openxmlformats-officedocument.wordprocessingml.template/vnd.openxmlformats-officedocument.wordprocessingml.template.dotx +0 -0
  80. data/test/fixtures/name/application/x-font-ttf.ttf +0 -0
  81. data/test/fixtures/name/application/zip/zip.zip +0 -0
  82. data/test/fixtures/name/audio/flac/flac.flac +0 -0
  83. data/test/fixtures/name/audio/mp4/mp4.m4a +0 -0
  84. data/test/fixtures/name/audio/mpeg/mpeg.mp3 +0 -0
  85. data/test/fixtures/name/audio/x-wav/x-wav.wav +0 -0
  86. data/test/fixtures/name/image/bmp/bmp.bmp +0 -0
  87. data/test/fixtures/name/image/gif/gif.gif +0 -0
  88. data/test/fixtures/name/image/heic.heic +0 -0
  89. data/test/fixtures/name/image/heif.heif +0 -0
  90. data/test/fixtures/name/image/jpeg/jpeg.jpg +0 -0
  91. data/test/fixtures/name/image/png/png.png +0 -0
  92. data/test/fixtures/name/image/svg+xml/svg.svg +1 -0
  93. data/test/fixtures/name/image/tiff/tiff.tif +0 -0
  94. data/test/fixtures/name/image/tiff/tiff.tiff +0 -0
  95. data/test/fixtures/name/image/vnd.adobe.photoshop/saved-as-large-document-format.psb +0 -0
  96. data/test/fixtures/name/image/vnd.adobe.photoshop/vnd.adobe.photoshop.psd +0 -0
  97. data/test/fixtures/name/image/x-eps/postscript/postscript.eps +0 -0
  98. data/test/fixtures/name/image/x-eps/x-eps.eps +0 -0
  99. data/test/fixtures/name/message/rfc822/rfc822.eml +34 -0
  100. data/test/fixtures/name/text/csv/csv.csv +2 -0
  101. data/test/fixtures/name/text/html/html.html +3 -0
  102. data/test/fixtures/name/text/plain/plain.asc +1 -0
  103. data/test/fixtures/name/text/plain/plain.txt +1 -0
  104. data/test/fixtures/name/text/x-log/x-log.log +1 -0
  105. data/test/fixtures/name/video/mp4/mp4.mp4 +0 -0
  106. data/test/fixtures/name/video/quicktime/quicktime.mov +0 -0
  107. data/test/magic_and_declared_type_test.rb +10 -0
  108. data/test/magic_and_name_test.rb +13 -0
  109. data/test/magic_test.rb +13 -0
  110. data/test/mime_type_test.rb +47 -0
  111. data/test/name_test.rb +10 -0
  112. data/test/test_helper.rb +49 -0
  113. metadata +325 -0
@@ -0,0 +1,3 @@
1
+ function() {
2
+ alert("test")
3
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ name: 'JSON'
3
+ }
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg"/>
@@ -0,0 +1,34 @@
1
+ User-Agent: Microsoft-MacOutlook/0.0.0.151105
2
+ Date: Wed, 12 Jul 2017 15:25:43 +0100
3
+ Subject: Example email
4
+ From: Tom Ward <tom@popdog.net>
5
+ To: <tom@example.com>
6
+ Message-ID: <D7B2F82B-4176-475B-BA89-4356D7AA2DF6@popdog.net>
7
+ Thread-Topic: Example email
8
+ Mime-version: 1.0
9
+ Content-type: multipart/alternative;
10
+ boundary="B_3582727856_2021010881"
11
+
12
+ > This message is in MIME format. Since your mail reader does not understand
13
+ this format, some or all of this message may not be legible.
14
+
15
+ --B_3582727856_2021010881
16
+ Content-type: text/plain;
17
+ charset="UTF-8"
18
+ Content-transfer-encoding: 7bit
19
+
20
+ Hello
21
+
22
+
23
+ --B_3582727856_2021010881
24
+ Content-type: text/html;
25
+ charset="UTF-8"
26
+ Content-transfer-encoding: quoted-printable
27
+
28
+ <html><head></head><body style=3D"word-wrap: break-word; -webkit-nbsp-mode: s=
29
+ pace; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size:=
30
+ 14px; font-family: Calibri, sans-serif;"><div><div><div>Hello</div><div><di=
31
+ v id=3D"MAC_OUTLOOK_SIGNATURE"></div></div></div></div></body></html>
32
+
33
+ --B_3582727856_2021010881--
34
+
@@ -0,0 +1,2 @@
1
+ Name,Age,Occupation
2
+ Marcel Marceau,94,Mime
@@ -0,0 +1,3 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ </html>
@@ -0,0 +1 @@
1
+ Some logging
@@ -0,0 +1,10 @@
1
+ require 'test_helper'
2
+ require 'rack'
3
+
4
+ class Marcel::MimeType::MagicAndDeclaredTypeTest < Marcel::TestCase
5
+ each_content_type_fixture('name') do |file, name, content_type|
6
+ test "correctly returns #{content_type} for #{name} given both file and declared type" do
7
+ assert_equal content_type, Marcel::MimeType.for(file, declared_type: content_type)
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,13 @@
1
+ require 'test_helper'
2
+ require 'rack'
3
+
4
+ class Marcel::MimeType::MagicAndNameTest < Marcel::TestCase
5
+ # All fixtures that can be recognised by name should also be recognisable when given
6
+ # the file contents and the name. In some cases, the file contents will point to a
7
+ # generic type, while the name will choose a more specific subclass
8
+ each_content_type_fixture('name') do |file, name, content_type|
9
+ test "correctly returns #{content_type} for #{name} given both file and name" do
10
+ assert_equal content_type, Marcel::MimeType.for(file, name: name)
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ require 'test_helper'
2
+ require 'rack'
3
+
4
+ class Marcel::MimeType::MagicTest < Marcel::TestCase
5
+ # These fixtures should be recognisable given only their contents. Where a generic type
6
+ # has more specific subclasses (such as application/zip), these subclasses cannot usually
7
+ # be recognised by magic alone; their name is also needed to correctly identify them.
8
+ each_content_type_fixture('magic') do |file, name, content_type|
9
+ test "gets type for #{content_type} by using only magic bytes #{name}" do
10
+ assert_equal content_type, Marcel::MimeType.for(file)
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,47 @@
1
+ require 'test_helper'
2
+ require 'rack'
3
+
4
+ class Marcel::MimeTypeTest < Marcel::TestCase
5
+ def setup
6
+ @path = files("image.gif").to_s
7
+ end
8
+
9
+ test "gets content type from Files" do
10
+ content_type = File.open @path do |file|
11
+ Marcel::MimeType.for file
12
+ end
13
+ assert_equal "image/gif", content_type
14
+ end
15
+
16
+ test "gets content type from Pathnames" do
17
+ content_type = Marcel::MimeType.for Pathname.new(@path)
18
+ assert_equal "image/gif", content_type
19
+ end
20
+
21
+ test "closes Pathname files after use" do
22
+ content_type = Marcel::MimeType.for Pathname.new(@path)
23
+ open_files = ObjectSpace.each_object(File).reject(&:closed?)
24
+ assert open_files.none? { |f| f.path == @path }
25
+ end
26
+
27
+ test "gets content type from Tempfiles" do
28
+ Tempfile.open do |tempfile|
29
+ tempfile.write(File.read(@path))
30
+ content_type = Marcel::MimeType.for tempfile
31
+ assert_equal "image/gif", content_type
32
+ end
33
+ end
34
+
35
+ test "gets content type from IOs" do
36
+ io = StringIO.new(File.read(@path))
37
+ content_type = Marcel::MimeType.for io
38
+ assert_equal "image/gif", content_type
39
+ end
40
+
41
+ test "gets content type from sources that conform to Rack::Lint::InputWrapper" do
42
+ io = StringIO.new(File.read(@path))
43
+ wrapper = Rack::Lint::InputWrapper.new(io)
44
+ content_type = Marcel::MimeType.for wrapper
45
+ assert_equal "image/gif", content_type
46
+ end
47
+ end
@@ -0,0 +1,10 @@
1
+ require 'test_helper'
2
+ require 'rack'
3
+
4
+ class Marcel::MimeType::NameTest < Marcel::TestCase
5
+ each_content_type_fixture('name') do |file, name, content_type|
6
+ test "gets type for #{content_type} by filename from #{name}" do
7
+ assert_equal content_type, Marcel::MimeType.for(name: name)
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,49 @@
1
+ require 'minitest/autorun'
2
+ require 'marcel'
3
+
4
+ class Marcel::TestCase < MiniTest::Test
5
+ class << self
6
+ def setup(&block)
7
+ define_method(:setup, &block)
8
+ end
9
+
10
+ def teardown(&block)
11
+ define_method(:teardown, &block)
12
+ end
13
+
14
+ def test(name, &block)
15
+ test_name = "test_#{name.gsub(/\s+/,'_')}".to_sym
16
+ defined = instance_method(test_name) rescue false
17
+ raise "#{test_name} is already defined in #{self}" if defined
18
+ define_method(test_name, &block)
19
+ end
20
+
21
+ def fixture_path(name)
22
+ File.expand_path("../fixtures/#{name}", __FILE__)
23
+ end
24
+
25
+ def files(name)
26
+ Pathname.new fixture_path(name)
27
+ end
28
+
29
+ def each_content_type_fixture(folder)
30
+ FileUtils.chdir fixture_path(folder) do
31
+ Dir["**/*.*"].map do |name|
32
+ if File.file?(name)
33
+ _, content_type, extra, extension = *name.match(/\A([^\/]+\/[^\/]*)\/?(.*)\.(\w+)\Z/)
34
+ extra = nil if content_type[-content_type.size..-1] == extra
35
+ yield files("#{folder}/#{name}"), name, content_type
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
41
+
42
+ def files(name)
43
+ Pathname.new fixture_path(name)
44
+ end
45
+
46
+ def fixture_path(name)
47
+ self.class.fixture_path(name)
48
+ end
49
+ end
metadata ADDED
@@ -0,0 +1,325 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: marcel
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.0
5
+ platform: ruby
6
+ authors:
7
+ - Tom Ward
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-01-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: mimemagic
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.3.2
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.3.2
27
+ - !ruby/object:Gem::Dependency
28
+ name: minitest
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.7'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.7'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rack
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 2.0.1
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 2.0.1
83
+ description:
84
+ email:
85
+ - tom@basecamp.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - ".gitignore"
91
+ - Gemfile
92
+ - Gemfile.lock
93
+ - MIT-LICENSE
94
+ - README.md
95
+ - Rakefile
96
+ - lib/marcel.rb
97
+ - lib/marcel/mime_type.rb
98
+ - lib/marcel/mime_type/definitions.rb
99
+ - 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
202
+ licenses:
203
+ - MIT
204
+ metadata: {}
205
+ post_install_message:
206
+ rdoc_options: []
207
+ require_paths:
208
+ - lib
209
+ required_ruby_version: !ruby/object:Gem::Requirement
210
+ requirements:
211
+ - - "~>"
212
+ - !ruby/object:Gem::Version
213
+ version: '2.3'
214
+ required_rubygems_version: !ruby/object:Gem::Requirement
215
+ requirements:
216
+ - - ">="
217
+ - !ruby/object:Gem::Version
218
+ version: '0'
219
+ requirements: []
220
+ rubyforge_project:
221
+ rubygems_version: 2.7.3
222
+ signing_key:
223
+ specification_version: 4
224
+ 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