Skip to content

Commit

Permalink
Fix [_1,_2,_3] parameters (conflict with Ruby 2.7.0); Updated gems an…
Browse files Browse the repository at this point in the history
…d ruby versions.
  • Loading branch information
jasnow authored and halostatue committed Dec 26, 2019
1 parent 1787454 commit c446731
Show file tree
Hide file tree
Showing 11 changed files with 80 additions and 97 deletions.
16 changes: 8 additions & 8 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ AllCops:
Exclude:
- mime-types.gemspec

Layout/AlignParameters:
Layout/ParameterAlignment:
EnforcedStyle: with_fixed_indentation

Layout/DotPosition:
Expand All @@ -15,7 +15,7 @@ Layout/DotPosition:
Layout/MultilineMethodCallIndentation:
EnforcedStyle: indented

Metrics/LineLength:
Layout/LineLength:
Max: 100

Naming/FileName:
Expand All @@ -26,18 +26,18 @@ Naming/MemoizedInstanceVariableName:
Exclude:
- lib/mime/types/registry.rb

Naming/UncommunicativeMethodParamName:
Naming/MethodParameterName:
Exclude:
- lib/mime/types/logger.rb

Naming/VariableNumber:
Exclude:
- lib/mime/types/logger.rb

Performance/Caller:
Exclude:
- lib/mime/types/deprecations.rb

#Performance/Caller:
# Exclude:
# - lib/mime/types/deprecations.rb
#
Security/MarshalLoad:
Exclude:
- lib/mime/types/cache.rb
Expand Down Expand Up @@ -71,7 +71,7 @@ Style/RescueStandardError:
Style/SignalException:
EnforcedStyle: semantic

Layout/IndentHeredoc: { Enabled: false }
Layout/HeredocIndentation: { Enabled: false }
Metrics/AbcSize: { Enabled: false }
Metrics/BlockLength: { Enabled: false }
Metrics/ClassLength: { Enabled: false }
Expand Down
10 changes: 5 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
language: ruby
rvm:
- 2.6.4
- 2.5.6
- 2.4.7
- 2.7.0
- 2.6.5
- 2.5.7
- 2.4.9
- 2.3.8
- 2.2.10
- 2.1.10
- jruby-9.2.8.0
- jruby-9.2.9.0
- jruby-9.1.17.0
- jruby-head
- ruby-head
Expand Down
4 changes: 2 additions & 2 deletions lib/mime/type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def to_s
# :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
Expand Down Expand Up @@ -343,7 +343,7 @@ def friendly(lang = 'en')
@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

Expand Down
2 changes: 1 addition & 1 deletion lib/mime/type/columnar.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def self.column(*methods, file: nil) # :nodoc:
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=

Expand Down
18 changes: 9 additions & 9 deletions lib/mime/types/container.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ def to_hash
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)
Expand Down
2 changes: 1 addition & 1 deletion lib/mime/types/logger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def close
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 }
Expand Down
73 changes: 28 additions & 45 deletions mime-types.gemspec
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# -*- encoding: utf-8 -*-
# stub: mime-types 3.2.2 ruby lib
# stub: mime-types 3.3 ruby lib

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

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", "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.require_paths = ["lib".freeze]
s.authors = ["Austin Ziegler".freeze]
s.date = "2018-08-13"
s.date = "2019-12-25"
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 = ["halostatue@gmail.com".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 @@ -17,52 +18,34 @@ 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 = "2.7.7".freeze
s.rubygems_version = "3.1.2".freeze
s.summary = "The mime-types library provides a library and registry for information about MIME content type definitions".freeze

if s.respond_to? :specification_version then
s.specification_version = 4
end

if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
s.add_runtime_dependency(%q<mime-types-data>.freeze, ["~> 3.2015"])
s.add_development_dependency(%q<minitest>.freeze, ["~> 5.11"])
s.add_development_dependency(%q<hoe-doofus>.freeze, ["~> 1.0"])
s.add_development_dependency(%q<hoe-gemspec2>.freeze, ["~> 1.1"])
s.add_development_dependency(%q<hoe-git>.freeze, ["~> 1.6"])
s.add_development_dependency(%q<hoe-rubygems>.freeze, ["~> 1.0"])
s.add_development_dependency(%q<hoe-travis>.freeze, ["~> 1.2"])
s.add_development_dependency(%q<minitest-autotest>.freeze, ["~> 1.0"])
s.add_development_dependency(%q<minitest-focus>.freeze, ["~> 1.0"])
s.add_development_dependency(%q<minitest-bonus-assertions>.freeze, ["~> 3.0"])
s.add_development_dependency(%q<minitest-hooks>.freeze, ["~> 1.4"])
s.add_development_dependency(%q<rake>.freeze, ["< 13.0", ">= 10.0"])
s.add_development_dependency(%q<fivemat>.freeze, ["~> 1.3"])
s.add_development_dependency(%q<minitest-rg>.freeze, ["~> 5.2"])
s.add_development_dependency(%q<simplecov>.freeze, ["~> 0.7"])
s.add_development_dependency(%q<rdoc>.freeze, ["< 6", ">= 4.0"])
s.add_development_dependency(%q<hoe>.freeze, ["~> 3.17"])
else
s.add_dependency(%q<mime-types-data>.freeze, ["~> 3.2015"])
s.add_dependency(%q<minitest>.freeze, ["~> 5.11"])
s.add_dependency(%q<hoe-doofus>.freeze, ["~> 1.0"])
s.add_dependency(%q<hoe-gemspec2>.freeze, ["~> 1.1"])
s.add_dependency(%q<hoe-git>.freeze, ["~> 1.6"])
s.add_dependency(%q<hoe-rubygems>.freeze, ["~> 1.0"])
s.add_dependency(%q<hoe-travis>.freeze, ["~> 1.2"])
s.add_dependency(%q<minitest-autotest>.freeze, ["~> 1.0"])
s.add_dependency(%q<minitest-focus>.freeze, ["~> 1.0"])
s.add_dependency(%q<minitest-bonus-assertions>.freeze, ["~> 3.0"])
s.add_dependency(%q<minitest-hooks>.freeze, ["~> 1.4"])
s.add_dependency(%q<rake>.freeze, ["< 13.0", ">= 10.0"])
s.add_dependency(%q<fivemat>.freeze, ["~> 1.3"])
s.add_dependency(%q<minitest-rg>.freeze, ["~> 5.2"])
s.add_dependency(%q<simplecov>.freeze, ["~> 0.7"])
s.add_dependency(%q<rdoc>.freeze, ["< 6", ">= 4.0"])
s.add_dependency(%q<hoe>.freeze, ["~> 3.17"])
end
if s.respond_to? :add_runtime_dependency then
s.add_runtime_dependency(%q<mime-types-data>.freeze, ["~> 3.2015"])
s.add_development_dependency(%q<minitest>.freeze, ["~> 5.13"])
s.add_development_dependency(%q<hoe-doofus>.freeze, ["~> 1.0"])
s.add_development_dependency(%q<hoe-gemspec2>.freeze, ["~> 1.1"])
s.add_development_dependency(%q<hoe-git>.freeze, ["~> 1.6"])
s.add_development_dependency(%q<hoe-rubygems>.freeze, ["~> 1.0"])
s.add_development_dependency(%q<hoe-travis>.freeze, ["~> 1.2"])
s.add_development_dependency(%q<minitest-autotest>.freeze, ["~> 1.0"])
s.add_development_dependency(%q<minitest-focus>.freeze, ["~> 1.0"])
s.add_development_dependency(%q<minitest-bonus-assertions>.freeze, ["~> 3.0"])
s.add_development_dependency(%q<minitest-hooks>.freeze, ["~> 1.4"])
s.add_development_dependency(%q<rake>.freeze, [">= 10.0", "< 13.0"])
s.add_development_dependency(%q<fivemat>.freeze, ["~> 1.3"])
s.add_development_dependency(%q<minitest-rg>.freeze, ["~> 5.2"])
s.add_development_dependency(%q<simplecov>.freeze, ["~> 0.7"])
s.add_development_dependency(%q<rdoc>.freeze, [">= 4.0", "< 7"])
s.add_development_dependency(%q<hoe>.freeze, ["~> 3.20"])
else
s.add_dependency(%q<mime-types-data>.freeze, ["~> 3.2015"])
s.add_dependency(%q<minitest>.freeze, ["~> 5.11"])
s.add_dependency(%q<minitest>.freeze, ["~> 5.13"])
s.add_dependency(%q<hoe-doofus>.freeze, ["~> 1.0"])
s.add_dependency(%q<hoe-gemspec2>.freeze, ["~> 1.1"])
s.add_dependency(%q<hoe-git>.freeze, ["~> 1.6"])
Expand All @@ -72,11 +55,11 @@ Gem::Specification.new do |s|
s.add_dependency(%q<minitest-focus>.freeze, ["~> 1.0"])
s.add_dependency(%q<minitest-bonus-assertions>.freeze, ["~> 3.0"])
s.add_dependency(%q<minitest-hooks>.freeze, ["~> 1.4"])
s.add_dependency(%q<rake>.freeze, ["< 13.0", ">= 10.0"])
s.add_dependency(%q<rake>.freeze, [">= 10.0", "< 13.0"])
s.add_dependency(%q<fivemat>.freeze, ["~> 1.3"])
s.add_dependency(%q<minitest-rg>.freeze, ["~> 5.2"])
s.add_dependency(%q<simplecov>.freeze, ["~> 0.7"])
s.add_dependency(%q<rdoc>.freeze, ["< 6", ">= 4.0"])
s.add_dependency(%q<hoe>.freeze, ["~> 3.17"])
s.add_dependency(%q<rdoc>.freeze, [">= 4.0", "< 7"])
s.add_dependency(%q<hoe>.freeze, ["~> 3.20"])
end
end
18 changes: 9 additions & 9 deletions test/test_mime_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ def mime_type(content_type)

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
Expand All @@ -73,7 +73,7 @@ def mime_type(content_type)

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
Expand Down Expand Up @@ -436,12 +436,12 @@ def assert_priority(left, middle, right)

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
Expand Down Expand Up @@ -472,7 +472,7 @@ def assert_priority(left, middle, right)

describe '#to_s, #to_str' do
it 'represents itself as a string of the canonical content_type' do
assert_equal 'text/plain', "#{text_plain}" # rubocop:disable Style/UnneededInterpolation
assert_equal 'text/plain', text_plain.to_s
end

it 'acts like a string of the canonical content_type for comparison' do
Expand Down Expand Up @@ -587,7 +587,7 @@ def assert_priority(left, middle, right)
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
Expand All @@ -604,7 +604,7 @@ def assert_priority(left, middle, right)
end

assert_equal 'Expected a language or translation set, not 1',
exception.message
exception.message
end
end
end
28 changes: 14 additions & 14 deletions test/test_mime_types.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@
def mime_types
@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
)
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

Expand Down Expand Up @@ -136,7 +136,7 @@ def mime_types
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
Expand All @@ -145,7 +145,7 @@ def mime_types

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
Expand Down
4 changes: 2 additions & 2 deletions test/test_mime_types_class.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def setup
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
Expand All @@ -88,7 +88,7 @@ def setup

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
Expand Down
2 changes: 1 addition & 1 deletion test/test_mime_types_loader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def assert_correctly_loaded(types)
refute(types['audio/webm'].first.registered?)

assert_equal('Fixes a bug with IE6 and progressive JPEGs',
types['image/pjpeg'].first.docs)
types['image/pjpeg'].first.docs)

assert(types['audio/vnd.qcelp'].first.obsolete?)
assert_equal('audio/QCELP', types['audio/vnd.qcelp'].first.use_instead)
Expand Down

0 comments on commit c446731

Please sign in to comment.