magic 0.2.7 → 0.2.8

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: 919960b329ad47db4dcb6da5974f285dd143c78e
4
- data.tar.gz: 0148ea45766514a784595db16e0f6c4164946942
3
+ metadata.gz: b912f49d8acd299f3dcf5316599f40b6da452eee
4
+ data.tar.gz: 27308b8df81ae0ad7f43680d209e1c690b0a962c
5
5
  SHA512:
6
- metadata.gz: b102fff10f1ae47bce7b37b0cf4abb6f3e59d0b676dc93f095843ffb37317a8854a8286e60670b4ef3c4e423f15642161cb88bd346b54806bf9fff44c8c8a24a
7
- data.tar.gz: 2ee1c69e1ea2424c14da32606b5f02e146e155a6826d9cf34b60e428a58fbc5afb72e1e96c35e67f5da68d60cc5b4febb2452ed30228f3005499e0cdd23ede60
6
+ metadata.gz: ffeb6e08ced56a8f6e05592f310764745dc6f88f6b804de128c9f26829365b212a9e2cc3a438bf988a5096e9e41c26787f701c7e8bf722d0a9b981a1e048291d
7
+ data.tar.gz: 4d24ffa3e98aac70151c7ce6fe121149dc4c6d4d2879becabd97dcd92105e7aa26ee668ed23c308d70738ad8d729ff7b2645c27733c4ea694840a005583c87fd
@@ -29,12 +29,10 @@ module Magic
29
29
 
30
30
  # Determine type of a file at given path
31
31
  def file(filename)
32
- if !File.exists?(filename)
33
- raise Exception, "#{filename}: No such file or directory"
34
- end
32
+ raise Errno::ENOENT, filename unless File.exists?(filename)
35
33
  result = Api.magic_file(@magic_set, filename.to_s)
36
34
  if result.null?
37
- raise Exception, error
35
+ raise Error, error
38
36
  else
39
37
  result.get_string(0)
40
38
  end
@@ -44,7 +42,7 @@ module Magic
44
42
  def buffer(string)
45
43
  result = Api.magic_buffer(@magic_set, string, string.bytesize)
46
44
  if result.null?
47
- raise Exception, error
45
+ raise Error, error
48
46
  else
49
47
  result.get_string(0)
50
48
  end
data/lib/magic/errors.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Magic
2
2
  # General Exception class
3
- class Exception < StandardError
3
+ class Error < StandardError
4
4
  end
5
5
  end
data/lib/magic/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Magic
2
- VERSION = "0.2.7"
2
+ VERSION = "0.2.8"
3
3
  end
data/test/test_magic.rb CHANGED
@@ -28,7 +28,7 @@ class TestMagic < Test::Unit::TestCase
28
28
  end
29
29
 
30
30
  test "guess non-existing file mime" do
31
- assert_raises Magic::Exception do
31
+ assert_raises Errno::ENOENT do
32
32
  Magic.guess_file_mime(fixture("non-existing.file"))
33
33
  end
34
34
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: magic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kuba Kuźma