Skip to content

Commit

Permalink
Merge pull request #160 from mime-types/fix-mime-types-syntax-error
Browse files Browse the repository at this point in the history
Fix invalid syntax for < Ruby 2.3
  • Loading branch information
halostatue committed Nov 16, 2021
2 parents 54cb8ed + 35cc02d commit 5b931d7
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 10 deletions.
9 changes: 9 additions & 0 deletions History.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## 3.4.1 / 2021-11-16

- 1 bugfix:

- Fixed a Ruby &lt; 2.3 incompatibility introduced by the use of standardrb,
where `<<-` heredocs were converted to `<<~` heredocs. These have been
reverted back to `<<-` with the indentation kept and a `.strip` call
to prevent excess whitespace.

## 3.4.0 / 2021-11-15

- 1 minor enhancement:
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.0"
VERSION = "3.4.1"

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
MIME::Types.logger.warn <<-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
MIME::Types.logger.warn <<-WARNING.chomp.strip
Could not load MIME::Types cache: invalid version
WARNING
nil
end
rescue => e
MIME::Types.logger.warn <<~WARNING.chomp
MIME::Types.logger.warn <<-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
MIME::Types.logger.warn <<-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
MIME::Types.logger.warn <<-WARNING.chomp.strip
Lazy loading ($RUBY_MIME_TYPES_LAZY_LOAD) is deprecated and will be removed.
WARNING

Expand Down
6 changes: 3 additions & 3 deletions mime-types.gemspec
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# -*- encoding: utf-8 -*-
# stub: mime-types 3.4.0 ruby lib
# stub: mime-types 3.4.1 ruby lib

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

s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.metadata = { "bug_tracker_uri" => "https://github.com/mime-types/ruby-mime-types/issues", "changelog_uri" => "https://github.com/mime-types/ruby-mime-types/blob/master/History.md", "homepage_uri" => "https://github.com/mime-types/ruby-mime-types/", "source_code_uri" => "https://github.com/mime-types/ruby-mime-types/" } if s.respond_to? :metadata=
s.require_paths = ["lib".freeze]
s.authors = ["Austin Ziegler".freeze]
s.date = "2021-11-15"
s.date = "2021-11-16"
s.description = "The mime-types library provides a library and registry for information about\nMIME content type definitions. It can be used to determine defined filename\nextensions for MIME types, or to use filename extensions to look up the likely\nMIME type definitions.\n\nVersion 3.0 is a major release that requires Ruby 2.0 compatibility and removes\ndeprecated functions. The columnar registry format introduced in 2.6 has been\nmade the primary format; the registry data has been extracted from this library\nand put into {mime-types-data}[https://github.com/mime-types/mime-types-data].\nAdditionally, mime-types is now licensed exclusively under the MIT licence and\nthere is a code of conduct in effect. There are a number of other smaller\nchanges described in the History file.".freeze
s.email = ["[email protected]".freeze]
s.extra_rdoc_files = ["Code-of-Conduct.md".freeze, "Contributing.md".freeze, "History.md".freeze, "Licence.md".freeze, "Manifest.txt".freeze, "README.rdoc".freeze]
Expand Down
2 changes: 1 addition & 1 deletion support/deps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def rubygems_get(gem_name: "", endpoint: "")
end

def gem_downloads(name)
rubygems_get(gem_name: name)["downloads"]
rubygems_get(gem_name: name)["downloads"]
rescue => e
puts "#{name} #{e.message}"
end
Expand Down

0 comments on commit 5b931d7

Please sign in to comment.