mime-types 3.2.2 → 3.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Contributing.md +4 -0
- data/History.md +33 -1
- data/Licence.md +1 -1
- data/README.rdoc +1 -8
- data/Rakefile +39 -11
- data/lib/mime/type/columnar.rb +2 -2
- data/lib/mime/type.rb +51 -37
- data/lib/mime/types/_columnar.rb +8 -9
- data/lib/mime/types/cache.rb +5 -5
- data/lib/mime/types/container.rb +18 -16
- data/lib/mime/types/deprecations.rb +0 -2
- data/lib/mime/types/logger.rb +1 -1
- data/lib/mime/types/registry.rb +7 -7
- data/lib/mime/types.rb +4 -3
- data/test/minitest_helper.rb +0 -2
- data/test/test_mime_type.rb +20 -24
- data/test/test_mime_types.rb +24 -26
- data/test/test_mime_types_cache.rb +1 -3
- data/test/test_mime_types_class.rb +11 -13
- data/test/test_mime_types_lazy.rb +0 -2
- data/test/test_mime_types_loader.rb +0 -2
- metadata +14 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 727050c60daa98ccb85692629f83999009ca6d6cd259e15ceebdaf524da14c0a
|
4
|
+
data.tar.gz: 28a5af3883b49bd685f35cd84247dbe3c6894d5cca8417c212d3bb0d261b23d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb64be5b69ac765df59ea4ae0fd17f549263107c59878954e3613b44519a73eacfe00f2e28e0369452afe1a4c4846a98a5f59402d559a7b3acf9de78388bff4a
|
7
|
+
data.tar.gz: 1141d794103db9810da89504387f56caa84e704f523197072393855a8f9a89e474b52794d9de6a09d750634711446ce4731971a13fbe642a32f58e5f7f27b0fb
|
data/Contributing.md
CHANGED
@@ -99,6 +99,7 @@ Thanks to everyone else who has contributed to mime-types over the years:
|
|
99
99
|
|
100
100
|
* Aaron Patterson
|
101
101
|
* Aggelos Avgerinos
|
102
|
+
* Al Snow
|
102
103
|
* Andre Pankratz
|
103
104
|
* Andy Brody
|
104
105
|
* Arnaud Meuret
|
@@ -115,6 +116,7 @@ Thanks to everyone else who has contributed to mime-types over the years:
|
|
115
116
|
* Hans de Graaff
|
116
117
|
* Henrik Hodne
|
117
118
|
* Janko Marohnić
|
119
|
+
* Jean Boussier
|
118
120
|
* Jeremy Evans
|
119
121
|
* Juanito Fatas
|
120
122
|
* Jun Aruga
|
@@ -124,7 +126,9 @@ Thanks to everyone else who has contributed to mime-types over the years:
|
|
124
126
|
* Martin d'Allens
|
125
127
|
* Mauricio Linhares
|
126
128
|
* Nicolas Leger
|
129
|
+
* Nicholas La Roux
|
127
130
|
* nycvotes-dev
|
131
|
+
* Olle Jonsson
|
128
132
|
* Postmodern
|
129
133
|
* Richard Hirner
|
130
134
|
* Richard Hurt
|
data/History.md
CHANGED
@@ -1,3 +1,31 @@
|
|
1
|
+
## 3.3.1 / 2019-12-26
|
2
|
+
|
3
|
+
* 1 minor bugfix:
|
4
|
+
|
5
|
+
* Al Snow fixed a warning with MIME::Types::Logger producing a warning
|
6
|
+
because Ruby 2.7 introduces numbered block parameters. Because of the
|
7
|
+
way that the MIME::Types::Logger works for deprecation messages, the
|
8
|
+
initializer parameters had been named `_1`, `_2`, and `_3`. This has
|
9
|
+
now been resolved. [#146][]
|
10
|
+
|
11
|
+
* Administrivia:
|
12
|
+
|
13
|
+
* Olle Jonsson removed an outdated Travis configuration option (`sudo:
|
14
|
+
false`). [#142][]
|
15
|
+
|
16
|
+
## 3.3 / 2019-09-04
|
17
|
+
|
18
|
+
* 1 minor enhancement
|
19
|
+
|
20
|
+
* Jean Boussier reduced memory usage for Ruby versions 2.3 or higher by
|
21
|
+
interning various string values in each type. This is done with a
|
22
|
+
backwards-compatible call that _freezes_ the strings on older
|
23
|
+
versions of Ruby. [#141][]
|
24
|
+
|
25
|
+
* Administrivia:
|
26
|
+
|
27
|
+
* Nicholas La Roux updated Travis build configurations. [#139][]
|
28
|
+
|
1
29
|
## 3.2.2 / 2018-08-12
|
2
30
|
|
3
31
|
* Hiroto Fukui removed a stray `debugger` statement that I had used in
|
@@ -50,7 +78,7 @@
|
|
50
78
|
* Documentation Changes:
|
51
79
|
|
52
80
|
* Supporting files are now Markdown instead of rdoc, except for the
|
53
|
-
README.
|
81
|
+
README.
|
54
82
|
|
55
83
|
* The history file has been modified to remove all history prior to 3.0.
|
56
84
|
This history can be found in previous commits.
|
@@ -203,6 +231,10 @@
|
|
203
231
|
[#135]: https://github.com/mime-types/ruby-mime-types/pull/135
|
204
232
|
[#136]: https://github.com/mime-types/ruby-mime-types/issues/136
|
205
233
|
[#137]: https://github.com/mime-types/ruby-mime-types/pull/137
|
234
|
+
[#139]: https://github.com/mime-types/ruby-mime-types/pull/139
|
235
|
+
[#141]: https://github.com/mime-types/ruby-mime-types/pull/141
|
236
|
+
[#142]: https://github.com/mime-types/ruby-mime-types/pull/142
|
237
|
+
[#146]: https://github.com/mime-types/ruby-mime-types/pull/146
|
206
238
|
[Code-of-Conduct.md]: Code-of-Conduct_md.html
|
207
239
|
[Contributor Covenant]: http://contributor-covenant.org
|
208
240
|
[mime-types-data]: https://github.com/mime-types/mime-types-data
|
data/Licence.md
CHANGED
data/README.rdoc
CHANGED
@@ -4,6 +4,7 @@ home :: https://github.com/mime-types/ruby-mime-types/
|
|
4
4
|
code :: https://github.com/mime-types/ruby-mime-types/
|
5
5
|
bugs :: https://github.com/mime-types/ruby-mime-types/issues
|
6
6
|
rdoc :: http://rdoc.info/gems/mime-types/
|
7
|
+
clog :: https://github.com/mime-types/ruby-mime-types/blob/master/History.md
|
7
8
|
continuous integration :: {<img src="https://travis-ci.org/mime-types/ruby-mime-types.svg?branch=master" alt="Build Status" />}[https://travis-ci.org/mime-types/ruby-mime-types]
|
8
9
|
test coverage :: {<img src="https://coveralls.io/repos/mime-types/ruby-mime-types/badge.svg?branch=master&service=github" alt="Coverage Status" />}[https://coveralls.io/github/mime-types/ruby-mime-types?branch=master]
|
9
10
|
|
@@ -35,14 +36,6 @@ recommendations, the {IANA Media Types
|
|
35
36
|
registry}[https://www.iana.org/assignments/media-types/media-types.xhtml], and
|
36
37
|
user contributions. It conforms to RFCs 2045 and 2231.
|
37
38
|
|
38
|
-
=== mime-types 1.x End of Life
|
39
|
-
|
40
|
-
mime-types 1.x is no longer supported as of 2015-10-27.
|
41
|
-
|
42
|
-
=== mime-types 2.x End of Life
|
43
|
-
|
44
|
-
mime-types 2.x is no longer supported as of 2017-11-21.
|
45
|
-
|
46
39
|
=== mime-types 3.x
|
47
40
|
|
48
41
|
Users are encouraged to upgrade to mime-types 3.x as soon as is practical.
|
data/Rakefile
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# -*- ruby encoding: utf-8 -*-
|
4
|
-
|
5
3
|
require 'rubygems'
|
6
4
|
require 'hoe'
|
7
5
|
require 'rake/clean'
|
@@ -37,7 +35,7 @@ spec = Hoe.spec 'mime-types' do
|
|
37
35
|
extra_dev_deps << ['minitest-bonus-assertions', '~> 3.0']
|
38
36
|
extra_dev_deps << ['minitest-hooks', '~> 1.4']
|
39
37
|
extra_dev_deps << ['rake', '>= 10.0', '< 13.0']
|
40
|
-
extra_dev_deps << ['fivemat', '~> 1.3'
|
38
|
+
extra_dev_deps << ['fivemat', '~> 1.3']
|
41
39
|
extra_dev_deps << ['minitest-rg', '~> 5.2']
|
42
40
|
|
43
41
|
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.0')
|
@@ -56,7 +54,7 @@ namespace :benchmark do
|
|
56
54
|
end
|
57
55
|
|
58
56
|
desc 'Benchmark Load Times'
|
59
|
-
task :load, [
|
57
|
+
task :load, [:repeats] => 'benchmark:support' do |_, args|
|
60
58
|
require 'benchmarks/load'
|
61
59
|
Benchmarks::Load.report(
|
62
60
|
File.join(Rake.application.original_dir, 'lib'),
|
@@ -65,7 +63,7 @@ namespace :benchmark do
|
|
65
63
|
end
|
66
64
|
|
67
65
|
desc 'Allocation counts'
|
68
|
-
task :allocations, [
|
66
|
+
task :allocations, [:top_x, :mime_types_only] => 'benchmark:support' do |_, args|
|
69
67
|
require 'benchmarks/load_allocations'
|
70
68
|
Benchmarks::LoadAllocations.report(
|
71
69
|
top_x: args.top_x,
|
@@ -74,7 +72,7 @@ namespace :benchmark do
|
|
74
72
|
end
|
75
73
|
|
76
74
|
desc 'Columnar allocation counts'
|
77
|
-
task 'allocations:columnar', [
|
75
|
+
task 'allocations:columnar', [:top_x, :mime_types_only] => 'benchmark:support' do |_, args|
|
78
76
|
require 'benchmarks/load_allocations'
|
79
77
|
Benchmarks::LoadAllocations.report(
|
80
78
|
columnar: true,
|
@@ -84,7 +82,7 @@ namespace :benchmark do
|
|
84
82
|
end
|
85
83
|
|
86
84
|
desc 'Columnar allocation counts (full load)'
|
87
|
-
task 'allocations:columnar:full', [
|
85
|
+
task 'allocations:columnar:full', [:top_x, :mime_types_only] => 'benchmark:support' do |_, args|
|
88
86
|
require 'benchmarks/load_allocations'
|
89
87
|
Benchmarks::LoadAllocations.report(
|
90
88
|
columnar: true,
|
@@ -94,6 +92,36 @@ namespace :benchmark do
|
|
94
92
|
)
|
95
93
|
end
|
96
94
|
|
95
|
+
desc 'Memory profiler'
|
96
|
+
task :memory, [:top_x, :mime_types_only] => 'benchmark:support' do |_, args|
|
97
|
+
require 'benchmarks/memory_profiler'
|
98
|
+
Benchmarks::ProfileMemory.report(
|
99
|
+
mime_types_only: args.mime_types_only,
|
100
|
+
top_x: args.top_x
|
101
|
+
)
|
102
|
+
end
|
103
|
+
|
104
|
+
desc 'Columnar memory profiler'
|
105
|
+
task 'memory:columnar', [:top_x, :mime_types_only] => 'benchmark:support' do |_, args|
|
106
|
+
require 'benchmarks/memory_profiler'
|
107
|
+
Benchmarks::ProfileMemory.report(
|
108
|
+
columnar: true,
|
109
|
+
mime_types_only: args.mime_types_only,
|
110
|
+
top_x: args.top_x
|
111
|
+
)
|
112
|
+
end
|
113
|
+
|
114
|
+
desc 'Columnar allocation counts (full load)'
|
115
|
+
task 'memory:columnar:full', [:top_x, :mime_types_only] => 'benchmark:support' do |_, args|
|
116
|
+
require 'benchmarks/memory_profiler'
|
117
|
+
Benchmarks::ProfileMemory.report(
|
118
|
+
columnar: true,
|
119
|
+
full: true,
|
120
|
+
top_x: args.top_x,
|
121
|
+
mime_types_only: args.mime_types_only
|
122
|
+
)
|
123
|
+
end
|
124
|
+
|
97
125
|
desc 'Object counts'
|
98
126
|
task objects: 'benchmark:support' do
|
99
127
|
require 'benchmarks/object_counts'
|
@@ -131,7 +159,7 @@ namespace :profile do
|
|
131
159
|
'-R', 'mime/types',
|
132
160
|
'-s', 'self',
|
133
161
|
'-p', 'multi',
|
134
|
-
'-f',
|
162
|
+
'-f', output.to_s,
|
135
163
|
script.to_s
|
136
164
|
]
|
137
165
|
ruby args.join(' ')
|
@@ -194,7 +222,7 @@ namespace :convert do
|
|
194
222
|
rdoc = name
|
195
223
|
mark = "#{File.basename(name, '.rdoc')}.md"
|
196
224
|
|
197
|
-
file mark => [
|
225
|
+
file mark => [rdoc, :setup] do |t|
|
198
226
|
puts "#{rdoc} => #{mark}"
|
199
227
|
File.open(t.name, 'wb') { |target|
|
200
228
|
target.write @doc_converter.convert(IO.read(t.prerequisites.first))
|
@@ -203,7 +231,7 @@ namespace :convert do
|
|
203
231
|
|
204
232
|
CLEAN.add mark
|
205
233
|
|
206
|
-
task run: [
|
234
|
+
task run: [mark]
|
207
235
|
end
|
208
236
|
end
|
209
237
|
|
@@ -211,7 +239,7 @@ namespace :convert do
|
|
211
239
|
task docs: 'convert:docs:run'
|
212
240
|
end
|
213
241
|
|
214
|
-
task 'deps:top', [
|
242
|
+
task 'deps:top', [:number] do |_, args|
|
215
243
|
require 'net/http'
|
216
244
|
require 'json'
|
217
245
|
|
data/lib/mime/type/columnar.rb
CHANGED
@@ -20,7 +20,7 @@ class MIME::Type::Columnar < MIME::Type
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def self.column(*methods, file: nil) # :nodoc:
|
23
|
-
file
|
23
|
+
file ||= methods.first
|
24
24
|
|
25
25
|
file_method = :"load_#{file}"
|
26
26
|
methods.each do |m|
|
@@ -36,7 +36,7 @@ class MIME::Type::Columnar < MIME::Type
|
|
36
36
|
column :docs, :docs=
|
37
37
|
column :preferred_extension, :preferred_extension=
|
38
38
|
column :obsolete, :obsolete=, :obsolete?, :registered, :registered=,
|
39
|
-
|
39
|
+
:registered?, :signature, :signature=, :signature?, file: 'flags'
|
40
40
|
column :xrefs, :xrefs=, :xref_urls
|
41
41
|
column :use_instead, :use_instead=
|
42
42
|
|
data/lib/mime/type.rb
CHANGED
@@ -57,21 +57,21 @@ class MIME::Type
|
|
57
57
|
end
|
58
58
|
|
59
59
|
# The released version of the mime-types library.
|
60
|
-
VERSION = '3.
|
60
|
+
VERSION = '3.3.1'
|
61
61
|
|
62
62
|
include Comparable
|
63
63
|
|
64
64
|
# :stopdoc:
|
65
65
|
# TODO verify mime-type character restrictions; I am pretty sure that this is
|
66
66
|
# too wide open.
|
67
|
-
MEDIA_TYPE_RE = %r{([-\w.+]+)/([-\w.+]*)}
|
68
|
-
I18N_RE =
|
69
|
-
BINARY_ENCODINGS = %w(base64 8bit)
|
70
|
-
ASCII_ENCODINGS = %w(7bit quoted-printable)
|
67
|
+
MEDIA_TYPE_RE = %r{([-\w.+]+)/([-\w.+]*)}.freeze
|
68
|
+
I18N_RE = /[^[:alnum:]]/.freeze
|
69
|
+
BINARY_ENCODINGS = %w(base64 8bit).freeze
|
70
|
+
ASCII_ENCODINGS = %w(7bit quoted-printable).freeze
|
71
71
|
# :startdoc:
|
72
72
|
|
73
73
|
private_constant :MEDIA_TYPE_RE, :I18N_RE, :BINARY_ENCODINGS,
|
74
|
-
|
74
|
+
:ASCII_ENCODINGS
|
75
75
|
|
76
76
|
# Builds a MIME::Type object from the +content_type+, a MIME Content Type
|
77
77
|
# value (e.g., 'text/plain' or 'applicaton/x-eruby'). The constructed object
|
@@ -301,7 +301,7 @@ class MIME::Type
|
|
301
301
|
|
302
302
|
# Returns the default encoding for the MIME::Type based on the media type.
|
303
303
|
def default_encoding
|
304
|
-
|
304
|
+
@media_type == 'text' ? 'quoted-printable' : 'base64'
|
305
305
|
end
|
306
306
|
|
307
307
|
##
|
@@ -321,7 +321,7 @@ class MIME::Type
|
|
321
321
|
|
322
322
|
# Returns +true+ if the media type is obsolete.
|
323
323
|
attr_accessor :obsolete
|
324
|
-
|
324
|
+
alias obsolete? obsolete
|
325
325
|
|
326
326
|
# The documentation for this MIME::Type.
|
327
327
|
attr_accessor :docs
|
@@ -331,7 +331,7 @@ class MIME::Type
|
|
331
331
|
# call-seq:
|
332
332
|
# text_plain.friendly # => "Text File"
|
333
333
|
# text_plain.friendly('en') # => "Text File"
|
334
|
-
def friendly(lang = 'en'
|
334
|
+
def friendly(lang = 'en')
|
335
335
|
@friendly ||= {}
|
336
336
|
|
337
337
|
case lang
|
@@ -343,7 +343,7 @@ class MIME::Type
|
|
343
343
|
@friendly.update(lang)
|
344
344
|
else
|
345
345
|
fail ArgumentError,
|
346
|
-
|
346
|
+
"Expected a language or translation set, not #{lang.inspect}"
|
347
347
|
end
|
348
348
|
end
|
349
349
|
|
@@ -367,8 +367,8 @@ class MIME::Type
|
|
367
367
|
attr_reader :xrefs
|
368
368
|
|
369
369
|
##
|
370
|
-
def xrefs=(
|
371
|
-
@xrefs = MIME::Types::Container.new(
|
370
|
+
def xrefs=(xrefs) # :nodoc:
|
371
|
+
@xrefs = MIME::Types::Container.new(xrefs)
|
372
372
|
end
|
373
373
|
|
374
374
|
# The decoded cross-reference URL list for this MIME::Type.
|
@@ -381,7 +381,7 @@ class MIME::Type
|
|
381
381
|
|
382
382
|
# Indicates whether the MIME type has been registered with IANA.
|
383
383
|
attr_accessor :registered
|
384
|
-
|
384
|
+
alias registered? registered
|
385
385
|
|
386
386
|
# MIME types can be specified to be sent across a network in particular
|
387
387
|
# formats. This method returns +true+ when the MIME::Type encoding is set
|
@@ -399,7 +399,7 @@ class MIME::Type
|
|
399
399
|
|
400
400
|
# Indicateswhether the MIME type is declared as a signature type.
|
401
401
|
attr_accessor :signature
|
402
|
-
|
402
|
+
alias signature? signature
|
403
403
|
|
404
404
|
# Returns +true+ if the MIME::Type specifies an extension list,
|
405
405
|
# indicating that it is a complete MIME::Type.
|
@@ -438,17 +438,15 @@ class MIME::Type
|
|
438
438
|
#
|
439
439
|
# This method should be considered a private implementation detail.
|
440
440
|
def encode_with(coder)
|
441
|
-
coder['content-type']
|
442
|
-
coder['docs']
|
443
|
-
unless @friendly.nil? or @friendly.empty?
|
444
|
-
|
445
|
-
|
446
|
-
coder['encoding'] = @encoding
|
447
|
-
coder['extensions'] = @extensions.to_a unless @extensions.empty?
|
441
|
+
coder['content-type'] = @content_type
|
442
|
+
coder['docs'] = @docs unless @docs.nil? or @docs.empty?
|
443
|
+
coder['friendly'] = @friendly unless @friendly.nil? or @friendly.empty?
|
444
|
+
coder['encoding'] = @encoding
|
445
|
+
coder['extensions'] = @extensions.to_a unless @extensions.empty?
|
448
446
|
coder['preferred-extension'] = @preferred_extension if @preferred_extension
|
449
447
|
if obsolete?
|
450
|
-
coder['obsolete']
|
451
|
-
coder['use-instead']
|
448
|
+
coder['obsolete'] = obsolete?
|
449
|
+
coder['use-instead'] = use_instead if use_instead
|
452
450
|
end
|
453
451
|
unless xrefs.empty?
|
454
452
|
{}.tap do |hash|
|
@@ -458,8 +456,8 @@ class MIME::Type
|
|
458
456
|
coder['xrefs'] = hash
|
459
457
|
end
|
460
458
|
end
|
461
|
-
coder['registered']
|
462
|
-
coder['signature']
|
459
|
+
coder['registered'] = registered?
|
460
|
+
coder['signature'] = signature? if signature?
|
463
461
|
coder
|
464
462
|
end
|
465
463
|
|
@@ -504,7 +502,7 @@ class MIME::Type
|
|
504
502
|
# use with the I18n library.
|
505
503
|
def i18n_key(content_type)
|
506
504
|
simplify_matchdata(match(content_type), joiner: '.') { |e|
|
507
|
-
e.gsub!(I18N_RE, '-'
|
505
|
+
e.gsub!(I18N_RE, '-')
|
508
506
|
}
|
509
507
|
end
|
510
508
|
|
@@ -521,12 +519,12 @@ class MIME::Type
|
|
521
519
|
|
522
520
|
private
|
523
521
|
|
524
|
-
def simplify_matchdata(matchdata, remove_x = false, joiner: '/'
|
522
|
+
def simplify_matchdata(matchdata, remove_x = false, joiner: '/')
|
525
523
|
return nil unless matchdata
|
526
524
|
|
527
525
|
matchdata.captures.map { |e|
|
528
526
|
e.downcase!
|
529
|
-
e.sub!(
|
527
|
+
e.sub!(/^x-/, '') if remove_x
|
530
528
|
yield e if block_given?
|
531
529
|
e
|
532
530
|
}.join(joiner)
|
@@ -539,11 +537,28 @@ class MIME::Type
|
|
539
537
|
match = MEDIA_TYPE_RE.match(type_string)
|
540
538
|
fail InvalidContentType, type_string if match.nil?
|
541
539
|
|
542
|
-
@content_type = type_string
|
540
|
+
@content_type = intern_string(type_string)
|
543
541
|
@raw_media_type, @raw_sub_type = match.captures
|
544
|
-
@simplified = MIME::Type.simplified(match)
|
545
|
-
@i18n_key = MIME::Type.i18n_key(match)
|
542
|
+
@simplified = intern_string(MIME::Type.simplified(match))
|
543
|
+
@i18n_key = intern_string(MIME::Type.i18n_key(match))
|
546
544
|
@media_type, @sub_type = MEDIA_TYPE_RE.match(@simplified).captures
|
545
|
+
|
546
|
+
@raw_media_type = intern_string(@raw_media_type)
|
547
|
+
@raw_sub_type = intern_string(@raw_sub_type)
|
548
|
+
@media_type = intern_string(@media_type)
|
549
|
+
@sub_type = intern_string(@sub_type)
|
550
|
+
end
|
551
|
+
|
552
|
+
if String.method_defined?(:-@)
|
553
|
+
def intern_string(string)
|
554
|
+
-string
|
555
|
+
end
|
556
|
+
else
|
557
|
+
# MRI 2.2 and older don't have a method for string interning,
|
558
|
+
# so we simply freeze them for keeping a similar interface
|
559
|
+
def intern_string(string)
|
560
|
+
string.freeze
|
561
|
+
end
|
547
562
|
end
|
548
563
|
|
549
564
|
def xref_map(values, helper)
|
@@ -551,23 +566,22 @@ class MIME::Type
|
|
551
566
|
end
|
552
567
|
|
553
568
|
def xref_url_for_rfc(value)
|
554
|
-
'http://www.iana.org/go/%s'
|
569
|
+
'http://www.iana.org/go/%s' % value
|
555
570
|
end
|
556
571
|
|
557
572
|
def xref_url_for_draft(value)
|
558
|
-
'http://www.iana.org/go/%s'
|
573
|
+
'http://www.iana.org/go/%s' % value.sub(/\ARFC/, 'draft')
|
559
574
|
end
|
560
575
|
|
561
576
|
def xref_url_for_rfc_errata(value)
|
562
|
-
'http://www.rfc-editor.org/errata_search.php?eid=%s'
|
577
|
+
'http://www.rfc-editor.org/errata_search.php?eid=%s' % value
|
563
578
|
end
|
564
579
|
|
565
580
|
def xref_url_for_person(value)
|
566
|
-
'http://www.iana.org/assignments/media-types/media-types.xhtml#%s'
|
567
|
-
value
|
581
|
+
'http://www.iana.org/assignments/media-types/media-types.xhtml#%s' % value
|
568
582
|
end
|
569
583
|
|
570
584
|
def xref_url_for_template(value)
|
571
|
-
'http://www.iana.org/assignments/media-types/%s'
|
585
|
+
'http://www.iana.org/assignments/media-types/%s' % value
|
572
586
|
end
|
573
587
|
end
|
data/lib/mime/types/_columnar.rb
CHANGED
@@ -45,7 +45,7 @@ module MIME::Types::Columnar
|
|
45
45
|
i = -1
|
46
46
|
column = File.join(@__root__, "mime.#{name}.column")
|
47
47
|
|
48
|
-
IO.readlines(column, encoding: 'UTF-8'
|
48
|
+
IO.readlines(column, encoding: 'UTF-8').each do |line|
|
49
49
|
line.chomp!
|
50
50
|
|
51
51
|
if lookup
|
@@ -63,7 +63,6 @@ module MIME::Types::Columnar
|
|
63
63
|
def load_encoding
|
64
64
|
each_file_line('encoding') do |type, line|
|
65
65
|
pool ||= {}
|
66
|
-
line.freeze
|
67
66
|
type.instance_variable_set(:@encoding, (pool[line] ||= line))
|
68
67
|
end
|
69
68
|
end
|
@@ -108,11 +107,11 @@ module MIME::Types::Columnar
|
|
108
107
|
end
|
109
108
|
|
110
109
|
def dict(line, array: false)
|
111
|
-
if line == '-'
|
110
|
+
if line == '-'
|
112
111
|
{}
|
113
112
|
else
|
114
|
-
line.split('|'
|
115
|
-
k, v = l.split('^'
|
113
|
+
line.split('|').each_with_object({}) { |l, h|
|
114
|
+
k, v = l.split('^')
|
116
115
|
v = nil if v.empty?
|
117
116
|
h[k] = array ? Array(v) : v
|
118
117
|
}
|
@@ -120,18 +119,18 @@ module MIME::Types::Columnar
|
|
120
119
|
end
|
121
120
|
|
122
121
|
def arr(line)
|
123
|
-
if line == '-'
|
122
|
+
if line == '-'
|
124
123
|
[]
|
125
124
|
else
|
126
|
-
line.split('|'
|
125
|
+
line.split('|').flatten.compact.uniq
|
127
126
|
end
|
128
127
|
end
|
129
128
|
|
130
129
|
def opt(line)
|
131
|
-
line unless line == '-'
|
130
|
+
line unless line == '-'
|
132
131
|
end
|
133
132
|
|
134
133
|
def flag(line)
|
135
|
-
line == '1'
|
134
|
+
line == '1'
|
136
135
|
end
|
137
136
|
end
|
data/lib/mime/types/cache.rb
CHANGED
@@ -22,16 +22,16 @@ class << MIME::Types::Cache
|
|
22
22
|
if cache.version == MIME::Types::Data::VERSION
|
23
23
|
Marshal.load(cache.data)
|
24
24
|
else
|
25
|
-
MIME::Types.logger.warn <<-
|
25
|
+
MIME::Types.logger.warn <<-WARNING.chomp
|
26
26
|
Could not load MIME::Types cache: invalid version
|
27
|
-
|
27
|
+
WARNING
|
28
28
|
nil
|
29
29
|
end
|
30
30
|
rescue => e
|
31
|
-
MIME::Types.logger.warn <<-
|
31
|
+
MIME::Types.logger.warn <<-WARNING.chomp
|
32
32
|
Could not load MIME::Types cache: #{e}
|
33
|
-
|
34
|
-
|
33
|
+
WARNING
|
34
|
+
nil
|
35
35
|
end
|
36
36
|
|
37
37
|
# Attempts to save the types provided to the cache file provided.
|
data/lib/mime/types/container.rb
CHANGED
@@ -22,12 +22,13 @@ class MIME::Types::Container #:nodoc:
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def []=(key, value)
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
25
|
+
container[key] =
|
26
|
+
case value
|
27
|
+
when Set
|
28
|
+
value
|
29
|
+
else
|
30
|
+
Set[*value]
|
31
|
+
end
|
31
32
|
end
|
32
33
|
|
33
34
|
def merge(other)
|
@@ -37,7 +38,7 @@ class MIME::Types::Container #:nodoc:
|
|
37
38
|
def merge!(other)
|
38
39
|
tap {
|
39
40
|
other = other.kind_of?(MIME::Types::Container) ? other.container : other
|
40
|
-
|
41
|
+
container.merge!(other)
|
41
42
|
normalize
|
42
43
|
}
|
43
44
|
end
|
@@ -47,15 +48,15 @@ class MIME::Types::Container #:nodoc:
|
|
47
48
|
end
|
48
49
|
|
49
50
|
def_delegators :@container,
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
51
|
+
:==,
|
52
|
+
:count,
|
53
|
+
:each,
|
54
|
+
:each_value,
|
55
|
+
:empty?,
|
56
|
+
:flat_map,
|
57
|
+
:keys,
|
58
|
+
:select,
|
59
|
+
:values
|
59
60
|
|
60
61
|
def add(key, value)
|
61
62
|
(container[key] ||= Set.new).add(value)
|
@@ -85,6 +86,7 @@ class MIME::Types::Container #:nodoc:
|
|
85
86
|
def normalize
|
86
87
|
container.each do |k, v|
|
87
88
|
next if v.kind_of?(Set)
|
89
|
+
|
88
90
|
container[k] = Set[*v]
|
89
91
|
end
|
90
92
|
end
|
data/lib/mime/types/logger.rb
CHANGED
data/lib/mime/types/registry.rb
CHANGED
@@ -33,7 +33,7 @@ class << MIME::Types
|
|
33
33
|
def type_for(filename)
|
34
34
|
__types__.type_for(filename)
|
35
35
|
end
|
36
|
-
|
36
|
+
alias of type_for
|
37
37
|
|
38
38
|
# MIME::Types#add against the default MIME::Types registry.
|
39
39
|
def add(*types)
|
@@ -43,13 +43,13 @@ class << MIME::Types
|
|
43
43
|
private
|
44
44
|
|
45
45
|
def lazy_load?
|
46
|
-
|
47
|
-
|
46
|
+
return unless ENV.key?('RUBY_MIME_TYPES_LAZY_LOAD')
|
47
|
+
|
48
|
+
MIME::Types.logger.warn <<-WARNING.chomp
|
48
49
|
Lazy loading ($RUBY_MIME_TYPES_LAZY_LOAD) is deprecated and will be removed.
|
49
|
-
|
50
|
+
WARNING
|
50
51
|
|
51
|
-
|
52
|
-
end
|
52
|
+
(lazy = ENV['RUBY_MIME_TYPES_LAZY_LOAD']) && (lazy != 'false')
|
53
53
|
end
|
54
54
|
|
55
55
|
def __types__
|
@@ -63,7 +63,7 @@ Lazy loading ($RUBY_MIME_TYPES_LAZY_LOAD) is deprecated and will be removed.
|
|
63
63
|
end
|
64
64
|
|
65
65
|
def load_default_mime_types(mode = load_mode)
|
66
|
-
if @__types__ = MIME::Types::Cache.load
|
66
|
+
if (@__types__ = MIME::Types::Cache.load)
|
67
67
|
__instances__.add(@__types__)
|
68
68
|
else
|
69
69
|
@__types__ = MIME::Types::Loader.load(mode)
|
data/lib/mime/types.rb
CHANGED
@@ -155,7 +155,7 @@ class MIME::Types
|
|
155
155
|
a.priority_compare(b)
|
156
156
|
}
|
157
157
|
end
|
158
|
-
|
158
|
+
alias of type_for
|
159
159
|
|
160
160
|
# Add one or more MIME::Type objects to the set of known types. If the
|
161
161
|
# type is already known, a warning will be displayed.
|
@@ -185,9 +185,9 @@ class MIME::Types
|
|
185
185
|
# truthy value to suppress that warning.
|
186
186
|
def add_type(type, quiet = false)
|
187
187
|
if !quiet and @type_variants[type.simplified].include?(type)
|
188
|
-
MIME::Types.logger.warn <<-
|
188
|
+
MIME::Types.logger.warn <<-WARNING
|
189
189
|
Type #{type} is already registered as a variant of #{type.simplified}.
|
190
|
-
|
190
|
+
WARNING
|
191
191
|
end
|
192
192
|
|
193
193
|
add_type_variant!(type)
|
@@ -202,6 +202,7 @@ Type #{type} is already registered as a variant of #{type.simplified}.
|
|
202
202
|
|
203
203
|
def reindex_extensions!(mime_type)
|
204
204
|
return unless @type_variants[mime_type.simplified].include?(mime_type)
|
205
|
+
|
205
206
|
index_extensions!(mime_type)
|
206
207
|
end
|
207
208
|
|
data/test/minitest_helper.rb
CHANGED
data/test/test_mime_type.rb
CHANGED
@@ -1,13 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# -*- ruby encoding: utf-8 -*-
|
4
|
-
|
5
3
|
require 'mime/types'
|
6
4
|
require 'minitest_helper'
|
7
5
|
|
8
6
|
describe MIME::Type do
|
9
|
-
# it { fail }
|
10
|
-
|
11
7
|
def mime_type(content_type)
|
12
8
|
MIME::Type.new(content_type) { |mt| yield mt if block_given? }
|
13
9
|
end
|
@@ -50,15 +46,15 @@ describe MIME::Type do
|
|
50
46
|
|
51
47
|
it 'does not remove x- prefixes by default' do
|
52
48
|
assert_equal 'application/x-msword',
|
53
|
-
|
49
|
+
MIME::Type.simplified('application/x-msword')
|
54
50
|
assert_equal 'x-xyz/abc', MIME::Type.simplified('x-xyz/abc')
|
55
51
|
end
|
56
52
|
|
57
53
|
it 'removes x- prefixes when requested' do
|
58
54
|
assert_equal 'application/msword',
|
59
|
-
|
55
|
+
MIME::Type.simplified('application/x-msword', remove_x_prefix: true)
|
60
56
|
assert_equal 'xyz/abc',
|
61
|
-
|
57
|
+
MIME::Type.simplified('x-xyz/abc', remove_x_prefix: true)
|
62
58
|
end
|
63
59
|
|
64
60
|
it 'lowercases mixed-case types' do
|
@@ -77,7 +73,7 @@ describe MIME::Type do
|
|
77
73
|
|
78
74
|
it 'does not remove x-prefixes' do
|
79
75
|
assert_equal 'application.x-msword',
|
80
|
-
|
76
|
+
MIME::Type.i18n_key('application/x-msword')
|
81
77
|
end
|
82
78
|
|
83
79
|
it 'converts text/vCard to text.vcard' do
|
@@ -333,8 +329,8 @@ describe MIME::Type do
|
|
333
329
|
end
|
334
330
|
|
335
331
|
it 'sorts (2) based on extensions' do
|
336
|
-
text_1.extensions = [
|
337
|
-
text_2.extensions = [
|
332
|
+
text_1.extensions = ['foo', 'bar']
|
333
|
+
text_2.extensions = ['foo']
|
338
334
|
|
339
335
|
assert_priority_same text_1, text_2
|
340
336
|
|
@@ -440,12 +436,12 @@ describe MIME::Type do
|
|
440
436
|
|
441
437
|
it 'has the extensions key if set' do
|
442
438
|
assert_has_keys mime_type(t) { |v| v.extensions = 'a' }.to_h,
|
443
|
-
|
439
|
+
'extensions'
|
444
440
|
end
|
445
441
|
|
446
442
|
it 'has the preferred-extension key if set' do
|
447
443
|
assert_has_keys mime_type(t) { |v| v.preferred_extension = 'a' }.to_h,
|
448
|
-
|
444
|
+
'preferred-extension'
|
449
445
|
end
|
450
446
|
|
451
447
|
it 'has the obsolete key if set' do
|
@@ -476,7 +472,7 @@ describe MIME::Type do
|
|
476
472
|
|
477
473
|
describe '#to_s, #to_str' do
|
478
474
|
it 'represents itself as a string of the canonical content_type' do
|
479
|
-
assert_equal 'text/plain',
|
475
|
+
assert_equal 'text/plain', text_plain.to_s
|
480
476
|
end
|
481
477
|
|
482
478
|
it 'acts like a string of the canonical content_type for comparison' do
|
@@ -490,7 +486,7 @@ describe MIME::Type do
|
|
490
486
|
|
491
487
|
describe '#xrefs, #xrefs=' do
|
492
488
|
let(:expected) {
|
493
|
-
MIME::Types::Container.new(
|
489
|
+
MIME::Types::Container.new('rfc' => Set['rfc1234', 'rfc5678'])
|
494
490
|
}
|
495
491
|
|
496
492
|
it 'returns the expected results' do
|
@@ -518,13 +514,13 @@ describe MIME::Type do
|
|
518
514
|
let(:type) {
|
519
515
|
mime_type('a/b').tap do |t|
|
520
516
|
t.xrefs = {
|
521
|
-
'draft'
|
522
|
-
'template'
|
523
|
-
'person'
|
524
|
-
'rfc'
|
525
|
-
'rfc-errata' => [
|
526
|
-
'uri'
|
527
|
-
'text'
|
517
|
+
'draft' => ['RFC1'],
|
518
|
+
'template' => ['a/b'],
|
519
|
+
'person' => ['p-1'],
|
520
|
+
'rfc' => ['rfc-1'],
|
521
|
+
'rfc-errata' => ['err-1'],
|
522
|
+
'uri' => ['http://example.org'],
|
523
|
+
'text' => ['text']
|
528
524
|
}
|
529
525
|
end
|
530
526
|
}
|
@@ -588,10 +584,10 @@ describe MIME::Type do
|
|
588
584
|
|
589
585
|
it 'merges new values from an array parameter' do
|
590
586
|
expected = { 'en' => 'Text files' }
|
591
|
-
assert_equal expected, text_plain.friendly([
|
587
|
+
assert_equal expected, text_plain.friendly(['en', 'Text files'])
|
592
588
|
expected.update('fr' => 'des fichiers texte')
|
593
589
|
assert_equal expected,
|
594
|
-
|
590
|
+
text_plain.friendly(['fr', 'des fichiers texte'])
|
595
591
|
end
|
596
592
|
|
597
593
|
it 'merges new values from a hash parameter' do
|
@@ -608,7 +604,7 @@ describe MIME::Type do
|
|
608
604
|
end
|
609
605
|
|
610
606
|
assert_equal 'Expected a language or translation set, not 1',
|
611
|
-
|
607
|
+
exception.message
|
612
608
|
end
|
613
609
|
end
|
614
610
|
end
|
data/test/test_mime_types.rb
CHANGED
@@ -1,32 +1,30 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# -*- ruby encoding: utf-8 -*-
|
4
|
-
|
5
3
|
require 'mime/types'
|
6
4
|
require 'minitest_helper'
|
7
5
|
|
8
6
|
describe MIME::Types do
|
9
7
|
def mime_types
|
10
|
-
@mime_types ||= MIME::Types.new.tap
|
8
|
+
@mime_types ||= MIME::Types.new.tap { |mt|
|
11
9
|
mt.add MIME::Type.new(['text/plain', %w(txt)]),
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
10
|
+
MIME::Type.new(['image/jpeg', %w(jpg jpeg)]),
|
11
|
+
MIME::Type.new('application/x-wordperfect6.1'),
|
12
|
+
MIME::Type.new(
|
13
|
+
'content-type' => 'application/x-www-form-urlencoded',
|
14
|
+
'registered' => true
|
15
|
+
),
|
16
|
+
MIME::Type.new(['application/x-gzip', %w(gz)]),
|
17
|
+
MIME::Type.new(
|
18
|
+
'content-type' => 'application/gzip',
|
19
|
+
'extensions' => 'gz',
|
20
|
+
'registered' => true
|
21
|
+
)
|
22
|
+
}
|
25
23
|
end
|
26
24
|
|
27
25
|
describe 'is enumerable' do
|
28
26
|
it 'correctly uses an Enumerable method like #any?' do
|
29
|
-
assert
|
27
|
+
assert(mime_types.any? { |type| type.content_type == 'text/plain' })
|
30
28
|
end
|
31
29
|
|
32
30
|
it 'implements each with no parameters to return an Enumerator' do
|
@@ -95,11 +93,11 @@ describe MIME::Types do
|
|
95
93
|
|
96
94
|
describe '#add' do
|
97
95
|
let(:eruby) { MIME::Type.new('application/x-eruby') }
|
98
|
-
let(:jinja) { MIME::Type.new('application/jinja2'
|
96
|
+
let(:jinja) { MIME::Type.new('application/jinja2') }
|
99
97
|
|
100
98
|
it 'successfully adds a new type' do
|
101
99
|
mime_types.add(eruby)
|
102
|
-
assert_equal mime_types['application/x-eruby'], [
|
100
|
+
assert_equal mime_types['application/x-eruby'], [eruby]
|
103
101
|
end
|
104
102
|
|
105
103
|
it 'complains about adding a duplicate type' do
|
@@ -115,13 +113,13 @@ describe MIME::Types do
|
|
115
113
|
assert_output '', '' do
|
116
114
|
mime_types.add(eruby, :silent)
|
117
115
|
end
|
118
|
-
assert_equal mime_types['application/x-eruby'], [
|
116
|
+
assert_equal mime_types['application/x-eruby'], [eruby]
|
119
117
|
end
|
120
118
|
|
121
119
|
it 'successfully adds from an array' do
|
122
|
-
mime_types.add([
|
123
|
-
assert_equal mime_types['application/x-eruby'], [
|
124
|
-
assert_equal mime_types['application/jinja2'], [
|
120
|
+
mime_types.add([eruby, jinja])
|
121
|
+
assert_equal mime_types['application/x-eruby'], [eruby]
|
122
|
+
assert_equal mime_types['application/jinja2'], [jinja]
|
125
123
|
end
|
126
124
|
|
127
125
|
it 'successfully adds from another MIME::Types' do
|
@@ -130,7 +128,7 @@ describe MIME::Types do
|
|
130
128
|
assert_equal mime_types.count, mt.count
|
131
129
|
|
132
130
|
mime_types.each do |type|
|
133
|
-
assert_equal mt[type.content_type], [
|
131
|
+
assert_equal mt[type.content_type], [type]
|
134
132
|
end
|
135
133
|
end
|
136
134
|
end
|
@@ -138,7 +136,7 @@ describe MIME::Types do
|
|
138
136
|
describe '#type_for' do
|
139
137
|
it 'finds all types for a given extension' do
|
140
138
|
assert_equal %w(application/gzip application/x-gzip),
|
141
|
-
|
139
|
+
mime_types.type_for('gz')
|
142
140
|
end
|
143
141
|
|
144
142
|
it 'separates the extension from filenames' do
|
@@ -147,7 +145,7 @@ describe MIME::Types do
|
|
147
145
|
|
148
146
|
it 'finds multiple extensions' do
|
149
147
|
assert_equal %w(image/jpeg text/plain),
|
150
|
-
|
148
|
+
mime_types.type_for(%w(foo.txt foo.jpeg))
|
151
149
|
end
|
152
150
|
|
153
151
|
it 'does not find unknown extensions' do
|
@@ -1,7 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# -*- ruby encoding: utf-8 -*-
|
4
|
-
|
5
3
|
require 'mime/types'
|
6
4
|
require 'minitest_helper'
|
7
5
|
|
@@ -69,7 +67,7 @@ describe MIME::Types::Cache do
|
|
69
67
|
it 'outputs an error when there is a marshal file incompatibility' do
|
70
68
|
MIME::Types::Cache.save
|
71
69
|
data = File.binread(@cache_file).reverse
|
72
|
-
File.open(@cache_file, 'wb')
|
70
|
+
File.open(@cache_file, 'wb') do |f| f.write(data) end
|
73
71
|
MIME::Types.instance_variable_set(:@__types__, nil)
|
74
72
|
assert_output '', /incompatible marshal file format/ do
|
75
73
|
MIME::Types['text/html']
|
@@ -1,7 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# -*- ruby encoding: utf-8 -*-
|
4
|
-
|
5
3
|
require 'mime/types'
|
6
4
|
require 'minitest_helper'
|
7
5
|
|
@@ -12,7 +10,7 @@ describe MIME::Types, 'registry' do
|
|
12
10
|
|
13
11
|
describe 'is enumerable' do
|
14
12
|
it 'correctly uses an Enumerable method like #any?' do
|
15
|
-
assert
|
13
|
+
assert(MIME::Types.any? { |type| type.content_type == 'text/plain' })
|
16
14
|
end
|
17
15
|
|
18
16
|
it 'implements each with no parameters to return an Enumerator' do
|
@@ -45,7 +43,7 @@ describe MIME::Types, 'registry' do
|
|
45
43
|
|
46
44
|
it 'sorts by priority with multiple matches' do
|
47
45
|
types = MIME::Types[/gzip$/].select { |t|
|
48
|
-
|
46
|
+
%w(application/gzip application/x-gzip multipart/x-gzip).include?(t)
|
49
47
|
}
|
50
48
|
# This is this way because of a new type ending with gzip that only
|
51
49
|
# appears in some data files.
|
@@ -81,7 +79,7 @@ describe MIME::Types, 'registry' do
|
|
81
79
|
describe '.type_for' do
|
82
80
|
it 'finds all types for a given extension' do
|
83
81
|
assert_equal %w(application/gzip application/x-gzip),
|
84
|
-
|
82
|
+
MIME::Types.type_for('gz')
|
85
83
|
end
|
86
84
|
|
87
85
|
it 'separates the extension from filenames' do
|
@@ -90,7 +88,7 @@ describe MIME::Types, 'registry' do
|
|
90
88
|
|
91
89
|
it 'finds multiple extensions' do
|
92
90
|
assert_equal %w(image/jpeg text/plain),
|
93
|
-
|
91
|
+
MIME::Types.type_for(%w(foo.txt foo.jpeg))
|
94
92
|
end
|
95
93
|
|
96
94
|
it 'does not find unknown extensions' do
|
@@ -117,11 +115,11 @@ describe MIME::Types, 'registry' do
|
|
117
115
|
end
|
118
116
|
|
119
117
|
let(:eruby) { MIME::Type.new('application/x-eruby') }
|
120
|
-
let(:jinja) { MIME::Type.new('application/jinja2'
|
118
|
+
let(:jinja) { MIME::Type.new('application/jinja2') }
|
121
119
|
|
122
120
|
it 'successfully adds a new type' do
|
123
121
|
MIME::Types.add(eruby)
|
124
|
-
assert_equal MIME::Types['application/x-eruby'], [
|
122
|
+
assert_equal MIME::Types['application/x-eruby'], [eruby]
|
125
123
|
end
|
126
124
|
|
127
125
|
it 'complains about adding a duplicate type' do
|
@@ -137,13 +135,13 @@ describe MIME::Types, 'registry' do
|
|
137
135
|
assert_silent do
|
138
136
|
MIME::Types.add(eruby, :silent)
|
139
137
|
end
|
140
|
-
assert_equal MIME::Types['application/x-eruby'], [
|
138
|
+
assert_equal MIME::Types['application/x-eruby'], [eruby]
|
141
139
|
end
|
142
140
|
|
143
141
|
it 'successfully adds from an array' do
|
144
|
-
MIME::Types.add([
|
145
|
-
assert_equal MIME::Types['application/x-eruby'], [
|
146
|
-
assert_equal MIME::Types['application/jinja2'], [
|
142
|
+
MIME::Types.add([eruby, jinja])
|
143
|
+
assert_equal MIME::Types['application/x-eruby'], [eruby]
|
144
|
+
assert_equal MIME::Types['application/jinja2'], [jinja]
|
147
145
|
end
|
148
146
|
|
149
147
|
it 'successfully adds from another MIME::Types' do
|
@@ -155,7 +153,7 @@ describe MIME::Types, 'registry' do
|
|
155
153
|
MIME::Types.add(mt)
|
156
154
|
assert_equal old_count + 1, MIME::Types.count
|
157
155
|
|
158
|
-
assert_equal MIME::Types[eruby.content_type], [
|
156
|
+
assert_equal MIME::Types[eruby.content_type], [eruby]
|
159
157
|
end
|
160
158
|
end
|
161
159
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mime-types
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Austin Ziegler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-12-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mime-types-data
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '5.
|
33
|
+
version: '5.13'
|
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: '5.
|
40
|
+
version: '5.13'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: hoe-doofus
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -235,7 +235,7 @@ dependencies:
|
|
235
235
|
version: '4.0'
|
236
236
|
- - "<"
|
237
237
|
- !ruby/object:Gem::Version
|
238
|
-
version: '
|
238
|
+
version: '7'
|
239
239
|
type: :development
|
240
240
|
prerelease: false
|
241
241
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -245,21 +245,21 @@ dependencies:
|
|
245
245
|
version: '4.0'
|
246
246
|
- - "<"
|
247
247
|
- !ruby/object:Gem::Version
|
248
|
-
version: '
|
248
|
+
version: '7'
|
249
249
|
- !ruby/object:Gem::Dependency
|
250
250
|
name: hoe
|
251
251
|
requirement: !ruby/object:Gem::Requirement
|
252
252
|
requirements:
|
253
253
|
- - "~>"
|
254
254
|
- !ruby/object:Gem::Version
|
255
|
-
version: '3.
|
255
|
+
version: '3.20'
|
256
256
|
type: :development
|
257
257
|
prerelease: false
|
258
258
|
version_requirements: !ruby/object:Gem::Requirement
|
259
259
|
requirements:
|
260
260
|
- - "~>"
|
261
261
|
- !ruby/object:Gem::Version
|
262
|
-
version: '3.
|
262
|
+
version: '3.20'
|
263
263
|
description: |-
|
264
264
|
The mime-types library provides a library and registry for information about
|
265
265
|
MIME content type definitions. It can be used to determine defined filename
|
@@ -319,7 +319,11 @@ files:
|
|
319
319
|
homepage: https://github.com/mime-types/ruby-mime-types/
|
320
320
|
licenses:
|
321
321
|
- MIT
|
322
|
-
metadata:
|
322
|
+
metadata:
|
323
|
+
homepage_uri: https://github.com/mime-types/ruby-mime-types/
|
324
|
+
source_code_uri: https://github.com/mime-types/ruby-mime-types/
|
325
|
+
bug_tracker_uri: https://github.com/mime-types/ruby-mime-types/issues
|
326
|
+
changelog_uri: https://github.com/mime-types/ruby-mime-types/blob/master/History.md
|
323
327
|
post_install_message:
|
324
328
|
rdoc_options:
|
325
329
|
- "--main"
|
@@ -337,8 +341,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
337
341
|
- !ruby/object:Gem::Version
|
338
342
|
version: '0'
|
339
343
|
requirements: []
|
340
|
-
|
341
|
-
rubygems_version: 2.7.7
|
344
|
+
rubygems_version: 3.0.3
|
342
345
|
signing_key:
|
343
346
|
specification_version: 4
|
344
347
|
summary: The mime-types library provides a library and registry for information about
|