Skip to content

Commit

Permalink
Prepare for 3.5.0
Browse files Browse the repository at this point in the history
- 1 bug fix:

  - Added a definition of `MIME::Type#hash`. Contributed by Alex Vondrak
    in [#167][], fixing [#166][].

- Dependency and CI updates:

  - Update the .github/workflows/ci.yml workflow to test Ruby 3.2 and
    more reliably test certain combinations rather than depending on
    exclusions.

  - Change `.standard.yml` configuration to format for Ruby 2.3 as
    certain files are not properly detected with Ruby 2.0.

    - Change from `hoe-git` to `hoe-git2` to support Hoe version 4.

    - Apply `standardrb --fix`.

    - The above changes have resulted in the soft deprecation of Ruby
      versions below 2.6. Any errors reported for Ruby versions 2.0,
      2.1, 2.2, 2.3, 2.4, and 2.5 will be resolved, but maintaining CI
      for these versions is unsustainable.

[#166]: #166
[#167]: #167
  • Loading branch information
halostatue committed Aug 7, 2023
1 parent b9382fe commit c7ca8b2
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 98 deletions.
9 changes: 2 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby

name: CI

on:
Expand Down Expand Up @@ -63,3 +56,5 @@ jobs:
bundler: 2
bundler-cache: true
- run: bundle exec ruby -S rake test --trace
- if: matrix.os == 'ubuntu-22.04' && matrix.ruby == '3.2'
run: bundle exec standardrb
19 changes: 8 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
*.swp
*~
*.gem
.byebug_history
.rake_tasks~
.source_index
.vagrant
Gemfile.lock
Vagrantfile
coverage
doc
html
pkg
publish
coverage.info
coverage/
doc/
html/
pkg/
publish/
test/cache.tst
tmp/
.byebug_history
tags
2 changes: 0 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# frozen_string_literal: true

# NOTE: This file is not the canonical source of dependencies. Edit the
# Rakefile, instead.

Expand Down
52 changes: 27 additions & 25 deletions History.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Changelog

## NEXT / 2022-MM-DD
## 3.4.2 / 2023-08-07

- 1 bugfix:
- 1 bug fix:

- Added a definition of `MIME::Type#hash`. Contributed by Alex Vondrak in
[#167][], fixing [#166][].
Expand All @@ -26,7 +26,7 @@

## 3.4.1 / 2021-11-16

- 1 bugfix:
- 1 bug fix:

- Fixed a Ruby < 2.3 incompatibility introduced by the use of standardrb,
where `<<-` heredocs were converted to `<<~` heredocs. These have been
Expand All @@ -50,15 +50,15 @@
- Added Ruby 3.0 to the CI test matrix. Added `windows/jruby` to the
CI exclusion list; it refuses to run successfully.
- Removed the Travis CI configuration and changed it to Github Workflows
[#150]. Removed Coveralls configuration.
[#150][]. Removed Coveralls configuration.
- Igor Victor added TruffleRuby to the Travis CI configuration. [#149]
- Koichi ITO loosened an excessively tight dependency. [#147]
- Started using `standardrb` for Ruby formatting and validation.
- Moved `deps:top` functionality to a support file.

## 3.3.1 / 2019-12-26

- 1 minor bugfix:
- 1 minor bug fix:

- Al Snow fixed a warning with MIME::Types::Logger producing a warning
because Ruby 2.7 introduces numbered block parameters. Because of the way
Expand All @@ -68,7 +68,7 @@

- Administrivia:

- Olle Jonsson removed an outdated Travis configuration option (`sudo: false`). [#142]
- Olle Jonsson removed an outdated Travis configuration option. [#142][]

## 3.3 / 2019-09-04

Expand Down Expand Up @@ -103,8 +103,9 @@
to be in the same family even if strict sorting would cause an
unregistered type to be sorted first. [#132]

- Dillon Welch contributed a change that added `frozen_string_literal: true` to files so that modern Rubies can automatically reduce duplicate
string allocations. [#135]
- Dillon Welch contributed a change that added `frozen_string_literal: true`
to files so that modern Rubies can automatically reduce duplicate string
allocations. [#135]

- 2 bug fixes

Expand All @@ -115,7 +116,7 @@
because when Enumerable#inject isn't provided a starting value, the first
value is used as the default value. In every case where this error was
happening, the result was supposed to be an array containing Set objects
so they can be reduced to a single Set. [#117], [#127], [#134]
so they can be reduced to a single Set. [#117][], [#127][], [#134][]

- Fixed an uncontrolled growth bug in MIME::Types::Container where a key
miss would create a new entry with an empty Set in the container. This
Expand All @@ -137,12 +138,12 @@
- The history file has been modified to remove all history prior to 3.0.
This history can be found in previous commits.

- A spelling error was corrected by Edward Betts ([#129]).
- A spelling error was corrected by Edward Betts ([#129][]).

- Administrivia:

- CI configuration for more modern versions of Ruby were added by Nicolas
Leger ([#130]), Jun Aruga ([#125]), and Austin Ziegler. Removed
Leger ([#130][]), Jun Aruga ([#125][]), and Austin Ziegler. Removed
ruby-head-clang and rbx (Rubinius) from CI.

- Fixed tests which were asserting equality against nil, which will become
Expand All @@ -153,18 +154,18 @@
- 1 documentation change:

- Tim Smith (@tas50) updated the build badges to be SVGs to improve
readability on high-density (retina) screens with pull request [#112].
readability on high-density (retina) screens with pull request [#112][].

- 3 bug fixes

- A test for `MIME::Types::Cache` fails under Ruby 2.3 because of frozen
strings, [#118]. This has been fixed.
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
- 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
Expand All @@ -179,22 +180,22 @@
- 2 governance changes

- This project and the related mime-types-data project are now exclusively
MIT licensed. Resolves [#95].
MIT licensed. Resolves [#95][].

- All projects under the mime-types organization now have a standard code
of conduct adapted from the [Contributor Covenant]. This text can be
found in the [Code-of-Conduct.md] file.
of conduct adapted from the [Contributor Covenant][]. This text can be
found in the [Code-of-Conduct.md][] file.

- 3 major changes

- All methods deprecated in mime-types 2.x have been removed.

- mime-types now requires Ruby 2.0 compatibility or later. Resolves
[#97].
[#97][].

- The registry data has been removed from mime-types and put into
mime-types-data, maintained and released separately. It can be found at
[mime-types-data].
[mime-types-data][].

- 17 minor changes:

Expand All @@ -207,17 +208,18 @@
`x-` prefixes.

- Improved initialization with an Array works so that extensions do not
need to be wrapped in another array. This means that `%w(text/yaml yaml yml)` works in the same way that `['text/yaml', %w(yaml yml)]` did (and
still does).
need to be wrapped in another array. This means that
`%w(text/yaml yaml yml)` works in the same way that
`['text/yaml', %w(yaml yml)]` did (and still does).

- Changed `priority_compare` to conform with attributes that no longer
exist.

- Changed the internal implementation of extensions to use a frozen Set.

- When extensions are set or modified with `add_extensions`, the primary
registry will be informed of a need to reindex extensions. Resolves
[#84].
registry will be informed of a need to re-index extensions. Resolves
[#84][].

- The preferred extension can be set explicitly. If not set, it will be
the first extension. If the preferred extension is not in the extension
Expand All @@ -240,7 +242,7 @@
- Extracted the class methods to a separate file.

- Changed the container implementation to use a Set instead of an Array
to prevent data duplication. Resolves [#79].
to prevent data duplication. Resolves [#79][].

- `MIME::Types::Cache` changes:

Expand All @@ -259,7 +261,7 @@

- The registry is default loaded from the columnar store by default. The
internal format of the columnar store has changed; many of the boolean
flags are now loaded from a single file. Resolves [#85].
flags are now loaded from a single file. Resolves [#85][].

[#79]: https://github.com/mime-types/ruby-mime-types/pull/79
[#84]: https://github.com/mime-types/ruby-mime-types/pull/84
Expand Down
52 changes: 7 additions & 45 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,60 +1,26 @@
# frozen_string_literal: true

require "rubygems"
require "hoe"
require "rake/clean"

# This is required until https://github.com/seattlerb/hoe/issues/112 is fixed
class Hoe
def with_config
config = Hoe::DEFAULT_CONFIG

rc = File.expand_path("~/.hoerc")
homeconfig = load_config(rc)
config = config.merge(homeconfig)

localconfig = load_config(File.expand_path(File.join(Dir.pwd, ".hoerc")))
config = config.merge(localconfig)

yield config, rc
end

def load_config(name)
File.exist?(name) ? safe_load_yaml(name) : {}
end

def safe_load_yaml(name)
return safe_load_yaml_file(name) if YAML.respond_to?(:safe_load_file)

data = IO.binread(name)
YAML.safe_load(data, permitted_classes: [Regexp])
rescue
YAML.safe_load(data, [Regexp])
end

def safe_load_yaml_file(name)
YAML.safe_load_file(name, permitted_classes: [Regexp])
rescue
YAML.safe_load_file(name, [Regexp])
end
end

Hoe.plugin :cov
Hoe.plugin :doofus
Hoe.plugin :gemspec2
Hoe.plugin :git
Hoe.plugin :git2
Hoe.plugin :minitest
Hoe.plugin :email unless ENV["CI"]
Hoe.plugin :rubygems

spec = Hoe.spec "mime-types" do
developer("Austin Ziegler", "[email protected]")

require_ruby_version ">= 2.0"

self.history_file = "History.md"
self.readme_file = "README.rdoc"

license "MIT"

require_ruby_version ">= 2.0"

spec_extras[:metadata] = ->(val) { val["rubygems_mfa_required"] = "true" }

extra_deps << ["mime-types-data", "~> 3.2015"]

extra_dev_deps << ["hoe", ">= 3.0", "< 5"]
Expand All @@ -69,10 +35,6 @@ spec = Hoe.spec "mime-types" do
extra_dev_deps << ["minitest-hooks", "~> 1.4"]
extra_dev_deps << ["rake", ">= 10.0", "< 14.0"]
extra_dev_deps << ["standard", "~> 1.0"]

if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.0")
extra_dev_deps << ["simplecov", "~> 0.7"]
end
end

namespace :benchmark do
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.4.1"
VERSION = "3.4.2"

include Comparable

Expand Down
14 changes: 7 additions & 7 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.4.1 ruby lib
# stub: mime-types 3.4.2 ruby lib

Gem::Specification.new do |s|
s.name = "mime-types".freeze
s.version = "3.4.1"
s.version = "3.4.2"

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/", "source_code_uri" => "https://github.com/mime-types/ruby-mime-types/" } if s.respond_to? :metadata=
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-02-17"
s.date = "2023-08-07"
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,13 +18,13 @@ 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.7".freeze
s.rubygems_version = "3.4.10".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.17"])
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"])
Expand All @@ -36,6 +36,6 @@ Gem::Specification.new do |s|
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<simplecov>.freeze, ["~> 0.7"])
s.add_development_dependency(%q<rdoc>.freeze, [">= 4.0", "< 7"])
s.add_development_dependency(%q<simplecov>.freeze, ["~> 0.21"])
end

0 comments on commit c7ca8b2

Please sign in to comment.