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

Prepare for 3.5.0 #176

Merged
merged 3 commits into from
Aug 7, 2023
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
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
64 changes: 39 additions & 25 deletions History.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
# Changelog

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

- 1 bugfix:
- 1 minor enhancement:

- Robb Shecter changed the default log level for duplicate type variant from
`warn` to `debug` in [#170][]. This works because `MIME::Types.logger` is
intended to fit the `::Logger` interface, and the default logger
(`WarnLogger`) is a subclass of `::Logger` that passes through to
`Kernel.warn`.

- Further consideration has changed cache load messages from `warn` to
`error` and deprecation messages from `warn` to `debug`.

- 1 bug fix:

- Added a definition of `MIME::Type#hash`. Contributed by Alex Vondrak in
[#167][], fixing [#166][].
Expand All @@ -26,7 +37,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 +61,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 +79,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 +114,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 +127,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 +149,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 +165,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 +191,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 +219,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 +253,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 +272,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 Expand Up @@ -290,6 +303,7 @@
[#153]: https://github.com/mime-types/ruby-mime-types/pull/153
[#166]: https://github.com/mime-types/ruby-mime-types/issues/166
[#167]: https://github.com/mime-types/ruby-mime-types/pull/167
[#170]: https://github.com/mime-types/ruby-mime-types/pull/170
[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
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.5.0"

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 @@ -187,7 +187,7 @@ def add(*types)
# truthy value to suppress that warning.
def add_type(type, quiet = false)
if !quiet && @type_variants[type.simplified].include?(type)
MIME::Types.logger.warn <<-WARNING.chomp.strip
MIME::Types.logger.debug <<-WARNING.chomp.strip
Type #{type} is already registered as a variant of #{type.simplified}.
WARNING
end
Expand Down
4 changes: 2 additions & 2 deletions lib/mime/types/cache.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ def load(cache_file = nil)
if cache.version == MIME::Types::Data::VERSION
Marshal.load(cache.data)
else
MIME::Types.logger.warn <<-WARNING.chomp.strip
MIME::Types.logger.error <<-WARNING.chomp.strip
Could not load MIME::Types cache: invalid version
WARNING
nil
end
rescue => e
MIME::Types.logger.warn <<-WARNING.chomp.strip
MIME::Types.logger.error <<-WARNING.chomp.strip
Could not load MIME::Types cache: #{e}
WARNING
nil
Expand Down
2 changes: 1 addition & 1 deletion lib/mime/types/deprecations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def self.deprecated(klass, sym, message = nil, &block) # :nodoc:
else
message
end
MIME::Types.logger.warn <<-WARNING.chomp.strip
MIME::Types.logger.debug <<-WARNING.chomp.strip
#{caller(2..2).first}: #{klass}#{level}#{sym} is deprecated #{message}.
WARNING

Expand Down
2 changes: 1 addition & 1 deletion lib/mime/types/registry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def add(*types)
def lazy_load?
return unless ENV.key?("RUBY_MIME_TYPES_LAZY_LOAD")

MIME::Types.logger.warn <<-WARNING.chomp.strip
MIME::Types.logger.debug <<-WARNING.chomp.strip
Lazy loading ($RUBY_MIME_TYPES_LAZY_LOAD) is deprecated and will be removed.
WARNING

Expand Down
Loading
Loading