mime-types 2.5 → 2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Contributing.rdoc +72 -20
- data/History-Types.rdoc +11 -0
- data/History.rdoc +31 -1
- data/Manifest.txt +18 -1
- data/README.rdoc +142 -61
- data/Rakefile +59 -91
- data/data/mime-types.json +1 -1
- data/data/mime.content_type.column +1907 -0
- data/data/mime.docs.column +1907 -0
- data/data/mime.encoding.column +1907 -0
- data/data/mime.friendly.column +1907 -0
- data/data/mime.obsolete.column +1907 -0
- data/data/mime.references.column +1907 -0
- data/data/mime.registered.column +1907 -0
- data/data/mime.signature.column +1907 -0
- data/data/mime.system.column +1907 -0
- data/data/mime.use_instead.column +1907 -0
- data/data/mime.xrefs.column +1907 -0
- data/lib/mime/type.rb +192 -119
- data/lib/mime/type/columnar.rb +112 -0
- data/lib/mime/types.rb +39 -25
- data/lib/mime/types/cache.rb +41 -35
- data/lib/mime/types/columnar.rb +160 -0
- data/lib/mime/types/deprecations.rb +53 -0
- data/lib/mime/types/loader.rb +60 -20
- data/lib/mime/types/loader_path.rb +2 -3
- data/lib/mime/types/logger.rb +35 -0
- data/support/apache_mime_types.rb +8 -1
- data/support/benchmarks/load.rb +17 -8
- data/support/benchmarks/load_allocations.rb +83 -0
- data/support/benchmarks/object_counts.rb +41 -0
- data/support/convert.rb +44 -24
- data/support/convert/columnar.rb +90 -0
- data/support/iana_registry.rb +18 -8
- data/test/fixture/json.json +1 -1
- data/test/fixture/yaml.yaml +3 -6
- data/test/minitest_helper.rb +9 -10
- data/test/test_mime_type.rb +126 -62
- data/test/test_mime_types.rb +15 -11
- data/test/test_mime_types_class.rb +16 -14
- data/test/test_mime_types_lazy.rb +7 -1
- data/test/test_mime_types_loader.rb +17 -8
- metadata +54 -12
- data/lib/mime.rb +0 -51
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 393ac8426babd4f63f6cd7dd13ec79df643c4dcf
|
4
|
+
data.tar.gz: 39b333003a9c9d4fe5b211893fa3f286e41cd6c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 147fe43e230dc0eba2e3197622388ee79ca26e59aa111e4eabc484dd81eb66770e1d769434656e2bccef020dcddd7af3cf5487c05ead2e04b99fde37a86ffce8
|
7
|
+
data.tar.gz: 6bda16873866db44e312bfbafe985b1fac2b482fddb0b0c03a53838a7ba691e436601e9bb37d24aafcf1cb07dfdcce2d7fabd0464a321d9a50637f35afc3ae59
|
data/.gitignore
CHANGED
data/Contributing.rdoc
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
I value any contribution to mime-types you can provide: a bug report, a feature
|
4
4
|
request, or code contributions.
|
5
5
|
|
6
|
-
|
6
|
+
There are a few guidelines for contributing to mime-types:
|
7
7
|
|
8
8
|
* Code changes *will* *not* be accepted without tests. The test suite is
|
9
9
|
written with {Minitest}[https://github.com/seattlerb/minitest].
|
@@ -18,9 +18,12 @@ As mime-types is a mature codebase, there are a few guidelines:
|
|
18
18
|
|
19
19
|
=== Adding or Modifying MIME Types
|
20
20
|
|
21
|
-
The mime-types registry is loaded from
|
22
|
-
|
23
|
-
|
21
|
+
The mime-types registry is loaded from encoded files in +data+. These are not
|
22
|
+
editable and cannot be compared meaningfully in a pull request; pull requests
|
23
|
+
that include changes to these files will require amendment to revert these
|
24
|
+
files.
|
25
|
+
|
26
|
+
New or modified MIME types should be edited in the appropriate YAML file under
|
24
27
|
+type-lists+. The format is as shown below for the +application/xml+ MIME type
|
25
28
|
in +type-lists/application.yml+.
|
26
29
|
|
@@ -46,7 +49,20 @@ to verify that the JSON matches the YAML changes, which is why it is not
|
|
46
49
|
necessary to convert for the pull request.
|
47
50
|
|
48
51
|
If you are making a change for a private fork, use <tt>rake
|
49
|
-
convert:yaml:json</tt> to convert the YAML to JSON
|
52
|
+
convert:yaml:json</tt> to convert the YAML to JSON, or <tt>rake
|
53
|
+
convert:yaml:columnar</tt> to convert it to the new columnar format.
|
54
|
+
|
55
|
+
==== Updating Types from the IANA or Apache Lists
|
56
|
+
|
57
|
+
If you are maintaining a private fork and wish to update your copy of the MIME
|
58
|
+
types registry used by this gem, you can do this with the rake tasks:
|
59
|
+
|
60
|
+
$ rake mime:iana
|
61
|
+
$ rake mime:apache
|
62
|
+
|
63
|
+
Both of these require
|
64
|
+
{Nokogiri}[http://www.nokogiri.org/tutorials/installing_nokogiri.html], which
|
65
|
+
is not installed by default. Install it in the usual way for your Ruby.
|
50
66
|
|
51
67
|
=== Test Dependencies
|
52
68
|
|
@@ -77,12 +93,41 @@ can accomplish the same thing with:
|
|
77
93
|
This task will install any missing dependencies, run the tests/specs, and
|
78
94
|
generate the RDoc.
|
79
95
|
|
96
|
+
You can run tests with code coverage analysis by running:
|
97
|
+
|
98
|
+
$ rake test:coverage
|
99
|
+
|
100
|
+
=== Benchmarks
|
101
|
+
|
102
|
+
mime-types offers several benchmark tasks to measure different measures of
|
103
|
+
performance.
|
104
|
+
|
105
|
+
There is a repeated load test, measuring how long it takes to start and load
|
106
|
+
mime-types with its full registry. By default, it runs fifty loops and uses the
|
107
|
+
built-in benchmark library.
|
108
|
+
|
109
|
+
$ rake benchmark:load
|
110
|
+
|
111
|
+
There are two allocation tracing benchmarks (for normal and columnar loads).
|
112
|
+
These can only be run on Ruby 2.1 or better and requires the
|
113
|
+
{allocation_tracer}[https://github.com/ko1/allocation_tracer] gem (not
|
114
|
+
installed by default).
|
115
|
+
|
116
|
+
$ rake benchmark:allocations
|
117
|
+
$ rake benchmark:allocations:columnar
|
118
|
+
|
119
|
+
There are two loaded object count benchmarks (for normal and columnar loads).
|
120
|
+
These use <tt>ObjectSpace.count_objects</tt>.
|
121
|
+
|
122
|
+
$ rake benchmark:objects
|
123
|
+
$ rake benchmark:objects:columnar
|
124
|
+
|
80
125
|
=== Workflow
|
81
126
|
|
82
127
|
Here's the most direct way to get your work merged into the project:
|
83
128
|
|
84
129
|
* Fork the project.
|
85
|
-
* Clone down your fork (<tt>git clone git://github.com/<username>/mime-types.git</tt>).
|
130
|
+
* Clone down your fork (<tt>git clone git://github.com/<username>/ruby-mime-types.git</tt>).
|
86
131
|
* Create a topic branch to contain your change (<tt>git checkout -b my\_awesome\_feature</tt>).
|
87
132
|
* Hack away, add tests. Not necessarily in that order.
|
88
133
|
* Make sure everything still passes by running +rake+.
|
@@ -97,24 +142,31 @@ Here's the most direct way to get your work merged into the project:
|
|
97
142
|
|
98
143
|
Thanks to everyone else who has contributed to mime-types:
|
99
144
|
|
145
|
+
* Aaron Patterson
|
146
|
+
* Aggelos Avgerinos
|
100
147
|
* Andre Pankratz
|
101
|
-
*
|
102
|
-
*
|
103
|
-
*
|
148
|
+
* Andy Brody
|
149
|
+
* Arnaud Meuret
|
150
|
+
* Brandon Galbraith
|
151
|
+
* Chris Gat
|
152
|
+
* David Genord
|
153
|
+
* Eric Marden
|
104
154
|
* Garret Alfert
|
155
|
+
* Godfrey Chan
|
156
|
+
* Greg Brockman
|
105
157
|
* Hans de Graaff
|
106
158
|
* Henrik Hodne
|
107
|
-
*
|
108
|
-
*
|
109
|
-
*
|
110
|
-
* Łukasz Śliwa (for the friendly names)
|
159
|
+
* Jeremy Evans
|
160
|
+
* Juanito Fatas
|
161
|
+
* Łukasz Śliwa
|
111
162
|
* Keerthi Siva
|
112
|
-
* Aaron Patterson
|
113
|
-
* Godfrey Chan
|
114
|
-
* Tibor Szolár
|
115
163
|
* Ken Ip
|
116
|
-
*
|
117
|
-
*
|
118
|
-
*
|
119
|
-
*
|
164
|
+
* Martin d'Allens
|
165
|
+
* Mauricio Linhares
|
166
|
+
* nycvotes-dev
|
167
|
+
* Postmodern
|
168
|
+
* Richard Hirner
|
169
|
+
* Richard Hurt
|
120
170
|
* Richard Schneeman
|
171
|
+
* Tibor Szolár
|
172
|
+
* Todd Carrico
|
data/History-Types.rdoc
CHANGED
@@ -1,5 +1,16 @@
|
|
1
1
|
= MIME Types Changes by Version
|
2
2
|
|
3
|
+
== 2.6 / 2015-05-25
|
4
|
+
|
5
|
+
* Steven Michael Thomas (@stevenmichaelthomas) added +woff2+ as an extension to
|
6
|
+
application/font-woff,
|
7
|
+
{#99}[https://github.com/mime-types/ruby-mime-types/pull/99].
|
8
|
+
* Updated the IANA media registry entries as of release date:
|
9
|
+
* Updated metadata for application/jose, application/jose\+json,
|
10
|
+
application/jwk\+json, applicatoin/jwk-set\+json, application/jwt to
|
11
|
+
reflect the adoption of RFC7519.
|
12
|
+
* Added application/vnd.balsamiq.bmpr.
|
13
|
+
|
3
14
|
== 2.5 / 2015-04-25
|
4
15
|
|
5
16
|
* Updated the IANA media registry entries as of release date:
|
data/History.rdoc
CHANGED
@@ -1,7 +1,37 @@
|
|
1
|
+
== 2.6 / 2015-05-25
|
2
|
+
|
3
|
+
* New Feature:
|
4
|
+
* Columnar data storage for the MIME::Types registry, contributed by Jeremy
|
5
|
+
Evans (@jeremyevans). Reduces default memory use substantially (the mail
|
6
|
+
gem drops from 19 Mib to about 3 Mib). Resolves
|
7
|
+
{#96}[https://github.com/mime-types/ruby-mime-types/pull/96],
|
8
|
+
{#94}[https://github.com/mime-types/ruby-mime-types/issues/94],
|
9
|
+
{#83}[https://github.com/mime-types/ruby-mime-types/issues/83]. Partially
|
10
|
+
addresses {#64}[https://github.com/mime-types/ruby-mime-types/issues/64]
|
11
|
+
and {#62}[https://github.com/mime-types/ruby-mime-types/issues/62].
|
12
|
+
* Development:
|
13
|
+
* Removed caching of deprecation messages in preparation for mime-types 3.0.
|
14
|
+
Now, deprecated methods will always warn their deprecation instead of only
|
15
|
+
warning once.
|
16
|
+
* Added a logger for deprecation messages.
|
17
|
+
* Renamed <tt>lib/mime.rb</tt> to <tt>lib/mime/deprecations.rb</tt> to not
|
18
|
+
conflict with the {mime}[https://rubygems.org/gems/mime] gem on behalf of
|
19
|
+
the maintainers of the {Praxis Framework}[http://praxis-framework.io/].
|
20
|
+
Provided by Josep M. Blanquer (@blanquer),
|
21
|
+
{#100}[https://github.com/mime-types/ruby-mime-types/pull/100].
|
22
|
+
* Added the columnar data conversion tool, also provided by Jeremy Evans.
|
23
|
+
* Documentation:
|
24
|
+
* Improved documentation and ensured that all deprecated methods are marked
|
25
|
+
as such in the documentation.
|
26
|
+
* Development:
|
27
|
+
* Added more Ruby variants to Travis CI.
|
28
|
+
* Silenced deprecation messages for internal tools. Noisy deprecations are
|
29
|
+
noisy, but that's the point.
|
30
|
+
|
1
31
|
== 2.5 / 2015-04-25
|
2
32
|
|
3
33
|
* Bugs:
|
4
|
-
* David Genord (@albus522) fixed a bug in loading MIME::
|
34
|
+
* David Genord (@albus522) fixed a bug in loading MIME::Types cache where a
|
5
35
|
container loaded from cache did not have the expected +default_proc+,
|
6
36
|
{#86}[https://github.com/mime-types/ruby-mime-types/pull/86].
|
7
37
|
* Richard Schneeman (@schneems) provided a patch that substantially reduces
|
data/Manifest.txt
CHANGED
@@ -10,18 +10,35 @@ Manifest.txt
|
|
10
10
|
README.rdoc
|
11
11
|
Rakefile
|
12
12
|
data/mime-types.json
|
13
|
+
data/mime.content_type.column
|
14
|
+
data/mime.docs.column
|
15
|
+
data/mime.encoding.column
|
16
|
+
data/mime.friendly.column
|
17
|
+
data/mime.obsolete.column
|
18
|
+
data/mime.references.column
|
19
|
+
data/mime.registered.column
|
20
|
+
data/mime.signature.column
|
21
|
+
data/mime.system.column
|
22
|
+
data/mime.use_instead.column
|
23
|
+
data/mime.xrefs.column
|
13
24
|
docs/COPYING.txt
|
14
25
|
docs/artistic.txt
|
15
26
|
lib/mime-types.rb
|
16
|
-
lib/mime.rb
|
17
27
|
lib/mime/type.rb
|
28
|
+
lib/mime/type/columnar.rb
|
18
29
|
lib/mime/types.rb
|
19
30
|
lib/mime/types/cache.rb
|
31
|
+
lib/mime/types/columnar.rb
|
32
|
+
lib/mime/types/deprecations.rb
|
20
33
|
lib/mime/types/loader.rb
|
21
34
|
lib/mime/types/loader_path.rb
|
35
|
+
lib/mime/types/logger.rb
|
22
36
|
support/apache_mime_types.rb
|
23
37
|
support/benchmarks/load.rb
|
38
|
+
support/benchmarks/load_allocations.rb
|
39
|
+
support/benchmarks/object_counts.rb
|
24
40
|
support/convert.rb
|
41
|
+
support/convert/columnar.rb
|
25
42
|
support/iana_registry.rb
|
26
43
|
test/bad-fixtures/malformed
|
27
44
|
test/fixture/json.json
|
data/README.rdoc
CHANGED
@@ -18,33 +18,43 @@ MIME content types are used in MIME-compliant communications, as in e-mail or
|
|
18
18
|
HTTP traffic, to indicate the type of content which is transmitted. The
|
19
19
|
mime-types library provides the ability for detailed information about MIME
|
20
20
|
entities (provided as an enumerable collection of MIME::Type objects) to be
|
21
|
-
determined and used
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
This is release 2.
|
29
|
-
|
30
|
-
|
21
|
+
determined and used. There are many types defined by RFCs and vendors, so the
|
22
|
+
list is long but by definition incomplete; don't hesitate to add additional
|
23
|
+
type definitions. MIME type definitions found in mime-types are from RFCs, W3C
|
24
|
+
recommendations, the {IANA Media Types
|
25
|
+
registry}[https://www.iana.org/assignments/media-types/media-types.xhtml], and
|
26
|
+
user contributions. It conforms to RFCs 2045 and 2231.
|
27
|
+
|
28
|
+
This is release 2.6 with two new experimental features. The first new feature
|
29
|
+
is a new default registry storage format that greatly reduces the initial
|
30
|
+
memory use of the mime-types library. This feature is enabled by requiring
|
31
|
+
+mime/types/columnar+ instead of +mime/types+ with a small performance cost and
|
32
|
+
no change in *total* memory use if certain methods are called (see {Columnar
|
33
|
+
Store}[#columnar-store] for more details). The second new feature is a logger
|
34
|
+
interface that conforms to the expectations of an ActiveSupport::Logger so that
|
35
|
+
warnings can be written to an application's log rather than the default
|
36
|
+
location for +warn+. This interface may be used for other logging purposes in
|
37
|
+
the future.
|
38
|
+
|
39
|
+
mime-types 2.6 is the last planned version of mime-types 2.x, so deprecation
|
40
|
+
warnings are no longer cached but provided every time the method is called.
|
41
|
+
mime-types 2.6 supports Ruby 1.9.2 or later.
|
31
42
|
|
32
43
|
=== mime-types 1.x End of Life
|
33
44
|
|
34
45
|
mime-types 2.0 was released in late 2013, and as of early 2015 there have been
|
35
46
|
no reported security issues for mime-types 1.x. With the release of mime-types
|
36
|
-
2.5, I
|
37
|
-
|
38
|
-
|
47
|
+
2.5, I set the formal End of Life for mime-types 1.x for 2015-10-27 (the second
|
48
|
+
anniversary of the release of mime-types 2.0). After this date, absolutely no
|
49
|
+
pull requests for mime-types 1.x will be accepted.
|
39
50
|
|
40
51
|
=== mime-types Future
|
41
52
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
(2015-11-15).
|
53
|
+
There are a number of issues open that make clear to me that there are some
|
54
|
+
fundamental changes that need to happen to both the data representation and the
|
55
|
+
API provided by mime-types. This cannot happen under the current release, so
|
56
|
+
all new development is focussing on an upcoming 3.0 release. The target for the
|
57
|
+
release is on or before the beginning of RubyConf 2015 (2015-11-15).
|
48
58
|
|
49
59
|
When 3.0 is released, mime-types 2.x will receive regular updates of the IANA
|
50
60
|
registry for two years following the release. It will also receive security
|
@@ -52,9 +62,15 @@ updates, if needed, for the same period. There will be no further feature
|
|
52
62
|
development on mime-types 2.x following the 3.0 release.
|
53
63
|
|
54
64
|
Coincident with the 3.0 release, I will release mime-types 2.99.0 that no
|
55
|
-
longer imports the data to fields that have been deprecated
|
56
|
-
because they derive data from that
|
57
|
-
work. The quarterly updates will be against
|
65
|
+
longer imports the data to fields that have been deprecated, or exports it if
|
66
|
+
it is present. If they work because they derive data from the data that is
|
67
|
+
still present, the will continue to work. The quarterly updates will be against
|
68
|
+
2.99.x.
|
69
|
+
|
70
|
+
If the possible loss of this deprecated data matters, be sure to set your
|
71
|
+
dependency appropriately:
|
72
|
+
|
73
|
+
gem 'mime-types', '~> 2.6, < 2.99'
|
58
74
|
|
59
75
|
== Synopsis
|
60
76
|
|
@@ -62,44 +78,109 @@ MIME types are used in MIME entities, as in email or HTTP traffic. It is useful
|
|
62
78
|
at times to have information available about MIME types (or, inversely, about
|
63
79
|
files). A MIME::Type stores the known information about one MIME type.
|
64
80
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
81
|
+
require 'mime/types'
|
82
|
+
|
83
|
+
plaintext = MIME::Types['text/plain'] # => [ text/plain ]
|
84
|
+
text = plaintext.first
|
85
|
+
puts text.media_type # => 'text'
|
86
|
+
puts text.sub_type # => 'plain'
|
87
|
+
|
88
|
+
puts text.extensions.join(' ') # => 'txt asc c cc h hh cpp hpp dat hlp'
|
89
|
+
puts text.preferred_extension # => 'txt'
|
90
|
+
puts text.friendly # => 'Text Document'
|
91
|
+
puts text.i18n_key # => 'text.plain'
|
92
|
+
|
93
|
+
puts text.encoding # => quoted-printable
|
94
|
+
puts text.default_encoding # => quoted-printable
|
95
|
+
puts text.binary? # => false
|
96
|
+
puts text.ascii? # => true
|
97
|
+
puts text.obsolete? # => false
|
98
|
+
puts text.registered? # => true
|
99
|
+
puts text.complete? # => true
|
100
|
+
|
101
|
+
puts text # => 'text/plain'
|
102
|
+
|
103
|
+
puts text == 'text/plain' # => true
|
104
|
+
puts 'text/plain' == text # => true
|
105
|
+
puts text == 'text/x-plain' # => false
|
106
|
+
puts 'text/x-plain' == text # => false
|
107
|
+
|
108
|
+
puts MIME::Type.simplified('x-appl/x-zip') # => 'appl/zip'
|
109
|
+
puts MIME::Type.i18n_key('x-appl/x-zip') # => 'appl.zip'
|
110
|
+
|
111
|
+
puts text.like?('text/x-plain') # => true
|
112
|
+
puts text.like?(MIME::Type.new('x-text/x-plain')) # => true
|
113
|
+
|
114
|
+
puts text.xrefs.inspect # => { "rfc" => [ "rfc2046", "rfc3676", "rfc5147" ] }
|
115
|
+
puts text.urls # => [ "http://www.iana.org/go/rfc2046",
|
116
|
+
# "http://www.iana.org/go/rfc3676",
|
117
|
+
# "http://www.iana.org/go/rfc5147" ]
|
118
|
+
|
119
|
+
xtext = MIME::Type.new('x-text/x-plain')
|
120
|
+
puts xtext.media_type # => 'text'
|
121
|
+
puts xtext.raw_media_type # => 'x-text'
|
122
|
+
puts xtext.sub_type # => 'plain'
|
123
|
+
puts xtext.raw_sub_type # => 'x-plain'
|
124
|
+
puts xtext.complete? # => false
|
125
|
+
|
126
|
+
puts MIME::Types.any? { |type| type.content_type == 'text/plain' } # => true
|
127
|
+
puts MIME::Types.all?(&:registered?) # => false
|
128
|
+
|
129
|
+
# Various string representations of MIME types
|
130
|
+
qcelp = MIME::Types['audio/QCELP'].first # => audio/QCELP
|
131
|
+
puts qcelp.content_type # => 'audio/QCELP'
|
132
|
+
puts qcelp.simplified # => 'audio/qcelp'
|
133
|
+
|
134
|
+
xwingz = MIME::Types['application/x-Wingz'].first # => application/x-Wingz
|
135
|
+
puts xwingz.content_type # => 'application/x-Wingz'
|
136
|
+
puts xwingz.simplified # => 'application/wingz'
|
137
|
+
|
138
|
+
=== Columnar Store
|
139
|
+
|
140
|
+
mime-types 2.6 has an experimental columnar storage format that reduces the
|
141
|
+
default memory footprint. It does this by selectively loading data. When a
|
142
|
+
registry is first loaded from a columnar store, only the canonical MIME type
|
143
|
+
and registered extensions will be loaded and the MIME type will be connected to
|
144
|
+
its registry. When extended data is required (including #registered, #obsolete,
|
145
|
+
#use_instead), that data is loaded from its own column file for all types in
|
146
|
+
the registry. This load is done with a Mutex to ensure that the types are
|
147
|
+
updated safely in a multithreaded environment.
|
148
|
+
|
149
|
+
Columnar storage is slated to become the default storage format for mime-types
|
150
|
+
3.0, but until that is released, the default is still to use the JSON storage
|
151
|
+
format. As such, columnar storage can only currently be loaded at an
|
152
|
+
application level with the following specification in the application Gemfile:
|
153
|
+
|
154
|
+
gem 'mime-types', require: 'mime/types/columnar'
|
155
|
+
|
156
|
+
Projects that do not use Bundler, and libraries that wish to suggest this
|
157
|
+
behaviour to applications are encouraged to require this directly, but only if
|
158
|
+
you specify a dependency on mime-types 2.6.
|
159
|
+
|
160
|
+
require 'mime/types/columnar'
|
161
|
+
|
162
|
+
Although this require will not be necessary after mime-types 3, it will work
|
163
|
+
through at least {version
|
164
|
+
4}[https://github.com/mime-types/ruby-mime-types/pull/96#issuecomment-100725400]
|
165
|
+
and possibly beyond.
|
166
|
+
|
167
|
+
Note that the new Columnar class (MIME::Type::Columnar) and module
|
168
|
+
(MIME::Types::Columnar) are considered private variant implementations of
|
169
|
+
MIME::Type and MIME::Types and the specific implementation should not be relied
|
170
|
+
upon by consumers of the mime-types library. Instead, depend on the public
|
171
|
+
implementations only.
|
172
|
+
|
173
|
+
=== Cached Storage
|
174
|
+
|
175
|
+
Since version 2.0, mime-types has supported a cache of MIME types based on
|
176
|
+
<tt>Marshal.dump</tt>. The cache is invalidated for each released version of
|
177
|
+
mime-types so that version 2.5 is not reused for version 2.6. If the
|
178
|
+
environment variable +RUBY_MIME_TYPES_CACHE+ is set to a cache file, mime-types
|
179
|
+
will attempt to load the MIME type registry from the cache file. If it cannot,
|
180
|
+
it will load the types normally and then saves the registry to the cache file.
|
181
|
+
|
182
|
+
The current mime-types cache is not compatible with the columnar storage
|
183
|
+
format. This will be resolved for mime-types 3.
|
103
184
|
|
104
185
|
== mime-types Modified Semantic Versioning
|
105
186
|
|
@@ -129,7 +210,7 @@ In practical terms, there should be a MINOR release roughly monthly to track
|
|
129
210
|
updated or changed MIME types from the official IANA registry. This does not
|
130
211
|
indicate when new API features have been added, but all minor versions of
|
131
212
|
mime-types 2.x will be backwards compatible; the interfaces marked deprecated
|
132
|
-
will
|
213
|
+
will be removed in mime-types 3.x.
|
133
214
|
|
134
215
|
:include: Contributing.rdoc
|
135
216
|
|