ptools 1.3.3 → 1.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/CHANGES +7 -0
- data/Rakefile +4 -4
- data/certs/djberg96_pub.pem +15 -15
- data/lib/ptools.rb +7 -3
- data/ptools.gemspec +3 -3
- data/test/test_binary.rb +5 -0
- data/test/test_constants.rb +1 -1
- metadata +28 -24
- metadata.gz.sig +0 -0
- data/.gemtest +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 10dd763e75f62b662df564b86af1dd45a830c57d
|
4
|
+
data.tar.gz: 3cff979f3aa49c9115a1b7efaa266fba060a7161
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 42bf217eddaa220ae53d95566725e894c7df8093db51902411fe135cd207a2523068c177c3bf07d87c1def428ea955c2b2f0ec8f989176991c5a16728aaf72cb
|
7
|
+
data.tar.gz: 959372d0a5f9144b0f8ce5f80f907316afb288fda00feddd661248734aa83393319f97787965ce0f084770adaa4f579415687b89665e24066bd2c7fb7d13ff14
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGES
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
== 1.3.4 - 4-Jul-2017
|
2
|
+
* The File.binary? method now lets you set your own percentage for the
|
3
|
+
internal heuristic as an optional second argument.
|
4
|
+
* The VERSION constant is now frozen.
|
5
|
+
* Minor updates to the Rakefile and gemspec.
|
6
|
+
* Updated cert file.
|
7
|
+
|
1
8
|
== 1.3.3 - 25-Sep-2015
|
2
9
|
* This gem is now signed.
|
3
10
|
* The Rakefile tasks now assume Rubygems 2.x.
|
data/Rakefile
CHANGED
@@ -8,9 +8,9 @@ CLEAN.include("**/*.gem", "**/*.rbc", "**/*coverage*")
|
|
8
8
|
|
9
9
|
desc 'Install the ptools package (non-gem)'
|
10
10
|
task :install do
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
sitelibdir = CONFIG["sitelibdir"]
|
12
|
+
file = "lib/ptools.rb"
|
13
|
+
FileUtils.cp(file, sitelibdir, :verbose => true)
|
14
14
|
end
|
15
15
|
|
16
16
|
namespace 'gem' do
|
@@ -19,7 +19,7 @@ namespace 'gem' do
|
|
19
19
|
require 'rubygems/package'
|
20
20
|
spec = eval(IO.read('ptools.gemspec'))
|
21
21
|
spec.signing_key = File.join(Dir.home, '.ssh', 'gem-private_key.pem')
|
22
|
-
Gem::Package.build(spec)
|
22
|
+
Gem::Package.build(spec, true)
|
23
23
|
end
|
24
24
|
|
25
25
|
desc 'Install the ptools gem'
|
data/certs/djberg96_pub.pem
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
-----BEGIN CERTIFICATE-----
|
2
2
|
MIIDcDCCAligAwIBAgIBATANBgkqhkiG9w0BAQUFADA/MREwDwYDVQQDDAhkamJl
|
3
3
|
cmc5NjEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYDY29t
|
4
|
-
|
4
|
+
MB4XDTE2MTAzMTE4NTcyNVoXDTE3MTAzMTE4NTcyNVowPzERMA8GA1UEAwwIZGpi
|
5
5
|
ZXJnOTYxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkWA2Nv
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
6
|
+
bTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALwqllig3Tyc29Y3SZgK
|
7
|
+
fFaApRB5R3l8KkOog3rwqr4Rr8bc8MfAMwHOzfqUMQRF7bPIyd5jLu24tPSC2X8D
|
8
|
+
SKDS3069iTzTEDSPin90MVes+nd/ngys93lgmJ9DSwpGXQzZ7sWqdaJjzqLqDMhZ
|
9
|
+
3LhTRZeMpDA8hyEiX7GmVp+VvhAXQ1pjfoFBmMNrzibUmYXcyllzqfEFcbI31/EK
|
10
|
+
vlkEmcTKdNyd4aIOFLadZpzVvLxWsxFqi6qwteAwlNk3zxaik6O82iAXq2tcnk8p
|
11
|
+
asWidshXCiRunncPhVogVYNCS4ISfYD6b/f85T9DsxJ6tsADNfeXnMTRxQcQv+1x
|
12
|
+
0l0CAwEAAaN3MHUwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFC3D
|
13
|
+
p9cyKtYtWUAefeMpMh4kMUP4MB0GA1UdEQQWMBSBEmRqYmVyZzk2QGdtYWlsLmNv
|
14
14
|
bTAdBgNVHRIEFjAUgRJkamJlcmc5NkBnbWFpbC5jb20wDQYJKoZIhvcNAQEFBQAD
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
15
|
+
ggEBAEYzyGzoleAO3i6mOBi/Px1yWdVuU4ejvxrj8axHRK+wHQ+bYvx9eEosuRHB
|
16
|
+
mXjRvpN9UnOiY7wYbK36MpAALBq3swpcBpYXyfBOdv0JQvjMEGmKqXJS7AbNHNPc
|
17
|
+
ZbpPrVSdJJ+aTWEDvybl693eEUvEuiSkVIz8w4yNcJP1zOBRBKxG2viJdMKz5Ho7
|
18
|
+
2M9INmGCv3GCv4bljYlIIg4YYAyOaBbSQeAb2/F5XAlOR2oEB8ipB+RKGZXR8rq5
|
19
|
+
EkhPwYAx+jZ4KyPve9JKm34Du9veVFEzq3aW+opaveK167NEorK7xLpmdEcdo9bR
|
20
|
+
9CkYV0lClarK7w1ykAePuEeXD7k=
|
21
21
|
-----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.4'.freeze
|
7
7
|
|
8
8
|
# :stopdoc:
|
9
9
|
|
@@ -79,6 +79,10 @@ class File
|
|
79
79
|
# It performs a "best guess" based on a simple test of the first
|
80
80
|
# +File.blksize+ characters, or 4096, whichever is smaller.
|
81
81
|
#
|
82
|
+
# By default it will check to see if more than 30 percent of the characters
|
83
|
+
# are non-text characters. If so, the method returns true. You can configure
|
84
|
+
# this percentage by passing your own as a second argument.
|
85
|
+
#
|
82
86
|
# Example:
|
83
87
|
#
|
84
88
|
# File.binary?('somefile.exe') # => true
|
@@ -87,13 +91,13 @@ class File
|
|
87
91
|
# Based on code originally provided by Ryan Davis (which, in turn, is
|
88
92
|
# based on Perl's -B switch).
|
89
93
|
#
|
90
|
-
def self.binary?(file)
|
94
|
+
def self.binary?(file, percentage = 0.30)
|
91
95
|
return false if image?(file)
|
92
96
|
bytes = File.stat(file).blksize
|
93
97
|
bytes = 4096 if bytes > 4096
|
94
98
|
s = (File.read(file, bytes) || "")
|
95
99
|
s = s.encode('US-ASCII', :undef => :replace).split(//)
|
96
|
-
((s.size - s.grep(" ".."~").size) / s.size.to_f) >
|
100
|
+
((s.size - s.grep(" ".."~").size) / s.size.to_f) > percentage
|
97
101
|
end
|
98
102
|
|
99
103
|
# Looks for the first occurrence of +program+ within +path+.
|
data/ptools.gemspec
CHANGED
@@ -3,14 +3,14 @@ require 'rbconfig'
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |spec|
|
5
5
|
spec.name = 'ptools'
|
6
|
-
spec.version = '1.3.
|
7
|
-
spec.license = 'Artistic
|
6
|
+
spec.version = '1.3.4'
|
7
|
+
spec.license = 'Artistic-2.0'
|
8
8
|
spec.author = 'Daniel J. Berger'
|
9
9
|
spec.email = 'djberg96@gmail.com'
|
10
10
|
spec.homepage = 'https://github.com/djberg96/ptools'
|
11
11
|
spec.summary = 'Extra methods for the File class'
|
12
12
|
spec.test_files = Dir['test/test*']
|
13
|
-
spec.files = Dir['**/*']
|
13
|
+
spec.files = Dir['**/*'].reject{ |f| f.include?('git') }
|
14
14
|
spec.cert_chain = ['certs/djberg96_pub.pem']
|
15
15
|
|
16
16
|
spec.extra_rdoc_files = ['README', 'CHANGES', 'MANIFEST']
|
data/test/test_binary.rb
CHANGED
@@ -47,6 +47,11 @@ class TC_Ptools_Binary < Test::Unit::TestCase
|
|
47
47
|
assert_false(File.binary?(@gif_file))
|
48
48
|
end
|
49
49
|
|
50
|
+
test "File.binary? accepts an optional percentage argument" do
|
51
|
+
assert_false(File.binary?(@txt_file, 0.50))
|
52
|
+
assert_true(File.binary?(@txt_file, 0.05))
|
53
|
+
end
|
54
|
+
|
50
55
|
test "File.binary? raises an error if the file cannot be found" do
|
51
56
|
assert_raise_kind_of(SystemCallError){ File.binary?('bogus') }
|
52
57
|
end
|
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.4', File::PTOOLS_VERSION)
|
19
19
|
end
|
20
20
|
|
21
21
|
test "IMAGE_EXT constant is set to array of values" do
|
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.4
|
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
|
-
|
15
|
+
MB4XDTE2MTA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aTWEDvybl693eEUvEuiSkVIz8w4yNcJP1zOBRBKxG2viJdMKz5Ho7
|
29
|
+
2M9INmGCv3GCv4bljYlIIg4YYAyOaBbSQeAb2/F5XAlOR2oEB8ipB+RKGZXR8rq5
|
30
|
+
EkhPwYAx+jZ4KyPve9JKm34Du9veVFEzq3aW+opaveK167NEorK7xLpmdEcdo9bR
|
31
|
+
9CkYV0lClarK7w1ykAePuEeXD7k=
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date:
|
33
|
+
date: 2017-07-04 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: rake
|
@@ -72,15 +72,18 @@ extra_rdoc_files:
|
|
72
72
|
- CHANGES
|
73
73
|
- MANIFEST
|
74
74
|
files:
|
75
|
-
-
|
75
|
+
- certs
|
76
|
+
- certs/djberg96_pub.pem
|
76
77
|
- CHANGES
|
77
78
|
- Gemfile
|
78
|
-
-
|
79
|
-
- README
|
80
|
-
- Rakefile
|
81
|
-
- certs/djberg96_pub.pem
|
79
|
+
- lib
|
82
80
|
- lib/ptools.rb
|
81
|
+
- MANIFEST
|
83
82
|
- ptools.gemspec
|
83
|
+
- Rakefile
|
84
|
+
- README
|
85
|
+
- test
|
86
|
+
- test/img
|
84
87
|
- test/img/test.gif
|
85
88
|
- test/img/test.jpg
|
86
89
|
- test/img/test.png
|
@@ -96,11 +99,12 @@ files:
|
|
96
99
|
- test/test_wc.rb
|
97
100
|
- test/test_whereis.rb
|
98
101
|
- test/test_which.rb
|
102
|
+
- test/txt
|
99
103
|
- test/txt/english.txt
|
100
104
|
- test/txt/korean.txt
|
101
105
|
homepage: https://github.com/djberg96/ptools
|
102
106
|
licenses:
|
103
|
-
- Artistic
|
107
|
+
- Artistic-2.0
|
104
108
|
metadata: {}
|
105
109
|
post_install_message:
|
106
110
|
rdoc_options: []
|
@@ -118,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
118
122
|
version: '0'
|
119
123
|
requirements: []
|
120
124
|
rubyforge_project:
|
121
|
-
rubygems_version: 2.
|
125
|
+
rubygems_version: 2.6.12
|
122
126
|
signing_key:
|
123
127
|
specification_version: 4
|
124
128
|
summary: Extra methods for the File class
|
metadata.gz.sig
CHANGED
Binary file
|
data/.gemtest
DELETED
File without changes
|