-
-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 3 bug fixes * A test for MIME::Types::Cache fails under Ruby 2.3 because of frozen strings #118. This has been fixed. * The JSON data has been incorrectly encoded since the release of mime-types 3 on the +xrefs+ field, because of the switch to using a Set to store cross-reference information. This has been fixed. * A tentative fix for #117 has been applied, removing the only circular require dependencies that exist (and for which there was code to prevent, but the current fix is simpler). I have no way to verify this fix and depending on how things are loaded by `delayed_job`, this fix may not be sufficient. * 1 governance change * Updated to Contributor Covenant 1.4.
- Loading branch information
1 parent
a46e29d
commit aa499d1
Showing
15 changed files
with
343 additions
and
275 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,74 @@ | ||
== Contributor Code of Conduct | ||
== Contributor Covenant Code of Conduct | ||
|
||
As contributors and maintainers of this project, and in the interest of | ||
fostering an open and welcoming community, we pledge to respect all people who | ||
contribute through reporting issues, posting feature requests, updating | ||
documentation, submitting pull requests or patches, and other activities. | ||
## Our Pledge | ||
|
||
We are committed to making participation in this project a harassment-free | ||
experience for everyone, regardless of level of experience, gender, gender | ||
identity and expression, sexual orientation, disability, personal appearance, | ||
body size, race, ethnicity, age, religion, or nationality. | ||
In the interest of fostering an open and welcoming environment, we as | ||
contributors and maintainers pledge to making participation in our project and | ||
our community a harassment-free experience for everyone, regardless of age, | ||
body size, disability, ethnicity, gender identity and expression, level of | ||
experience, nationality, personal appearance, race, religion, or sexual | ||
identity and orientation. | ||
|
||
=== Our Standards | ||
|
||
Examples of behavior that contributes to creating a positive environment | ||
include: | ||
|
||
* Using welcoming and inclusive language | ||
* Being respectful of differing viewpoints and experiences | ||
* Gracefully accepting constructive criticism | ||
* Focusing on what is best for the community | ||
* Showing empathy towards other community members | ||
|
||
Examples of unacceptable behavior by participants include: | ||
|
||
* The use of sexualized language or imagery | ||
* Personal attacks | ||
* Trolling or insulting/derogatory comments | ||
* The use of sexualized language or imagery and unwelcome sexual attention or | ||
advances | ||
* Trolling, insulting/derogatory comments, and personal or political attacks | ||
* Public or private harassment | ||
* Publishing other's private information, such as physical or electronic | ||
addresses, without explicit permission | ||
* Other unethical or unprofessional conduct. | ||
* Publishing others' private information, such as a physical or electronic | ||
address, without explicit permission | ||
* Other conduct which could reasonably be considered inappropriate in a | ||
professional setting | ||
|
||
=== Our Responsibilities | ||
|
||
Project maintainers are responsible for clarifying the standards of acceptable | ||
behavior and are expected to take appropriate and fair corrective action in | ||
response to any instances of unacceptable behavior. | ||
|
||
Project maintainers have the right and responsibility to remove, edit, or | ||
reject comments, commits, code, wiki edits, issues, and other contributions | ||
that are not aligned to this Code of Conduct. By adopting this Code of Conduct, | ||
project maintainers commit themselves to fairly and consistently applying these | ||
principles to every aspect of managing this project. Project maintainers who do | ||
not follow or enforce the Code of Conduct may be permanently removed from the | ||
project team. | ||
that are not aligned to this Code of Conduct, or to ban temporarily or | ||
permanently any contributor for other behaviors that they deem inappropriate, | ||
threatening, offensive, or harmful. | ||
|
||
This code of conduct applies both within project spaces and in public spaces | ||
when an individual is representing the project or its community. | ||
=== Scope | ||
|
||
This Code of Conduct applies both within project spaces and in public spaces | ||
when an individual is representing the project or its community. Examples of | ||
representing a project or community include using an official project e-mail | ||
address, posting via an official social media account, or acting as an | ||
appointed representative at an online or offline event. Representation of a | ||
project may be further defined and clarified by project maintainers. | ||
|
||
=== Enforcement | ||
|
||
Instances of abusive, harassing, or otherwise unacceptable behavior may be | ||
reported by opening an issue or contacting one or more of the project | ||
maintainers. | ||
reported by contacting the project team at [INSERT EMAIL ADDRESS]. All | ||
complaints will be reviewed and investigated and will result in a response that | ||
is deemed necessary and appropriate to the circumstances. The project team is | ||
obligated to maintain confidentiality with regard to the reporter of an | ||
incident. Further details of specific enforcement policies may be posted | ||
separately. | ||
|
||
Project maintainers who do not follow or enforce the Code of Conduct in good | ||
faith may face temporary or permanent repercussions as determined by other | ||
members of the project's leadership. | ||
|
||
=== Attribution | ||
|
||
This Code of Conduct is adapted from the | ||
{Contributor Covenant}[http://contributor-covenant.org], version 1.2.0, | ||
This Code of Conduct is adapted from the {Contributor | ||
Covenant}[http://contributor-covenant.org], version 1.4, | ||
available at | ||
{http://contributor-covenant.org/version/1/2/0/}[http://contributor-covenant.org/version/1/2/0/]. | ||
{http://contributor-covenant.org/version/1/4/}[http://contributor-covenant.org/version/1/4/]. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
require 'mime/type/columnar' | ||
|
||
# MIME::Types::Columnar is used to extend a MIME::Types container to load data | ||
# by columns instead of from JSON or YAML. Column loads of MIME types loaded | ||
# through the columnar store are synchronized with a Mutex. | ||
# | ||
# MIME::Types::Columnar is not intended to be used directly, but will be added | ||
# to an instance of MIME::Types when it is loaded with | ||
# MIME::Types::Loader#load_columnar. | ||
module MIME::Types::Columnar | ||
LOAD_MUTEX = Mutex.new # :nodoc: | ||
|
||
def self.extended(obj) # :nodoc: | ||
super | ||
obj.instance_variable_set(:@__mime_data__, []) | ||
obj.instance_variable_set(:@__files__, Set.new) | ||
end | ||
|
||
# Load the first column data file (type and extensions). | ||
def load_base_data(path) #:nodoc: | ||
@__root__ = path | ||
|
||
each_file_line('content_type', false) do |line| | ||
line = line.split | ||
content_type = line.shift | ||
extensions = line | ||
# content_type, *extensions = line.split | ||
|
||
type = MIME::Type::Columnar.new(self, content_type, extensions) | ||
@__mime_data__ << type | ||
add(type) | ||
end | ||
|
||
self | ||
end | ||
|
||
private | ||
|
||
def each_file_line(name, lookup = true) | ||
LOAD_MUTEX.synchronize do | ||
next if @__files__.include?(name) | ||
|
||
i = -1 | ||
column = File.join(@__root__, "mime.#{name}.column") | ||
|
||
IO.readlines(column, encoding: 'UTF-8'.freeze).each do |line| | ||
line.chomp! | ||
|
||
if lookup | ||
type = @__mime_data__[i += 1] or next | ||
yield type, line | ||
else | ||
yield line | ||
end | ||
end | ||
|
||
@__files__ << name | ||
end | ||
end | ||
|
||
def load_encoding | ||
each_file_line('encoding') do |type, line| | ||
pool ||= {} | ||
line.freeze | ||
type.instance_variable_set(:@encoding, (pool[line] ||= line)) | ||
end | ||
end | ||
|
||
def load_docs | ||
each_file_line('docs') do |type, line| | ||
type.instance_variable_set(:@docs, opt(line)) | ||
end | ||
end | ||
|
||
def load_preferred_extension | ||
each_file_line('pext') do |type, line| | ||
type.instance_variable_set(:@preferred_extension, opt(line)) | ||
end | ||
end | ||
|
||
def load_flags | ||
each_file_line('flags') do |type, line| | ||
line = line.split | ||
type.instance_variable_set(:@obsolete, flag(line.shift)) | ||
type.instance_variable_set(:@registered, flag(line.shift)) | ||
type.instance_variable_set(:@signature, flag(line.shift)) | ||
end | ||
end | ||
|
||
def load_xrefs | ||
each_file_line('xrefs') { |type, line| | ||
type.instance_variable_set(:@xrefs, dict(line, array: true)) | ||
} | ||
end | ||
|
||
def load_friendly | ||
each_file_line('friendly') { |type, line| | ||
type.instance_variable_set(:@friendly, dict(line)) | ||
} | ||
end | ||
|
||
def load_use_instead | ||
each_file_line('use_instead') do |type, line| | ||
type.instance_variable_set(:@use_instead, opt(line)) | ||
end | ||
end | ||
|
||
def dict(line, array: false) | ||
if line == '-'.freeze | ||
{} | ||
else | ||
line.split('|'.freeze).each_with_object({}) { |l, h| | ||
k, v = l.split('^'.freeze) | ||
v = nil if v.empty? | ||
h[k] = array ? Array(v) : v | ||
} | ||
end | ||
end | ||
|
||
def arr(line) | ||
if line == '-'.freeze | ||
[] | ||
else | ||
line.split('|'.freeze).flatten.compact.uniq | ||
end | ||
end | ||
|
||
def opt(line) | ||
line unless line == '-'.freeze | ||
end | ||
|
||
def flag(line) | ||
line == '1'.freeze ? true : false | ||
end | ||
end |
Oops, something went wrong.