ptools 1.3.5-universal-mingw32 → 1.3.6-universal-mingw32

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
- SHA1:
3
- metadata.gz: ee238a6835d5ed4a5dec58ed5eb35e88d8c6af6b
4
- data.tar.gz: 96b5a663c8a6ef5c0dbedfbedaadbb399e735ca1
2
+ SHA256:
3
+ metadata.gz: 7137b9d1e8f2be72fc7c5fecaad1101105dfcdec8b20ce4a14613290eb654d7f
4
+ data.tar.gz: f6277cd2a7c718b3fba6e219fcb67a550b97ce05986770b1badc760c9be527ba
5
5
  SHA512:
6
- metadata.gz: 9e5ef4db7f09c58cd4ee9e2b3343f1bcceb647abe07651a7ac2e308769c183b903d3729f9e444a64b85503b68a30b09601eb8bc1e3986868cbc3544f5c6f1f05
7
- data.tar.gz: faa94b24f47fb46c74a723030eeebba3cf49fbfb34bfcb9a25064ad19cb10e82d638746bea0519f7e2209328dae4fb17b63e466e6f4a51edf9b4cf399244117d
6
+ metadata.gz: 35a63af1addb2fb3e5bce61393941586a2f5bdd137408afeb437207502e61bc21ed92f72ff392ffc8adf7b67a4353604f713ce5cbcbd64245d4e4860efdf46ba
7
+ data.tar.gz: 408a73f0219d50632a63265b3a72f13f120962f5bee89a3a36ece8f8671a896015b1f2442c129558b4b079b5723efee37beaac3d56893f8246d3cb298c648885
Binary file
data.tar.gz.sig CHANGED
Binary file
data/CHANGES CHANGED
@@ -1,3 +1,10 @@
1
+ == 1.3.6 - 7-Jun-2020
2
+ * Updated gemspec, added more versions to .travis.yml file, fixed typo.
3
+ Thanks go to Al Snow for the updates.
4
+ * Fixed a bug where the File.binary? method would return true for utf16
5
+ or utf32 encoded files. Thanks go to Andrew McAndre for the spot.
6
+ * Updated cert.
7
+
1
8
  == 1.3.5 - 3-Sep-2017
2
9
  * The File.image? method now checks against .ico files.
3
10
  * Eliminated Fixnum warning that showed up in Ruby 2.4.x.
@@ -0,0 +1,19 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ power_assert (1.1.5)
5
+ rake (13.0.1)
6
+ structured_warnings (0.4.0)
7
+ test-unit (3.3.5)
8
+ power_assert
9
+
10
+ PLATFORMS
11
+ ruby
12
+
13
+ DEPENDENCIES
14
+ rake
15
+ structured_warnings
16
+ test-unit
17
+
18
+ BUNDLED WITH
19
+ 2.1.2
data/README CHANGED
@@ -47,6 +47,8 @@
47
47
 
48
48
  Thanks go to Matt Hoyle for help with the File.tail method.
49
49
 
50
+ And thanks to any and all contributors!
51
+
50
52
  == Future Plans
51
53
  Add whatever other tools people think might be useful.
52
54
 
@@ -54,7 +56,7 @@
54
56
  Artistic 2.0
55
57
 
56
58
  == Copyright
57
- (C) 2003-2014 Daniel J. Berger
59
+ (C) 2003-2020 Daniel J. Berger
58
60
  All Rights Reserved.
59
61
 
60
62
  == Warranty
@@ -1,21 +1,26 @@
1
1
  -----BEGIN CERTIFICATE-----
2
- MIIDcDCCAligAwIBAgIBATANBgkqhkiG9w0BAQUFADA/MREwDwYDVQQDDAhkamJl
2
+ MIIEcDCCAtigAwIBAgIBATANBgkqhkiG9w0BAQsFADA/MREwDwYDVQQDDAhkamJl
3
3
  cmc5NjEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYDY29t
4
- MB4XDTE3MDkwMzE1MjMxM1oXDTE4MDkwMzE1MjMxM1owPzERMA8GA1UEAwwIZGpi
4
+ MB4XDTE4MDMxODE1MjIwN1oXDTI4MDMxNTE1MjIwN1owPzERMA8GA1UEAwwIZGpi
5
5
  ZXJnOTYxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkWA2Nv
6
- bTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ8y4kEssxNpAdPhNNw2
7
- p4zkERFndPAnmOKDdErczFYYUA9uYpA7/iTjkLlNyRwvsNHpnMXdSF7vy++YIU+F
8
- Ux3AGTmspupbdSzqBNUhSEJ9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+ WZs4eecIcUc4tKdHxcAJ0MO/Dkqq7hGaiHpwKY76wQ1+8xAh
21
26
  -----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.5'.freeze
6
+ PTOOLS_VERSION = '1.3.6'.freeze
7
7
 
8
8
  # :stopdoc:
9
9
 
@@ -93,6 +93,7 @@ class File
93
93
  #
94
94
  def self.binary?(file, percentage = 0.30)
95
95
  return false if image?(file)
96
+ return false if check_bom?(file)
96
97
  bytes = File.stat(file).blksize
97
98
  bytes = 4096 if bytes > 4096
98
99
  s = (File.read(file, bytes) || "")
@@ -432,6 +433,20 @@ class File
432
433
 
433
434
  private
434
435
 
436
+ # Returns whether or not the given +text+ contains a BOM marker.
437
+ # If present, we can generally assume it's a text file.
438
+ #
439
+ def self.check_bom?(file)
440
+ text = File.read(file, 4).force_encoding('utf-8')
441
+
442
+ bool = false
443
+ bool = true if text[0,3] == "\xEF\xBB\xBF"
444
+ bool = true if text[0,4] == "\x00\x00\xFE\xFF" || text[0,4] == "\xFF\xFE\x00\x00"
445
+ bool = true if text[0,2] == "\xFF\xFE" || text[0,2] == "\xFE\xFF"
446
+
447
+ bool
448
+ end
449
+
435
450
  def self.nl_for_platform(platform)
436
451
  platform = RbConfig::CONFIG["host_os"] if platform == 'local'
437
452
 
@@ -1,9 +1,8 @@
1
- require 'rubygems'
2
1
  require 'rbconfig'
3
2
 
4
3
  Gem::Specification.new do |spec|
5
4
  spec.name = 'ptools'
6
- spec.version = '1.3.5'
5
+ spec.version = '1.3.6'
7
6
  spec.license = 'Artistic-2.0'
8
7
  spec.author = 'Daniel J. Berger'
9
8
  spec.email = 'djberg96@gmail.com'
@@ -22,10 +21,10 @@ Gem::Specification.new do |spec|
22
21
  EOF
23
22
 
24
23
  spec.add_development_dependency('rake')
25
- spec.add_development_dependency('test-unit', '>= 2.5.0')
24
+ spec.add_development_dependency('test-unit')
26
25
 
27
26
  if File::ALT_SEPARATOR
28
27
  spec.platform = Gem::Platform.new(['universal', 'mingw32'])
29
- spec.add_dependency('win32-file', '>= 0.7.0')
28
+ spec.add_dependency('win32-file')
30
29
  end
31
30
  end
@@ -22,6 +22,7 @@ class TC_Ptools_Binary < Test::Unit::TestCase
22
22
  def setup
23
23
  @txt_file = File.join(@@dirname, 'txt', 'english.txt')
24
24
  @uni_file = File.join(@@dirname, 'txt', 'korean.txt')
25
+ @utf_file = File.join(@@dirname, 'txt', 'english.utf16')
25
26
  @png_file = File.join(@@dirname, 'img', 'test.png')
26
27
  @jpg_file = File.join(@@dirname, 'img', 'test.jpg')
27
28
  @gif_file = File.join(@@dirname, 'img', 'test.gif')
@@ -39,6 +40,7 @@ class TC_Ptools_Binary < Test::Unit::TestCase
39
40
  test "File.binary? returns false for text files" do
40
41
  assert_false(File.binary?(@txt_file))
41
42
  assert_false(File.binary?(@uni_file))
43
+ assert_false(File.binary?(@utf_file))
42
44
  end
43
45
 
44
46
  test "File.binary? returns false for image files" do
@@ -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.5', File::PTOOLS_VERSION)
18
+ assert_equal('1.3.6', File::PTOOLS_VERSION)
19
19
  end
20
20
 
21
21
  test "IMAGE_EXT constant is set to array of values" do
@@ -27,7 +27,7 @@ class TC_Ptools_Constants < Test::Unit::TestCase
27
27
  assert_not_nil(File::MSWINDOWS)
28
28
  end
29
29
 
30
- test "WIN32EXTS constant is defiend on MS Windows" do
30
+ test "WIN32EXTS constant is defined on MS Windows" do
31
31
  omit_unless(@@windows, "Skipping on Unix systems")
32
32
  assert_not_nil(File::WIN32EXTS)
33
33
  end
Binary file
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.5
4
+ version: 1.3.6
5
5
  platform: universal-mingw32
6
6
  authors:
7
7
  - Daniel J. Berger
@@ -10,27 +10,32 @@ bindir: bin
10
10
  cert_chain:
11
11
  - |
12
12
  -----BEGIN CERTIFICATE-----
13
- MIIDcDCCAligAwIBAgIBATANBgkqhkiG9w0BAQUFADA/MREwDwYDVQQDDAhkamJl
13
+ MIIEcDCCAtigAwIBAgIBATANBgkqhkiG9w0BAQsFADA/MREwDwYDVQQDDAhkamJl
14
14
  cmc5NjEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYDY29t
15
- MB4XDTE3MDkwMzE1MjMxM1oXDTE4MDkwMzE1MjMxM1owPzERMA8GA1UEAwwIZGpi
15
+ MB4XDTE4MDMxODE1MjIwN1oXDTI4MDMxNTE1MjIwN1owPzERMA8GA1UEAwwIZGpi
16
16
  ZXJnOTYxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkWA2Nv
17
- bTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ8y4kEssxNpAdPhNNw2
18
- p4zkERFndPAnmOKDdErczFYYUA9uYpA7/iTjkLlNyRwvsNHpnMXdSF7vy++YIU+F
19
- Ux3AGTmspupbdSzqBNUhSEJ9TmpjMer1dMYMR9fRw3r3qQreiO2u/O/tV4VpzrDj
20
- 28JC0b1PcKtfobxbnk+hporZqTH6ClOxDsRx+trlkr7q7FLZwTZn0ywjAV8WMVTO
21
- SMmkzXQ37s2Nnrq6r+dDZI0voBxyQkAUzmdBOQTrvOFAo3tuWcnJNR/RRdFhJ9nK
22
- mYMPmEd1z0s+cU0SUEeTvhGv/9LCmbSyZqKezDLYNR4Gb0FOA9D50+4OOi2+3G1o
23
- 1U0CAwEAAaN3MHUwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFJCx
24
- ukSSioTiLtwQCdML0IyEZAJ/MB0GA1UdEQQWMBSBEmRqYmVyZzk2QG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EAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQUFZsMapgzJimzsbaBG2Tm8j5e
27
+ AzgwHQYDVR0RBBYwFIESZGpiZXJnOTZAZ21haWwuY29tMB0GA1UdEgQWMBSBEmRq
28
+ YmVyZzk2QGdtYWlsLmNvbTANBgkqhkiG9w0BAQsFAAOCAYEAW2tnYixXQtKxgGXq
29
+ /3iSWG2bLwvxS4go3srO+aRXZHrFUMlJ5W0mCxl03aazxxKTsVVpZD8QZxvK91OQ
30
+ h9zr9JBYqCLcCVbr8SkmYCi/laxIZxsNE5YI8cC8vvlLI7AMgSfPSnn/Epq1GjGY
31
+ 6L1iRcEDtanGCIvjqlCXO9+BmsnCfEVehqZkQHeYczA03tpOWb6pon2wzvMKSsKH
32
+ ks0ApVdstSLz1kzzAqem/uHdG9FyXdbTAwH1G4ZPv69sQAFAOCgAqYmdnzedsQtE
33
+ 1LQfaQrx0twO+CZJPcRLEESjq8ScQxWRRkfuh2VeR7cEU7L7KqT10mtUwrvw7APf
34
+ DYoeCY9KyjIBjQXfbj2ke5u1hZj94Fsq9FfbEQg8ygCgwThnmkTrrKEiMSs3alYR
35
+ ORVCZpRuCPpmC8qmqxUnARDArzucjaclkxjLWvCVHeFa9UP7K3Nl9oTjJNv+7/jM
36
+ WZs4eecIcUc4tKdHxcAJ0MO/Dkqq7hGaiHpwKY76wQ1+8xAh
32
37
  -----END CERTIFICATE-----
33
- date: 2017-09-03 00:00:00.000000000 Z
38
+ date:
34
39
  dependencies:
35
40
  - !ruby/object:Gem::Dependency
36
41
  name: rake
@@ -52,28 +57,28 @@ dependencies:
52
57
  requirements:
53
58
  - - ">="
54
59
  - !ruby/object:Gem::Version
55
- version: 2.5.0
60
+ version: '0'
56
61
  type: :development
57
62
  prerelease: false
58
63
  version_requirements: !ruby/object:Gem::Requirement
59
64
  requirements:
60
65
  - - ">="
61
66
  - !ruby/object:Gem::Version
62
- version: 2.5.0
67
+ version: '0'
63
68
  - !ruby/object:Gem::Dependency
64
69
  name: win32-file
65
70
  requirement: !ruby/object:Gem::Requirement
66
71
  requirements:
67
72
  - - ">="
68
73
  - !ruby/object:Gem::Version
69
- version: 0.7.0
74
+ version: '0'
70
75
  type: :runtime
71
76
  prerelease: false
72
77
  version_requirements: !ruby/object:Gem::Requirement
73
78
  requirements:
74
79
  - - ">="
75
80
  - !ruby/object:Gem::Version
76
- version: 0.7.0
81
+ version: '0'
77
82
  description: |2
78
83
  The ptools (power tools) library provides several handy methods to
79
84
  Ruby's core File class, such as File.which for finding executables,
@@ -90,6 +95,7 @@ files:
90
95
  - certs/djberg96_pub.pem
91
96
  - CHANGES
92
97
  - Gemfile
98
+ - Gemfile.lock
93
99
  - lib
94
100
  - lib/ptools.rb
95
101
  - MANIFEST
@@ -116,6 +122,7 @@ files:
116
122
  - test/test_which.rb
117
123
  - test/txt
118
124
  - test/txt/english.txt
125
+ - test/txt/english.utf16
119
126
  - test/txt/korean.txt
120
127
  homepage: https://github.com/djberg96/ptools
121
128
  licenses:
@@ -136,8 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
136
143
  - !ruby/object:Gem::Version
137
144
  version: '0'
138
145
  requirements: []
139
- rubyforge_project:
140
- rubygems_version: 2.6.12
146
+ rubygems_version: 3.0.3
141
147
  signing_key:
142
148
  specification_version: 4
143
149
  summary: Extra methods for the File class
metadata.gz.sig CHANGED
Binary file