mime-types 1.17.2 → 3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.autotest +35 -0
- data/.gitignore +17 -0
- data/.hoerc +20 -12
- data/Code-of-Conduct.rdoc +41 -0
- data/Contributing.rdoc +169 -0
- data/History.rdoc +531 -30
- data/Licence.rdoc +25 -0
- data/Manifest.txt +32 -34
- data/README.rdoc +198 -13
- data/Rakefile +181 -159
- data/lib/mime/type/columnar.rb +55 -0
- data/lib/mime/type.rb +566 -0
- data/lib/mime/types/cache.rb +56 -0
- data/lib/mime/types/columnar.rb +142 -0
- data/lib/mime/types/container.rb +30 -0
- data/lib/mime/types/deprecations.rb +32 -0
- data/lib/mime/types/full.rb +17 -0
- data/lib/mime/types/loader.rb +148 -0
- data/lib/mime/types/logger.rb +37 -0
- data/lib/mime/types/registry.rb +81 -0
- data/lib/mime/types.rb +199 -819
- data/lib/mime-types.rb +1 -0
- data/support/benchmarks/load.rb +65 -0
- data/support/benchmarks/load_allocations.rb +90 -0
- data/support/benchmarks/object_counts.rb +43 -0
- data/support/profile/columnar.rb +5 -0
- data/support/profile/columnar_full.rb +5 -0
- data/support/profile/full.rb +5 -0
- data/test/bad-fixtures/malformed +9 -0
- data/test/fixture/json.json +1 -0
- data/test/fixture/old-data +9 -0
- data/test/fixture/yaml.yaml +55 -0
- data/test/minitest_helper.rb +12 -0
- data/test/test_mime_type.rb +527 -242
- data/test/test_mime_types.rb +130 -68
- data/test/test_mime_types_cache.rb +100 -0
- data/test/test_mime_types_class.rb +155 -0
- data/test/test_mime_types_lazy.rb +43 -0
- data/test/test_mime_types_loader.rb +32 -0
- metadata +286 -229
- data/License.rdoc +0 -10
- data/lib/mime/types/application +0 -940
- data/lib/mime/types/application.mac +0 -2
- data/lib/mime/types/application.nonstandard +0 -114
- data/lib/mime/types/application.obsolete +0 -40
- data/lib/mime/types/audio +0 -131
- data/lib/mime/types/audio.nonstandard +0 -10
- data/lib/mime/types/audio.obsolete +0 -1
- data/lib/mime/types/image +0 -43
- data/lib/mime/types/image.nonstandard +0 -17
- data/lib/mime/types/image.obsolete +0 -5
- data/lib/mime/types/message +0 -19
- data/lib/mime/types/message.obsolete +0 -1
- data/lib/mime/types/model +0 -15
- data/lib/mime/types/multipart +0 -14
- data/lib/mime/types/multipart.nonstandard +0 -1
- data/lib/mime/types/multipart.obsolete +0 -7
- data/lib/mime/types/other.nonstandard +0 -8
- data/lib/mime/types/text +0 -54
- data/lib/mime/types/text.nonstandard +0 -5
- data/lib/mime/types/text.obsolete +0 -7
- data/lib/mime/types/text.vms +0 -1
- data/lib/mime/types/video +0 -68
- data/lib/mime/types/video.nonstandard +0 -11
- data/lib/mime/types/video.obsolete +0 -3
- data/mime-types.gemspec +0 -57
- data/type-lists/application.txt +0 -951
- data/type-lists/audio.txt +0 -132
- data/type-lists/image.txt +0 -43
- data/type-lists/message.txt +0 -20
- data/type-lists/model.txt +0 -15
- data/type-lists/multipart.txt +0 -14
- data/type-lists/text.txt +0 -57
- data/type-lists/video.txt +0 -67
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7023816dbfc18473c51bed6f14864322167273fe
|
4
|
+
data.tar.gz: d29e9c15601cca71c991bc5cc1b50b31c1864d74
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1e7ba49d9b78b1331085a956c9c4c6c24687e7f69443bc00370b4e233874d32d28067d9171d50d14b14ea2bd4885a9b452b6ccc0a1fd179283855aebf9a23a3d
|
7
|
+
data.tar.gz: 7aa2a2ff6b297ed18a4feb6029d30b051fcc87bcd6d7aa6be37be3b9caa15e4207756614c729322e62592ae71abc5beeafbae40959194719fb11ac8acbfde2d9
|
data/.autotest
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
|
3
|
+
require 'autotest/bundler'
|
4
|
+
require 'autotest/restart'
|
5
|
+
require 'autotest/timestamp'
|
6
|
+
|
7
|
+
def require_plugin(resource)
|
8
|
+
require resource
|
9
|
+
rescue LoadError
|
10
|
+
false
|
11
|
+
end
|
12
|
+
|
13
|
+
require_plugin 'autotest/clear'
|
14
|
+
|
15
|
+
Autotest.add_hook :initialize do |at|
|
16
|
+
# at.testlib = "minitest/unit"
|
17
|
+
#
|
18
|
+
# at.extra_files << "../some/external/dependency.rb"
|
19
|
+
#
|
20
|
+
# at.libs << ":../some/external"
|
21
|
+
#
|
22
|
+
# at.add_exception "vendor"
|
23
|
+
#
|
24
|
+
# at.add_mapping(/dependency.rb/) do |f, _|
|
25
|
+
# at.files_matching(/test_.*rb$/)
|
26
|
+
# end
|
27
|
+
#
|
28
|
+
# %w(TestA TestB).each do |klass|
|
29
|
+
# at.extra_class_map[klass] = "test/test_misc.rb"
|
30
|
+
# end
|
31
|
+
end
|
32
|
+
|
33
|
+
# Autotest.add_hook :run_command do |at|
|
34
|
+
# system "rake build"
|
35
|
+
# end
|
data/.gitignore
ADDED
data/.hoerc
CHANGED
@@ -1,12 +1,20 @@
|
|
1
|
-
---
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
1
|
+
---
|
2
|
+
exclude: !ruby/regexp '/
|
3
|
+
\.(tmp|swp)$
|
4
|
+
|
|
5
|
+
(CVS|tmp)\/
|
6
|
+
|
|
7
|
+
(?i:TAGS)
|
8
|
+
|
|
9
|
+
\.(svn|git|hg|DS_Store|idea|vagrant)\/
|
10
|
+
|
|
11
|
+
Gemfile(?:\.lock)?
|
12
|
+
|
|
13
|
+
\.(rubocop|coveralls|pullreview|travis).yml$
|
14
|
+
|
|
15
|
+
\.gemspec
|
16
|
+
|
|
17
|
+
\.byebug_history
|
18
|
+
|
|
19
|
+
Vagrantfile
|
20
|
+
/x'
|
@@ -0,0 +1,41 @@
|
|
1
|
+
== Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, and in the interest of
|
4
|
+
fostering an open and welcoming community, we pledge to respect all people who
|
5
|
+
contribute through reporting issues, posting feature requests, updating
|
6
|
+
documentation, submitting pull requests or patches, and other activities.
|
7
|
+
|
8
|
+
We are committed to making participation in this project a harassment-free
|
9
|
+
experience for everyone, regardless of level of experience, gender, gender
|
10
|
+
identity and expression, sexual orientation, disability, personal appearance,
|
11
|
+
body size, race, ethnicity, age, religion, or nationality.
|
12
|
+
|
13
|
+
Examples of unacceptable behavior by participants include:
|
14
|
+
|
15
|
+
* The use of sexualized language or imagery
|
16
|
+
* Personal attacks
|
17
|
+
* Trolling or insulting/derogatory comments
|
18
|
+
* Public or private harassment
|
19
|
+
* Publishing other's private information, such as physical or electronic
|
20
|
+
addresses, without explicit permission
|
21
|
+
* Other unethical or unprofessional conduct.
|
22
|
+
|
23
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
24
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
25
|
+
that are not aligned to this Code of Conduct. By adopting this Code of Conduct,
|
26
|
+
project maintainers commit themselves to fairly and consistently applying these
|
27
|
+
principles to every aspect of managing this project. Project maintainers who do
|
28
|
+
not follow or enforce the Code of Conduct may be permanently removed from the
|
29
|
+
project team.
|
30
|
+
|
31
|
+
This code of conduct applies both within project spaces and in public spaces
|
32
|
+
when an individual is representing the project or its community.
|
33
|
+
|
34
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
35
|
+
reported by opening an issue or contacting one or more of the project
|
36
|
+
maintainers.
|
37
|
+
|
38
|
+
This Code of Conduct is adapted from the
|
39
|
+
{Contributor Covenant}[http://contributor-covenant.org], version 1.2.0,
|
40
|
+
available at
|
41
|
+
{http://contributor-covenant.org/version/1/2/0/}[http://contributor-covenant.org/version/1/2/0/].
|
data/Contributing.rdoc
ADDED
@@ -0,0 +1,169 @@
|
|
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}[https://github.com/seattlerb/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}[http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html].
|
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 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
|
27
|
+
+type-lists+. The format is as shown below for the +application/xml+ MIME type
|
28
|
+
in +type-lists/application.yml+.
|
29
|
+
|
30
|
+
- !ruby/object:MIME::Type
|
31
|
+
content-type: application/xml
|
32
|
+
encoding: 8bit
|
33
|
+
extensions:
|
34
|
+
- xml
|
35
|
+
- xsl
|
36
|
+
xrefs: !ruby/hash:MIME::Types::Container
|
37
|
+
rfc:
|
38
|
+
- rfc3023
|
39
|
+
registered: true
|
40
|
+
|
41
|
+
There are other fields that can be added, matching the fields discussed in the
|
42
|
+
documentation for MIME::Type. Pull requests for MIME types should just contain
|
43
|
+
the changes to the YAML files for the new or modified MIME types; I will
|
44
|
+
convert the YAML files to JSON prior to a new release. I would rather not have
|
45
|
+
to verify that the JSON matches the YAML changes, which is why it is not
|
46
|
+
necessary to convert for the pull request.
|
47
|
+
|
48
|
+
If you are making a change for a private fork, use <tt>rake
|
49
|
+
convert:yaml:json</tt> to convert the YAML to JSON, or <tt>rake
|
50
|
+
convert:yaml:columnar</tt> to convert it to the new columnar format.
|
51
|
+
|
52
|
+
==== Updating Types from the IANA or Apache Lists
|
53
|
+
|
54
|
+
If you are maintaining a private fork and wish to update your copy of the MIME
|
55
|
+
types registry used by this gem, you can do this with the rake tasks:
|
56
|
+
|
57
|
+
$ rake mime:iana
|
58
|
+
$ rake mime:apache
|
59
|
+
|
60
|
+
Both of these require
|
61
|
+
{Nokogiri}[http://www.nokogiri.org/tutorials/installing_nokogiri.html], which
|
62
|
+
is not installed by default. Install it in the usual way for your Ruby.
|
63
|
+
|
64
|
+
=== Test Dependencies
|
65
|
+
|
66
|
+
mime-types uses Ryan Davis’s {Hoe}[https://github.com/seattlerb/hoe] to manage
|
67
|
+
the release process, and it adds a number of rake tasks. You will mostly be
|
68
|
+
interested in:
|
69
|
+
|
70
|
+
$ rake
|
71
|
+
|
72
|
+
which runs the tests the same way that:
|
73
|
+
|
74
|
+
$ rake test
|
75
|
+
$ rake travis
|
76
|
+
|
77
|
+
will do.
|
78
|
+
|
79
|
+
To assist with the installation of the development dependencies for mime-types,
|
80
|
+
I have provided the simplest possible Gemfile pointing to the (generated)
|
81
|
+
+mime-types.gemspec+ file. This will permit you to do:
|
82
|
+
|
83
|
+
$ bundle install
|
84
|
+
|
85
|
+
to get the development dependencies. If you aleady have +hoe+ installed, you
|
86
|
+
can accomplish the same thing with:
|
87
|
+
|
88
|
+
$ rake newb
|
89
|
+
|
90
|
+
This task will install any missing dependencies, run the tests/specs, and
|
91
|
+
generate the RDoc.
|
92
|
+
|
93
|
+
You can run tests with code coverage analysis by running:
|
94
|
+
|
95
|
+
$ rake test:coverage
|
96
|
+
|
97
|
+
=== Benchmarks
|
98
|
+
|
99
|
+
mime-types offers several benchmark tasks to measure different measures of
|
100
|
+
performance.
|
101
|
+
|
102
|
+
There is a repeated load test, measuring how long it takes to start and load
|
103
|
+
mime-types with its full registry. By default, it runs fifty loops and uses the
|
104
|
+
built-in benchmark library.
|
105
|
+
|
106
|
+
$ rake benchmark:load
|
107
|
+
|
108
|
+
There are two allocation tracing benchmarks (for normal and columnar loads).
|
109
|
+
These can only be run on Ruby 2.1 or better and requires the
|
110
|
+
{allocation_tracer}[https://github.com/ko1/allocation_tracer] gem (not
|
111
|
+
installed by default).
|
112
|
+
|
113
|
+
$ rake benchmark:allocations
|
114
|
+
$ rake benchmark:allocations:columnar
|
115
|
+
|
116
|
+
There are two loaded object count benchmarks (for normal and columnar loads).
|
117
|
+
These use <tt>ObjectSpace.count_objects</tt>.
|
118
|
+
|
119
|
+
$ rake benchmark:objects
|
120
|
+
$ rake benchmark:objects:columnar
|
121
|
+
|
122
|
+
=== Workflow
|
123
|
+
|
124
|
+
Here's the most direct way to get your work merged into the project:
|
125
|
+
|
126
|
+
* Fork the project.
|
127
|
+
* Clone down your fork (<tt>git clone git://github.com/<username>/ruby-mime-types.git</tt>).
|
128
|
+
* Create a topic branch to contain your change (<tt>git checkout -b my\_awesome\_feature</tt>).
|
129
|
+
* Hack away, add tests. Not necessarily in that order.
|
130
|
+
* Make sure everything still passes by running +rake+.
|
131
|
+
* If necessary, rebase your commits into logical chunks, without errors.
|
132
|
+
* Push the branch up (<tt>git push origin my\_awesome\_feature</tt>).
|
133
|
+
* Create a pull request against mime-types/ruby-mime-types and describe what
|
134
|
+
your change does and the why you think it should be merged.
|
135
|
+
|
136
|
+
=== Contributors
|
137
|
+
|
138
|
+
* Austin Ziegler created mime-types.
|
139
|
+
|
140
|
+
Thanks to everyone else who has contributed to mime-types:
|
141
|
+
|
142
|
+
* Aaron Patterson
|
143
|
+
* Aggelos Avgerinos
|
144
|
+
* Andre Pankratz
|
145
|
+
* Andy Brody
|
146
|
+
* Arnaud Meuret
|
147
|
+
* Brandon Galbraith
|
148
|
+
* Chris Gat
|
149
|
+
* David Genord
|
150
|
+
* Eric Marden
|
151
|
+
* Garret Alfert
|
152
|
+
* Godfrey Chan
|
153
|
+
* Greg Brockman
|
154
|
+
* Hans de Graaff
|
155
|
+
* Henrik Hodne
|
156
|
+
* Jeremy Evans
|
157
|
+
* Juanito Fatas
|
158
|
+
* Łukasz Śliwa
|
159
|
+
* Keerthi Siva
|
160
|
+
* Ken Ip
|
161
|
+
* Martin d'Allens
|
162
|
+
* Mauricio Linhares
|
163
|
+
* nycvotes-dev
|
164
|
+
* Postmodern
|
165
|
+
* Richard Hirner
|
166
|
+
* Richard Hurt
|
167
|
+
* Richard Schneeman
|
168
|
+
* Tibor Szolár
|
169
|
+
* Todd Carrico
|