mime-types 3.3.1 → 3.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Code-of-Conduct.md +10 -10
- data/Contributing.md +82 -93
- data/History.md +167 -138
- data/Licence.md +3 -3
- data/README.rdoc +1 -0
- data/Rakefile +131 -145
- data/lib/mime/type/columnar.rb +3 -3
- data/lib/mime/type.rb +141 -94
- data/lib/mime/types/_columnar.rb +20 -19
- data/lib/mime/types/cache.rb +8 -8
- data/lib/mime/types/columnar.rb +1 -1
- data/lib/mime/types/container.rb +14 -14
- data/lib/mime/types/deprecations.rb +15 -11
- data/lib/mime/types/full.rb +2 -2
- data/lib/mime/types/loader.rb +28 -15
- data/lib/mime/types/logger.rb +3 -5
- data/lib/mime/types/registry.rb +7 -7
- data/lib/mime/types.rb +18 -16
- data/lib/mime-types.rb +1 -1
- data/test/minitest_helper.rb +7 -9
- data/test/test_mime_type.rb +272 -261
- data/test/test_mime_types.rb +72 -72
- data/test/test_mime_types_cache.rb +38 -38
- data/test/test_mime_types_class.rb +59 -59
- data/test/test_mime_types_lazy.rb +16 -16
- data/test/test_mime_types_loader.rb +14 -14
- metadata +15 -43
@@ -1,16 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require "mime/types"
|
4
|
+
require "minitest_helper"
|
5
5
|
|
6
|
-
describe MIME::Types,
|
6
|
+
describe MIME::Types, "lazy loading" do
|
7
7
|
def setup
|
8
|
-
ENV[
|
8
|
+
ENV["RUBY_MIME_TYPES_LAZY_LOAD"] = "true"
|
9
9
|
end
|
10
10
|
|
11
11
|
def teardown
|
12
12
|
reset_mime_types
|
13
|
-
ENV.delete(
|
13
|
+
ENV.delete("RUBY_MIME_TYPES_LAZY_LOAD")
|
14
14
|
end
|
15
15
|
|
16
16
|
def reset_mime_types
|
@@ -18,32 +18,32 @@ describe MIME::Types, 'lazy loading' do
|
|
18
18
|
MIME::Types.send(:load_default_mime_types)
|
19
19
|
end
|
20
20
|
|
21
|
-
describe
|
22
|
-
it
|
23
|
-
assert_output
|
21
|
+
describe ".lazy_load?" do
|
22
|
+
it "is true when RUBY_MIME_TYPES_LAZY_LOAD is set" do
|
23
|
+
assert_output "", /RUBY_MIME_TYPES_LAZY_LOAD/ do
|
24
24
|
assert_equal true, MIME::Types.send(:lazy_load?)
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
it
|
29
|
-
ENV[
|
30
|
-
assert_output
|
28
|
+
it "is nil when RUBY_MIME_TYPES_LAZY_LOAD is unset" do
|
29
|
+
ENV["RUBY_MIME_TYPES_LAZY_LOAD"] = nil
|
30
|
+
assert_output "", "" do
|
31
31
|
assert_nil MIME::Types.send(:lazy_load?)
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
-
it
|
36
|
-
ENV[
|
37
|
-
assert_output
|
35
|
+
it "is false when RUBY_MIME_TYPES_LAZY_LOAD is false" do
|
36
|
+
ENV["RUBY_MIME_TYPES_LAZY_LOAD"] = "false"
|
37
|
+
assert_output "", /RUBY_MIME_TYPES_LAZY_LOAD/ do
|
38
38
|
assert_equal false, MIME::Types.send(:lazy_load?)
|
39
39
|
end
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
-
it
|
43
|
+
it "loads lazily when RUBY_MIME_TYPES_LAZY_LOAD is set" do
|
44
44
|
MIME::Types.instance_variable_set(:@__types__, nil)
|
45
45
|
assert_nil MIME::Types.instance_variable_get(:@__types__)
|
46
|
-
refute_nil MIME::Types[
|
46
|
+
refute_nil MIME::Types["text/html"].first
|
47
47
|
refute_nil MIME::Types.instance_variable_get(:@__types__)
|
48
48
|
end
|
49
49
|
end
|
@@ -1,32 +1,32 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require "mime/types"
|
4
|
+
require "minitest_helper"
|
5
5
|
|
6
6
|
describe MIME::Types::Loader do
|
7
7
|
def setup
|
8
|
-
@path
|
9
|
-
@loader
|
10
|
-
@bad_path = File.expand_path(
|
8
|
+
@path = File.expand_path("../fixture", __FILE__)
|
9
|
+
@loader = MIME::Types::Loader.new(@path)
|
10
|
+
@bad_path = File.expand_path("../bad-fixtures", __FILE__)
|
11
11
|
end
|
12
12
|
|
13
13
|
def assert_correctly_loaded(types)
|
14
|
-
assert_includes(types,
|
15
|
-
assert_equal(%w
|
16
|
-
refute(types[
|
14
|
+
assert_includes(types, "application/1d-interleaved-parityfec")
|
15
|
+
assert_equal(%w[webm], types["audio/webm"].first.extensions)
|
16
|
+
refute(types["audio/webm"].first.registered?)
|
17
17
|
|
18
|
-
assert_equal(
|
19
|
-
|
18
|
+
assert_equal("Fixes a bug with IE6 and progressive JPEGs",
|
19
|
+
types["image/pjpeg"].first.docs)
|
20
20
|
|
21
|
-
assert(types[
|
22
|
-
assert_equal(
|
21
|
+
assert(types["audio/vnd.qcelp"].first.obsolete?)
|
22
|
+
assert_equal("audio/QCELP", types["audio/vnd.qcelp"].first.use_instead)
|
23
23
|
end
|
24
24
|
|
25
|
-
it
|
25
|
+
it "loads YAML files correctly" do
|
26
26
|
assert_correctly_loaded @loader.load_yaml
|
27
27
|
end
|
28
28
|
|
29
|
-
it
|
29
|
+
it "loads JSON files correctly" do
|
30
30
|
assert_correctly_loaded @loader.load_json
|
31
31
|
end
|
32
32
|
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.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Austin Ziegler
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-11-16 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.14'
|
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.14'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: hoe-doofus
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -95,19 +95,19 @@ dependencies:
|
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '1.0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: standard
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '1.
|
103
|
+
version: '1.0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '1.
|
110
|
+
version: '1.0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: minitest-autotest
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -173,7 +173,7 @@ dependencies:
|
|
173
173
|
version: '10.0'
|
174
174
|
- - "<"
|
175
175
|
- !ruby/object:Gem::Version
|
176
|
-
version: '
|
176
|
+
version: '14.0'
|
177
177
|
type: :development
|
178
178
|
prerelease: false
|
179
179
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -183,35 +183,7 @@ dependencies:
|
|
183
183
|
version: '10.0'
|
184
184
|
- - "<"
|
185
185
|
- !ruby/object:Gem::Version
|
186
|
-
version: '
|
187
|
-
- !ruby/object:Gem::Dependency
|
188
|
-
name: fivemat
|
189
|
-
requirement: !ruby/object:Gem::Requirement
|
190
|
-
requirements:
|
191
|
-
- - "~>"
|
192
|
-
- !ruby/object:Gem::Version
|
193
|
-
version: '1.3'
|
194
|
-
type: :development
|
195
|
-
prerelease: false
|
196
|
-
version_requirements: !ruby/object:Gem::Requirement
|
197
|
-
requirements:
|
198
|
-
- - "~>"
|
199
|
-
- !ruby/object:Gem::Version
|
200
|
-
version: '1.3'
|
201
|
-
- !ruby/object:Gem::Dependency
|
202
|
-
name: minitest-rg
|
203
|
-
requirement: !ruby/object:Gem::Requirement
|
204
|
-
requirements:
|
205
|
-
- - "~>"
|
206
|
-
- !ruby/object:Gem::Version
|
207
|
-
version: '5.2'
|
208
|
-
type: :development
|
209
|
-
prerelease: false
|
210
|
-
version_requirements: !ruby/object:Gem::Requirement
|
211
|
-
requirements:
|
212
|
-
- - "~>"
|
213
|
-
- !ruby/object:Gem::Version
|
214
|
-
version: '5.2'
|
186
|
+
version: '14.0'
|
215
187
|
- !ruby/object:Gem::Dependency
|
216
188
|
name: simplecov
|
217
189
|
requirement: !ruby/object:Gem::Requirement
|
@@ -252,14 +224,14 @@ dependencies:
|
|
252
224
|
requirements:
|
253
225
|
- - "~>"
|
254
226
|
- !ruby/object:Gem::Version
|
255
|
-
version: '3.
|
227
|
+
version: '3.23'
|
256
228
|
type: :development
|
257
229
|
prerelease: false
|
258
230
|
version_requirements: !ruby/object:Gem::Requirement
|
259
231
|
requirements:
|
260
232
|
- - "~>"
|
261
233
|
- !ruby/object:Gem::Version
|
262
|
-
version: '3.
|
234
|
+
version: '3.23'
|
263
235
|
description: |-
|
264
236
|
The mime-types library provides a library and registry for information about
|
265
237
|
MIME content type definitions. It can be used to determine defined filename
|
@@ -324,7 +296,7 @@ metadata:
|
|
324
296
|
source_code_uri: https://github.com/mime-types/ruby-mime-types/
|
325
297
|
bug_tracker_uri: https://github.com/mime-types/ruby-mime-types/issues
|
326
298
|
changelog_uri: https://github.com/mime-types/ruby-mime-types/blob/master/History.md
|
327
|
-
post_install_message:
|
299
|
+
post_install_message:
|
328
300
|
rdoc_options:
|
329
301
|
- "--main"
|
330
302
|
- README.rdoc
|
@@ -341,8 +313,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
341
313
|
- !ruby/object:Gem::Version
|
342
314
|
version: '0'
|
343
315
|
requirements: []
|
344
|
-
rubygems_version: 3.
|
345
|
-
signing_key:
|
316
|
+
rubygems_version: 3.1.6
|
317
|
+
signing_key:
|
346
318
|
specification_version: 4
|
347
319
|
summary: The mime-types library provides a library and registry for information about
|
348
320
|
MIME content type definitions
|