mime-types 2.99.3 → 3.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +5 -5
  2. data/{Code-of-Conduct.rdoc → Code-of-Conduct.md} +19 -20
  3. data/Contributing.md +143 -0
  4. data/History.md +240 -0
  5. data/{Licence.rdoc → Licence.md} +4 -18
  6. data/Manifest.txt +8 -25
  7. data/README.rdoc +62 -73
  8. data/Rakefile +175 -58
  9. data/lib/mime-types.rb +1 -1
  10. data/lib/mime/type.rb +213 -424
  11. data/lib/mime/type/columnar.rb +29 -62
  12. data/lib/mime/types.rb +46 -141
  13. data/lib/mime/types/_columnar.rb +136 -0
  14. data/lib/mime/types/cache.rb +51 -73
  15. data/lib/mime/types/columnar.rb +2 -147
  16. data/lib/mime/types/container.rb +96 -0
  17. data/lib/mime/types/deprecations.rb +4 -25
  18. data/lib/mime/types/full.rb +19 -0
  19. data/lib/mime/types/loader.rb +12 -141
  20. data/lib/mime/types/logger.rb +5 -1
  21. data/lib/mime/types/registry.rb +90 -0
  22. data/test/minitest_helper.rb +5 -13
  23. data/test/test_mime_type.rb +470 -456
  24. data/test/test_mime_types.rb +135 -87
  25. data/test/test_mime_types_cache.rb +82 -54
  26. data/test/test_mime_types_class.rb +118 -98
  27. data/test/test_mime_types_lazy.rb +26 -24
  28. data/test/test_mime_types_loader.rb +6 -33
  29. metadata +107 -64
  30. data/Contributing.rdoc +0 -170
  31. data/History-Types.rdoc +0 -454
  32. data/History.rdoc +0 -590
  33. data/data/mime-types.json +0 -1
  34. data/data/mime.content_type.column +0 -1980
  35. data/data/mime.docs.column +0 -1980
  36. data/data/mime.encoding.column +0 -1980
  37. data/data/mime.friendly.column +0 -1980
  38. data/data/mime.obsolete.column +0 -1980
  39. data/data/mime.registered.column +0 -1980
  40. data/data/mime.signature.column +0 -1980
  41. data/data/mime.use_instead.column +0 -1980
  42. data/data/mime.xrefs.column +0 -1980
  43. data/docs/COPYING.txt +0 -339
  44. data/docs/artistic.txt +0 -127
  45. data/lib/mime/types/loader_path.rb +0 -15
  46. data/support/apache_mime_types.rb +0 -108
  47. data/support/benchmarks/load.rb +0 -64
  48. data/support/benchmarks/load_allocations.rb +0 -83
  49. data/support/benchmarks/object_counts.rb +0 -41
  50. data/support/convert.rb +0 -158
  51. data/support/convert/columnar.rb +0 -88
  52. data/support/iana_registry.rb +0 -172
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 6fc8f9668b867116a596617ef0c7a3deb6525d4f
4
- data.tar.gz: da57ee98722d4b5cee6ae754df620202a3d4a7db
2
+ SHA256:
3
+ metadata.gz: 727050c60daa98ccb85692629f83999009ca6d6cd259e15ceebdaf524da14c0a
4
+ data.tar.gz: 28a5af3883b49bd685f35cd84247dbe3c6894d5cca8417c212d3bb0d261b23d4
5
5
  SHA512:
6
- metadata.gz: a82b94ceb52e642b263c8223a55c213220125a576d5abeaa5a72c2ad7941d967921bfc13385a300d4c02f45228d9f9f4fccb9999da6dd16ea29cf5fe8388a3a0
7
- data.tar.gz: c5411c2e67a87c342cde930311d3c3df806e2699f5e27bccd72df1c8ab4095bb81db256b787e354ab13e8ec953b8b8b3aa41b3891a6f749aa0a579419d1a133a
6
+ metadata.gz: bb64be5b69ac765df59ea4ae0fd17f549263107c59878954e3613b44519a73eacfe00f2e28e0369452afe1a4c4846a98a5f59402d559a7b3acf9de78388bff4a
7
+ data.tar.gz: 1141d794103db9810da89504387f56caa84e704f523197072393855a8f9a89e474b52794d9de6a09d750634711446ce4731971a13fbe642a32f58e5f7f27b0fb
@@ -1,15 +1,15 @@
1
- == Contributor Covenant Code of Conduct
1
+ # Contributor Covenant Code of Conduct
2
2
 
3
3
  ## Our Pledge
4
4
 
5
5
  In the interest of fostering an open and welcoming environment, we as
6
6
  contributors and maintainers pledge to making participation in our project and
7
- our community a harassment-free experience for everyone, regardless of age,
8
- body size, disability, ethnicity, gender identity and expression, level of
9
- experience, nationality, personal appearance, race, religion, or sexual
10
- identity and orientation.
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
11
 
12
- === Our Standards
12
+ ## Our Standards
13
13
 
14
14
  Examples of behavior that contributes to creating a positive environment
15
15
  include:
@@ -31,7 +31,7 @@ Examples of unacceptable behavior by participants include:
31
31
  * Other conduct which could reasonably be considered inappropriate in a
32
32
  professional setting
33
33
 
34
- === Our Responsibilities
34
+ ## Our Responsibilities
35
35
 
36
36
  Project maintainers are responsible for clarifying the standards of acceptable
37
37
  behavior and are expected to take appropriate and fair corrective action in
@@ -43,32 +43,31 @@ that are not aligned to this Code of Conduct, or to ban temporarily or
43
43
  permanently any contributor for other behaviors that they deem inappropriate,
44
44
  threatening, offensive, or harmful.
45
45
 
46
- === Scope
46
+ ## Scope
47
47
 
48
48
  This Code of Conduct applies both within project spaces and in public spaces
49
49
  when an individual is representing the project or its community. Examples of
50
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
52
- appointed representative at an online or offline event. Representation of a
53
- project may be further defined and clarified by project maintainers.
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
54
 
55
- === Enforcement
55
+ ## Enforcement
56
56
 
57
57
  Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
58
  reported by contacting the project team at [INSERT EMAIL ADDRESS]. All
59
59
  complaints will be reviewed and investigated and will result in a response that
60
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
62
- incident. Further details of specific enforcement policies may be posted
63
- separately.
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
64
63
 
65
64
  Project maintainers who do not follow or enforce the Code of Conduct in good
66
65
  faith may face temporary or permanent repercussions as determined by other
67
66
  members of the project's leadership.
68
67
 
69
- === Attribution
68
+ ## Attribution
70
69
 
71
- This Code of Conduct is adapted from the {Contributor
72
- Covenant}[http://contributor-covenant.org], version 1.4,
73
- available at
74
- {http://contributor-covenant.org/version/1/4/}[http://contributor-covenant.org/version/1/4/].
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
@@ -0,0 +1,143 @@
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:
28
+
29
+ $ rake
30
+
31
+ which runs the tests the same way that:
32
+
33
+ $ rake test
34
+ $ rake travis
35
+
36
+ will do.
37
+
38
+ To assist with the installation of the development dependencies for mime-types,
39
+ I have provided the simplest possible Gemfile pointing to the (generated)
40
+ `mime-types.gemspec` file. This will permit you to do:
41
+
42
+ $ bundle install
43
+
44
+ to get the development dependencies. If you aleady have +hoe+ installed, you
45
+ can accomplish the same thing with:
46
+
47
+ $ rake newb
48
+
49
+ This task will install any missing dependencies, run the tests/specs, and
50
+ generate the RDoc.
51
+
52
+ You can run tests with code coverage analysis by running:
53
+
54
+ $ rake test:coverage
55
+
56
+ ### Benchmarks
57
+
58
+ mime-types offers several benchmark tasks to measure different measures of
59
+ performance.
60
+
61
+ There is a repeated load test, measuring how long it takes to start and load
62
+ mime-types with its full registry. By default, it runs fifty loops and uses the
63
+ built-in benchmark library.
64
+
65
+ $ rake benchmark:load
66
+
67
+ There are two allocation tracing benchmarks (for normal and columnar loads).
68
+ These can only be run on Ruby 2.1 or better and requires the
69
+ [allocation\_tracer][] gem (not installed by default).
70
+
71
+ $ rake benchmark:allocations
72
+ $ rake benchmark:allocations:columnar
73
+
74
+ There are two loaded object count benchmarks (for normal and columnar loads).
75
+ These use `ObjectSpace.count_objects`.
76
+
77
+ $ rake benchmark:objects
78
+ $ rake benchmark:objects:columnar
79
+
80
+ ### Workflow
81
+
82
+ Here's the most direct way to get your work merged into the project:
83
+
84
+ * Fork the project.
85
+ * Clone down your fork (`git clone git://github.com/<username>/ruby-mime-types.git`).
86
+ * Create a topic branch to contain your change (`git checkout -b my_awesome_feature`).
87
+ * Hack away, add tests. Not necessarily in that order.
88
+ * Make sure everything still passes by running `rake`.
89
+ * If necessary, rebase your commits into logical chunks, without errors.
90
+ * Push the branch up (`git push origin my_awesome_feature`).
91
+ * Create a pull request against mime-types/ruby-mime-types and describe what
92
+ your change does and the why you think it should be merged.
93
+
94
+ ### Contributors
95
+
96
+ * Austin Ziegler created mime-types.
97
+
98
+ Thanks to everyone else who has contributed to mime-types over the years:
99
+
100
+ * Aaron Patterson
101
+ * Aggelos Avgerinos
102
+ * Al Snow
103
+ * Andre Pankratz
104
+ * Andy Brody
105
+ * Arnaud Meuret
106
+ * Brandon Galbraith
107
+ * Burke Libbey
108
+ * Chris Gat
109
+ * David Genord
110
+ * Dillon Welch
111
+ * Eric Marden
112
+ * Edward Betts
113
+ * Garret Alfert
114
+ * Godfrey Chan
115
+ * Greg Brockman
116
+ * Hans de Graaff
117
+ * Henrik Hodne
118
+ * Janko Marohnić
119
+ * Jean Boussier
120
+ * Jeremy Evans
121
+ * Juanito Fatas
122
+ * Jun Aruga
123
+ * Łukasz Śliwa
124
+ * Keerthi Siva
125
+ * Ken Ip
126
+ * Martin d'Allens
127
+ * Mauricio Linhares
128
+ * Nicolas Leger
129
+ * Nicholas La Roux
130
+ * nycvotes-dev
131
+ * Olle Jonsson
132
+ * Postmodern
133
+ * Richard Hirner
134
+ * Richard Hurt
135
+ * Richard Schneeman
136
+ * Tibor Szolár
137
+ * Todd Carrico
138
+
139
+ [minitest]: https://github.com/seattlerb/minitest
140
+ [quality commit messages]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
141
+ [mime-types-data]: https://github.com/mime-types/mime-types-data
142
+ [Hoe]: https://github.com/seattlerb/hoe
143
+ [allocation\_tracer]: https://github.com/ko1/allocation_tracer
@@ -0,0 +1,240 @@
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
+
29
+ ## 3.2.2 / 2018-08-12
30
+
31
+ * Hiroto Fukui removed a stray `debugger` statement that I had used in
32
+ producing v3.2.1. [#137][]
33
+
34
+ ## 3.2.1 / 2018-08-12
35
+
36
+ * A few bugs related to MIME::Types::Container and its use in the
37
+ mime-types-data helper tools reared their head because I released 3.2
38
+ before verifying against mime-types-data.
39
+
40
+ ## 3.2 / 2018-08-12
41
+
42
+ * 2 minor enhancements
43
+
44
+ * Janko Marohnić contributed a change to `MIME::Type#priority_order` that
45
+ should improve on strict sorting when dealing with MIME types that
46
+ appear to be in the same family even if strict sorting would cause an
47
+ unregistered type to be sorted first. [#132][]
48
+
49
+ * Dillon Welch contributed a change that added `frozen_string_literal:
50
+ true` to files so that modern Rubies can automatically reduce duplicate
51
+ string allocations. [#135][]
52
+
53
+ * 2 bug fixes
54
+
55
+ * Burke Libbey fixed a problem with cached data loading. [#126][]
56
+
57
+ * Resolved an issue where Enumerable#inject returns +nil+ when provided
58
+ an empty enumerable and a default value has not been provided. This is
59
+ because when Enumerable#inject isn't provided a starting value, the
60
+ first value is used as the default value. In every case where this
61
+ error was happening, the result was supposed to be an array containing
62
+ Set objects so they can be reduced to a single Set. [#117][], [#127][],
63
+ [#134][].
64
+
65
+ * Fixed an uncontrolled growth bug in MIME::Types::Container where a key
66
+ miss would create a new entry with an empty Set in the container. This
67
+ was working as designed (this particular feature was heavily used
68
+ during MIME::Type registry construction), but the design was flawed in
69
+ that it did not have any way of determining the difference between
70
+ construction and querying. This would mean that, if you have a function
71
+ in your web app that queries the MIME::Types registry by extension, the
72
+ extension registry would grow uncontrollably. [#136][]
73
+
74
+ * Deprecations:
75
+
76
+ * Lazy loading (`$RUBY_MIME_TYPES_LAZY_LOAD`) has been deprecated.
77
+
78
+ * Documentation Changes:
79
+
80
+ * Supporting files are now Markdown instead of rdoc, except for the
81
+ README.
82
+
83
+ * The history file has been modified to remove all history prior to 3.0.
84
+ This history can be found in previous commits.
85
+
86
+ * A spelling error was corrected by Edward Betts ([#129][]).
87
+
88
+ * Administrivia:
89
+
90
+ * CI configuration for more modern versions of Ruby were added by Nicolas
91
+ Leger ([#130][]), Jun Aruga ([#125][]), and Austin Ziegler. Removed
92
+ ruby-head-clang and rbx (Rubinius) from CI.
93
+
94
+ * Fixed tests which were asserting equality against nil, which will
95
+ become an error in Minitest 6.
96
+
97
+ ## 3.1 / 2016-05-22
98
+
99
+ * 1 documentation change:
100
+
101
+ * Tim Smith (@tas50) updated the build badges to be SVGs to improve
102
+ readability on high-density (retina) screens with pull request
103
+ [#112][].
104
+
105
+ * 3 bug fixes
106
+
107
+ * A test for `MIME::Types::Cache` fails under Ruby 2.3 because of frozen
108
+ strings, [#118][]. This has been fixed.
109
+
110
+ * The JSON data has been incorrectly encoded since the release of
111
+ mime-types 3 on the `xrefs` field, because of the switch to using a Set
112
+ to store cross-reference information. This has been fixed.
113
+
114
+ * A tentative fix for [#117][] has been applied, removing the only
115
+ circular require dependencies that exist (and for which there was code
116
+ to prevent, but the current fix is simpler). I have no way to verify
117
+ this fix and depending on how things are loaded by `delayed_job`, this
118
+ fix may not be sufficient.
119
+
120
+ * 1 governance change
121
+
122
+ * Updated to Contributor Covenant 1.4.
123
+
124
+ ## 3.0 / 2015-11-21
125
+
126
+ * 2 governance changes
127
+
128
+ * This project and the related mime-types-data project are now
129
+ exclusively MIT licensed. Resolves [#95][].
130
+
131
+ * All projects under the mime-types organization now have a standard code
132
+ of conduct adapted from the [Contributor Covenant][]. This text can be
133
+ found in the [Code-of-Conduct.md][] file.
134
+
135
+ * 3 major changes
136
+
137
+ * All methods deprecated in mime-types 2.x have been removed.
138
+
139
+ * mime-types now requires Ruby 2.0 compatibility or later. Resolves
140
+ [#97][].
141
+
142
+ * The registry data has been removed from mime-types and put into
143
+ mime-types-data, maintained and released separately. It can be found at
144
+ [mime-types-data][].
145
+
146
+ * 17 minor changes:
147
+
148
+ * `MIME::Type` changes:
149
+
150
+ * Changed the way that simplified types representations are created
151
+ to reflect the fact that `x-` prefixes are no longer considered
152
+ special according to IANA. A simplified MIME type is case-folded to
153
+ lowercase. A new keyword parameter, `remove_x_prefix`, can be
154
+ provided to remove `x-` prefixes.
155
+
156
+ * Improved initialization with an Array works so that extensions do
157
+ not need to be wrapped in another array. This means that
158
+ `%w(text/yaml yaml yml)` works in the same way that
159
+ `['text/yaml', %w(yaml yml)]` did (and still does).
160
+
161
+ * Changed `priority_compare` to conform with attributes that no
162
+ longer exist.
163
+
164
+ * Changed the internal implementation of extensions to use a frozen
165
+ Set.
166
+
167
+ * When extensions are set or modified with `add_extensions`, the
168
+ primary registry will be informed of a need to reindex extensions.
169
+ Resolves [#84][].
170
+
171
+ * The preferred extension can be set explicitly. If not set, it will
172
+ be the first extension. If the preferred extension is not in the
173
+ extension list, it will be added.
174
+
175
+ * Improved how xref URLs are generated.
176
+
177
+ * Converted `obsolete`, `registered` and `signature` to
178
+ `attr_accessors`.
179
+
180
+ * `MIME::Types` changes:
181
+
182
+ * Modified `MIME::Types.new` to track instances of `MIME::Types` so
183
+ that they can be told to reindex the extensions as necessary.
184
+
185
+ * Removed `data_version` attribute.
186
+
187
+ * Changed `#[]` so that the `complete` and `registered` flags are
188
+ keywords instead of a generic options parameter.
189
+
190
+ * Extracted the class methods to a separate file.
191
+
192
+ * Changed the container implementation to use a Set instead of an
193
+ Array to prevent data duplication. Resolves [#79][].
194
+
195
+ * `MIME::Types::Cache` changes:
196
+
197
+ * Caching is now based on the data gem version instead of the
198
+ mime-types version.
199
+
200
+ * Caching is compatible with columnar registry stores.
201
+
202
+ * `MIME::Types::Loader` changes:
203
+
204
+ * `MIME::Types::Loader::PATH` has been removed and replaced with
205
+ `MIME::Types::Data::PATH` from the mime-types-data gem. The
206
+ environment variable `RUBY_MIME_TYPES_DATA` is still used.
207
+
208
+ * Support for the long-deprecated mime-types v1 format has been
209
+ removed.
210
+
211
+ * The registry is default loaded from the columnar store by default.
212
+ The internal format of the columnar store has changed; many of the
213
+ boolean flags are now loaded from a single file. Resolves [#85][].
214
+
215
+ [#79]: https://github.com/mime-types/ruby-mime-types/pull/79
216
+ [#84]: https://github.com/mime-types/ruby-mime-types/pull/84
217
+ [#85]: https://github.com/mime-types/ruby-mime-types/pull/85
218
+ [#95]: https://github.com/mime-types/ruby-mime-types/pull/95
219
+ [#97]: https://github.com/mime-types/ruby-mime-types/pull/97
220
+ [#112]: https://github.com/mime-types/ruby-mime-types/pull/112
221
+ [#117]: https://github.com/mime-types/ruby-mime-types/issues/117
222
+ [#118]: https://github.com/mime-types/ruby-mime-types/pull/118
223
+ [#125]: https://github.com/mime-types/ruby-mime-types/pull/125
224
+ [#126]: https://github.com/mime-types/ruby-mime-types/pull/126
225
+ [#127]: https://github.com/mime-types/ruby-mime-types/issues/127
226
+ [#129]: https://github.com/mime-types/ruby-mime-types/pull/129
227
+ [#130]: https://github.com/mime-types/ruby-mime-types/pull/130
228
+ [#127]: https://github.com/mime-types/ruby-mime-types/issues/127
229
+ [#132]: https://github.com/mime-types/ruby-mime-types/pull/132
230
+ [#134]: https://github.com/mime-types/ruby-mime-types/issues/134
231
+ [#135]: https://github.com/mime-types/ruby-mime-types/pull/135
232
+ [#136]: https://github.com/mime-types/ruby-mime-types/issues/136
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
238
+ [Code-of-Conduct.md]: Code-of-Conduct_md.html
239
+ [Contributor Covenant]: http://contributor-covenant.org
240
+ [mime-types-data]: https://github.com/mime-types/mime-types-data