1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 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 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244
|
## Contributing
Contributions to mime-types-data is encouraged in any form: a bug report, new
MIME type definitions, or additional code to help manage the MIME types. As with
many of my projects, I have a few suggestions for improving the chance of
acceptance of your code contributions:
- The support files are written in Ruby and should remain in the coding style
that already exists, and I use hoe for releasing the mime-types-data RubyGem.
- Use a thoughtfully-named topic branch that contains your change. Rebase your
commits into logical chunks as necessary.
- Use [quality commit messages][qcm].
- Do not change the version number; when your patch is accepted and a release
is made, the version will be updated at that point.
- Submit a GitHub pull request with your changes.
- New or changed behaviours require new or updated documentation.
Although mime-types-data was extracted from the [Ruby mime-types][rmt] gem and
the support files are written in Ruby, the _target_ of mime-types-data is any
implementation that wishes to use the data as a MIME types registry, so I am
particularly interested in tools that will create a mime-types-data package for
other languages.
### Adding or Modifying MIME Types
The Ruby mime-types gem loads its data from files encoded in the `data`
directory in this gem by loading `mime-types-data` and reading
MIME::Types::Data::PATH. These files are compiled files from the collection of
data in the `types` directory. Pull requests that include changes to these files
will require amendment to revert these files.
New or modified MIME types should be edited in the appropriate YAML file under
`types`. The format is as shown below for the `application/xml` MIME type in
`types/application.yml`.
```yaml
- !ruby/object:MIME::Type
content-type: application/xml
encoding: 8bit
extensions:
- xml
- xsl
references:
- IANA
- RFC3023
xrefs:
rfc:
- rfc3023
registered: true
```
There are other fields that can be added, matching the fields discussed in the
documentation for MIME::Type. Pull requests for MIME types should just contain
the changes to the YAML files for the new or modified MIME types; I will convert
the YAML files to JSON prior to a new release. I would rather not have to verify
that the JSON matches the YAML changes, which is why it is not necessary to
convert for the pull request.
If you are making a change for a private fork, use `rake convert:yaml:json` to
convert the YAML to JSON, or `rake convert:yaml:columnar` to convert it to the
new columnar format.
#### Updating Types from the IANA or Apache Lists
If you are maintaining a private fork and wish to update your copy of the MIME
types registry used by this gem, you can do this with the rake tasks:
```sh
$ rake mime:iana
$ rake mime:apache
```
##### A Note on Provisional Types
The file `types/provisional-standard-types.yaml` contains the provisionally
registered types from IANA. Per IANA,
> This registry, unlike some other provisional IANA registries, is only for
> temporary use. Entries in this registry are either finalized and moved to the
> main media types registry or are abandoned and deleted. Entries in this
> registry are suitable for use for development and test purposes only.
The provisional types file is rewritten when updated, so pull requests to
manually promote or customize provisional types (such as with extensions). It is
recommended that any updates required to the data be performed in your
application if you require provisional types.
### Development Dependencies
mime-types-data uses Ryan Davis’s {Hoe}[https://github.com/seattlerb/hoe] to
manage the release process, and it adds a number of rake tasks. You will mostly
be interested in:
```sh
$ rake
```
which runs the tests the same way that:
```sh
$ rake test
$ rake travis
```
will do.
To assist with the installation of the development dependencies for
mime-types-data, I have provided the simplest possible Gemfile pointing to the
(generated) `mime-types-data.gemspec` file. This will permit you to do:
```sh
$ bundle install
```
to get the development dependencies. If you aleady have `hoe` installed, you
can accomplish the same thing with:
```sh
$ rake newb
```
This task will install any missing dependencies, run the tests/specs, and
generate the RDoc.
You can run tests with code coverage analysis by running:
```sh
$ rake test:coverage
```
### Workflow
Here's the most direct way to get your work merged into the project:
- Fork the project.
- Clone down your fork (`git clone git://github.com/<username>/mime-types-data.git`).
- Create a topic branch to contain your change (`git checkout -b my\_awesome\_feature`).
- Hack away, add tests. Not necessarily in that order.
- Make sure everything still passes by running `rake`.
- If necessary, rebase your commits into logical chunks, without errors.
- Push the branch up (`git push origin my\_awesome\_feature`).
- Create a pull request against mime-types/mime-types-data and describe what
your change does and the why you think it should be merged.
### The Release Process
The release process needs automation; as it includes generating code and
committing to the repository, it is not clear how this will happen safely.
1. Review any outstanding issues or pull requests to see if anything needs to be
addressed. This is necessary because there is currently no automated source
for extensions for the thousands of MIME entries. (Suggestions and/or pull
requests for same would be deeply appreciated.)
2. `bundle install`
3. `bundle exec rake mime:apache`
4. `bundle exec rake mime:iana`
5. Review the changes to make sure that the changes are sane. The IANA data
source changes from time to time, resulting in big changes or even a broken
step 4. (The most recent change was the addition of the font/\* top-level
category.)
6. `bundle exec rake convert`
7. `bundle exec rake update:version`
8. Write up the changes in History.md. If any PRs have been merged, these should
be noted specifically.
9. Commit the changes and push to GitHub.
10. `bundle exec rake release VERSION=newversion`
### Automating the Release
If anyone wishes to provide suggestions on automation, this would be a two-phase
process:
1. A system would need to periodically create PRs to the GitHub repository with
the output of the following commands (steps 2, 3, and 4):
```sh
bundle install
bundle exec rake mime:apache
bundle exec rake mime:iana
git add .
git commit -m "[Automated] MIME Type update for $(date)"
# Somehow make the PR from here.
```
2. Once this PR is approved and merged, the next steps would be conversion,
version update, automatic update of History.md, and release (steps 6–10).
This is based on an issue [#18][].
### Contributors
- Austin Ziegler created mime-types.
Thanks to everyone else who has contributed to mime-types:
- Aaron Patterson
- Aggelos Avgerinos
- Alessio Parma
- Alex Balhatchet
- Andre Pankratz
- Andrey Eremin
- Andy Brody
- Arnaud Meuret
- Bradley Meck
- Brandon Galbraith
- Chris Gat
- Chris Salzberg
- David Genord
- Eric Marden
- Garret Alfert
- Godfrey Chan
- Greg Brockman
- Hans de Graaff
- Henrik Hodne
- Jeremy Evans
- John Gardner
- Jon Sneyers
- Jonas Petersen
- Juanito Fatas
- Keerthi Siva
- Ken Ip
- Łukasz Śliwa
- Lucia
- Martin d'Allens
- Mauricio Linhares
- Mohammed Gad
- Myk Klemme
- nycvotes-dev
- Postmodern
- Richard Hirner
- Richard Hurt
- Richard Schneeman
- Robert Buchberger
- Samuel Williams
- Sergio Baptista
- Tao Guo
- Thomas Leese
- Tibor Szolár
- Todd Carrico
- Yoran Brondsema
[qcm]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
[rmt]: https://github.com/mime-types/ruby-mime-types/
[#18]: https://github.com/mime-types/mime-types-data/issues/18
|