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.
data/History.md DELETED
@@ -1,335 +0,0 @@
1
- # Changelog
2
-
3
- ## 3.5.2 / 2024-01-02
4
-
5
- There are no primary code changes, but we are releasing this as an update as
6
- there are some validation changes and updated code with formatting.
7
-
8
- - Dependency and CI updates:
9
-
10
- - Masato Nakamura added Ruby 3.3 to the CI workflow in [#179][].
11
-
12
- - Fixed regressions in standard formatting in [#180][].
13
-
14
- - Removed `minitest-bonus-assertions` because of a bundler resolution issue.
15
- Created a better replacement in-line.
16
-
17
- ## 3.5.1 / 2023-08-21
18
-
19
- - 1 bug fix:
20
-
21
- - Better handle possible line-termination strings (legal in Unix filenames)
22
- such as `\n` in `MIME::Types.type_for`. Reported by ooooooo-q in [#177][],
23
- resolved in [#178][].
24
-
25
- ## 3.5.0 / 2023-08-07
26
-
27
- - 1 minor enhancement:
28
-
29
- - Robb Shecter changed the default log level for duplicate type variant from
30
- `warn` to `debug` in [#170][]. This works because `MIME::Types.logger` is
31
- intended to fit the `::Logger` interface, and the default logger
32
- (`WarnLogger`) is a subclass of `::Logger` that passes through to
33
- `Kernel.warn`.
34
-
35
- - Further consideration has changed cache load messages from `warn` to
36
- `error` and deprecation messages from `warn` to `debug`.
37
-
38
- - 1 bug fix:
39
-
40
- - Added a definition of `MIME::Type#hash`. Contributed by Alex Vondrak in
41
- [#167][], fixing [#166][].
42
-
43
- - Dependency and CI updates:
44
-
45
- - Update the .github/workflows/ci.yml workflow to test Ruby 3.2 and more
46
- reliably test certain combinations rather than depending on exclusions.
47
-
48
- - Change `.standard.yml` configuration to format for Ruby 2.3 as certain files
49
- are not properly detected with Ruby 2.0.
50
-
51
- - Change from `hoe-git` to `hoe-git2` to support Hoe version 4.
52
-
53
- - Apply `standardrb --fix`.
54
-
55
- - The above changes have resulted in the Soft deprecation of Ruby versions
56
- below 2.6. Any errors reported for Ruby versions 2.0, 2.1, 2.2, 2.3, 2.4,
57
- and 2.5 will be resolved, but maintaining CI for these versions is
58
- unsustainable.
59
-
60
- ## 3.4.1 / 2021-11-16
61
-
62
- - 1 bug fix:
63
-
64
- - Fixed a Ruby < 2.3 incompatibility introduced by the use of standardrb,
65
- where `<<-` heredocs were converted to `<<~` heredocs. These have been
66
- reverted back to `<<-` with the indentation kept and a `.strip` call
67
- to prevent excess whitespace.
68
-
69
- ## 3.4.0 / 2021-11-15
70
-
71
- - 1 minor enhancement:
72
-
73
- - Added a new field to `MIME::Type` for checking provisional registrations
74
- from IANA. [#157]
75
-
76
- - Documentation:
77
-
78
- - Kevin Menard synced the documentation so that all examples are correct.
79
- [#153]
80
-
81
- - Administrivia:
82
-
83
- - Added Ruby 3.0 to the CI test matrix. Added `windows/jruby` to the
84
- CI exclusion list; it refuses to run successfully.
85
- - Removed the Travis CI configuration and changed it to Github Workflows
86
- [#150][]. Removed Coveralls configuration.
87
- - Igor Victor added TruffleRuby to the Travis CI configuration. [#149]
88
- - Koichi ITO loosened an excessively tight dependency. [#147]
89
- - Started using `standardrb` for Ruby formatting and validation.
90
- - Moved `deps:top` functionality to a support file.
91
-
92
- ## 3.3.1 / 2019-12-26
93
-
94
- - 1 minor bug fix:
95
-
96
- - Al Snow fixed a warning with MIME::Types::Logger producing a warning
97
- because Ruby 2.7 introduces numbered block parameters. Because of the way
98
- that the MIME::Types::Logger works for deprecation messages, the
99
- initializer parameters had been named `_1`, `_2`, and `_3`. This has now
100
- been resolved. [#146]
101
-
102
- - Administrivia:
103
-
104
- - Olle Jonsson removed an outdated Travis configuration option. [#142][]
105
-
106
- ## 3.3 / 2019-09-04
107
-
108
- - 1 minor enhancement
109
-
110
- - Jean Boussier reduced memory usage for Ruby versions 2.3 or higher by
111
- interning various string values in each type. This is done with a
112
- backwards-compatible call that _freezes_ the strings on older versions of
113
- Ruby. [#141]
114
-
115
- - Administrivia:
116
-
117
- - Nicholas La Roux updated Travis build configurations. [#139]
118
-
119
- ## 3.2.2 / 2018-08-12
120
-
121
- - Hiroto Fukui removed a stray `debugger` statement that I had used in
122
- producing v3.2.1. [#137]
123
-
124
- ## 3.2.1 / 2018-08-12
125
-
126
- - A few bugs related to MIME::Types::Container and its use in the
127
- mime-types-data helper tools reared their head because I released 3.2
128
- before verifying against mime-types-data.
129
-
130
- ## 3.2 / 2018-08-12
131
-
132
- - 2 minor enhancements
133
-
134
- - Janko Marohnić contributed a change to `MIME::Type#priority_order` that
135
- should improve on strict sorting when dealing with MIME types that appear
136
- to be in the same family even if strict sorting would cause an
137
- unregistered type to be sorted first. [#132]
138
-
139
- - Dillon Welch contributed a change that added `frozen_string_literal: true`
140
- to files so that modern Rubies can automatically reduce duplicate string
141
- allocations. [#135]
142
-
143
- - 2 bug fixes
144
-
145
- - Burke Libbey fixed a problem with cached data loading. [#126]
146
-
147
- - Resolved an issue where Enumerable#inject returns `nil` when provided an
148
- empty enumerable and a default value has not been provided. This is
149
- because when Enumerable#inject isn't provided a starting value, the first
150
- value is used as the default value. In every case where this error was
151
- happening, the result was supposed to be an array containing Set objects
152
- so they can be reduced to a single Set. [#117][], [#127][], [#134][]
153
-
154
- - Fixed an uncontrolled growth bug in MIME::Types::Container where a key
155
- miss would create a new entry with an empty Set in the container. This
156
- was working as designed (this particular feature was heavily used during
157
- MIME::Type registry construction), but the design was flawed in that it
158
- did not have any way of determining the difference between construction
159
- and querying. This would mean that, if you have a function in your web
160
- app that queries the MIME::Types registry by extension, the extension
161
- registry would grow uncontrollably. [#136]
162
-
163
- - Deprecations:
164
-
165
- - Lazy loading (`$RUBY_MIME_TYPES_LAZY_LOAD`) has been deprecated.
166
-
167
- - Documentation Changes:
168
-
169
- - Supporting files are now Markdown instead of rdoc, except for the README.
170
-
171
- - The history file has been modified to remove all history prior to 3.0.
172
- This history can be found in previous commits.
173
-
174
- - A spelling error was corrected by Edward Betts ([#129][]).
175
-
176
- - Administrivia:
177
-
178
- - CI configuration for more modern versions of Ruby were added by Nicolas
179
- Leger ([#130][]), Jun Aruga ([#125][]), and Austin Ziegler. Removed
180
- ruby-head-clang and rbx (Rubinius) from CI.
181
-
182
- - Fixed tests which were asserting equality against nil, which will become
183
- an error in Minitest 6.
184
-
185
- ## 3.1 / 2016-05-22
186
-
187
- - 1 documentation change:
188
-
189
- - Tim Smith (@tas50) updated the build badges to be SVGs to improve
190
- readability on high-density (retina) screens with pull request [#112][].
191
-
192
- - 3 bug fixes
193
-
194
- - A test for `MIME::Types::Cache` fails under Ruby 2.3 because of frozen
195
- strings, [#118][]. This has been fixed.
196
-
197
- - The JSON data has been incorrectly encoded since the release of
198
- mime-types 3 on the `xrefs` field, because of the switch to using a Set
199
- to store cross-reference information. This has been fixed.
200
-
201
- - A tentative fix for [#117][] has been applied, removing the only circular
202
- require dependencies that exist (and for which there was code to prevent,
203
- but the current fix is simpler). I have no way to verify this fix and
204
- depending on how things are loaded by `delayed_job`, this fix may not be
205
- sufficient.
206
-
207
- - 1 governance change
208
-
209
- - Updated to Contributor Covenant 1.4.
210
-
211
- ## 3.0 / 2015-11-21
212
-
213
- - 2 governance changes
214
-
215
- - This project and the related mime-types-data project are now exclusively
216
- MIT licensed. Resolves [#95][].
217
-
218
- - All projects under the mime-types organization now have a standard code
219
- of conduct adapted from the [Contributor Covenant][]. This text can be
220
- found in the [Code-of-Conduct.md][] file.
221
-
222
- - 3 major changes
223
-
224
- - All methods deprecated in mime-types 2.x have been removed.
225
-
226
- - mime-types now requires Ruby 2.0 compatibility or later. Resolves
227
- [#97][].
228
-
229
- - The registry data has been removed from mime-types and put into
230
- mime-types-data, maintained and released separately. It can be found at
231
- [mime-types-data][].
232
-
233
- - 17 minor changes:
234
-
235
- - `MIME::Type` changes:
236
-
237
- - Changed the way that simplified types representations are created to
238
- reflect the fact that `x-` prefixes are no longer considered special
239
- according to IANA. A simplified MIME type is case-folded to lowercase.
240
- A new keyword parameter, `remove_x_prefix`, can be provided to remove
241
- `x-` prefixes.
242
-
243
- - Improved initialization with an Array works so that extensions do not
244
- need to be wrapped in another array. This means that
245
- `%w(text/yaml yaml yml)` works in the same way that
246
- `['text/yaml', %w(yaml yml)]` did (and still does).
247
-
248
- - Changed `priority_compare` to conform with attributes that no longer
249
- exist.
250
-
251
- - Changed the internal implementation of extensions to use a frozen Set.
252
-
253
- - When extensions are set or modified with `add_extensions`, the primary
254
- registry will be informed of a need to re-index extensions. Resolves
255
- [#84][].
256
-
257
- - The preferred extension can be set explicitly. If not set, it will be
258
- the first extension. If the preferred extension is not in the extension
259
- list, it will be added.
260
-
261
- - Improved how xref URLs are generated.
262
-
263
- - Converted `obsolete`, `registered` and `signature` to `attr_accessors`.
264
-
265
- - `MIME::Types` changes:
266
-
267
- - Modified `MIME::Types.new` to track instances of `MIME::Types` so that
268
- they can be told to reindex the extensions as necessary.
269
-
270
- - Removed `data_version` attribute.
271
-
272
- - Changed `#[]` so that the `complete` and `registered` flags are
273
- keywords instead of a generic options parameter.
274
-
275
- - Extracted the class methods to a separate file.
276
-
277
- - Changed the container implementation to use a Set instead of an Array
278
- to prevent data duplication. Resolves [#79][].
279
-
280
- - `MIME::Types::Cache` changes:
281
-
282
- - Caching is now based on the data gem version instead of the mime-types
283
- version.
284
-
285
- - Caching is compatible with columnar registry stores.
286
-
287
- - `MIME::Types::Loader` changes:
288
-
289
- - `MIME::Types::Loader::PATH` has been removed and replaced with
290
- `MIME::Types::Data::PATH` from the mime-types-data gem. The environment
291
- variable `RUBY_MIME_TYPES_DATA` is still used.
292
-
293
- - Support for the long-deprecated mime-types v1 format has been removed.
294
-
295
- - The registry is default loaded from the columnar store by default. The
296
- internal format of the columnar store has changed; many of the boolean
297
- flags are now loaded from a single file. Resolves [#85][].
298
-
299
- [#79]: https://github.com/mime-types/ruby-mime-types/pull/79
300
- [#84]: https://github.com/mime-types/ruby-mime-types/pull/84
301
- [#85]: https://github.com/mime-types/ruby-mime-types/pull/85
302
- [#95]: https://github.com/mime-types/ruby-mime-types/pull/95
303
- [#97]: https://github.com/mime-types/ruby-mime-types/pull/97
304
- [#112]: https://github.com/mime-types/ruby-mime-types/pull/112
305
- [#117]: https://github.com/mime-types/ruby-mime-types/issues/117
306
- [#118]: https://github.com/mime-types/ruby-mime-types/pull/118
307
- [#125]: https://github.com/mime-types/ruby-mime-types/pull/125
308
- [#126]: https://github.com/mime-types/ruby-mime-types/pull/126
309
- [#127]: https://github.com/mime-types/ruby-mime-types/issues/127
310
- [#129]: https://github.com/mime-types/ruby-mime-types/pull/129
311
- [#130]: https://github.com/mime-types/ruby-mime-types/pull/130
312
- [#127]: https://github.com/mime-types/ruby-mime-types/issues/127
313
- [#132]: https://github.com/mime-types/ruby-mime-types/pull/132
314
- [#134]: https://github.com/mime-types/ruby-mime-types/issues/134
315
- [#135]: https://github.com/mime-types/ruby-mime-types/pull/135
316
- [#136]: https://github.com/mime-types/ruby-mime-types/issues/136
317
- [#137]: https://github.com/mime-types/ruby-mime-types/pull/137
318
- [#139]: https://github.com/mime-types/ruby-mime-types/pull/139
319
- [#141]: https://github.com/mime-types/ruby-mime-types/pull/141
320
- [#142]: https://github.com/mime-types/ruby-mime-types/pull/142
321
- [#146]: https://github.com/mime-types/ruby-mime-types/pull/146
322
- [#147]: https://github.com/mime-types/ruby-mime-types/pull/147
323
- [#149]: https://github.com/mime-types/ruby-mime-types/pull/149
324
- [#150]: https://github.com/mime-types/ruby-mime-types/pull/150
325
- [#153]: https://github.com/mime-types/ruby-mime-types/pull/153
326
- [#166]: https://github.com/mime-types/ruby-mime-types/issues/166
327
- [#167]: https://github.com/mime-types/ruby-mime-types/pull/167
328
- [#170]: https://github.com/mime-types/ruby-mime-types/pull/170
329
- [#177]: https://github.com/mime-types/ruby-mime-types/issues/177
330
- [#178]: https://github.com/mime-types/ruby-mime-types/pull/178
331
- [#179]: https://github.com/mime-types/ruby-mime-types/pull/179
332
- [#180]: https://github.com/mime-types/ruby-mime-types/pull/180
333
- [code-of-conduct.md]: Code-of-Conduct_md.html
334
- [contributor covenant]: http://contributor-covenant.org
335
- [mime-types-data]: https://github.com/mime-types/mime-types-data
data/README.rdoc DELETED
@@ -1,194 +0,0 @@
1
- = mime-types for Ruby
2
-
3
- home :: https://github.com/mime-types/ruby-mime-types/
4
- code :: https://github.com/mime-types/ruby-mime-types/
5
- bugs :: https://github.com/mime-types/ruby-mime-types/issues
6
- rdoc :: http://rdoc.info/gems/mime-types/
7
- clog :: https://github.com/mime-types/ruby-mime-types/blob/master/History.md
8
- continuous integration :: {<img src="https://github.com/mime-types/ruby-mime-types/actions/workflows/ci.yml/badge.svg" alt="Build Status" />}[https://github.com/mime-types/ruby-mime-types/actions/workflows/ci.yml]
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]
10
-
11
- == Description
12
-
13
- The mime-types library provides a library and registry for information about
14
- MIME content type definitions. It can be used to determine defined filename
15
- extensions for MIME types, or to use filename extensions to look up the likely
16
- MIME type definitions.
17
-
18
- Version 3.0 is a major release that requires Ruby 2.0 compatibility and removes
19
- deprecated functions. The columnar registry format introduced in 2.6 has been
20
- made the primary format; the registry data has been extracted from this library
21
- and put into {mime-types-data}[https://github.com/mime-types/mime-types-data].
22
- Additionally, mime-types is now licensed exclusively under the MIT licence and
23
- there is a code of conduct in effect. There are a number of other smaller
24
- changes described in the History file.
25
-
26
- === About MIME Media Types
27
-
28
- MIME content types are used in MIME-compliant communications, as in e-mail or
29
- HTTP traffic, to indicate the type of content which is transmitted. The
30
- mime-types library provides the ability for detailed information about MIME
31
- entities (provided as an enumerable collection of MIME::Type objects) to be
32
- determined and used. There are many types defined by RFCs and vendors, so the
33
- list is long but by definition incomplete; don't hesitate to add additional
34
- type definitions. MIME type definitions found in mime-types are from RFCs, W3C
35
- recommendations, the {IANA Media Types
36
- registry}[https://www.iana.org/assignments/media-types/media-types.xhtml], and
37
- user contributions. It conforms to RFCs 2045 and 2231.
38
-
39
- === mime-types 3.x
40
-
41
- Users are encouraged to upgrade to mime-types 3.x as soon as is practical.
42
- mime-types 3.x requires Ruby 2.0 compatibility and a simpler licensing scheme.
43
-
44
- == Synopsis
45
-
46
- MIME types are used in MIME entities, as in email or HTTP traffic. It is useful
47
- at times to have information available about MIME types (or, inversely, about
48
- files). A MIME::Type stores the known information about one MIME type.
49
-
50
- require 'mime/types'
51
-
52
- plaintext = MIME::Types['text/plain'] # => [ text/plain ]
53
- text = plaintext.first
54
- puts text.media_type # => 'text'
55
- puts text.sub_type # => 'plain'
56
-
57
- puts text.extensions.join(' ') # => 'txt asc c cc h hh cpp hpp dat hlp'
58
- puts text.preferred_extension # => 'txt'
59
- puts text.friendly # => 'Text Document'
60
- puts text.i18n_key # => 'text.plain'
61
-
62
- puts text.encoding # => quoted-printable
63
- puts text.default_encoding # => quoted-printable
64
- puts text.binary? # => false
65
- puts text.ascii? # => true
66
- puts text.obsolete? # => false
67
- puts text.registered? # => true
68
- puts text.provisional? # => false
69
- puts text.complete? # => true
70
-
71
- puts text # => 'text/plain'
72
-
73
- puts text == 'text/plain' # => true
74
- puts 'text/plain' == text # => true
75
- puts text == 'text/x-plain' # => false
76
- puts 'text/x-plain' == text # => false
77
-
78
- puts MIME::Type.simplified('x-appl/x-zip') # => 'x-appl/x-zip'
79
- puts MIME::Type.i18n_key('x-appl/x-zip') # => 'x-appl.x-zip'
80
-
81
- puts text.like?('text/x-plain') # => true
82
- puts text.like?(MIME::Type.new('x-text/x-plain')) # => true
83
-
84
- puts text.xrefs.inspect # => { "rfc" => [ "rfc2046", "rfc3676", "rfc5147" ] }
85
- puts text.xref_urls # => [ "http://www.iana.org/go/rfc2046",
86
- # "http://www.iana.org/go/rfc3676",
87
- # "http://www.iana.org/go/rfc5147" ]
88
-
89
- xtext = MIME::Type.new('x-text/x-plain')
90
- puts xtext.media_type # => 'text'
91
- puts xtext.raw_media_type # => 'x-text'
92
- puts xtext.sub_type # => 'plain'
93
- puts xtext.raw_sub_type # => 'x-plain'
94
- puts xtext.complete? # => false
95
-
96
- puts MIME::Types.any? { |type| type.content_type == 'text/plain' } # => true
97
- puts MIME::Types.all?(&:registered?) # => false
98
-
99
- # Various string representations of MIME types
100
- qcelp = MIME::Types['audio/QCELP'].first # => audio/QCELP
101
- puts qcelp.content_type # => 'audio/QCELP'
102
- puts qcelp.simplified # => 'audio/qcelp'
103
-
104
- xwingz = MIME::Types['application/x-Wingz'].first # => application/x-Wingz
105
- puts xwingz.content_type # => 'application/x-Wingz'
106
- puts xwingz.simplified # => 'application/x-wingz'
107
-
108
- === Columnar Store
109
-
110
- mime-types uses as its primary registry storage format a columnar storage
111
- format reducing the default memory footprint. This is done by selectively
112
- loading the data on a per-attribute basis. When the registry is first loaded
113
- from the columnar store, only the canonical MIME content type and known
114
- extensions and the MIME type will be connected to its loading registry. When
115
- other data about the type is required (including +preferred_extension+,
116
- <tt>obsolete?</tt>, and <tt>registered?</tt>) that data is loaded from its own
117
- column file for all types in the registry.
118
-
119
- The load of any column data is performed with a Mutex to ensure that types are
120
- updated safely in a multithreaded environment. Benchmarks show that while
121
- columnar data loading is slower than the JSON store, it cuts the memory use by
122
- a third over the JSON store.
123
-
124
- If you prefer to load all the data at once, this can be specified in your
125
- application Gemfile as:
126
-
127
- gem 'mime-types', require: 'mime/types/full'
128
-
129
- Projects that do not use Bundler should +require+ the same:
130
-
131
- require 'mime/types/full'
132
-
133
- Libraries that use mime-types are discouraged from choosing the JSON store.
134
-
135
- For applications and clients that used mime-types 2.6 when the columnar store
136
- was introduced, the require used previously will still work through at least
137
- {version
138
- 4}[https://github.com/mime-types/ruby-mime-types/pull/96#issuecomment-100725400]
139
- and possibly beyond; it is effectively an empty operation. You are recommended
140
- to change your Gemfile as soon as is practical.
141
-
142
- require 'mime/types/columnar'
143
-
144
- Note that MIME::Type::Columnar and MIME::Types::Columnar are considered private
145
- variant implementations of MIME::Type and MIME::Types and the specific
146
- implementation should not be relied upon by consumers of the mime-types
147
- library. Instead, depend on the public implementations (MIME::Type and
148
- MIME::Types) only.
149
-
150
- === Cached Storage
151
-
152
- mime-types supports a cache of MIME types using <tt>Marshal.dump</tt>. The
153
- cache is invalidated for each version of the mime-types-data gem so that data
154
- version 3.2015.1201 will not be reused with data version 3.2016.0101. If the
155
- environment variable +RUBY_MIME_TYPES_CACHE+ is set to a cache file, mime-types
156
- will attempt to load the MIME type registry from the cache file. If it cannot,
157
- it will load the types normally and then saves the registry to the cache file.
158
-
159
- The caching works with both full stores and columnar stores. Only the data that
160
- has been loaded prior to saving the cache will be stored.
161
-
162
- == mime-types Modified Semantic Versioning
163
-
164
- The mime-types library has one version number, but this single version number
165
- tracks both API changes and registry data changes; this is not wholly
166
- compatible with all aspects of {Semantic Versioning}[http://semver.org/];
167
- removing a MIME type from the registry *could* be considered a breaking change
168
- under some interpretations of semantic versioning (as lookups for that
169
- particular type would no longer work by default).
170
-
171
- mime-types uses a modified semantic versioning scheme. Given the version
172
- MAJOR.MINOR:
173
-
174
- 1. If an incompatible API (code) change is made, the MAJOR version will be
175
- incremented, MINOR will be set to zero, and PATCH will be reset to the
176
- implied zero.
177
-
178
- 2. If an API (code) feature is added that does not break compatibility, the
179
- MINOR version will be incremented and PATCH will be reset to the implied zero.
180
-
181
- 3. If there is a bugfix to a feature added in the most recent MAJOR.MINOR
182
- release, the implied PATCH value will be incremented resulting in
183
- MAJOR.MINOR.PATCH.
184
-
185
- In practical terms, there will be fewer releases of mime-types focussing on
186
- features because of the existence of the [mime-types-data][] gem, and if
187
- features are marked deprecated in the course of mime-types 3.x, they will not
188
- be removed until mime-types 4.x or possibly later.
189
-
190
- {Code of Conduct}[Code-of-Conduct_md.html]
191
-
192
- {Contributing}[Contributing_md.html]
193
-
194
- {Licence}[Licence_md.html]