Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move Ruby 3.3 to the "default" version #180

Merged
merged 1 commit into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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
9 changes: 5 additions & 4 deletions Contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
16 changes: 16 additions & 0 deletions History.md
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -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
1 change: 0 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
2 changes: 1 addition & 1 deletion lib/mime/type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion lib/mime/types.rb
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def type_for(filename)
# The last parameter may be the value <tt>:silent</tt> 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
Expand Down
2 changes: 1 addition & 1 deletion lib/mime/types/logger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
37 changes: 18 additions & 19 deletions mime-types.gemspec
Original file line number Diff line number Diff line change
@@ -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 = ["[email protected]".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]
Expand All @@ -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<mime-types-data>.freeze, ["~> 3.2015"])
s.add_development_dependency(%q<minitest>.freeze, ["~> 5.19"])
s.add_development_dependency(%q<hoe>.freeze, [">= 3.0", "< 5"])
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-git2>.freeze, ["~> 1.7"])
s.add_development_dependency(%q<hoe-rubygems>.freeze, ["~> 1.0"])
s.add_development_dependency(%q<minitest-autotest>.freeze, ["~> 1.0"])
s.add_development_dependency(%q<minitest-bonus-assertions>.freeze, ["~> 3.0"])
s.add_development_dependency(%q<minitest-focus>.freeze, ["~> 1.0"])
s.add_development_dependency(%q<minitest-hooks>.freeze, ["~> 1.4"])
s.add_development_dependency(%q<rake>.freeze, [">= 10.0", "< 14.0"])
s.add_development_dependency(%q<standard>.freeze, ["~> 1.0"])
s.add_development_dependency(%q<rdoc>.freeze, [">= 4.0", "< 7"])
s.add_development_dependency(%q<simplecov>.freeze, ["~> 0.21"])
s.add_runtime_dependency(%q<mime-types-data>.freeze, ["~> 3.2015".freeze])
s.add_development_dependency(%q<minitest>.freeze, ["~> 5.20".freeze])
s.add_development_dependency(%q<hoe>.freeze, [">= 3.0".freeze, "< 5".freeze])
s.add_development_dependency(%q<hoe-doofus>.freeze, ["~> 1.0".freeze])
s.add_development_dependency(%q<hoe-gemspec2>.freeze, ["~> 1.1".freeze])
s.add_development_dependency(%q<hoe-git2>.freeze, ["~> 1.7".freeze])
s.add_development_dependency(%q<hoe-rubygems>.freeze, ["~> 1.0".freeze])
s.add_development_dependency(%q<minitest-autotest>.freeze, ["~> 1.0".freeze])
s.add_development_dependency(%q<minitest-focus>.freeze, ["~> 1.0".freeze])
s.add_development_dependency(%q<minitest-hooks>.freeze, ["~> 1.4".freeze])
s.add_development_dependency(%q<rake>.freeze, [">= 10.0".freeze, "< 14.0".freeze])
s.add_development_dependency(%q<standard>.freeze, ["~> 1.0".freeze])
s.add_development_dependency(%q<rdoc>.freeze, [">= 4.0".freeze, "< 7".freeze])
s.add_development_dependency(%q<simplecov>.freeze, ["~> 0.21".freeze])
end
1 change: 0 additions & 1 deletion test/minitest_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

gem "minitest"
require "minitest/focus"
require "minitest-bonus-assertions"
require "minitest/hooks"

ENV["RUBY_MIME_TYPES_LAZY_LOAD"] = "yes"
36 changes: 26 additions & 10 deletions test/test_mime_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading