ptools 1.3.4 → 1.3.5

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: 10dd763e75f62b662df564b86af1dd45a830c57d
4
- data.tar.gz: 3cff979f3aa49c9115a1b7efaa266fba060a7161
3
+ metadata.gz: d84987b222f9b080bd61559d152790acfc5c17c9
4
+ data.tar.gz: 05f9fbe563ca0e70cdbe4983a43e0ae1132c8ee9
5
5
  SHA512:
6
- metadata.gz: 42bf217eddaa220ae53d95566725e894c7df8093db51902411fe135cd207a2523068c177c3bf07d87c1def428ea955c2b2f0ec8f989176991c5a16728aaf72cb
7
- data.tar.gz: 959372d0a5f9144b0f8ce5f80f907316afb288fda00feddd661248734aa83393319f97787965ce0f084770adaa4f579415687b89665e24066bd2c7fb7d13ff14
6
+ metadata.gz: dd49ca3dee0986e8f9d287de7fbfcad81492858b556a678692ff3510fd5400928b44b84b8fb701d13c40b3f34953ca213c849709f0c8666aacad6a8b2001314e
7
+ data.tar.gz: b0d5eb2e3b457c4d9ff23866b385e209c46e8f8b394ba0c29d45520b906b09173fb14dbdc436f344f8e65b7236b842277a9ba61d1f28dc746c36b5f6f8c891ad
Binary file
data.tar.gz.sig CHANGED
Binary file
data/CHANGES CHANGED
@@ -1,3 +1,8 @@
1
+ == 1.3.5 - 3-Sep-2017
2
+ * The File.image? method now checks against .ico files.
3
+ * Eliminated Fixnum warning that showed up in Ruby 2.4.x.
4
+ * Updated cert.
5
+
1
6
  == 1.3.4 - 4-Jul-2017
2
7
  * The File.binary? method now lets you set your own percentage for the
3
8
  internal heuristic as an optional second argument.
data/MANIFEST CHANGED
@@ -18,3 +18,4 @@
18
18
  * test/img/test.gif
19
19
  * test/img/test.jpg
20
20
  * test/img/test.png
21
+ * test/img/test.ico
@@ -1,21 +1,21 @@
1
1
  -----BEGIN CERTIFICATE-----
2
2
  MIIDcDCCAligAwIBAgIBATANBgkqhkiG9w0BAQUFADA/MREwDwYD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awtVAUHIWiuQPoBBVVKOkeEhioO0cV8UabKsKMbE8
20
+ VpiARrgH+4lYiRFJ+gKpIbSEJvk=
21
21
  -----END CERTIFICATE-----
@@ -3,7 +3,7 @@ require 'win32/file' if File::ALT_SEPARATOR
3
3
 
4
4
  class File
5
5
  # The version of the ptools library.
6
- PTOOLS_VERSION = '1.3.4'.freeze
6
+ PTOOLS_VERSION = '1.3.5'.freeze
7
7
 
8
8
  # :stopdoc:
9
9
 
@@ -23,8 +23,8 @@ class File
23
23
 
24
24
  # :startdoc:
25
25
 
26
- # Returns whether or not the file is an image. Only JPEG, PNG, BMP and
27
- # GIF are checked against.
26
+ # Returns whether or not the file is an image. Only JPEG, PNG, BMP,
27
+ # GIF, and ICO are checked against.
28
28
  #
29
29
  # This method does some simple read and extension checks. For a version
30
30
  # that is more robust, but which depends on a 3rd party C library (and is
@@ -39,8 +39,8 @@ class File
39
39
  # http://en.wikipedia.org/wiki/Magic_number_(programming)
40
40
  #
41
41
  def self.image?(file)
42
- bool = IMAGE_EXT.include?(File.extname(file).downcase) # Match ext
43
- bool = bmp?(file) || jpg?(file) || png?(file) || gif?(file) || tiff?(file) # Check data
42
+ bool = IMAGE_EXT.include?(File.extname(file).downcase)
43
+ bool = bmp?(file) || jpg?(file) || png?(file) || gif?(file) || tiff?(file) || ico?(file)
44
44
  bool
45
45
  end
46
46
 
@@ -483,4 +483,8 @@ class File
483
483
 
484
484
  true
485
485
  end
486
+
487
+ def self.ico?(file)
488
+ ["\000\000\001\000", "\000\000\002\000"].include?(IO.read(file, 4, nil, :encoding => 'binary'))
489
+ end
486
490
  end
@@ -3,7 +3,7 @@ require 'rbconfig'
3
3
 
4
4
  Gem::Specification.new do |spec|
5
5
  spec.name = 'ptools'
6
- spec.version = '1.3.4'
6
+ spec.version = '1.3.5'
7
7
  spec.license = 'Artistic-2.0'
8
8
  spec.author = 'Daniel J. Berger'
9
9
  spec.email = 'djberg96@gmail.com'
Binary file
@@ -15,7 +15,7 @@ class TC_Ptools_Constants < Test::Unit::TestCase
15
15
  end
16
16
 
17
17
  test "PTOOLS_VERSION constant is set to expected value" do
18
- assert_equal('1.3.4', File::PTOOLS_VERSION)
18
+ assert_equal('1.3.5', File::PTOOLS_VERSION)
19
19
  end
20
20
 
21
21
  test "IMAGE_EXT constant is set to array of values" do
@@ -18,6 +18,7 @@ class TC_Ptools_Image < Test::Unit::TestCase
18
18
  @jpg_file = File.join(Dir.pwd, 'img', 'test.jpg')
19
19
  @png_file = File.join(Dir.pwd, 'img', 'test.png')
20
20
  @gif_file = File.join(Dir.pwd, 'img', 'test.gif')
21
+ @ico_file = File.join(Dir.pwd, 'img', 'test.ico')
21
22
  end
22
23
 
23
24
  test "image? method basic functionality" do
@@ -43,6 +44,10 @@ class TC_Ptools_Image < Test::Unit::TestCase
43
44
  assert_true(File.image?(@png_file))
44
45
  end
45
46
 
47
+ test "image? method returns true for an ico" do
48
+ assert_true(File.image?(@ico_file))
49
+ end
50
+
46
51
  test "image? method raises an error if the file does not exist" do
47
52
  assert_raises(Errno::ENOENT, ArgumentError){ File.image?('bogus') }
48
53
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ptools
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.4
4
+ version: 1.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel J. Berger
@@ -12,25 +12,25 @@ cert_chain:
12
12
  -----BEGIN CERTIFICATE-----
13
13
  MIIDcDCCAligAwIBAgIBATANBgkqhkiG9w0BAQUFADA/MREwDwYDVQQDDAhkamJl
14
14
  cmc5NjEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYDY29t
15
- MB4XDTE2MTAzMTE4NTcyNVoXDTE3MTAzMTE4NTcyNVowPzERMA8GA1UEAwwIZGpi
15
+ MB4XDTE3MDkwMzE1MjMxM1oXDTE4MDkwMzE1MjMxM1owPzERMA8GA1UEAwwIZGpi
16
16
  Z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CBLAwHQYDVR0OBBYEFJCx
24
+ ukSSioTiLtwQCdML0IyEZAJ/MB0GA1UdEQQWMBSBEmRqYmVyZzk2QGdtYWlsLmNv
25
25
  bTAdBgNVHRIEFjAUgRJkamJlcmc5NkBnbWFpbC5jb20wDQYJKoZIhvcNAQEFBQAD
26
- ggEBAEYzyGzoleAO3i6mOBi/Px1yWdVuU4ejvxrj8axHRK+wHQ+bYvx9eEosuRHB
27
- mXjRvpN9UnOiY7wYbK36MpAALBq3swpcBpYXyfBOdv0JQvjMEGmKqXJS7AbNHNPc
28
- ZbpPrVSdJJ+aTWEDvybl693eEUvEuiSkVIz8w4yNcJP1zOBRBKxG2viJdMKz5Ho7
29
- 2M9INmGCv3GCv4bljYlIIg4YYAyOaBbSQeAb2/F5XAlOR2oEB8ipB+RKGZXR8rq5
30
- EkhPwYAx+jZ4KyPve9JKm34Du9veVFEzq3aW+opaveK167NEorK7xLpmdEcdo9bR
31
- 9CkYV0lClarK7w1ykAePuEeXD7k=
26
+ ggEBAJh/dmRaTpJAUeJ2x9CEyy9gSP6SZjMeAwWgPNdowPDyw0JzlpBIrYiTnCYK
27
+ 2OqxvIi8L38+rHw3KYL0fEyNqP3RbMl6+SljRwiU0JwEqj9e1pqIx99RTLKeI9PM
28
+ F8LxxmDHreGOaY4R8JBOMxys1wBkF/Iilx4qoT4LBn+DzraAlmYjr6O6itIxGten
29
+ NFJFS/tFBTTeNW6SJLdDnGd2b7vBBEd/ZpIhuZNxriU6FKWC5FJeBdAiuw6lqHun
30
+ QLLepVJthIvwmfc8AU5TJGMawtVAUHIWiuQPoBBVVKOkeEhioO0cV8UabKsKMbE8
31
+ VpiARrgH+4lYiRFJ+gKpIbSEJvk=
32
32
  -----END CERTIFICATE-----
33
- date: 2017-07-04 00:00:00.000000000 Z
33
+ date: 2017-09-03 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: rake
@@ -85,6 +85,7 @@ files:
85
85
  - test
86
86
  - test/img
87
87
  - test/img/test.gif
88
+ - test/img/test.ico
88
89
  - test/img/test.jpg
89
90
  - test/img/test.png
90
91
  - test/test_binary.rb
metadata.gz.sig CHANGED
Binary file