carrierwave-mimetype-magic 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 26002819171a212e2cf620bb3493cd37debff895
4
- data.tar.gz: 0078c461a3bddb85b7a6e2c7401e368e10e80981
3
+ metadata.gz: 54d641eebdc2671db4019f5ff512691ba7b292c3
4
+ data.tar.gz: 895342b926cf4e3a67bee6ba43a796e29b2a3149
5
5
  SHA512:
6
- metadata.gz: b4bbd99413ac836b6bf59a515a5d4eb2e83568d2ae43dc3026335326a0ce0873be85f533450ec91990bdb8a79387b5bdac292ae09a1755e62c7866dde1869875
7
- data.tar.gz: 5dfb011fd71be4d3655683af9cb0cd7ed4a3d77494e92c9675f7c2781a61f549be85d9d9a62019f96acd75556f67a8afaea595aeaa32181849ea5ee85500e961
6
+ metadata.gz: 5b3a8498b75a7ebd3400f3eff7d7b57dd4dbe4aa53e88e9c2fe0f732db15bd1b2411d330a8b8b64d5409e52199c70766b6d0245f993f6db19e85ed71abb9da15
7
+ data.tar.gz: 2d1413a16d391a791c7d955f301a5406da5a23b32b98243abcc57fcc4f4f4303e05ba0e31e577a984f62c30deaff3d94050e6584de9ebd0365b06063d5d41737
@@ -1,5 +1,9 @@
1
1
  # changelog
2
2
 
3
+ ## `0.0.3`
4
+
5
+ * Change gem 'ruby-filemagic' to 'mimemagic', because file-devel library required for 'ruby-filemagic' is too old on CentOS server and it doesn't works correct.
6
+
3
7
  ## `0.0.2`
4
8
 
5
9
  * Fix Gemfile
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
1
  # CarrierWave::MimetypeMagic
2
+ [![Gem Version](https://badge.fury.io/rb/carrierwave-mimetype-magic.svg)](https://badge.fury.io/rb/carrierwave-mimetype-magic)
2
3
 
3
4
  By default, carrierwave uses the uploaded file's extension to guess the content type. Sometimes you'd prefer to actually look at the file and set the content type based on that, so users can't upload php files as *i\_am\_lying.jpg* and have the server try to process them as images.
4
5
 
@@ -30,7 +31,7 @@ And now uploaded files' content\_type will be set appropriately, and uploads wil
30
31
 
31
32
  ## History
32
33
 
33
- Originally based on the [carrierwave-mymetype-fu](https://github.com/deviantech/carrierwave-mimetype-fu) (that based on [carrierwave-magic](https://github.com/glebtv/carrierwave-magic)) gem, but using [ruby-filemagic](https://github.com/blackwinter/ruby-filemagic) rather than MimetypeFu, that works incorrect with MS files.
34
+ Originally based on the [carrierwave-mymetype-fu](https://github.com/deviantech/carrierwave-mimetype-fu) (that based on [carrierwave-magic](https://github.com/glebtv/carrierwave-magic)) gem, but using [mimemagic](https://github.com/minad/mimemagic) rather than MimetypeFu, that works incorrect with MS files.
34
35
 
35
36
  ## Contributing
36
37
 
@@ -9,7 +9,7 @@ Gem::Specification.new do |gem|
9
9
  gem.authors = ["Piton4eg"]
10
10
  gem.email = ["piton4eg@mail.ru"]
11
11
  gem.description = %q{Real mime-types for carrierwave}
12
- gem.summary = %q{Carrierwave extension to set file content type and extension with ruby-filemagic from real mime type}
12
+ gem.summary = %q{Carrierwave extension to set file content type and extension with mimemagic from real mime type}
13
13
  gem.homepage = "https://github.com/piton4eg/carrierwave-mimetype-magic"
14
14
 
15
15
  gem.files = `git ls-files`.split($/)
@@ -17,7 +17,7 @@ Gem::Specification.new do |gem|
17
17
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
18
  gem.require_paths = ["lib"]
19
19
 
20
- gem.add_runtime_dependency "ruby-filemagic", '~> 0.7.1'
20
+ gem.add_runtime_dependency "mimemagic", '~> 0.3.0'
21
21
  gem.add_runtime_dependency "carrierwave", '~> 0.10.0'
22
22
 
23
23
  gem.license = 'MIT'
@@ -8,9 +8,10 @@ module CarrierWave
8
8
  alias_method_chain :cache!, :mimetype_magic
9
9
 
10
10
  begin
11
- require 'filemagic'
11
+ require 'mimemagic'
12
+ require 'mimemagic/overlay'
12
13
  rescue LoadError => e
13
- e.message << ' (You may need to install the ruby-filemagic gem)'
14
+ e.message << ' (You may need to install the mimemagic gem)'
14
15
  raise e
15
16
  end
16
17
  end
@@ -28,7 +29,7 @@ module CarrierWave
28
29
 
29
30
  begin
30
31
  # Collect information about the real content type
31
- real_content_type = ::FileMagic.new(::FileMagic::MAGIC_MIME).file(opened_file.path).split(';').first
32
+ real_content_type = MimeMagic.by_magic(opened_file).type
32
33
  valid_extensions = Array(MIME::Types[real_content_type].try(:first).try(:extensions))
33
34
 
34
35
  # Set proper content type, and update filename if current name doesn't match reach content type
@@ -1,5 +1,5 @@
1
1
  module CarrierWave
2
2
  module MimetypeMagic
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: carrierwave-mimetype-magic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piton4eg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-01 00:00:00.000000000 Z
11
+ date: 2016-03-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: ruby-filemagic
14
+ name: mimemagic
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.7.1
19
+ version: 0.3.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.7.1
26
+ version: 0.3.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: carrierwave
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -77,6 +77,6 @@ rubyforge_project:
77
77
  rubygems_version: 2.5.2
78
78
  signing_key:
79
79
  specification_version: 4
80
- summary: Carrierwave extension to set file content type and extension with ruby-filemagic
80
+ summary: Carrierwave extension to set file content type and extension with mimemagic
81
81
  from real mime type
82
82
  test_files: []