diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 287e88d..9336535 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -1,13 +1,14 @@
name: CI
on:
- push:
- branches: [main]
pull_request:
+ push:
branches: [main]
+ workflow_dispatch:
jobs:
test:
+ name: Ruby ${{ matrix.ruby }} - ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
@@ -40,10 +41,13 @@ jobs:
continue-on-error: true
- os: ubuntu-22.04
ruby: head
+ continue-on-error: true
- os: ubuntu-22.04
ruby: '3.1'
- os: ubuntu-22.04
ruby: '3.2'
+ - os: ubuntu-22.04
+ ruby: '3.3'
- os: ubuntu-22.04
ruby: truffleruby+graalvm-head
continue-on-error: true
@@ -53,14 +57,17 @@ jobs:
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.continue-on-error || false }}
+
steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- rubygems: ${{ matrix.rubygems || 'latest' }}
+ rubygems: latest
bundler: 2
bundler-cache: true
+
- run: bundle exec ruby -S rake test --trace
- - if: matrix.os == 'ubuntu-22.04' && matrix.ruby == '3.2'
+
+ - if: matrix.os == 'ubuntu-22.04' && matrix.ruby == '3.3'
run: bundle exec standardrb
diff --git a/Contributing.md b/Contributing.md
index 058138a..1f4125b 100644
--- a/Contributing.md
+++ b/Contributing.md
@@ -82,9 +82,9 @@ Here's the most direct way to get your work merged into the project:
Thanks to everyone else who has contributed to mime-types over the years:
- Aaron Patterson
-- Alex Vondrak
- Aggelos Avgerinos
- Al Snow
+- Alex Vondrak
- Andre Pankratz
- Andy Brody
- Arnaud Meuret
@@ -93,8 +93,8 @@ Thanks to everyone else who has contributed to mime-types over the years:
- Chris Gat
- David Genord
- Dillon Welch
-- Eric Marden
- Edward Betts
+- Eric Marden
- Garret Alfert
- Godfrey Chan
- Greg Brockman
@@ -106,15 +106,16 @@ Thanks to everyone else who has contributed to mime-types over the years:
- Jeremy Evans
- Juanito Fatas
- Jun Aruga
-- Łukasz Śliwa
- Keerthi Siva
- Ken Ip
- Kevin Menard
- Koichi ITO
+- Łukasz Śliwa
- Martin d'Allens
+- Masato Nakamura
- Mauricio Linhares
-- Nicolas Leger
- Nicholas La Roux
+- Nicolas Leger
- nycvotes-dev
- Olle Jonsson
- Postmodern
diff --git a/History.md b/History.md
index 789a901..c7f2900 100644
--- a/History.md
+++ b/History.md
@@ -1,5 +1,19 @@
# Changelog
+## 3.5.2 / 2024-01-02
+
+There are no primary code changes, but we are releasing this as an update as
+there are some validation changes and updated code with formatting.
+
+- Dependency and CI updates:
+
+ - Masato Nakamura added Ruby 3.3 to the CI workflow in [#179][].
+
+ - Fixed regressions in standard formatting in [#180][].
+
+ - Removed `minitest-bonus-assertions` because of a bundler resolution issue.
+ Created a better replacement in-line.
+
## 3.5.1 / 2023-08-21
- 1 bug fix:
@@ -314,6 +328,8 @@
[#170]: https://github.com/mime-types/ruby-mime-types/pull/170
[#177]: https://github.com/mime-types/ruby-mime-types/issues/177
[#178]: https://github.com/mime-types/ruby-mime-types/pull/178
+[#179]: https://github.com/mime-types/ruby-mime-types/pull/179
+[#180]: https://github.com/mime-types/ruby-mime-types/pull/180
[code-of-conduct.md]: Code-of-Conduct_md.html
[contributor covenant]: http://contributor-covenant.org
[mime-types-data]: https://github.com/mime-types/mime-types-data
diff --git a/Rakefile b/Rakefile
index 51254e5..15a8354 100644
--- a/Rakefile
+++ b/Rakefile
@@ -30,7 +30,6 @@ spec = Hoe.spec "mime-types" do
extra_dev_deps << ["hoe-rubygems", "~> 1.0"]
extra_dev_deps << ["minitest", "~> 5.0"]
extra_dev_deps << ["minitest-autotest", "~> 1.0"]
- extra_dev_deps << ["minitest-bonus-assertions", "~> 3.0"]
extra_dev_deps << ["minitest-focus", "~> 1.0"]
extra_dev_deps << ["minitest-hooks", "~> 1.4"]
extra_dev_deps << ["rake", ">= 10.0", "< 14.0"]
diff --git a/lib/mime/type.rb b/lib/mime/type.rb
index d19a6a9..9a086bf 100644
--- a/lib/mime/type.rb
+++ b/lib/mime/type.rb
@@ -93,7 +93,7 @@ def to_s
end
# The released version of the mime-types library.
- VERSION = "3.5.1"
+ VERSION = "3.5.2"
include Comparable
diff --git a/lib/mime/types.rb b/lib/mime/types.rb
index bb0a3d0..026be34 100644
--- a/lib/mime/types.rb
+++ b/lib/mime/types.rb
@@ -165,7 +165,7 @@ def type_for(filename)
# The last parameter may be the value :silent or +true+ which
# will suppress duplicate MIME type warnings.
def add(*types)
- quiet = ((types.last == :silent) || (types.last == true))
+ quiet = (types.last == :silent) || (types.last == true)
types.each do |mime_type|
case mime_type
diff --git a/lib/mime/types/logger.rb b/lib/mime/types/logger.rb
index 894f47c..2bc1a1d 100644
--- a/lib/mime/types/logger.rb
+++ b/lib/mime/types/logger.rb
@@ -26,7 +26,7 @@ def close
end
def initialize(_one, _two = nil, _three = nil)
- super nil
+ super(nil)
@logdev = WarnLogDevice.new
@formatter = ->(_s, _d, _p, m) { m }
end
diff --git a/mime-types.gemspec b/mime-types.gemspec
index 846f4c3..bce4357 100644
--- a/mime-types.gemspec
+++ b/mime-types.gemspec
@@ -1,15 +1,15 @@
# -*- encoding: utf-8 -*-
-# stub: mime-types 3.5.1 ruby lib
+# stub: mime-types 3.5.2 ruby lib
Gem::Specification.new do |s|
s.name = "mime-types".freeze
- s.version = "3.5.1"
+ s.version = "3.5.2".freeze
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.metadata = { "bug_tracker_uri" => "https://github.com/mime-types/ruby-mime-types/issues", "changelog_uri" => "https://github.com/mime-types/ruby-mime-types/blob/master/History.md", "homepage_uri" => "https://github.com/mime-types/ruby-mime-types/", "rubygems_mfa_required" => "true", "source_code_uri" => "https://github.com/mime-types/ruby-mime-types/" } if s.respond_to? :metadata=
s.require_paths = ["lib".freeze]
s.authors = ["Austin Ziegler".freeze]
- s.date = "2023-08-22"
+ s.date = "2024-01-02"
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.md".freeze, "Contributing.md".freeze, "History.md".freeze, "Licence.md".freeze, "Manifest.txt".freeze, "README.rdoc".freeze]
@@ -18,24 +18,23 @@ Gem::Specification.new do |s|
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 = "3.4.18".freeze
+ s.rubygems_version = "3.5.3".freeze
s.summary = "The mime-types library provides a library and registry for information about MIME content type definitions".freeze
s.specification_version = 4
- s.add_runtime_dependency(%q.freeze, ["~> 3.2015"])
- s.add_development_dependency(%q.freeze, ["~> 5.19"])
- s.add_development_dependency(%q.freeze, [">= 3.0", "< 5"])
- s.add_development_dependency(%q.freeze, ["~> 1.0"])
- s.add_development_dependency(%q.freeze, ["~> 1.1"])
- s.add_development_dependency(%q.freeze, ["~> 1.7"])
- s.add_development_dependency(%q.freeze, ["~> 1.0"])
- s.add_development_dependency(%q.freeze, ["~> 1.0"])
- s.add_development_dependency(%q.freeze, ["~> 3.0"])
- s.add_development_dependency(%q.freeze, ["~> 1.0"])
- s.add_development_dependency(%q.freeze, ["~> 1.4"])
- s.add_development_dependency(%q.freeze, [">= 10.0", "< 14.0"])
- s.add_development_dependency(%q.freeze, ["~> 1.0"])
- s.add_development_dependency(%q.freeze, [">= 4.0", "< 7"])
- s.add_development_dependency(%q.freeze, ["~> 0.21"])
+ s.add_runtime_dependency(%q.freeze, ["~> 3.2015".freeze])
+ s.add_development_dependency(%q.freeze, ["~> 5.20".freeze])
+ s.add_development_dependency(%q.freeze, [">= 3.0".freeze, "< 5".freeze])
+ s.add_development_dependency(%q.freeze, ["~> 1.0".freeze])
+ s.add_development_dependency(%q.freeze, ["~> 1.1".freeze])
+ s.add_development_dependency(%q.freeze, ["~> 1.7".freeze])
+ s.add_development_dependency(%q.freeze, ["~> 1.0".freeze])
+ s.add_development_dependency(%q.freeze, ["~> 1.0".freeze])
+ s.add_development_dependency(%q.freeze, ["~> 1.0".freeze])
+ s.add_development_dependency(%q.freeze, ["~> 1.4".freeze])
+ s.add_development_dependency(%q.freeze, [">= 10.0".freeze, "< 14.0".freeze])
+ s.add_development_dependency(%q.freeze, ["~> 1.0".freeze])
+ s.add_development_dependency(%q.freeze, [">= 4.0".freeze, "< 7".freeze])
+ s.add_development_dependency(%q.freeze, ["~> 0.21".freeze])
end
diff --git a/test/minitest_helper.rb b/test/minitest_helper.rb
index 44973e3..cd168e5 100644
--- a/test/minitest_helper.rb
+++ b/test/minitest_helper.rb
@@ -5,7 +5,6 @@
gem "minitest"
require "minitest/focus"
-require "minitest-bonus-assertions"
require "minitest/hooks"
ENV["RUBY_MIME_TYPES_LAZY_LOAD"] = "yes"
diff --git a/test/test_mime_type.rb b/test/test_mime_type.rb
index 25f0a07..16e80fb 100644
--- a/test/test_mime_type.rb
+++ b/test/test_mime_type.rb
@@ -446,37 +446,53 @@ def assert_priority(left, middle, right)
describe "#to_h" do
let(:t) { mime_type("a/b") }
+ def assert_has_keys(wanted_keys, actual, msg = nil)
+ wanted_keys = Array(wanted_keys).uniq.sort
+ actual_keys = if actual.is_a?(Hash)
+ actual.keys
+ else
+ actual.to_h.keys
+ end
+
+ missing = wanted_keys - actual_keys
+ pretty_wanted_keys = (wanted_keys + actual_keys).uniq.sort
+
+ msg = message(msg) {
+ "#{mu_pp(actual)} is missing attribute values\n#{diff(pretty_wanted_keys, actual_keys)}"
+ }
+
+ assert missing.empty?, msg
+ end
+
it "has the required keys (content-type, registered, encoding)" do
- assert_has_keys t.to_h, %w[content-type registered encoding]
+ assert_has_keys %w[content-type registered encoding], t
end
it "has the docs key if there are documents" do
- assert_has_keys mime_type(t) { |v| v.docs = "a" }.to_h, %w[docs]
+ assert_has_keys "docs", mime_type(t) { |v| v.docs = "a" }
end
it "has the extensions key if set" do
- assert_has_keys mime_type(t) { |v| v.extensions = "a" }.to_h,
- "extensions"
+ assert_has_keys "extensions", mime_type(t) { |v| v.extensions = "a" }
end
it "has the preferred-extension key if set" do
- assert_has_keys mime_type(t) { |v| v.preferred_extension = "a" }.to_h,
- "preferred-extension"
+ assert_has_keys "preferred-extension", mime_type(t) { |v| v.preferred_extension = "a" }
end
it "has the obsolete key if set" do
- assert_has_keys mime_type(t) { |v| v.obsolete = true }.to_h, "obsolete"
+ assert_has_keys "obsolete", mime_type(t) { |v| v.obsolete = true }
end
it "has the obsolete and use-instead keys if set" do
- assert_has_keys mime_type(t) { |v|
+ assert_has_keys %w[obsolete use-instead], mime_type(t) { |v|
v.obsolete = true
v.use_instead = "c/d"
- }.to_h, %w[obsolete use-instead]
+ }
end
it "has the signature key if set" do
- assert_has_keys mime_type(t) { |v| v.signature = true }.to_h, "signature"
+ assert_has_keys "signature", mime_type(t) { |v| v.signature = true }
end
end