Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package rubygem-mime-types for openSUSE:Factory checked in at 2023-11-15 21:06:55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-mime-types (Old) and /work/SRC/openSUSE:Factory/.rubygem-mime-types.new.17445 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-mime-types" Wed Nov 15 21:06:55 2023 rev:26 rq:1126383 version:3.5.1 Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-mime-types/rubygem-mime-types.changes 2022-01-27 23:16:37.427120396 +0100 +++ /work/SRC/openSUSE:Factory/.rubygem-mime-types.new.17445/rubygem-mime-types.changes 2023-11-15 21:07:23.569608063 +0100 @@ -1,0 +2,5 @@ +Tue Nov 14 18:30:47 UTC 2023 - Dan Äermák <[email protected]> + +- New upstream release 3.5.1, see bundled History.md + +------------------------------------------------------------------- Old: ---- mime-types-3.4.1.gem New: ---- mime-types-3.5.1.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-mime-types.spec ++++++ --- /var/tmp/diff_new_pack.J5apI6/_old 2023-11-15 21:07:26.033698977 +0100 +++ /var/tmp/diff_new_pack.J5apI6/_new 2023-11-15 21:07:26.037699124 +0100 @@ -1,7 +1,7 @@ # # spec file for package rubygem-mime-types # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -24,11 +24,10 @@ # Name: rubygem-mime-types -Version: 3.4.1 +Version: 3.5.1 Release: 0 %define mod_name mime-types %define mod_full_name %{mod_name}-%{version} -BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: %{ruby >= 2.0} BuildRequires: %{rubygem gem2rpm} BuildRequires: %{rubygem rdoc > 3.10} @@ -38,7 +37,6 @@ Source1: gem2rpm.yml Summary: The mime-types library provides a library and registry for License: MIT -Group: Development/Languages/Ruby %description The mime-types library provides a library and registry for information about ++++++ mime-types-3.4.1.gem -> mime-types-3.5.1.gem ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/.standard.yml new/.standard.yml --- old/.standard.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/.standard.yml 2023-08-22 05:17:23.000000000 +0200 @@ -0,0 +1,4 @@ +parallel: true +ruby_version: 2.3 +ignore: + - 'mime-types.gemspec' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Contributing.md new/Contributing.md --- old/Contributing.md 2021-11-16 17:14:43.000000000 +0100 +++ new/Contributing.md 2023-08-22 05:17:23.000000000 +0200 @@ -6,11 +6,11 @@ There are a few guidelines for contributing to mime-types: - Code changes _will_ _not_ be accepted without tests. The test suite is - written with [minitest]. + written with [minitest][]. - Match my coding style. - Use a thoughtfully-named topic branch that contains your change. Rebase your commits into logical chunks as necessary. -- Use [quality commit messages]. +- Use [quality commit messages][]. - Do not change the version number; when your patch is accepted and a release is made, the version will be updated at that point. - Submit a GitHub pull request with your changes. @@ -19,25 +19,23 @@ ## Adding or Modifying MIME Types The mime-types registry is no longer contained in mime-types, but in -[mime-types-data]. Please see that project for contributions there. +[mime-types-data][]. Please see that project for contributions there. ### Test Dependencies -mime-types uses Ryan Davisâs [Hoe] to manage the release process, and it adds -a number of rake tasks. You will mostly be interested in `rake`, which runs -the tests the same way that `rake test` or `rake travis` will do. +mime-types uses Ryan Davisâs [Hoe][] to manage the release process, and it adds +a number of rake tasks. You will mostly be interested in `rake`, which runs the +tests the same way that `rake test` will do. To assist with the installation of the development dependencies for mime-types, I have provided the simplest possible Gemfile pointing to the -(generated) `mime-types.gemspec` file. This will permit you to do `bundle -install` to get the development dependencies. If you aleady have `hoe` +(generated) `mime-types.gemspec` file. This will permit you to do `bundle install` to get the development dependencies. If you already have `hoe` installed, you can accomplish the same thing with `rake newb`. This task will install any missing dependencies, run the tests/specs, and generate the RDoc. -You can run tests with code coverage analysis by running `rake -test:coverage`. +You can run tests with code coverage analysis by running `rake test:coverage`. ## Benchmarks @@ -52,7 +50,7 @@ There are two allocation tracing benchmarks (for normal and columnar loads). These can only be run on Ruby 2.1 or better and requires the -[allocation\_tracer] gem (not installed by default). +[allocation\_tracer][] gem (not installed by default). - `rake benchmark:allocations` - `rake benchmark:allocations:columnar` @@ -84,6 +82,7 @@ Thanks to everyone else who has contributed to mime-types over the years: - Aaron Patterson +- Alex Vondrak - Aggelos Avgerinos - Al Snow - Andre Pankratz @@ -122,6 +121,7 @@ - Richard Hirner - Richard Hurt - Richard Schneeman +- Robb Shecter - Tibor Szolár - Todd Carrico diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/History.md new/History.md --- old/History.md 2021-11-16 17:14:43.000000000 +0100 +++ new/History.md 2023-08-22 05:17:23.000000000 +0200 @@ -1,8 +1,51 @@ # Changelog +## 3.5.1 / 2023-08-21 + +- 1 bug fix: + + - Better handle possible line-termination strings (legal in Unix filenames) + such as `\n` in `MIME::Types.type_for`. Reported by ooooooo-q in [#177][], + resolved in [#178][]. + +## 3.5.0 / 2023-08-07 + +- 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][]. + +- 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. + ## 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 @@ -26,7 +69,7 @@ - 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. @@ -34,7 +77,7 @@ ## 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 @@ -44,7 +87,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 @@ -79,8 +122,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 @@ -91,7 +135,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 @@ -113,12 +157,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 @@ -129,18 +173,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 @@ -155,22 +199,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: @@ -183,8 +227,9 @@ `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. @@ -192,8 +237,8 @@ - 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 @@ -216,7 +261,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: @@ -235,7 +280,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 @@ -264,6 +309,11 @@ [#149]: https://github.com/mime-types/ruby-mime-types/pull/149 [#150]: https://github.com/mime-types/ruby-mime-types/pull/150 [#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 +[#177]: https://github.com/mime-types/ruby-mime-types/issues/177 +[#178]: https://github.com/mime-types/ruby-mime-types/pull/178 [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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Manifest.txt new/Manifest.txt --- old/Manifest.txt 2021-11-16 17:14:43.000000000 +0100 +++ new/Manifest.txt 2023-08-22 05:17:23.000000000 +0200 @@ -1,3 +1,4 @@ +.standard.yml Code-of-Conduct.md Contributing.md History.md diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/README.rdoc new/README.rdoc --- old/README.rdoc 2021-11-16 17:14:43.000000000 +0100 +++ new/README.rdoc 2023-08-22 05:17:23.000000000 +0200 @@ -5,7 +5,7 @@ bugs :: https://github.com/mime-types/ruby-mime-types/issues rdoc :: http://rdoc.info/gems/mime-types/ clog :: https://github.com/mime-types/ruby-mime-types/blob/master/History.md -continuous integration :: {<img src="https://travis-ci.org/mime-types/ruby-mime-types.svg?branch=master" alt="Build Status" />}[https://travis-ci.org/mime-types/ruby-mime-types] +continuous integration :: {<img src="https://github.com/mime-types/ruby-mime-types/actions/workflows/ci.yml/badge.svg" alt="Build Status" />}[https://github.com/mime-types/ruby-mime-types/actions/workflows/ci.yml] test coverage :: {<img src="https://coveralls.io/repos/mime-types/ruby-mime-types/badge.svg?branch=master&service=github" alt="Coverage Status" />}[https://coveralls.io/github/mime-types/ruby-mime-types?branch=master] == Description diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Rakefile new/Rakefile --- old/Rakefile 2021-11-16 17:14:43.000000000 +0100 +++ new/Rakefile 2023-08-22 05:17:23.000000000 +0200 @@ -1,78 +1,40 @@ -# 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]") - self.need_tar = true - - 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"] extra_dev_deps << ["hoe-doofus", "~> 1.0"] extra_dev_deps << ["hoe-gemspec2", "~> 1.1"] - extra_dev_deps << ["hoe-git", "~> 1.6"] + extra_dev_deps << ["hoe-git2", "~> 1.7"] extra_dev_deps << ["hoe-rubygems", "~> 1.0"] - extra_dev_deps << ["standard", "~> 1.0"] - extra_dev_deps << ["minitest", "~> 5.4"] + extra_dev_deps << ["minitest", "~> 5.0"] extra_dev_deps << ["minitest-autotest", "~> 1.0"] - extra_dev_deps << ["minitest-focus", "~> 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"] - - if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.0") - extra_dev_deps << ["simplecov", "~> 0.7"] - end + extra_dev_deps << ["standard", "~> 1.0"] end namespace :benchmark do @@ -235,9 +197,7 @@ file mark => [rdoc, :setup] do |t| puts "#{rdoc} => #{mark}" - File.open(t.name, "wb") { |target| - target.write @doc_converter.convert(IO.read(t.prerequisites.first)) - } + File.binwrite(t.name, @doc_converter.convert(IO.read(t.prerequisites.first))) end CLEAN.add mark Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/mime/type.rb new/lib/mime/type.rb --- old/lib/mime/type.rb 2021-11-16 17:14:43.000000000 +0100 +++ new/lib/mime/type.rb 2023-08-22 05:17:23.000000000 +0200 @@ -93,7 +93,7 @@ end # The released version of the mime-types library. - VERSION = "3.4.1" + VERSION = "3.5.1" include Comparable @@ -224,6 +224,32 @@ other.is_a?(MIME::Type) && (self == other) end + # Returns a hash based on the #simplified value. + # + # This maintains the invariant that two #eql? instances must have the same + # #hash (although having the same #hash does *not* imply that the objects are + # #eql?). + # + # To see why, suppose a MIME::Type instance +a+ is compared to another object + # +b+, and that <code>a.eql?(b)</code> is true. By the definition of #eql?, + # we know the following: + # + # 1. +b+ is a MIME::Type instance itself. + # 2. <code>a == b</code> is true. + # + # Due to the first point, we know that +b+ should respond to the #simplified + # method. Thus, per the definition of #<=>, we know that +a.simplified+ must + # be equal to +b.simplified+, as compared by the <=> method corresponding to + # +a.simplified+. + # + # Presumably, if <code>a.simplified <=> b.simplified</code> is +0+, then + # +a.simplified+ has the same hash as +b.simplified+. So we assume it's + # suitable for #hash to delegate to #simplified in service of the #eql? + # invariant. + def hash + simplified.hash + end + # Returns the whole MIME content-type string. # # The content type is a presentation value from the MIME type registry and @@ -338,7 +364,7 @@ # Returns the default encoding for the MIME::Type based on the media type. def default_encoding - @media_type == "text" ? "quoted-printable" : "base64" + (@media_type == "text") ? "quoted-printable" : "base64" end ## diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/mime/types/cache.rb new/lib/mime/types/cache.rb --- old/lib/mime/types/cache.rb 2021-11-16 17:14:43.000000000 +0100 +++ new/lib/mime/types/cache.rb 2023-08-22 05:17:23.000000000 +0200 @@ -22,13 +22,13 @@ 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 @@ -49,10 +49,6 @@ types ||= MIME::Types.send(:__types__) - File.open(cache_file, "wb") do |f| - f.write( - Marshal.dump(new(MIME::Types::Data::VERSION, Marshal.dump(types))) - ) - end + File.binwrite(cache_file, Marshal.dump(new(MIME::Types::Data::VERSION, Marshal.dump(types)))) end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/mime/types/deprecations.rb new/lib/mime/types/deprecations.rb --- old/lib/mime/types/deprecations.rb 2021-11-16 17:14:43.000000000 +0100 +++ new/lib/mime/types/deprecations.rb 2023-08-22 05:17:23.000000000 +0200 @@ -10,22 +10,22 @@ def self.deprecated(klass, sym, message = nil, &block) # :nodoc: level = case klass - when Class, Module - "." - else - klass = klass.class - "#" + when Class, Module + "." + else + klass = klass.class + "#" end message = case message - when :private, :protected - "and will be #{message}" - when nil - "and will be removed" - else - message + when :private, :protected + "and will be #{message}" + when nil + "and will be removed" + 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 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/mime/types/registry.rb new/lib/mime/types/registry.rb --- old/lib/mime/types/registry.rb 2021-11-16 17:14:43.000000000 +0100 +++ new/lib/mime/types/registry.rb 2023-08-22 05:17:23.000000000 +0200 @@ -45,7 +45,7 @@ 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 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/mime/types.rb new/lib/mime/types.rb --- old/lib/mime/types.rb 2021-11-16 17:14:43.000000000 +0100 +++ new/lib/mime/types.rb 2023-08-22 05:17:23.000000000 +0200 @@ -125,12 +125,12 @@ def [](type_id, complete: false, registered: false) matches = case type_id - when MIME::Type - @type_variants[type_id.simplified] - when Regexp - match(type_id) - else - @type_variants[MIME::Type.simplified(type_id)] + when MIME::Type + @type_variants[type_id.simplified] + when Regexp + match(type_id) + else + @type_variants[MIME::Type.simplified(type_id)] end prune_matches(matches, complete, registered).sort { |a, b| @@ -152,7 +152,7 @@ # => [application/xml, image/gif, text/xml] def type_for(filename) Array(filename).flat_map { |fn| - @extension_index[fn.chomp.downcase[/\.?([^.]*?)$/, 1]] + @extension_index[fn.chomp.downcase[/\.?([^.]*?)\z/m, 1]] }.compact.inject(Set.new, :+).sort { |a, b| a.priority_compare(b) } @@ -187,7 +187,7 @@ # 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 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2021-11-16 17:14:43.000000000 +0100 +++ new/metadata 2023-08-22 05:17:23.000000000 +0200 @@ -1,14 +1,14 @@ --- !ruby/object:Gem::Specification name: mime-types version: !ruby/object:Gem::Version - version: 3.4.1 + version: 3.5.1 platform: ruby authors: - Austin Ziegler autorequire: bindir: bin cert_chain: [] -date: 2021-11-16 00:00:00.000000000 Z +date: 2023-08-22 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: mime-types-data @@ -30,72 +30,78 @@ requirements: - - "~>" - !ruby/object:Gem::Version - version: '5.14' + version: '5.19' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version - version: '5.14' + version: '5.19' - !ruby/object:Gem::Dependency - name: hoe-doofus + name: hoe requirement: !ruby/object:Gem::Requirement requirements: - - - "~>" + - - ">=" - !ruby/object:Gem::Version - version: '1.0' + version: '3.0' + - - "<" + - !ruby/object:Gem::Version + version: '5' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - - "~>" + - - ">=" - !ruby/object:Gem::Version - version: '1.0' + version: '3.0' + - - "<" + - !ruby/object:Gem::Version + version: '5' - !ruby/object:Gem::Dependency - name: hoe-gemspec2 + name: hoe-doofus requirement: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version - version: '1.1' + version: '1.0' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version - version: '1.1' + version: '1.0' - !ruby/object:Gem::Dependency - name: hoe-git + name: hoe-gemspec2 requirement: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version - version: '1.6' + version: '1.1' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version - version: '1.6' + version: '1.1' - !ruby/object:Gem::Dependency - name: hoe-rubygems + name: hoe-git2 requirement: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version - version: '1.0' + version: '1.7' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version - version: '1.0' + version: '1.7' - !ruby/object:Gem::Dependency - name: standard + name: hoe-rubygems requirement: !ruby/object:Gem::Requirement requirements: - - "~>" @@ -123,33 +129,33 @@ - !ruby/object:Gem::Version version: '1.0' - !ruby/object:Gem::Dependency - name: minitest-focus + name: minitest-bonus-assertions requirement: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version - version: '1.0' + version: '3.0' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version - version: '1.0' + version: '3.0' - !ruby/object:Gem::Dependency - name: minitest-bonus-assertions + name: minitest-focus requirement: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version - version: '3.0' + version: '1.0' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version - version: '3.0' + version: '1.0' - !ruby/object:Gem::Dependency name: minitest-hooks requirement: !ruby/object:Gem::Requirement @@ -185,19 +191,19 @@ - !ruby/object:Gem::Version version: '14.0' - !ruby/object:Gem::Dependency - name: simplecov + name: standard requirement: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version - version: '0.7' + version: '1.0' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version - version: '0.7' + version: '1.0' - !ruby/object:Gem::Dependency name: rdoc requirement: !ruby/object:Gem::Requirement @@ -219,19 +225,19 @@ - !ruby/object:Gem::Version version: '7' - !ruby/object:Gem::Dependency - name: hoe + name: simplecov requirement: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version - version: '3.23' + version: '0.21' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version - version: '3.23' + version: '0.21' description: |- The mime-types library provides a library and registry for information about MIME content type definitions. It can be used to determine defined filename @@ -257,6 +263,7 @@ - Manifest.txt - README.rdoc files: +- ".standard.yml" - Code-of-Conduct.md - Contributing.md - History.md @@ -296,6 +303,7 @@ source_code_uri: https://github.com/mime-types/ruby-mime-types/ 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 + rubygems_mfa_required: 'true' post_install_message: rdoc_options: - "--main" @@ -313,7 +321,7 @@ - !ruby/object:Gem::Version version: '0' requirements: [] -rubygems_version: 3.1.6 +rubygems_version: 3.4.18 signing_key: specification_version: 4 summary: The mime-types library provides a library and registry for information about diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/test_mime_type.rb new/test/test_mime_type.rb --- old/test/test_mime_type.rb 2021-11-16 17:14:43.000000000 +0100 +++ new/test/test_mime_type.rb 2023-08-22 05:17:23.000000000 +0200 @@ -266,7 +266,27 @@ end it "is true for an equivalent MIME::Type" do - assert text_plain, mime_type("text/Plain") + assert text_plain.eql?(mime_type("text/Plain")) + end + + it "is true for an equivalent subclass of MIME::Type" do + subclass = Class.new(MIME::Type) + assert text_plain.eql?(subclass.new("text/plain")) + end + end + + describe "#hash" do + it "is the same between #eql? MIME::Type instances" do + assert_equal text_plain.hash, mime_type("text/plain").hash + end + + it "is the same between #eql? MIME::Type instances of different classes" do + subclass = Class.new(MIME::Type) + assert_equal text_plain.hash, subclass.new("text/plain").hash + end + + it "uses the #simplified value" do + assert_equal text_plain.hash, mime_type("text/Plain").hash end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/test_mime_types.rb new/test/test_mime_types.rb --- old/test/test_mime_types.rb 2021-11-16 17:14:43.000000000 +0100 +++ new/test/test_mime_types.rb 2023-08-22 05:17:23.000000000 +0200 @@ -159,6 +159,10 @@ plain_text.add_extensions("xtxt") assert_includes mime_types.type_for("xtxt"), "text/plain" end + + it "handles newline characters correctly" do + assert_includes mime_types.type_for("test.pdf\n.txt"), "text/plain" + end end describe "#count" do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/test_mime_types_cache.rb new/test/test_mime_types_cache.rb --- old/test/test_mime_types_cache.rb 2021-11-16 17:14:43.000000000 +0100 +++ new/test/test_mime_types_cache.rb 2023-08-22 05:17:23.000000000 +0200 @@ -67,7 +67,7 @@ it "outputs an error when there is a marshal file incompatibility" do MIME::Types::Cache.save data = File.binread(@cache_file).reverse - File.open(@cache_file, "wb") { |f| f.write(data) } + File.binwrite(@cache_file, data) MIME::Types.instance_variable_set(:@__types__, nil) assert_output "", /incompatible marshal file format/ do MIME::Types["text/html"] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/test_mime_types_class.rb new/test/test_mime_types_class.rb --- old/test/test_mime_types_class.rb 2021-11-16 17:14:43.000000000 +0100 +++ new/test/test_mime_types_class.rb 2023-08-22 05:17:23.000000000 +0200 @@ -100,6 +100,11 @@ plain_text.add_extensions("xtxt") assert_includes MIME::Types.type_for("xtxt"), "text/plain" end + + it "handles newline characters correctly" do + assert_includes MIME::Types.type_for("test.pdf\n.txt"), "text/plain" + assert_includes MIME::Types.type_for("test.txt\n.pdf"), "application/pdf" + end end describe ".count" do
