== Contributing I value any contribution to mime-types you can provide: a bug report, a feature request, or code contributions. There are a few guidelines for contributing to mime-types: * Code changes *will* *not* be accepted without tests. The test suite is written with {Minitest}[https://github.com/seattlerb/minitest]. * Match my coding style. * Use a thoughtfully-named topic branch that contains your change. Rebase your commits into logical chunks as necessary. * Use {quality commit messages}[http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html]. * 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. === Adding or Modifying MIME Types The mime-types registry is loaded from encoded files in +data+. These are not editable and cannot be compared meaningfully in a pull request; 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 +type-lists+. The format is as shown below for the +application/xml+ MIME type in +type-lists/application.yml+. - !ruby/object:MIME::Type content-type: application/xml encoding: 8bit extensions: - xml - xsl xrefs: !ruby/hash:MIME::Types::Container 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: $ rake mime:iana $ rake mime:apache Both of these require {Nokogiri}[http://www.nokogiri.org/tutorials/installing_nokogiri.html], which is not installed by default. Install it in the usual way for your Ruby. === Test Dependencies mime-types 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: $ rake which runs the tests the same way that: $ rake test $ rake travis will do. To assist with the installation of the development dependencies for mime-types, I have provided the simplest possible Gemfile pointing to the (generated) +mime-types.gemspec+ file. This will permit you to do: $ bundle install to get the development dependencies. If you aleady have +hoe+ installed, you can accomplish the same thing with: $ 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: $ rake test:coverage === Benchmarks mime-types offers several benchmark tasks to measure different measures of performance. There is a repeated load test, measuring how long it takes to start and load mime-types with its full registry. By default, it runs fifty loops and uses the built-in benchmark library. $ rake benchmark:load There are two allocation tracing benchmarks (for normal and columnar loads). These can only be run on Ruby 2.1 or better and requires the {allocation_tracer}[https://github.com/ko1/allocation_tracer] gem (not installed by default). $ rake benchmark:allocations $ rake benchmark:allocations:columnar There are two loaded object count benchmarks (for normal and columnar loads). These use ObjectSpace.count_objects. $ rake benchmark:objects $ rake benchmark:objects:columnar === 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//ruby-mime-types.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/ruby-mime-types and describe what your change does and the why you think it should be merged. === Contributors * Austin Ziegler created mime-types. Thanks to everyone else who has contributed to mime-types: * Aaron Patterson * Aggelos Avgerinos * Andre Pankratz * Andy Brody * Arnaud Meuret * Brandon Galbraith * Chris Gat * David Genord * Eric Marden * Garret Alfert * Godfrey Chan * Greg Brockman * Hans de Graaff * Henrik Hodne * Jeremy Evans * Juanito Fatas * Łukasz Śliwa * Keerthi Siva * Ken Ip * Martin d'Allens * Mauricio Linhares * nycvotes-dev * Postmodern * Richard Hirner * Richard Hurt * Richard Schneeman * Tibor Szolár * Todd Carrico