mime-types 3.5.2 → 3.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -31,7 +31,7 @@ describe MIME::Types, "registry" do
31
31
 
32
32
  describe ".[]" do
33
33
  it "can be searched with a MIME::Type" do
34
- text_plain = MIME::Type.new("text/plain")
34
+ text_plain = MIME::Type.new("content-type" => "text/plain")
35
35
  assert_includes MIME::Types[text_plain], "text/plain"
36
36
  assert_equal 1, MIME::Types[text_plain].size
37
37
  end
@@ -47,7 +47,7 @@ describe MIME::Types, "registry" do
47
47
  }
48
48
  # This is this way because of a new type ending with gzip that only
49
49
  # appears in some data files.
50
- assert_equal %w[application/gzip application/x-gzip multipart/x-gzip], types
50
+ assert_equal %w[application/gzip multipart/x-gzip application/x-gzip], types
51
51
  assert_equal 3, types.size
52
52
  end
53
53
 
@@ -86,9 +86,11 @@ describe MIME::Types, "registry" do
86
86
  assert_equal %w[image/jpeg], MIME::Types.of(["foo.jpeg", "bar.jpeg"])
87
87
  end
88
88
 
89
- it "finds multiple extensions" do
90
- assert_equal %w[image/jpeg text/plain],
91
- MIME::Types.type_for(%w[foo.txt foo.jpeg])
89
+ it "finds multiple extensions ordered by the filename list" do
90
+ result = MIME::Types.type_for(%w[foo.txt foo.jpeg])
91
+
92
+ # assert_equal %w[text/plain image/jpeg], MIME::Types.type_for(%w[foo.txt foo.jpeg])
93
+ assert_equal %w[text/plain image/jpeg], result
92
94
  end
93
95
 
94
96
  it "does not find unknown extensions" do
@@ -105,6 +107,10 @@ describe MIME::Types, "registry" do
105
107
  assert_includes MIME::Types.type_for("test.pdf\n.txt"), "text/plain"
106
108
  assert_includes MIME::Types.type_for("test.txt\n.pdf"), "application/pdf"
107
109
  end
110
+
111
+ it "returns a stable order for types with equal priority" do
112
+ assert_equal %w[text/x-vcalendar text/x-vcard], MIME::Types[/text\/x-vca/]
113
+ end
108
114
  end
109
115
 
110
116
  describe ".count" do
@@ -119,8 +125,8 @@ describe MIME::Types, "registry" do
119
125
  MIME::Types.send(:load_default_mime_types)
120
126
  end
121
127
 
122
- let(:eruby) { MIME::Type.new("application/x-eruby") }
123
- let(:jinja) { MIME::Type.new("application/jinja2") }
128
+ let(:eruby) { MIME::Type.new("content-type" => "application/x-eruby") }
129
+ let(:jinja) { MIME::Type.new("content-type" => "application/jinja2") }
124
130
 
125
131
  it "successfully adds a new type" do
126
132
  MIME::Types.add(eruby)
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mime-types
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.5.2
4
+ version: 3.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Austin Ziegler
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-01-02 00:00:00.000000000 Z
10
+ date: 2025-05-07 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: mime-types-data
@@ -16,104 +15,90 @@ dependencies:
16
15
  requirements:
17
16
  - - "~>"
18
17
  - !ruby/object:Gem::Version
19
- version: '3.2015'
18
+ version: '3.2025'
19
+ - - ">="
20
+ - !ruby/object:Gem::Version
21
+ version: 3.2025.0507
20
22
  type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
23
25
  requirements:
24
26
  - - "~>"
25
27
  - !ruby/object:Gem::Version
26
- version: '3.2015'
27
- - !ruby/object:Gem::Dependency
28
- name: minitest
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '5.20'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
28
+ version: '3.2025'
29
+ - - ">="
39
30
  - !ruby/object:Gem::Version
40
- version: '5.20'
31
+ version: 3.2025.0507
41
32
  - !ruby/object:Gem::Dependency
42
- name: hoe
33
+ name: logger
43
34
  requirement: !ruby/object:Gem::Requirement
44
35
  requirements:
45
36
  - - ">="
46
37
  - !ruby/object:Gem::Version
47
- version: '3.0'
48
- - - "<"
49
- - !ruby/object:Gem::Version
50
- version: '5'
51
- type: :development
38
+ version: '0'
39
+ type: :runtime
52
40
  prerelease: false
53
41
  version_requirements: !ruby/object:Gem::Requirement
54
42
  requirements:
55
43
  - - ">="
56
44
  - !ruby/object:Gem::Version
57
- version: '3.0'
58
- - - "<"
59
- - !ruby/object:Gem::Version
60
- version: '5'
45
+ version: '0'
61
46
  - !ruby/object:Gem::Dependency
62
- name: hoe-doofus
47
+ name: hoe
63
48
  requirement: !ruby/object:Gem::Requirement
64
49
  requirements:
65
50
  - - "~>"
66
51
  - !ruby/object:Gem::Version
67
- version: '1.0'
52
+ version: '4.0'
68
53
  type: :development
69
54
  prerelease: false
70
55
  version_requirements: !ruby/object:Gem::Requirement
71
56
  requirements:
72
57
  - - "~>"
73
58
  - !ruby/object:Gem::Version
74
- version: '1.0'
59
+ version: '4.0'
75
60
  - !ruby/object:Gem::Dependency
76
- name: hoe-gemspec2
61
+ name: hoe-halostatue
77
62
  requirement: !ruby/object:Gem::Requirement
78
63
  requirements:
79
64
  - - "~>"
80
65
  - !ruby/object:Gem::Version
81
- version: '1.1'
66
+ version: '2.0'
82
67
  type: :development
83
68
  prerelease: false
84
69
  version_requirements: !ruby/object:Gem::Requirement
85
70
  requirements:
86
71
  - - "~>"
87
72
  - !ruby/object:Gem::Version
88
- version: '1.1'
73
+ version: '2.0'
89
74
  - !ruby/object:Gem::Dependency
90
- name: hoe-git2
75
+ name: hoe-rubygems
91
76
  requirement: !ruby/object:Gem::Requirement
92
77
  requirements:
93
78
  - - "~>"
94
79
  - !ruby/object:Gem::Version
95
- version: '1.7'
80
+ version: '1.0'
96
81
  type: :development
97
82
  prerelease: false
98
83
  version_requirements: !ruby/object:Gem::Requirement
99
84
  requirements:
100
85
  - - "~>"
101
86
  - !ruby/object:Gem::Version
102
- version: '1.7'
87
+ version: '1.0'
103
88
  - !ruby/object:Gem::Dependency
104
- name: hoe-rubygems
89
+ name: minitest
105
90
  requirement: !ruby/object:Gem::Requirement
106
91
  requirements:
107
92
  - - "~>"
108
93
  - !ruby/object:Gem::Version
109
- version: '1.0'
94
+ version: '5.0'
110
95
  type: :development
111
96
  prerelease: false
112
97
  version_requirements: !ruby/object:Gem::Requirement
113
98
  requirements:
114
99
  - - "~>"
115
100
  - !ruby/object:Gem::Version
116
- version: '1.0'
101
+ version: '5.0'
117
102
  - !ruby/object:Gem::Dependency
118
103
  name: minitest-autotest
119
104
  requirement: !ruby/object:Gem::Requirement
@@ -165,7 +150,7 @@ dependencies:
165
150
  version: '10.0'
166
151
  - - "<"
167
152
  - !ruby/object:Gem::Version
168
- version: '14.0'
153
+ version: '14'
169
154
  type: :development
170
155
  prerelease: false
171
156
  version_requirements: !ruby/object:Gem::Requirement
@@ -175,55 +160,35 @@ dependencies:
175
160
  version: '10.0'
176
161
  - - "<"
177
162
  - !ruby/object:Gem::Version
178
- version: '14.0'
179
- - !ruby/object:Gem::Dependency
180
- name: standard
181
- requirement: !ruby/object:Gem::Requirement
182
- requirements:
183
- - - "~>"
184
- - !ruby/object:Gem::Version
185
- version: '1.0'
186
- type: :development
187
- prerelease: false
188
- version_requirements: !ruby/object:Gem::Requirement
189
- requirements:
190
- - - "~>"
191
- - !ruby/object:Gem::Version
192
- version: '1.0'
163
+ version: '14'
193
164
  - !ruby/object:Gem::Dependency
194
165
  name: rdoc
195
166
  requirement: !ruby/object:Gem::Requirement
196
167
  requirements:
197
168
  - - ">="
198
169
  - !ruby/object:Gem::Version
199
- version: '4.0'
200
- - - "<"
201
- - !ruby/object:Gem::Version
202
- version: '7'
170
+ version: '0.0'
203
171
  type: :development
204
172
  prerelease: false
205
173
  version_requirements: !ruby/object:Gem::Requirement
206
174
  requirements:
207
175
  - - ">="
208
176
  - !ruby/object:Gem::Version
209
- version: '4.0'
210
- - - "<"
211
- - !ruby/object:Gem::Version
212
- version: '7'
177
+ version: '0.0'
213
178
  - !ruby/object:Gem::Dependency
214
- name: simplecov
179
+ name: standard
215
180
  requirement: !ruby/object:Gem::Requirement
216
181
  requirements:
217
182
  - - "~>"
218
183
  - !ruby/object:Gem::Version
219
- version: '0.21'
184
+ version: '1.0'
220
185
  type: :development
221
186
  prerelease: false
222
187
  version_requirements: !ruby/object:Gem::Requirement
223
188
  requirements:
224
189
  - - "~>"
225
190
  - !ruby/object:Gem::Version
226
- version: '0.21'
191
+ version: '1.0'
227
192
  description: |-
228
193
  The mime-types library provides a library and registry for information about
229
194
  MIME content type definitions. It can be used to determine defined filename
@@ -233,30 +198,32 @@ description: |-
233
198
  Version 3.0 is a major release that requires Ruby 2.0 compatibility and removes
234
199
  deprecated functions. The columnar registry format introduced in 2.6 has been
235
200
  made the primary format; the registry data has been extracted from this library
236
- and put into {mime-types-data}[https://github.com/mime-types/mime-types-data].
237
- Additionally, mime-types is now licensed exclusively under the MIT licence and
238
- there is a code of conduct in effect. There are a number of other smaller
239
- changes described in the History file.
201
+ and put into [mime-types-data][data]. Additionally, mime-types is now licensed
202
+ exclusively under the MIT licence and there is a code of conduct in effect.
203
+ There are a number of other smaller changes described in the History file.
240
204
  email:
241
205
  - halostatue@gmail.com
242
206
  executables: []
243
207
  extensions: []
244
208
  extra_rdoc_files:
245
- - Code-of-Conduct.md
246
- - Contributing.md
247
- - History.md
248
- - Licence.md
209
+ - CHANGELOG.md
210
+ - CODE_OF_CONDUCT.md
211
+ - CONTRIBUTING.md
212
+ - CONTRIBUTORS.md
213
+ - LICENCE.md
249
214
  - Manifest.txt
250
- - README.rdoc
215
+ - README.md
216
+ - SECURITY.md
251
217
  files:
252
- - ".standard.yml"
253
- - Code-of-Conduct.md
254
- - Contributing.md
255
- - History.md
256
- - Licence.md
218
+ - CHANGELOG.md
219
+ - CODE_OF_CONDUCT.md
220
+ - CONTRIBUTING.md
221
+ - CONTRIBUTORS.md
222
+ - LICENCE.md
257
223
  - Manifest.txt
258
- - README.rdoc
224
+ - README.md
259
225
  - Rakefile
226
+ - SECURITY.md
260
227
  - lib/mime-types.rb
261
228
  - lib/mime/type.rb
262
229
  - lib/mime/type/columnar.rb
@@ -270,6 +237,7 @@ files:
270
237
  - lib/mime/types/loader.rb
271
238
  - lib/mime/types/logger.rb
272
239
  - lib/mime/types/registry.rb
240
+ - lib/mime/types/version.rb
273
241
  - test/bad-fixtures/malformed
274
242
  - test/fixture/json.json
275
243
  - test/fixture/old-data
@@ -286,14 +254,13 @@ licenses:
286
254
  - MIT
287
255
  metadata:
288
256
  homepage_uri: https://github.com/mime-types/ruby-mime-types/
289
- source_code_uri: https://github.com/mime-types/ruby-mime-types/
290
257
  bug_tracker_uri: https://github.com/mime-types/ruby-mime-types/issues
291
- changelog_uri: https://github.com/mime-types/ruby-mime-types/blob/master/History.md
258
+ source_code_uri: https://github.com/mime-types/ruby-mime-types/
259
+ changelog_uri: https://github.com/mime-types/ruby-mime-types/blob/main/CHANGELOG.md
292
260
  rubygems_mfa_required: 'true'
293
- post_install_message:
294
261
  rdoc_options:
295
262
  - "--main"
296
- - README.rdoc
263
+ - README.md
297
264
  require_paths:
298
265
  - lib
299
266
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -307,8 +274,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
307
274
  - !ruby/object:Gem::Version
308
275
  version: '0'
309
276
  requirements: []
310
- rubygems_version: 3.5.3
311
- signing_key:
277
+ rubygems_version: 3.6.6
312
278
  specification_version: 4
313
279
  summary: The mime-types library provides a library and registry for information about
314
280
  MIME content type definitions
data/.standard.yml DELETED
@@ -1,4 +0,0 @@
1
- parallel: true
2
- ruby_version: 2.3
3
- ignore:
4
- - 'mime-types.gemspec'
data/Code-of-Conduct.md DELETED
@@ -1,73 +0,0 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- In the interest of fostering an open and welcoming environment, we as
6
- contributors and maintainers pledge to making participation in our project and
7
- our community a harassment-free experience for everyone, regardless of age, body
8
- size, disability, ethnicity, sex characteristics, gender identity and expression,
9
- level of experience, education, socio-economic status, nationality, personal
10
- appearance, race, religion, or sexual identity and orientation.
11
-
12
- ## Our Standards
13
-
14
- Examples of behavior that contributes to creating a positive environment
15
- include:
16
-
17
- - Using welcoming and inclusive language
18
- - Being respectful of differing viewpoints and experiences
19
- - Gracefully accepting constructive criticism
20
- - Focusing on what is best for the community
21
- - Showing empathy towards other community members
22
-
23
- Examples of unacceptable behavior by participants include:
24
-
25
- - The use of sexualized language or imagery and unwelcome sexual attention or
26
- advances
27
- - Trolling, insulting/derogatory comments, and personal or political attacks
28
- - Public or private harassment
29
- - Publishing others' private information, such as a physical or electronic
30
- address, without explicit permission
31
- - Other conduct which could reasonably be considered inappropriate in a
32
- professional setting
33
-
34
- ## Our Responsibilities
35
-
36
- Project maintainers are responsible for clarifying the standards of acceptable
37
- behavior and are expected to take appropriate and fair corrective action in
38
- response to any instances of unacceptable behavior.
39
-
40
- Project maintainers have the right and responsibility to remove, edit, or
41
- reject comments, commits, code, wiki edits, issues, and other contributions
42
- that are not aligned to this Code of Conduct, or to ban temporarily or
43
- permanently any contributor for other behaviors that they deem inappropriate,
44
- threatening, offensive, or harmful.
45
-
46
- ## Scope
47
-
48
- This Code of Conduct applies both within project spaces and in public spaces
49
- when an individual is representing the project or its community. Examples of
50
- representing a project or community include using an official project e-mail
51
- address, posting via an official social media account, or acting as an appointed
52
- representative at an online or offline event. Representation of a project may be
53
- further defined and clarified by project maintainers.
54
-
55
- ## Enforcement
56
-
57
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at [INSERT EMAIL ADDRESS]. All
59
- complaints will be reviewed and investigated and will result in a response that
60
- is deemed necessary and appropriate to the circumstances. The project team is
61
- obligated to maintain confidentiality with regard to the reporter of an incident.
62
- Further details of specific enforcement policies may be posted separately.
63
-
64
- Project maintainers who do not follow or enforce the Code of Conduct in good
65
- faith may face temporary or permanent repercussions as determined by other
66
- members of the project's leadership.
67
-
68
- ## Attribution
69
-
70
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
- available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72
-
73
- [homepage]: https://www.contributor-covenant.org
data/Contributing.md DELETED
@@ -1,133 +0,0 @@
1
- # Contributing
2
-
3
- I value any contribution to mime-types you can provide: a bug report, a feature
4
- request, or code contributions.
5
-
6
- There are a few guidelines for contributing to mime-types:
7
-
8
- - Code changes _will_ _not_ be accepted without tests. The test suite is
9
- written with [minitest][].
10
- - Match my coding style.
11
- - Use a thoughtfully-named topic branch that contains your change. Rebase your
12
- commits into logical chunks as necessary.
13
- - Use [quality commit messages][].
14
- - Do not change the version number; when your patch is accepted and a release
15
- is made, the version will be updated at that point.
16
- - Submit a GitHub pull request with your changes.
17
- - New or changed behaviours require new or updated documentation.
18
-
19
- ## Adding or Modifying MIME Types
20
-
21
- The mime-types registry is no longer contained in mime-types, but in
22
- [mime-types-data][]. Please see that project for contributions there.
23
-
24
- ### Test Dependencies
25
-
26
- mime-types uses Ryan Davis’s [Hoe][] to manage the release process, and it adds
27
- a number of rake tasks. You will mostly be interested in `rake`, which runs the
28
- tests the same way that `rake test` will do.
29
-
30
- To assist with the installation of the development dependencies for
31
- mime-types, I have provided the simplest possible Gemfile pointing to the
32
- (generated) `mime-types.gemspec` file. This will permit you to do `bundle install` to get the development dependencies. If you already have `hoe`
33
- installed, you can accomplish the same thing with `rake newb`.
34
-
35
- This task will install any missing dependencies, run the tests/specs, and
36
- generate the RDoc.
37
-
38
- You can run tests with code coverage analysis by running `rake test:coverage`.
39
-
40
- ## Benchmarks
41
-
42
- mime-types offers several benchmark tasks to measure different measures of
43
- performance.
44
-
45
- There is a repeated load test, measuring how long it takes to start and load
46
- mime-types with its full registry. By default, it runs fifty loops and uses the
47
- built-in benchmark library:
48
-
49
- - `rake benchmark:load`
50
-
51
- There are two allocation tracing benchmarks (for normal and columnar loads).
52
- These can only be run on Ruby 2.1 or better and requires the
53
- [allocation\_tracer][] gem (not installed by default).
54
-
55
- - `rake benchmark:allocations`
56
- - `rake benchmark:allocations:columnar`
57
-
58
- There are two loaded object count benchmarks (for normal and columnar loads).
59
- These use `ObjectSpace.count_objects`.
60
-
61
- - `rake benchmark:objects`
62
- - `rake benchmark:objects:columnar`
63
-
64
- ## Workflow
65
-
66
- Here's the most direct way to get your work merged into the project:
67
-
68
- - Fork the project.
69
- - Clone down your fork (`git clone git://github.com/<username>/ruby-mime-types.git`).
70
- - Create a topic branch to contain your change (`git checkout -b my_awesome_feature`).
71
- - Hack away, add tests. Not necessarily in that order.
72
- - Make sure everything still passes by running `rake`.
73
- - If necessary, rebase your commits into logical chunks, without errors.
74
- - Push the branch up (`git push origin my_awesome_feature`).
75
- - Create a pull request against mime-types/ruby-mime-types and describe what
76
- your change does and the why you think it should be merged.
77
-
78
- ## Contributors
79
-
80
- - Austin Ziegler created mime-types.
81
-
82
- Thanks to everyone else who has contributed to mime-types over the years:
83
-
84
- - Aaron Patterson
85
- - Aggelos Avgerinos
86
- - Al Snow
87
- - Alex Vondrak
88
- - Andre Pankratz
89
- - Andy Brody
90
- - Arnaud Meuret
91
- - Brandon Galbraith
92
- - Burke Libbey
93
- - Chris Gat
94
- - David Genord
95
- - Dillon Welch
96
- - Edward Betts
97
- - Eric Marden
98
- - Garret Alfert
99
- - Godfrey Chan
100
- - Greg Brockman
101
- - Hans de Graaff
102
- - Henrik Hodne
103
- - Igor Victor
104
- - Janko Marohnić
105
- - Jean Boussier
106
- - Jeremy Evans
107
- - Juanito Fatas
108
- - Jun Aruga
109
- - Keerthi Siva
110
- - Ken Ip
111
- - Kevin Menard
112
- - Koichi ITO
113
- - Łukasz Śliwa
114
- - Martin d'Allens
115
- - Masato Nakamura
116
- - Mauricio Linhares
117
- - Nicholas La Roux
118
- - Nicolas Leger
119
- - nycvotes-dev
120
- - Olle Jonsson
121
- - Postmodern
122
- - Richard Hirner
123
- - Richard Hurt
124
- - Richard Schneeman
125
- - Robb Shecter
126
- - Tibor Szolár
127
- - Todd Carrico
128
-
129
- [minitest]: https://github.com/seattlerb/minitest
130
- [quality commit messages]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
131
- [mime-types-data]: https://github.com/mime-types/mime-types-data
132
- [hoe]: https://github.com/seattlerb/hoe
133
- [allocation\_tracer]: https://github.com/ko1/allocation_tracer