summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAustin Ziegler <austin@zieglers.ca>2016-05-22 17:00:21 -0400
committerAustin Ziegler <austin@zieglers.ca>2016-05-22 17:00:21 -0400
commitaa499d1ea849584c7e2e63518f10289e76c00ec6 (patch)
treeadd188b0ab1d60e770233f760e994808e1dcb5bc
parenta46e29dcd0aac9782b78d54a24f5c6a78a9bab91 (diff)
downloadmime-types-aa499d1ea849584c7e2e63518f10289e76c00ec6.tar.gz
mime-types 3.1 (#120)v3.1
* 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.
-rw-r--r--.hoerc24
-rw-r--r--Code-of-Conduct.rdoc87
-rw-r--r--History.rdoc23
-rw-r--r--Manifest.txt11
-rw-r--r--Rakefile1
-rw-r--r--lib/mime/type.rb11
-rw-r--r--lib/mime/types.rb10
-rw-r--r--lib/mime/types/_columnar.rb135
-rw-r--r--lib/mime/types/columnar.rb143
-rw-r--r--lib/mime/types/full.rb4
-rw-r--r--mime-types.gemspec133
-rw-r--r--test/minitest_helper.rb1
-rw-r--r--test/test_mime_types.rb2
-rw-r--r--test/test_mime_types_cache.rb31
-rw-r--r--test/test_mime_types_class.rb2
15 files changed, 343 insertions, 275 deletions
diff --git a/.hoerc b/.hoerc
index 15b72d5..d31a3d5 100644
--- a/.hoerc
+++ b/.hoerc
@@ -2,19 +2,27 @@
exclude: !ruby/regexp '/
\.(tmp|swp)$
|
- (CVS|tmp)\/
+ \.(?:autotest|gemtest|gitignore|hoerc|minitest.rb|simplecov-prelude.rb)
|
- (?i:TAGS)
+ ^(?i:TAGS)
|
- \.(svn|git|hg|DS_Store|idea|vagrant)\/
+ \.(?:
+ DS_Store|
+ bundle|
+ git|
+ hg|
+ idea|
+ svn|
+ vagrant
+ )\/
|
- Gemfile(?:\.lock)?
+ [gG]emfile(?:\.lock)?
|
- \.(rubocop|coveralls|pullreview|travis).yml$
+ support\/
|
- \.gemspec
+ \.(?:coveralls|pullreview|travis|rubocop.*)\.yml
|
- \.byebug_history
+ .byebug_history
|
- Vagrantfile
+ \.gemspec$
/x'
diff --git a/Code-of-Conduct.rdoc b/Code-of-Conduct.rdoc
index 848f7df..d7be506 100644
--- a/Code-of-Conduct.rdoc
+++ b/Code-of-Conduct.rdoc
@@ -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/].
diff --git a/History.rdoc b/History.rdoc
index b797fd3..22dcf2d 100644
--- a/History.rdoc
+++ b/History.rdoc
@@ -1,4 +1,4 @@
-== NEXT / 2016-MM-DD
+== 3.1 / 2016-05-22
* 1 documentation change:
@@ -6,6 +6,27 @@
readability on high-density (retina) screens with pull request
{#112}[https://github.com/mime-types/ruby-mime-types/pull/112].
+* 3 bug fixes
+
+ * A test for MIME::Types::Cache fails under Ruby 2.3 because of frozen
+ strings, {#118}[https://github.com/mime-types/ruby-mime-types/issues/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}[https://github.com/mime-types/ruby-mime-types/issues/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}[Code-of-Conduct_rdoc.html].
+
== 3.0 / 2015-11-21
* 2 governance changes
diff --git a/Manifest.txt b/Manifest.txt
index 3ac143e..8324a52 100644
--- a/Manifest.txt
+++ b/Manifest.txt
@@ -1,7 +1,3 @@
-.autotest
-.gemtest
-.gitignore
-.hoerc
Code-of-Conduct.rdoc
Contributing.rdoc
History.rdoc
@@ -13,6 +9,7 @@ lib/mime-types.rb
lib/mime/type.rb
lib/mime/type/columnar.rb
lib/mime/types.rb
+lib/mime/types/_columnar.rb
lib/mime/types/cache.rb
lib/mime/types/columnar.rb
lib/mime/types/container.rb
@@ -21,12 +18,6 @@ lib/mime/types/full.rb
lib/mime/types/loader.rb
lib/mime/types/logger.rb
lib/mime/types/registry.rb
-support/benchmarks/load.rb
-support/benchmarks/load_allocations.rb
-support/benchmarks/object_counts.rb
-support/profile/columnar.rb
-support/profile/columnar_full.rb
-support/profile/full.rb
test/bad-fixtures/malformed
test/fixture/json.json
test/fixture/old-data
diff --git a/Rakefile b/Rakefile
index 86a0697..4e249bf 100644
--- a/Rakefile
+++ b/Rakefile
@@ -33,6 +33,7 @@ spec = Hoe.spec 'mime-types' do
extra_dev_deps << ['minitest-autotest', '~> 1.0']
extra_dev_deps << ['minitest-focus', '~> 1.0']
extra_dev_deps << ['minitest-bonus-assertions', '~> 2.0']
+ extra_dev_deps << ['minitest-hooks', '~> 1.4']
extra_dev_deps << ['rake', '~> 10.0']
extra_dev_deps << ['fivemat', '~> 1.3' ]
extra_dev_deps << ['minitest-rg', '~> 5.2']
diff --git a/lib/mime/type.rb b/lib/mime/type.rb
index c62cf32..df0aac9 100644
--- a/lib/mime/type.rb
+++ b/lib/mime/type.rb
@@ -55,7 +55,7 @@ class MIME::Type
end
# The released version of the mime-types library.
- VERSION = '3.0'
+ VERSION = '3.1'
include Comparable
@@ -450,7 +450,14 @@ class MIME::Type
coder['obsolete'] = obsolete?
coder['use-instead'] = use_instead if use_instead
end
- coder['xrefs'] = xrefs unless xrefs.empty?
+ unless xrefs.empty?
+ {}.tap do |hash|
+ xrefs.each do |k, v|
+ hash[k] = v.sort.to_a
+ end
+ coder['xrefs'] = hash
+ end
+ end
coder['registered'] = registered?
coder['signature'] = signature? if signature?
coder
diff --git a/lib/mime/types.rb b/lib/mime/types.rb
index cd9b3ae..26277b3 100644
--- a/lib/mime/types.rb
+++ b/lib/mime/types.rb
@@ -5,11 +5,7 @@ module MIME
end
end
-require 'mime/types/logger'
-require 'mime/types/container'
require 'mime/type'
-require 'mime/types/cache'
-require 'mime/types/loader'
# MIME::Types is a registry of MIME types. It is both a class (created with
# MIME::Types.new) and a default registry (loaded automatically or through
@@ -224,5 +220,9 @@ Type #{type} is already registered as a variant of #{type.simplified}.
end
end
-require 'mime/types/columnar' unless defined?(MIME::Types::Columnar)
+require 'mime/types/cache'
+require 'mime/types/container'
+require 'mime/types/loader'
+require 'mime/types/logger'
+require 'mime/types/_columnar'
require 'mime/types/registry'
diff --git a/lib/mime/types/_columnar.rb b/lib/mime/types/_columnar.rb
new file mode 100644
index 0000000..acafbb9
--- /dev/null
+++ b/lib/mime/types/_columnar.rb
@@ -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
diff --git a/lib/mime/types/columnar.rb b/lib/mime/types/columnar.rb
index e018941..fc219b8 100644
--- a/lib/mime/types/columnar.rb
+++ b/lib/mime/types/columnar.rb
@@ -1,142 +1 @@
-module MIME
- class Types
- end
-end
-
-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
-
-require 'mime/types' unless defined?(MIME::Types::VERSION)
+require 'mime/types'
diff --git a/lib/mime/types/full.rb b/lib/mime/types/full.rb
index 2023f54..cf2dc0c 100644
--- a/lib/mime/types/full.rb
+++ b/lib/mime/types/full.rb
@@ -10,8 +10,8 @@ module MIME
{ columnar: false }
end
end
-
- require 'mime/types'
end
end
end
+
+require 'mime/types'
diff --git a/mime-types.gemspec b/mime-types.gemspec
index 7c92e0a..816365c 100644
--- a/mime-types.gemspec
+++ b/mime-types.gemspec
@@ -1,79 +1,82 @@
# -*- encoding: utf-8 -*-
-# stub: mime-types 3.0 ruby lib
+# stub: mime-types 3.1 ruby lib
Gem::Specification.new do |s|
- s.name = "mime-types"
- s.version = "3.0"
+ s.name = "mime-types".freeze
+ s.version = "3.1"
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
- s.require_paths = ["lib"]
- s.authors = ["Austin Ziegler"]
- s.date = "2015-11-21"
- s.description = "The mime-types library provides a library and registry for information about\nMIME content type definitions. It can be used to determine defined filename\nextensions for MIME types, or to use filename extensions to look up the likely\nMIME type definitions.\n\nThis is release 3.0\u{2026}"
- s.email = ["halostatue@gmail.com"]
- s.extra_rdoc_files = ["Code-of-Conduct.rdoc", "Contributing.rdoc", "History.rdoc", "Licence.rdoc", "Manifest.txt", "README.rdoc"]
- s.files = [".autotest", ".gemtest", ".gitignore", ".hoerc", "Code-of-Conduct.rdoc", "Contributing.rdoc", "History.rdoc", "Licence.rdoc", "Manifest.txt", "README.rdoc", "Rakefile", "lib/mime-types.rb", "lib/mime/type.rb", "lib/mime/type/columnar.rb", "lib/mime/types.rb", "lib/mime/types/cache.rb", "lib/mime/types/columnar.rb", "lib/mime/types/container.rb", "lib/mime/types/deprecations.rb", "lib/mime/types/full.rb", "lib/mime/types/loader.rb", "lib/mime/types/logger.rb", "lib/mime/types/registry.rb", "support/benchmarks/load.rb", "support/benchmarks/load_allocations.rb", "support/benchmarks/object_counts.rb", "support/profile/columnar.rb", "support/profile/columnar_full.rb", "support/profile/full.rb", "test/bad-fixtures/malformed", "test/fixture/json.json", "test/fixture/old-data", "test/fixture/yaml.yaml", "test/minitest_helper.rb", "test/test_mime_type.rb", "test/test_mime_types.rb", "test/test_mime_types_cache.rb", "test/test_mime_types_class.rb", "test/test_mime_types_lazy.rb", "test/test_mime_types_loader.rb"]
- s.homepage = "https://github.com/mime-types/ruby-mime-types/"
- s.licenses = ["MIT"]
- s.rdoc_options = ["--main", "README.rdoc"]
- s.required_ruby_version = Gem::Requirement.new(">= 2.0")
- s.rubygems_version = "2.4.8"
- s.summary = "The mime-types library provides a library and registry for information about MIME content type definitions"
+ s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
+ s.require_paths = ["lib".freeze]
+ s.authors = ["Austin Ziegler".freeze]
+ s.date = "2016-05-22"
+ s.description = "The mime-types library provides a library and registry for information about\nMIME content type definitions. It can be used to determine defined filename\nextensions for MIME types, or to use filename extensions to look up the likely\nMIME type definitions.\n\nVersion 3.0 is a major release that requires Ruby 2.0 compatibility and removes\ndeprecated functions. The columnar registry format introduced in 2.6 has been\nmade the primary format; the registry data has been extracted from this library\nand put into {mime-types-data}[https://github.com/mime-types/mime-types-data].\nAdditionally, mime-types is now licensed exclusively under the MIT licence and\nthere is a code of conduct in effect. There are a number of other smaller\nchanges described in the History file.".freeze
+ s.email = ["halostatue@gmail.com".freeze]
+ s.extra_rdoc_files = ["Code-of-Conduct.rdoc".freeze, "Contributing.rdoc".freeze, "History.rdoc".freeze, "Licence.rdoc".freeze, "Manifest.txt".freeze, "README.rdoc".freeze]
+ s.files = ["Code-of-Conduct.rdoc".freeze, "Contributing.rdoc".freeze, "History.rdoc".freeze, "Licence.rdoc".freeze, "Manifest.txt".freeze, "README.rdoc".freeze, "Rakefile".freeze, "lib/mime-types.rb".freeze, "lib/mime/type.rb".freeze, "lib/mime/type/columnar.rb".freeze, "lib/mime/types.rb".freeze, "lib/mime/types/_columnar.rb".freeze, "lib/mime/types/cache.rb".freeze, "lib/mime/types/columnar.rb".freeze, "lib/mime/types/container.rb".freeze, "lib/mime/types/deprecations.rb".freeze, "lib/mime/types/full.rb".freeze, "lib/mime/types/loader.rb".freeze, "lib/mime/types/logger.rb".freeze, "lib/mime/types/registry.rb".freeze, "test/bad-fixtures/malformed".freeze, "test/fixture/json.json".freeze, "test/fixture/old-data".freeze, "test/fixture/yaml.yaml".freeze, "test/minitest_helper.rb".freeze, "test/test_mime_type.rb".freeze, "test/test_mime_types.rb".freeze, "test/test_mime_types_cache.rb".freeze, "test/test_mime_types_class.rb".freeze, "test/test_mime_types_lazy.rb".freeze, "test/test_mime_types_loader.rb".freeze]
+ s.homepage = "https://github.com/mime-types/ruby-mime-types/".freeze
+ s.licenses = ["MIT".freeze]
+ s.rdoc_options = ["--main".freeze, "README.rdoc".freeze]
+ s.required_ruby_version = Gem::Requirement.new(">= 2.0".freeze)
+ s.rubygems_version = "2.6.4".freeze
+ s.summary = "The mime-types library provides a library and registry for information about MIME content type definitions".freeze
if s.respond_to? :specification_version then
s.specification_version = 4
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
- s.add_runtime_dependency(%q<mime-types-data>, ["~> 3.2015"])
- s.add_development_dependency(%q<minitest>, ["~> 5.8"])
- s.add_development_dependency(%q<rdoc>, ["~> 4.0"])
- s.add_development_dependency(%q<hoe-doofus>, ["~> 1.0"])
- s.add_development_dependency(%q<hoe-gemspec2>, ["~> 1.1"])
- s.add_development_dependency(%q<hoe-git>, ["~> 1.6"])
- s.add_development_dependency(%q<hoe-rubygems>, ["~> 1.0"])
- s.add_development_dependency(%q<hoe-travis>, ["~> 1.2"])
- s.add_development_dependency(%q<minitest-autotest>, ["~> 1.0"])
- s.add_development_dependency(%q<minitest-focus>, ["~> 1.0"])
- s.add_development_dependency(%q<minitest-bonus-assertions>, ["~> 2.0"])
- s.add_development_dependency(%q<rake>, ["~> 10.0"])
- s.add_development_dependency(%q<fivemat>, ["~> 1.3"])
- s.add_development_dependency(%q<minitest-rg>, ["~> 5.2"])
- s.add_development_dependency(%q<simplecov>, ["~> 0.7"])
- s.add_development_dependency(%q<hoe>, ["~> 3.14"])
+ s.add_runtime_dependency(%q<mime-types-data>.freeze, ["~> 3.2015"])
+ s.add_development_dependency(%q<minitest>.freeze, ["~> 5.9"])
+ s.add_development_dependency(%q<rdoc>.freeze, ["~> 4.0"])
+ s.add_development_dependency(%q<hoe-doofus>.freeze, ["~> 1.0"])
+ s.add_development_dependency(%q<hoe-gemspec2>.freeze, ["~> 1.1"])
+ s.add_development_dependency(%q<hoe-git>.freeze, ["~> 1.6"])
+ s.add_development_dependency(%q<hoe-rubygems>.freeze, ["~> 1.0"])
+ s.add_development_dependency(%q<hoe-travis>.freeze, ["~> 1.2"])
+ s.add_development_dependency(%q<minitest-autotest>.freeze, ["~> 1.0"])
+ s.add_development_dependency(%q<minitest-focus>.freeze, ["~> 1.0"])
+ s.add_development_dependency(%q<minitest-bonus-assertions>.freeze, ["~> 2.0"])
+ s.add_development_dependency(%q<minitest-hooks>.freeze, ["~> 1.4"])
+ s.add_development_dependency(%q<rake>.freeze, ["~> 10.0"])
+ s.add_development_dependency(%q<fivemat>.freeze, ["~> 1.3"])
+ s.add_development_dependency(%q<minitest-rg>.freeze, ["~> 5.2"])
+ s.add_development_dependency(%q<simplecov>.freeze, ["~> 0.7"])
+ s.add_development_dependency(%q<hoe>.freeze, ["~> 3.15"])
else
- s.add_dependency(%q<mime-types-data>, ["~> 3.2015"])
- s.add_dependency(%q<minitest>, ["~> 5.8"])
- s.add_dependency(%q<rdoc>, ["~> 4.0"])
- s.add_dependency(%q<hoe-doofus>, ["~> 1.0"])
- s.add_dependency(%q<hoe-gemspec2>, ["~> 1.1"])
- s.add_dependency(%q<hoe-git>, ["~> 1.6"])
- s.add_dependency(%q<hoe-rubygems>, ["~> 1.0"])
- s.add_dependency(%q<hoe-travis>, ["~> 1.2"])
- s.add_dependency(%q<minitest-autotest>, ["~> 1.0"])
- s.add_dependency(%q<minitest-focus>, ["~> 1.0"])
- s.add_dependency(%q<minitest-bonus-assertions>, ["~> 2.0"])
- s.add_dependency(%q<rake>, ["~> 10.0"])
- s.add_dependency(%q<fivemat>, ["~> 1.3"])
- s.add_dependency(%q<minitest-rg>, ["~> 5.2"])
- s.add_dependency(%q<simplecov>, ["~> 0.7"])
- s.add_dependency(%q<hoe>, ["~> 3.14"])
+ s.add_dependency(%q<mime-types-data>.freeze, ["~> 3.2015"])
+ s.add_dependency(%q<minitest>.freeze, ["~> 5.9"])
+ s.add_dependency(%q<rdoc>.freeze, ["~> 4.0"])
+ s.add_dependency(%q<hoe-doofus>.freeze, ["~> 1.0"])
+ s.add_dependency(%q<hoe-gemspec2>.freeze, ["~> 1.1"])
+ s.add_dependency(%q<hoe-git>.freeze, ["~> 1.6"])
+ s.add_dependency(%q<hoe-rubygems>.freeze, ["~> 1.0"])
+ s.add_dependency(%q<hoe-travis>.freeze, ["~> 1.2"])
+ s.add_dependency(%q<minitest-autotest>.freeze, ["~> 1.0"])
+ s.add_dependency(%q<minitest-focus>.freeze, ["~> 1.0"])
+ s.add_dependency(%q<minitest-bonus-assertions>.freeze, ["~> 2.0"])
+ s.add_dependency(%q<minitest-hooks>.freeze, ["~> 1.4"])
+ s.add_dependency(%q<rake>.freeze, ["~> 10.0"])
+ s.add_dependency(%q<fivemat>.freeze, ["~> 1.3"])
+ s.add_dependency(%q<minitest-rg>.freeze, ["~> 5.2"])
+ s.add_dependency(%q<simplecov>.freeze, ["~> 0.7"])
+ s.add_dependency(%q<hoe>.freeze, ["~> 3.15"])
end
else
- s.add_dependency(%q<mime-types-data>, ["~> 3.2015"])
- s.add_dependency(%q<minitest>, ["~> 5.8"])
- s.add_dependency(%q<rdoc>, ["~> 4.0"])
- s.add_dependency(%q<hoe-doofus>, ["~> 1.0"])
- s.add_dependency(%q<hoe-gemspec2>, ["~> 1.1"])
- s.add_dependency(%q<hoe-git>, ["~> 1.6"])
- s.add_dependency(%q<hoe-rubygems>, ["~> 1.0"])
- s.add_dependency(%q<hoe-travis>, ["~> 1.2"])
- s.add_dependency(%q<minitest-autotest>, ["~> 1.0"])
- s.add_dependency(%q<minitest-focus>, ["~> 1.0"])
- s.add_dependency(%q<minitest-bonus-assertions>, ["~> 2.0"])
- s.add_dependency(%q<rake>, ["~> 10.0"])
- s.add_dependency(%q<fivemat>, ["~> 1.3"])
- s.add_dependency(%q<minitest-rg>, ["~> 5.2"])
- s.add_dependency(%q<simplecov>, ["~> 0.7"])
- s.add_dependency(%q<hoe>, ["~> 3.14"])
+ s.add_dependency(%q<mime-types-data>.freeze, ["~> 3.2015"])
+ s.add_dependency(%q<minitest>.freeze, ["~> 5.9"])
+ s.add_dependency(%q<rdoc>.freeze, ["~> 4.0"])
+ s.add_dependency(%q<hoe-doofus>.freeze, ["~> 1.0"])
+ s.add_dependency(%q<hoe-gemspec2>.freeze, ["~> 1.1"])
+ s.add_dependency(%q<hoe-git>.freeze, ["~> 1.6"])
+ s.add_dependency(%q<hoe-rubygems>.freeze, ["~> 1.0"])
+ s.add_dependency(%q<hoe-travis>.freeze, ["~> 1.2"])
+ s.add_dependency(%q<minitest-autotest>.freeze, ["~> 1.0"])
+ s.add_dependency(%q<minitest-focus>.freeze, ["~> 1.0"])
+ s.add_dependency(%q<minitest-bonus-assertions>.freeze, ["~> 2.0"])
+ s.add_dependency(%q<minitest-hooks>.freeze, ["~> 1.4"])
+ s.add_dependency(%q<rake>.freeze, ["~> 10.0"])
+ s.add_dependency(%q<fivemat>.freeze, ["~> 1.3"])
+ s.add_dependency(%q<minitest-rg>.freeze, ["~> 5.2"])
+ s.add_dependency(%q<simplecov>.freeze, ["~> 0.7"])
+ s.add_dependency(%q<hoe>.freeze, ["~> 3.15"])
end
end
diff --git a/test/minitest_helper.rb b/test/minitest_helper.rb
index dc89002..3690403 100644
--- a/test/minitest_helper.rb
+++ b/test/minitest_helper.rb
@@ -8,5 +8,6 @@ require 'fivemat/minitest/autorun'
require 'minitest/focus'
require 'minitest/rg'
require 'minitest-bonus-assertions'
+require 'minitest/hooks'
ENV['RUBY_MIME_TYPES_LAZY_LOAD'] = 'yes'
diff --git a/test/test_mime_types.rb b/test/test_mime_types.rb
index 6df7b65..caadc37 100644
--- a/test/test_mime_types.rb
+++ b/test/test_mime_types.rb
@@ -43,7 +43,7 @@ describe MIME::Types do
end
end
- describe '#\[]' do
+ describe '#[]' do
it 'can be searched with a MIME::Type' do
text_plain = MIME::Type.new('text/plain')
assert_includes mime_types[text_plain], 'text/plain'
diff --git a/test/test_mime_types_cache.rb b/test/test_mime_types_cache.rb
index bcfc4c6..3b5859b 100644
--- a/test/test_mime_types_cache.rb
+++ b/test/test_mime_types_cache.rb
@@ -4,16 +4,23 @@ require 'mime/types'
require 'minitest_helper'
describe MIME::Types::Cache do
- def setup
+ include Minitest::Hooks
+
+ MUTEX = Mutex.new
+
+ def around
require 'fileutils'
- @cache_file = File.expand_path('../cache.tst', __FILE__)
- ENV['RUBY_MIME_TYPES_CACHE'] = @cache_file
- clear_cache_file
- end
- def teardown
- clear_cache_file
- ENV.delete('RUBY_MIME_TYPES_CACHE')
+ MUTEX.synchronize do
+ @cache_file = File.expand_path('../cache.tst', __FILE__)
+ ENV['RUBY_MIME_TYPES_CACHE'] = @cache_file
+ clear_cache_file
+
+ super
+
+ clear_cache_file
+ ENV.delete('RUBY_MIME_TYPES_CACHE')
+ end
end
def reset_mime_types
@@ -36,10 +43,12 @@ describe MIME::Types::Cache do
end
it 'outputs an error when there is an invalid version' do
- v = MIME::Types::Data::VERSION.dup
- MIME::Types::Data::VERSION.gsub!(/.*/, '0.0')
+ v = MIME::Types::Data::VERSION
+ MIME::Types::Data.send(:remove_const, :VERSION)
+ MIME::Types::Data.const_set(:VERSION, '0.0')
MIME::Types::Cache.save
- MIME::Types::Data::VERSION.gsub!(/.*/, v)
+ MIME::Types::Data.send(:remove_const, :VERSION)
+ MIME::Types::Data.const_set(:VERSION, v)
MIME::Types.instance_variable_set(:@__types__, nil)
assert_output '', /MIME::Types cache: invalid version/ do
MIME::Types['text/html']
diff --git a/test/test_mime_types_class.rb b/test/test_mime_types_class.rb
index 0735f48..3ba4653 100644
--- a/test/test_mime_types_class.rb
+++ b/test/test_mime_types_class.rb
@@ -29,7 +29,7 @@ describe MIME::Types, 'registry' do
end
end
- describe '.\[]' do
+ describe '.[]' do
it 'can be searched with a MIME::Type' do
text_plain = MIME::Type.new('text/plain')
assert_includes MIME::Types[text_plain], 'text/plain'