Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Replace mimemagic with marcel gem #2684

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions lib/paperclip.rb
Expand Up @@ -64,9 +64,8 @@
require "mime/types"
end

require 'mimemagic'
require 'mimemagic/overlay'
require 'logger'
require 'marcel'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dismiss the suggestion for consistency with the rest of single quoted requires

require 'terrapin'

require 'paperclip/railtie' if defined?(Rails::Railtie)
Expand Down
2 changes: 1 addition & 1 deletion lib/paperclip/content_type_detector.rb
Expand Up @@ -68,7 +68,7 @@ def type_from_file_contents

def type_from_mime_magic
@type_from_mime_magic ||= File.open(@filepath) do |file|
MimeMagic.by_magic(file).try(:type)
Marcel::Magic.by_magic(file).try(:type)
end
end

Expand Down
2 changes: 1 addition & 1 deletion paperclip.gemspec
Expand Up @@ -28,7 +28,7 @@ Gem::Specification.new do |s|
s.add_dependency('activesupport', '>= 4.2.0')
s.add_dependency('terrapin', '~> 0.6.0')
s.add_dependency('mime-types')
s.add_dependency('mimemagic', '~> 0.3.0')
s.add_dependency('marcel', '~> 1.0.0')

s.add_development_dependency('activerecord', '>= 4.2.0')
s.add_development_dependency('shoulda')
Expand Down