Hello community, here is the log from the commit of package rubygem-mime-types for openSUSE:Factory checked in at 2020-03-07 21:38:42 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-mime-types (Old) and /work/SRC/openSUSE:Factory/.rubygem-mime-types.new.26092 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-mime-types" Sat Mar 7 21:38:42 2020 rev:24 rq:773783 version:3.3.1 Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-mime-types/rubygem-mime-types.changes 2018-11-26 10:34:38.500723252 +0100 +++ /work/SRC/openSUSE:Factory/.rubygem-mime-types.new.26092/rubygem-mime-types.changes 2020-03-07 21:38:45.844293439 +0100 @@ -1,0 +2,34 @@ +Mon Feb 10 15:05:57 UTC 2020 - Stephan Kulow <[email protected]> + +- updated to version 3.3.1 + see installed History.md + + ## 3.3.1 / 2019-12-26 + + * 1 minor bugfix: + + * Al Snow fixed a warning with MIME::Types::Logger producing a warning + because Ruby 2.7 introduces numbered block parameters. Because of the + way that the MIME::Types::Logger works for deprecation messages, the + initializer parameters had been named `_1`, `_2`, and `_3`. This has + now been resolved. [#146][] + + * Administrivia: + + * Olle Jonsson removed an outdated Travis configuration option (`sudo: + false`). [#142][] + + ## 3.3 / 2019-09-04 + + * 1 minor enhancement + + * Jean Boussier reduced memory usage for Ruby versions 2.3 or higher by + interning various string values in each type. This is done with a + backwards-compatible call that _freezes_ the strings on older + versions of Ruby. [#141][] + + * Administrivia: + + * Nicholas La Roux updated Travis build configurations. [#139][] + +------------------------------------------------------------------- Old: ---- mime-types-3.2.2.gem New: ---- mime-types-3.3.1.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-mime-types.spec ++++++ --- /var/tmp/diff_new_pack.gJiSoA/_old 2020-03-07 21:38:46.384293804 +0100 +++ /var/tmp/diff_new_pack.gJiSoA/_new 2020-03-07 21:38:46.388293808 +0100 @@ -1,7 +1,7 @@ # # spec file for package rubygem-mime-types # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -24,7 +24,7 @@ # Name: rubygem-mime-types -Version: 3.2.2 +Version: 3.3.1 Release: 0 %define mod_name mime-types %define mod_full_name %{mod_name}-%{version} @@ -33,7 +33,7 @@ BuildRequires: %{rubygem gem2rpm} BuildRequires: %{rubygem rdoc > 3.10} BuildRequires: ruby-macros >= 5 -Url: https://github.com/mime-types/ruby-mime-types/ +URL: https://github.com/mime-types/ruby-mime-types/ Source: https://rubygems.org/gems/%{mod_full_name}.gem Source1: gem2rpm.yml Summary: The mime-types library provides a library and registry for ++++++ mime-types-3.2.2.gem -> mime-types-3.3.1.gem ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Contributing.md new/Contributing.md --- old/Contributing.md 2018-08-13 03:45:37.000000000 +0200 +++ new/Contributing.md 2019-12-26 20:42:06.000000000 +0100 @@ -99,6 +99,7 @@ * Aaron Patterson * Aggelos Avgerinos +* Al Snow * Andre Pankratz * Andy Brody * Arnaud Meuret @@ -115,6 +116,7 @@ * Hans de Graaff * Henrik Hodne * Janko Marohnić +* Jean Boussier * Jeremy Evans * Juanito Fatas * Jun Aruga @@ -124,7 +126,9 @@ * Martin d'Allens * Mauricio Linhares * Nicolas Leger +* Nicholas La Roux * nycvotes-dev +* Olle Jonsson * Postmodern * Richard Hirner * Richard Hurt diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/History.md new/History.md --- old/History.md 2018-08-13 03:45:37.000000000 +0200 +++ new/History.md 2019-12-26 20:42:06.000000000 +0100 @@ -1,3 +1,31 @@ +## 3.3.1 / 2019-12-26 + +* 1 minor bugfix: + + * Al Snow fixed a warning with MIME::Types::Logger producing a warning + because Ruby 2.7 introduces numbered block parameters. Because of the + way that the MIME::Types::Logger works for deprecation messages, the + initializer parameters had been named `_1`, `_2`, and `_3`. This has + now been resolved. [#146][] + +* Administrivia: + + * Olle Jonsson removed an outdated Travis configuration option (`sudo: + false`). [#142][] + +## 3.3 / 2019-09-04 + +* 1 minor enhancement + + * Jean Boussier reduced memory usage for Ruby versions 2.3 or higher by + interning various string values in each type. This is done with a + backwards-compatible call that _freezes_ the strings on older + versions of Ruby. [#141][] + +* Administrivia: + + * Nicholas La Roux updated Travis build configurations. [#139][] + ## 3.2.2 / 2018-08-12 * Hiroto Fukui removed a stray `debugger` statement that I had used in @@ -50,7 +78,7 @@ * Documentation Changes: * Supporting files are now Markdown instead of rdoc, except for the - README. + README. * The history file has been modified to remove all history prior to 3.0. This history can be found in previous commits. @@ -203,6 +231,10 @@ [#135]: https://github.com/mime-types/ruby-mime-types/pull/135 [#136]: https://github.com/mime-types/ruby-mime-types/issues/136 [#137]: https://github.com/mime-types/ruby-mime-types/pull/137 +[#139]: https://github.com/mime-types/ruby-mime-types/pull/139 +[#141]: https://github.com/mime-types/ruby-mime-types/pull/141 +[#142]: https://github.com/mime-types/ruby-mime-types/pull/142 +[#146]: https://github.com/mime-types/ruby-mime-types/pull/146 [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/Licence.md new/Licence.md --- old/Licence.md 2018-08-13 03:45:37.000000000 +0200 +++ new/Licence.md 2019-12-26 20:42:06.000000000 +0100 @@ -1,6 +1,6 @@ ## Licence -* Copyright 2003–2018 Austin Ziegler and contributors. +* Copyright 2003–2019 Austin Ziegler and contributors. The software in this repository is made available under the MIT license. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/README.rdoc new/README.rdoc --- old/README.rdoc 2018-08-13 03:45:37.000000000 +0200 +++ new/README.rdoc 2019-12-26 20:42:06.000000000 +0100 @@ -4,6 +4,7 @@ code :: https://github.com/mime-types/ruby-mime-types/ 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] 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] @@ -35,14 +36,6 @@ registry}[https://www.iana.org/assignments/media-types/media-types.xhtml], and user contributions. It conforms to RFCs 2045 and 2231. -=== mime-types 1.x End of Life - -mime-types 1.x is no longer supported as of 2015-10-27. - -=== mime-types 2.x End of Life - -mime-types 2.x is no longer supported as of 2017-11-21. - === mime-types 3.x Users are encouraged to upgrade to mime-types 3.x as soon as is practical. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Rakefile new/Rakefile --- old/Rakefile 2018-08-13 03:45:37.000000000 +0200 +++ new/Rakefile 2019-12-26 20:42:06.000000000 +0100 @@ -1,7 +1,5 @@ # frozen_string_literal: true -# -*- ruby encoding: utf-8 -*- - require 'rubygems' require 'hoe' require 'rake/clean' @@ -37,7 +35,7 @@ extra_dev_deps << ['minitest-bonus-assertions', '~> 3.0'] extra_dev_deps << ['minitest-hooks', '~> 1.4'] extra_dev_deps << ['rake', '>= 10.0', '< 13.0'] - extra_dev_deps << ['fivemat', '~> 1.3' ] + extra_dev_deps << ['fivemat', '~> 1.3'] extra_dev_deps << ['minitest-rg', '~> 5.2'] if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.0') @@ -56,7 +54,7 @@ end desc 'Benchmark Load Times' - task :load, [ :repeats ] => 'benchmark:support' do |_, args| + task :load, [:repeats] => 'benchmark:support' do |_, args| require 'benchmarks/load' Benchmarks::Load.report( File.join(Rake.application.original_dir, 'lib'), @@ -65,7 +63,7 @@ end desc 'Allocation counts' - task :allocations, [ :top_x, :mime_types_only ] => 'benchmark:support' do |_, args| + task :allocations, [:top_x, :mime_types_only] => 'benchmark:support' do |_, args| require 'benchmarks/load_allocations' Benchmarks::LoadAllocations.report( top_x: args.top_x, @@ -74,7 +72,7 @@ end desc 'Columnar allocation counts' - task 'allocations:columnar', [ :top_x, :mime_types_only ] => 'benchmark:support' do |_, args| + task 'allocations:columnar', [:top_x, :mime_types_only] => 'benchmark:support' do |_, args| require 'benchmarks/load_allocations' Benchmarks::LoadAllocations.report( columnar: true, @@ -84,7 +82,7 @@ end desc 'Columnar allocation counts (full load)' - task 'allocations:columnar:full', [ :top_x, :mime_types_only ] => 'benchmark:support' do |_, args| + task 'allocations:columnar:full', [:top_x, :mime_types_only] => 'benchmark:support' do |_, args| require 'benchmarks/load_allocations' Benchmarks::LoadAllocations.report( columnar: true, @@ -94,6 +92,36 @@ ) end + desc 'Memory profiler' + task :memory, [:top_x, :mime_types_only] => 'benchmark:support' do |_, args| + require 'benchmarks/memory_profiler' + Benchmarks::ProfileMemory.report( + mime_types_only: args.mime_types_only, + top_x: args.top_x + ) + end + + desc 'Columnar memory profiler' + task 'memory:columnar', [:top_x, :mime_types_only] => 'benchmark:support' do |_, args| + require 'benchmarks/memory_profiler' + Benchmarks::ProfileMemory.report( + columnar: true, + mime_types_only: args.mime_types_only, + top_x: args.top_x + ) + end + + desc 'Columnar allocation counts (full load)' + task 'memory:columnar:full', [:top_x, :mime_types_only] => 'benchmark:support' do |_, args| + require 'benchmarks/memory_profiler' + Benchmarks::ProfileMemory.report( + columnar: true, + full: true, + top_x: args.top_x, + mime_types_only: args.mime_types_only + ) + end + desc 'Object counts' task objects: 'benchmark:support' do require 'benchmarks/object_counts' @@ -131,7 +159,7 @@ '-R', 'mime/types', '-s', 'self', '-p', 'multi', - '-f', "#{output}", + '-f', output.to_s, script.to_s ] ruby args.join(' ') @@ -194,7 +222,7 @@ rdoc = name mark = "#{File.basename(name, '.rdoc')}.md" - file mark => [ rdoc, :setup ] do |t| + 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)) @@ -203,7 +231,7 @@ CLEAN.add mark - task run: [ mark ] + task run: [mark] end end @@ -211,7 +239,7 @@ task docs: 'convert:docs:run' end -task 'deps:top', [ :number ] do |_, args| +task 'deps:top', [:number] do |_, args| require 'net/http' require 'json' 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/columnar.rb new/lib/mime/type/columnar.rb --- old/lib/mime/type/columnar.rb 2018-08-13 03:45:37.000000000 +0200 +++ new/lib/mime/type/columnar.rb 2019-12-26 20:42:06.000000000 +0100 @@ -20,7 +20,7 @@ end def self.column(*methods, file: nil) # :nodoc: - file = methods.first unless file + file ||= methods.first file_method = :"load_#{file}" methods.each do |m| @@ -36,7 +36,7 @@ column :docs, :docs= column :preferred_extension, :preferred_extension= column :obsolete, :obsolete=, :obsolete?, :registered, :registered=, - :registered?, :signature, :signature=, :signature?, file: 'flags' + :registered?, :signature, :signature=, :signature?, file: 'flags' column :xrefs, :xrefs=, :xref_urls column :use_instead, :use_instead= 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 2018-08-13 03:45:37.000000000 +0200 +++ new/lib/mime/type.rb 2019-12-26 20:42:06.000000000 +0100 @@ -57,21 +57,21 @@ end # The released version of the mime-types library. - VERSION = '3.2.2' + VERSION = '3.3.1' include Comparable # :stopdoc: # TODO verify mime-type character restrictions; I am pretty sure that this is # too wide open. - MEDIA_TYPE_RE = %r{([-\w.+]+)/([-\w.+]*)} - I18N_RE = %r{[^[:alnum:]]} - BINARY_ENCODINGS = %w(base64 8bit) - ASCII_ENCODINGS = %w(7bit quoted-printable) + MEDIA_TYPE_RE = %r{([-\w.+]+)/([-\w.+]*)}.freeze + I18N_RE = /[^[:alnum:]]/.freeze + BINARY_ENCODINGS = %w(base64 8bit).freeze + ASCII_ENCODINGS = %w(7bit quoted-printable).freeze # :startdoc: private_constant :MEDIA_TYPE_RE, :I18N_RE, :BINARY_ENCODINGS, - :ASCII_ENCODINGS + :ASCII_ENCODINGS # Builds a MIME::Type object from the +content_type+, a MIME Content Type # value (e.g., 'text/plain' or 'applicaton/x-eruby'). The constructed object @@ -301,7 +301,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 ## @@ -321,7 +321,7 @@ # Returns +true+ if the media type is obsolete. attr_accessor :obsolete - alias_method :obsolete?, :obsolete + alias obsolete? obsolete # The documentation for this MIME::Type. attr_accessor :docs @@ -331,7 +331,7 @@ # call-seq: # text_plain.friendly # => "Text File" # text_plain.friendly('en') # => "Text File" - def friendly(lang = 'en'.freeze) + def friendly(lang = 'en') @friendly ||= {} case lang @@ -343,7 +343,7 @@ @friendly.update(lang) else fail ArgumentError, - "Expected a language or translation set, not #{lang.inspect}" + "Expected a language or translation set, not #{lang.inspect}" end end @@ -367,8 +367,8 @@ attr_reader :xrefs ## - def xrefs=(x) # :nodoc: - @xrefs = MIME::Types::Container.new(x) + def xrefs=(xrefs) # :nodoc: + @xrefs = MIME::Types::Container.new(xrefs) end # The decoded cross-reference URL list for this MIME::Type. @@ -381,7 +381,7 @@ # Indicates whether the MIME type has been registered with IANA. attr_accessor :registered - alias_method :registered?, :registered + alias registered? registered # MIME types can be specified to be sent across a network in particular # formats. This method returns +true+ when the MIME::Type encoding is set @@ -399,7 +399,7 @@ # Indicateswhether the MIME type is declared as a signature type. attr_accessor :signature - alias_method :signature?, :signature + alias signature? signature # Returns +true+ if the MIME::Type specifies an extension list, # indicating that it is a complete MIME::Type. @@ -438,17 +438,15 @@ # # This method should be considered a private implementation detail. def encode_with(coder) - coder['content-type'] = @content_type - coder['docs'] = @docs unless @docs.nil? or @docs.empty? - unless @friendly.nil? or @friendly.empty? - coder['friendly'] = @friendly - end - coder['encoding'] = @encoding - coder['extensions'] = @extensions.to_a unless @extensions.empty? + coder['content-type'] = @content_type + coder['docs'] = @docs unless @docs.nil? or @docs.empty? + coder['friendly'] = @friendly unless @friendly.nil? or @friendly.empty? + coder['encoding'] = @encoding + coder['extensions'] = @extensions.to_a unless @extensions.empty? coder['preferred-extension'] = @preferred_extension if @preferred_extension if obsolete? - coder['obsolete'] = obsolete? - coder['use-instead'] = use_instead if use_instead + coder['obsolete'] = obsolete? + coder['use-instead'] = use_instead if use_instead end unless xrefs.empty? {}.tap do |hash| @@ -458,8 +456,8 @@ coder['xrefs'] = hash end end - coder['registered'] = registered? - coder['signature'] = signature? if signature? + coder['registered'] = registered? + coder['signature'] = signature? if signature? coder end @@ -504,7 +502,7 @@ # use with the I18n library. def i18n_key(content_type) simplify_matchdata(match(content_type), joiner: '.') { |e| - e.gsub!(I18N_RE, '-'.freeze) + e.gsub!(I18N_RE, '-') } end @@ -521,12 +519,12 @@ private - def simplify_matchdata(matchdata, remove_x = false, joiner: '/'.freeze) + def simplify_matchdata(matchdata, remove_x = false, joiner: '/') return nil unless matchdata matchdata.captures.map { |e| e.downcase! - e.sub!(%r{^x-}, ''.freeze) if remove_x + e.sub!(/^x-/, '') if remove_x yield e if block_given? e }.join(joiner) @@ -539,11 +537,28 @@ match = MEDIA_TYPE_RE.match(type_string) fail InvalidContentType, type_string if match.nil? - @content_type = type_string + @content_type = intern_string(type_string) @raw_media_type, @raw_sub_type = match.captures - @simplified = MIME::Type.simplified(match) - @i18n_key = MIME::Type.i18n_key(match) + @simplified = intern_string(MIME::Type.simplified(match)) + @i18n_key = intern_string(MIME::Type.i18n_key(match)) @media_type, @sub_type = MEDIA_TYPE_RE.match(@simplified).captures + + @raw_media_type = intern_string(@raw_media_type) + @raw_sub_type = intern_string(@raw_sub_type) + @media_type = intern_string(@media_type) + @sub_type = intern_string(@sub_type) + end + + if String.method_defined?(:-@) + def intern_string(string) + -string + end + else + # MRI 2.2 and older don't have a method for string interning, + # so we simply freeze them for keeping a similar interface + def intern_string(string) + string.freeze + end end def xref_map(values, helper) @@ -551,23 +566,22 @@ end def xref_url_for_rfc(value) - 'http://www.iana.org/go/%s'.freeze % value + 'http://www.iana.org/go/%s' % value end def xref_url_for_draft(value) - 'http://www.iana.org/go/%s'.freeze % value.sub(/\ARFC/, 'draft') + 'http://www.iana.org/go/%s' % value.sub(/\ARFC/, 'draft') end def xref_url_for_rfc_errata(value) - 'http://www.rfc-editor.org/errata_search.php?eid=%s'.freeze % value + 'http://www.rfc-editor.org/errata_search.php?eid=%s' % value end def xref_url_for_person(value) - 'http://www.iana.org/assignments/media-types/media-types.xhtml#%s'.freeze % - value + 'http://www.iana.org/assignments/media-types/media-types.xhtml#%s' % value end def xref_url_for_template(value) - 'http://www.iana.org/assignments/media-types/%s'.freeze % value + 'http://www.iana.org/assignments/media-types/%s' % value end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/mime/types/_columnar.rb new/lib/mime/types/_columnar.rb --- old/lib/mime/types/_columnar.rb 2018-08-13 03:45:37.000000000 +0200 +++ new/lib/mime/types/_columnar.rb 2019-12-26 20:42:06.000000000 +0100 @@ -45,7 +45,7 @@ i = -1 column = File.join(@__root__, "mime.#{name}.column") - IO.readlines(column, encoding: 'UTF-8'.freeze).each do |line| + IO.readlines(column, encoding: 'UTF-8').each do |line| line.chomp! if lookup @@ -63,7 +63,6 @@ def load_encoding each_file_line('encoding') do |type, line| pool ||= {} - line.freeze type.instance_variable_set(:@encoding, (pool[line] ||= line)) end end @@ -108,11 +107,11 @@ end def dict(line, array: false) - if line == '-'.freeze + if line == '-' {} else - line.split('|'.freeze).each_with_object({}) { |l, h| - k, v = l.split('^'.freeze) + line.split('|').each_with_object({}) { |l, h| + k, v = l.split('^') v = nil if v.empty? h[k] = array ? Array(v) : v } @@ -120,18 +119,18 @@ end def arr(line) - if line == '-'.freeze + if line == '-' [] else - line.split('|'.freeze).flatten.compact.uniq + line.split('|').flatten.compact.uniq end end def opt(line) - line unless line == '-'.freeze + line unless line == '-' end def flag(line) - line == '1'.freeze ? true : false + line == '1' end 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 2018-08-13 03:45:37.000000000 +0200 +++ new/lib/mime/types/cache.rb 2019-12-26 20:42:06.000000000 +0100 @@ -22,16 +22,16 @@ if cache.version == MIME::Types::Data::VERSION Marshal.load(cache.data) else - MIME::Types.logger.warn <<-warning.chomp + MIME::Types.logger.warn <<-WARNING.chomp Could not load MIME::Types cache: invalid version - warning + WARNING nil end rescue => e - MIME::Types.logger.warn <<-warning.chomp + MIME::Types.logger.warn <<-WARNING.chomp Could not load MIME::Types cache: #{e} - warning - return nil + WARNING + nil end # Attempts to save the types provided to the cache file provided. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/mime/types/container.rb new/lib/mime/types/container.rb --- old/lib/mime/types/container.rb 2018-08-13 03:45:37.000000000 +0200 +++ new/lib/mime/types/container.rb 2019-12-26 20:42:06.000000000 +0100 @@ -22,12 +22,13 @@ end def []=(key, value) - case value - when Set - container[key] = value - else - container[key] = Set[*value] - end + container[key] = + case value + when Set + value + else + Set[*value] + end end def merge(other) @@ -37,7 +38,7 @@ def merge!(other) tap { other = other.kind_of?(MIME::Types::Container) ? other.container : other - self.container.merge!(other) + container.merge!(other) normalize } end @@ -47,15 +48,15 @@ end def_delegators :@container, - :==, - :count, - :each, - :each_value, - :empty?, - :flat_map, - :keys, - :select, - :values + :==, + :count, + :each, + :each_value, + :empty?, + :flat_map, + :keys, + :select, + :values def add(key, value) (container[key] ||= Set.new).add(value) @@ -85,6 +86,7 @@ def normalize container.each do |k, v| next if v.kind_of?(Set) + container[k] = Set[*v] 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 2018-08-13 03:45:37.000000000 +0200 +++ new/lib/mime/types/deprecations.rb 2019-12-26 20:42:06.000000000 +0100 @@ -1,7 +1,5 @@ # frozen_string_literal: true -# -*- ruby encoding: utf-8 -*- - require 'mime/types/logger' # The namespace for MIME applications, tools, and libraries. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/mime/types/logger.rb new/lib/mime/types/logger.rb --- old/lib/mime/types/logger.rb 2018-08-13 03:45:37.000000000 +0200 +++ new/lib/mime/types/logger.rb 2019-12-26 20:42:06.000000000 +0100 @@ -27,7 +27,7 @@ end end - def initialize(_1, _2 = nil, _3 = nil) + def initialize(_one, _two = nil, _three = nil) super nil @logdev = WarnLogDevice.new @formatter = ->(_s, _d, _p, m) { m } 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 2018-08-13 03:45:37.000000000 +0200 +++ new/lib/mime/types/registry.rb 2019-12-26 20:42:06.000000000 +0100 @@ -33,7 +33,7 @@ def type_for(filename) __types__.type_for(filename) end - alias_method :of, :type_for + alias of type_for # MIME::Types#add against the default MIME::Types registry. def add(*types) @@ -43,13 +43,13 @@ private def lazy_load? - if ENV.key?('RUBY_MIME_TYPES_LAZY_LOAD') - MIME::Types.logger.warn <<-WARNING.chomp + return unless ENV.key?('RUBY_MIME_TYPES_LAZY_LOAD') + + MIME::Types.logger.warn <<-WARNING.chomp Lazy loading ($RUBY_MIME_TYPES_LAZY_LOAD) is deprecated and will be removed. - WARNING + WARNING - (lazy = ENV['RUBY_MIME_TYPES_LAZY_LOAD']) && (lazy != 'false') - end + (lazy = ENV['RUBY_MIME_TYPES_LAZY_LOAD']) && (lazy != 'false') end def __types__ @@ -63,7 +63,7 @@ end def load_default_mime_types(mode = load_mode) - if @__types__ = MIME::Types::Cache.load + if (@__types__ = MIME::Types::Cache.load) __instances__.add(@__types__) else @__types__ = MIME::Types::Loader.load(mode) 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 2018-08-13 03:45:37.000000000 +0200 +++ new/lib/mime/types.rb 2019-12-26 20:42:06.000000000 +0100 @@ -155,7 +155,7 @@ a.priority_compare(b) } end - alias_method :of, :type_for + alias of type_for # Add one or more MIME::Type objects to the set of known types. If the # type is already known, a warning will be displayed. @@ -185,9 +185,9 @@ # truthy value to suppress that warning. def add_type(type, quiet = false) if !quiet and @type_variants[type.simplified].include?(type) - MIME::Types.logger.warn <<-warning + MIME::Types.logger.warn <<-WARNING Type #{type} is already registered as a variant of #{type.simplified}. - warning + WARNING end add_type_variant!(type) @@ -202,6 +202,7 @@ def reindex_extensions!(mime_type) return unless @type_variants[mime_type.simplified].include?(mime_type) + index_extensions!(mime_type) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2018-08-13 03:45:37.000000000 +0200 +++ new/metadata 2019-12-26 20:42:06.000000000 +0100 @@ -1,14 +1,14 @@ --- !ruby/object:Gem::Specification name: mime-types version: !ruby/object:Gem::Version - version: 3.2.2 + version: 3.3.1 platform: ruby authors: - Austin Ziegler autorequire: bindir: bin cert_chain: [] -date: 2018-08-13 00:00:00.000000000 Z +date: 2019-12-26 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: mime-types-data @@ -30,14 +30,14 @@ requirements: - - "~>" - !ruby/object:Gem::Version - version: '5.11' + version: '5.13' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version - version: '5.11' + version: '5.13' - !ruby/object:Gem::Dependency name: hoe-doofus requirement: !ruby/object:Gem::Requirement @@ -235,7 +235,7 @@ version: '4.0' - - "<" - !ruby/object:Gem::Version - version: '6' + version: '7' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement @@ -245,21 +245,21 @@ version: '4.0' - - "<" - !ruby/object:Gem::Version - version: '6' + version: '7' - !ruby/object:Gem::Dependency name: hoe requirement: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version - version: '3.17' + version: '3.20' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version - version: '3.17' + version: '3.20' 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 @@ -319,7 +319,11 @@ homepage: https://github.com/mime-types/ruby-mime-types/ licenses: - MIT -metadata: {} +metadata: + homepage_uri: https://github.com/mime-types/ruby-mime-types/ + 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 post_install_message: rdoc_options: - "--main" @@ -337,8 +341,7 @@ - !ruby/object:Gem::Version version: '0' requirements: [] -rubyforge_project: -rubygems_version: 2.7.7 +rubygems_version: 3.0.3 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/minitest_helper.rb new/test/minitest_helper.rb --- old/test/minitest_helper.rb 2018-08-13 03:45:37.000000000 +0200 +++ new/test/minitest_helper.rb 2019-12-26 20:42:06.000000000 +0100 @@ -1,7 +1,5 @@ # frozen_string_literal: true -# -*- ruby encoding: utf-8 -*- - require 'mime/type' require 'fileutils' 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 2018-08-13 03:45:37.000000000 +0200 +++ new/test/test_mime_type.rb 2019-12-26 20:42:06.000000000 +0100 @@ -1,13 +1,9 @@ # frozen_string_literal: true -# -*- ruby encoding: utf-8 -*- - require 'mime/types' require 'minitest_helper' describe MIME::Type do - # it { fail } - def mime_type(content_type) MIME::Type.new(content_type) { |mt| yield mt if block_given? } end @@ -50,15 +46,15 @@ it 'does not remove x- prefixes by default' do assert_equal 'application/x-msword', - MIME::Type.simplified('application/x-msword') + MIME::Type.simplified('application/x-msword') assert_equal 'x-xyz/abc', MIME::Type.simplified('x-xyz/abc') end it 'removes x- prefixes when requested' do assert_equal 'application/msword', - MIME::Type.simplified('application/x-msword', remove_x_prefix: true) + MIME::Type.simplified('application/x-msword', remove_x_prefix: true) assert_equal 'xyz/abc', - MIME::Type.simplified('x-xyz/abc', remove_x_prefix: true) + MIME::Type.simplified('x-xyz/abc', remove_x_prefix: true) end it 'lowercases mixed-case types' do @@ -77,7 +73,7 @@ it 'does not remove x-prefixes' do assert_equal 'application.x-msword', - MIME::Type.i18n_key('application/x-msword') + MIME::Type.i18n_key('application/x-msword') end it 'converts text/vCard to text.vcard' do @@ -333,8 +329,8 @@ end it 'sorts (2) based on extensions' do - text_1.extensions = ["foo", "bar"] - text_2.extensions = ["foo"] + text_1.extensions = ['foo', 'bar'] + text_2.extensions = ['foo'] assert_priority_same text_1, text_2 @@ -440,12 +436,12 @@ it 'has the extensions key if set' do assert_has_keys mime_type(t) { |v| v.extensions = 'a' }.to_h, - 'extensions' + 'extensions' 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' + 'preferred-extension' end it 'has the obsolete key if set' do @@ -476,7 +472,7 @@ describe '#to_s, #to_str' do it 'represents itself as a string of the canonical content_type' do - assert_equal 'text/plain', "#{text_plain}" + assert_equal 'text/plain', text_plain.to_s end it 'acts like a string of the canonical content_type for comparison' do @@ -490,7 +486,7 @@ describe '#xrefs, #xrefs=' do let(:expected) { - MIME::Types::Container.new({ 'rfc' => Set[*%w(rfc1234 rfc5678)] }) + MIME::Types::Container.new('rfc' => Set['rfc1234', 'rfc5678']) } it 'returns the expected results' do @@ -518,13 +514,13 @@ let(:type) { mime_type('a/b').tap do |t| t.xrefs = { - 'draft' => [ 'RFC1' ], - 'template' => [ 'a/b' ], - 'person' => [ 'p-1' ], - 'rfc' => [ 'rfc-1' ], - 'rfc-errata' => [ 'err-1' ], - 'uri' => [ 'http://example.org' ], - 'text' => [ 'text' ] + 'draft' => ['RFC1'], + 'template' => ['a/b'], + 'person' => ['p-1'], + 'rfc' => ['rfc-1'], + 'rfc-errata' => ['err-1'], + 'uri' => ['http://example.org'], + 'text' => ['text'] } end } @@ -588,10 +584,10 @@ it 'merges new values from an array parameter' do expected = { 'en' => 'Text files' } - assert_equal expected, text_plain.friendly([ 'en', 'Text files' ]) + assert_equal expected, text_plain.friendly(['en', 'Text files']) expected.update('fr' => 'des fichiers texte') assert_equal expected, - text_plain.friendly([ 'fr', 'des fichiers texte' ]) + text_plain.friendly(['fr', 'des fichiers texte']) end it 'merges new values from a hash parameter' do @@ -608,7 +604,7 @@ end assert_equal 'Expected a language or translation set, not 1', - exception.message + exception.message end 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 2018-08-13 03:45:37.000000000 +0200 +++ new/test/test_mime_types.rb 2019-12-26 20:42:06.000000000 +0100 @@ -1,32 +1,30 @@ # frozen_string_literal: true -# -*- ruby encoding: utf-8 -*- - require 'mime/types' require 'minitest_helper' describe MIME::Types do def mime_types - @mime_types ||= MIME::Types.new.tap do |mt| + @mime_types ||= MIME::Types.new.tap { |mt| mt.add MIME::Type.new(['text/plain', %w(txt)]), - MIME::Type.new(['image/jpeg', %w(jpg jpeg)]), - MIME::Type.new('application/x-wordperfect6.1'), - MIME::Type.new( - 'content-type' => 'application/x-www-form-urlencoded', - 'registered' => true - ), - MIME::Type.new(['application/x-gzip', %w(gz)]), - MIME::Type.new( - 'content-type' => 'application/gzip', - 'extensions' => 'gz', - 'registered' => true - ) - end + MIME::Type.new(['image/jpeg', %w(jpg jpeg)]), + MIME::Type.new('application/x-wordperfect6.1'), + MIME::Type.new( + 'content-type' => 'application/x-www-form-urlencoded', + 'registered' => true + ), + MIME::Type.new(['application/x-gzip', %w(gz)]), + MIME::Type.new( + 'content-type' => 'application/gzip', + 'extensions' => 'gz', + 'registered' => true + ) + } end describe 'is enumerable' do it 'correctly uses an Enumerable method like #any?' do - assert mime_types.any? { |type| type.content_type == 'text/plain' } + assert(mime_types.any? { |type| type.content_type == 'text/plain' }) end it 'implements each with no parameters to return an Enumerator' do @@ -95,11 +93,11 @@ describe '#add' do let(:eruby) { MIME::Type.new('application/x-eruby') } - let(:jinja) { MIME::Type.new('application/jinja2' )} + let(:jinja) { MIME::Type.new('application/jinja2') } it 'successfully adds a new type' do mime_types.add(eruby) - assert_equal mime_types['application/x-eruby'], [ eruby ] + assert_equal mime_types['application/x-eruby'], [eruby] end it 'complains about adding a duplicate type' do @@ -115,13 +113,13 @@ assert_output '', '' do mime_types.add(eruby, :silent) end - assert_equal mime_types['application/x-eruby'], [ eruby ] + assert_equal mime_types['application/x-eruby'], [eruby] end it 'successfully adds from an array' do - mime_types.add([ eruby, jinja ]) - assert_equal mime_types['application/x-eruby'], [ eruby ] - assert_equal mime_types['application/jinja2'], [ jinja ] + mime_types.add([eruby, jinja]) + assert_equal mime_types['application/x-eruby'], [eruby] + assert_equal mime_types['application/jinja2'], [jinja] end it 'successfully adds from another MIME::Types' do @@ -130,7 +128,7 @@ assert_equal mime_types.count, mt.count mime_types.each do |type| - assert_equal mt[type.content_type], [ type ] + assert_equal mt[type.content_type], [type] end end end @@ -138,7 +136,7 @@ describe '#type_for' do it 'finds all types for a given extension' do assert_equal %w(application/gzip application/x-gzip), - mime_types.type_for('gz') + mime_types.type_for('gz') end it 'separates the extension from filenames' do @@ -147,7 +145,7 @@ it 'finds multiple extensions' do assert_equal %w(image/jpeg text/plain), - mime_types.type_for(%w(foo.txt foo.jpeg)) + mime_types.type_for(%w(foo.txt foo.jpeg)) end it 'does not find unknown extensions' 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 2018-08-13 03:45:37.000000000 +0200 +++ new/test/test_mime_types_cache.rb 2019-12-26 20:42:06.000000000 +0100 @@ -1,7 +1,5 @@ # frozen_string_literal: true -# -*- ruby encoding: utf-8 -*- - require 'mime/types' require 'minitest_helper' @@ -69,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.open(@cache_file, 'wb') do |f| f.write(data) end 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 2018-08-13 03:45:37.000000000 +0200 +++ new/test/test_mime_types_class.rb 2019-12-26 20:42:06.000000000 +0100 @@ -1,7 +1,5 @@ # frozen_string_literal: true -# -*- ruby encoding: utf-8 -*- - require 'mime/types' require 'minitest_helper' @@ -12,7 +10,7 @@ describe 'is enumerable' do it 'correctly uses an Enumerable method like #any?' do - assert MIME::Types.any? { |type| type.content_type == 'text/plain' } + assert(MIME::Types.any? { |type| type.content_type == 'text/plain' }) end it 'implements each with no parameters to return an Enumerator' do @@ -45,7 +43,7 @@ it 'sorts by priority with multiple matches' do types = MIME::Types[/gzip$/].select { |t| - t == 'application/gzip' || t == 'application/x-gzip' || t == 'multipart/x-gzip' + %w(application/gzip application/x-gzip multipart/x-gzip).include?(t) } # This is this way because of a new type ending with gzip that only # appears in some data files. @@ -81,7 +79,7 @@ describe '.type_for' do it 'finds all types for a given extension' do assert_equal %w(application/gzip application/x-gzip), - MIME::Types.type_for('gz') + MIME::Types.type_for('gz') end it 'separates the extension from filenames' do @@ -90,7 +88,7 @@ it 'finds multiple extensions' do assert_equal %w(image/jpeg text/plain), - MIME::Types.type_for(%w(foo.txt foo.jpeg)) + MIME::Types.type_for(%w(foo.txt foo.jpeg)) end it 'does not find unknown extensions' do @@ -117,11 +115,11 @@ end let(:eruby) { MIME::Type.new('application/x-eruby') } - let(:jinja) { MIME::Type.new('application/jinja2' )} + let(:jinja) { MIME::Type.new('application/jinja2') } it 'successfully adds a new type' do MIME::Types.add(eruby) - assert_equal MIME::Types['application/x-eruby'], [ eruby ] + assert_equal MIME::Types['application/x-eruby'], [eruby] end it 'complains about adding a duplicate type' do @@ -137,13 +135,13 @@ assert_silent do MIME::Types.add(eruby, :silent) end - assert_equal MIME::Types['application/x-eruby'], [ eruby ] + assert_equal MIME::Types['application/x-eruby'], [eruby] end it 'successfully adds from an array' do - MIME::Types.add([ eruby, jinja ]) - assert_equal MIME::Types['application/x-eruby'], [ eruby ] - assert_equal MIME::Types['application/jinja2'], [ jinja ] + MIME::Types.add([eruby, jinja]) + assert_equal MIME::Types['application/x-eruby'], [eruby] + assert_equal MIME::Types['application/jinja2'], [jinja] end it 'successfully adds from another MIME::Types' do @@ -155,7 +153,7 @@ MIME::Types.add(mt) assert_equal old_count + 1, MIME::Types.count - assert_equal MIME::Types[eruby.content_type], [ eruby ] + assert_equal MIME::Types[eruby.content_type], [eruby] end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/test_mime_types_lazy.rb new/test/test_mime_types_lazy.rb --- old/test/test_mime_types_lazy.rb 2018-08-13 03:45:37.000000000 +0200 +++ new/test/test_mime_types_lazy.rb 2019-12-26 20:42:06.000000000 +0100 @@ -1,7 +1,5 @@ # frozen_string_literal: true -# -*- ruby encoding: utf-8 -*- - require 'mime/types' require 'minitest_helper' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/test_mime_types_loader.rb new/test/test_mime_types_loader.rb --- old/test/test_mime_types_loader.rb 2018-08-13 03:45:37.000000000 +0200 +++ new/test/test_mime_types_loader.rb 2019-12-26 20:42:06.000000000 +0100 @@ -1,7 +1,5 @@ # frozen_string_literal: true -# -*- ruby encoding: utf-8 -*- - require 'mime/types' require 'minitest_helper'
