ptools 1.3.5 → 1.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +1 -2
- data/CHANGES +7 -0
- data/Gemfile.lock +19 -0
- data/README +3 -1
- data/certs/djberg96_pub.pem +22 -17
- data/lib/ptools.rb +16 -1
- data/ptools.gemspec +3 -4
- data/test/test_binary.rb +2 -0
- data/test/test_constants.rb +2 -2
- data/test/txt/english.utf16 +0 -0
- metadata +54 -48
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 8af69190c08ac129154e8db30f4e3aebcace84ec56a052638337a2174e9b2112
|
4
|
+
data.tar.gz: 067e2a998841f349d933f121bc580b4c66e5f022db99ce45617b8ea760f68acb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d8b2067490b9af0348c50af062e466d403477a52addb4e1742072a8684be61701afa5e496f0006e459eac9fb1acb6ab0accb02d245a8e05e42e0e8b2212d820
|
7
|
+
data.tar.gz: aa9770acc57cd8170659f6912e8f3499bb1441f00d668eff0de291cd8276e303f6f9b166b5adf682147015763ac49d97b690eebcb9f57aec86606e58c0489ad4
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
@@ -1,2 +1 @@
|
|
1
|
-
|
2
|
-
��I|W�8�m�p<LJ�`,=���&|p��RF�,�;�i+%g��;ohL���_i��*��D��ʀ�DW_�#8�Q������V�
|
1
|
+
Q>�����ӫ� ��방���s[�V�c�!vl>#
|
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.
|
data/Gemfile.lock
ADDED
@@ -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-
|
59
|
+
(C) 2003-2020 Daniel J. Berger
|
58
60
|
All Rights Reserved.
|
59
61
|
|
60
62
|
== Warranty
|
data/certs/djberg96_pub.pem
CHANGED
@@ -1,21 +1,26 @@
|
|
1
1
|
-----BEGIN CERTIFICATE-----
|
2
|
-
|
2
|
+
MIIEcDCCAtigAwIBAgIBATANBgkqhkiG9w0BAQsFADA/MREwDwYDVQQDDAhkamJl
|
3
3
|
cmc5NjEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYDY29t
|
4
|
-
|
4
|
+
MB4X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dtYWlsLmNvbTANBgkqhkiG9w0BAQsFAAOCAYEAW2tnYixXQtKxgGXq
|
18
|
+
/3iSWG2bLwvxS4go3srO+aRXZHrFUMlJ5W0mCxl03aazxxKTsVVpZD8QZxvK91OQ
|
19
|
+
h9zr9JBYqCLcCVbr8SkmYCi/laxIZxsNE5YI8cC8vvlLI7AMgSfPSnn/Epq1GjGY
|
20
|
+
6L1iRcEDtanGCIvjqlCXO9+BmsnCfEVehqZkQHeYczA03tpOWb6pon2wzvMKSsKH
|
21
|
+
ks0ApVdstSLz1kzzAqem/uHdG9FyXdbTAwH1G4ZPv69sQAFAOCgAqYmdnzedsQtE
|
22
|
+
1LQfaQrx0twO+CZJPcRLEESjq8ScQxWRRkfuh2VeR7cEU7L7KqT10mtUwrvw7APf
|
23
|
+
DYoeCY9KyjIBjQXfbj2ke5u1hZj94Fsq9FfbEQg8ygCgwThnmkTrrKEiMSs3alYR
|
24
|
+
ORVCZpRuCPpmC8qmqxUnARDArzucjaclkxjLWvCVHeFa9UP7K3Nl9oTjJNv+7/jM
|
25
|
+
WZs4eecIcUc4tKdHxcAJ0MO/Dkqq7hGaiHpwKY76wQ1+8xAh
|
21
26
|
-----END CERTIFICATE-----
|
data/lib/ptools.rb
CHANGED
@@ -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.
|
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
|
|
data/ptools.gemspec
CHANGED
@@ -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
|
+
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'
|
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'
|
28
|
+
spec.add_dependency('win32-file')
|
30
29
|
end
|
31
30
|
end
|
data/test/test_binary.rb
CHANGED
@@ -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
|
data/test/test_constants.rb
CHANGED
@@ -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.
|
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
|
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.
|
4
|
+
version: 1.3.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel J. Berger
|
@@ -10,27 +10,32 @@ bindir: bin
|
|
10
10
|
cert_chain:
|
11
11
|
- |
|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bkpDrD5MYQIDAQABo3cwdTAJBgNV
|
26
|
+
HRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQUFZsMapgzJimzsbaBG2Tm8j5e
|
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:
|
38
|
+
date:
|
34
39
|
dependencies:
|
35
40
|
- !ruby/object:Gem::Dependency
|
36
41
|
name: rake
|
@@ -52,14 +57,14 @@ dependencies:
|
|
52
57
|
requirements:
|
53
58
|
- - ">="
|
54
59
|
- !ruby/object:Gem::Version
|
55
|
-
version:
|
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:
|
67
|
+
version: '0'
|
63
68
|
description: |2
|
64
69
|
The ptools (power tools) library provides several handy methods to
|
65
70
|
Ruby's core File class, such as File.which for finding executables,
|
@@ -72,37 +77,39 @@ extra_rdoc_files:
|
|
72
77
|
- CHANGES
|
73
78
|
- MANIFEST
|
74
79
|
files:
|
75
|
-
- certs
|
76
|
-
- certs/djberg96_pub.pem
|
77
|
-
- CHANGES
|
78
|
-
- Gemfile
|
79
|
-
- lib
|
80
|
-
- lib/ptools.rb
|
81
|
-
- MANIFEST
|
82
|
-
- ptools.gemspec
|
83
|
-
- Rakefile
|
84
|
-
- README
|
85
80
|
- test
|
81
|
+
- test/test_constants.rb
|
82
|
+
- test/txt
|
83
|
+
- test/txt/english.utf16
|
84
|
+
- test/txt/english.txt
|
85
|
+
- test/txt/korean.txt
|
86
|
+
- test/test_head.rb
|
87
|
+
- test/test_binary.rb
|
86
88
|
- test/img
|
87
89
|
- test/img/test.gif
|
88
90
|
- test/img/test.ico
|
89
91
|
- test/img/test.jpg
|
90
92
|
- test/img/test.png
|
91
|
-
- test/test_binary.rb
|
92
|
-
- test/test_constants.rb
|
93
|
-
- test/test_head.rb
|
94
93
|
- test/test_image.rb
|
95
|
-
- test/test_is_sparse.rb
|
96
|
-
- test/test_nlconvert.rb
|
97
94
|
- test/test_null.rb
|
95
|
+
- test/test_which.rb
|
98
96
|
- test/test_tail.rb
|
97
|
+
- test/test_is_sparse.rb
|
98
|
+
- test/test_nlconvert.rb
|
99
|
+
- test/test_whereis.rb
|
99
100
|
- test/test_touch.rb
|
100
101
|
- test/test_wc.rb
|
101
|
-
-
|
102
|
-
-
|
103
|
-
-
|
104
|
-
-
|
105
|
-
-
|
102
|
+
- CHANGES
|
103
|
+
- MANIFEST
|
104
|
+
- README
|
105
|
+
- ptools.gemspec
|
106
|
+
- Rakefile
|
107
|
+
- certs
|
108
|
+
- certs/djberg96_pub.pem
|
109
|
+
- lib
|
110
|
+
- lib/ptools.rb
|
111
|
+
- Gemfile
|
112
|
+
- Gemfile.lock
|
106
113
|
homepage: https://github.com/djberg96/ptools
|
107
114
|
licenses:
|
108
115
|
- Artistic-2.0
|
@@ -122,21 +129,20 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
122
129
|
- !ruby/object:Gem::Version
|
123
130
|
version: '0'
|
124
131
|
requirements: []
|
125
|
-
|
126
|
-
rubygems_version: 2.6.12
|
132
|
+
rubygems_version: 3.0.8
|
127
133
|
signing_key:
|
128
134
|
specification_version: 4
|
129
135
|
summary: Extra methods for the File class
|
130
136
|
test_files:
|
131
|
-
- test/test_binary.rb
|
132
137
|
- test/test_constants.rb
|
133
138
|
- test/test_head.rb
|
139
|
+
- test/test_binary.rb
|
134
140
|
- test/test_image.rb
|
135
|
-
- test/test_is_sparse.rb
|
136
|
-
- test/test_nlconvert.rb
|
137
141
|
- test/test_null.rb
|
142
|
+
- test/test_which.rb
|
138
143
|
- test/test_tail.rb
|
144
|
+
- test/test_is_sparse.rb
|
145
|
+
- test/test_nlconvert.rb
|
146
|
+
- test/test_whereis.rb
|
139
147
|
- test/test_touch.rb
|
140
148
|
- test/test_wc.rb
|
141
|
-
- test/test_whereis.rb
|
142
|
-
- test/test_which.rb
|
metadata.gz.sig
CHANGED
Binary file
|