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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c180275bc8e38301a9c1d13771831614cf4febb5
4
- data.tar.gz: 0de46ac283166ffc26a20955f2b4d4809116a6fc
3
+ metadata.gz: 10dd763e75f62b662df564b86af1dd45a830c57d
4
+ data.tar.gz: 3cff979f3aa49c9115a1b7efaa266fba060a7161
5
5
  SHA512:
6
- metadata.gz: 8bf975d8d26c1f464f48cdb831347eba7a4094ccba45e9f974766ca14f343db58d87a41dad2a7647ad1f3b3a1923622549177c6936638b60a796ba33088984ee
7
- data.tar.gz: 849697b55d1a7ee705f5eec78f3a2e19dcfe086e5b1cbf753bcf185509554dac11ee153709fd356ff8dc601d7806ebe9cc5d288abfb70cd6df5c6cd631449fdb
6
+ metadata.gz: 42bf217eddaa220ae53d95566725e894c7df8093db51902411fe135cd207a2523068c177c3bf07d87c1def428ea955c2b2f0ec8f989176991c5a16728aaf72cb
7
+ data.tar.gz: 959372d0a5f9144b0f8ce5f80f907316afb288fda00feddd661248734aa83393319f97787965ce0f084770adaa4f579415687b89665e24066bd2c7fb7d13ff14
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
- sitelibdir = CONFIG["sitelibdir"]
12
- file = "lib/ptools.rb"
13
- FileUtils.cp(file, sitelibdir, :verbose => true)
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'
@@ -1,21 +1,21 @@
1
1
  -----BEGIN CERTIFICATE-----
2
2
  MIIDcDCCAligAwIBAgIBATANBgkqhkiG9w0BAQUFADA/MREwDwYDVQQDDAhkamJl
3
3
  cmc5NjEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYDY29t
4
- MB4XDTE1MDkwMjIwNDkxOFoXDTE2MDkwMTIwNDkxOFowPzERMA8GA1UEAwwIZGpi
4
+ MB4XDTE2MTAzMTE4NTcyNVoXDTE3MTAzMTE4NTcyNVowPzERMA8GA1UEAwwIZGpi
5
5
  ZXJnOTYxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkWA2Nv
6
- bTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMyTkvXqRp6hLs9eoJOS
7
- Hmi8kRYbq9Vkf15/hMxJpotYMgJVHHWrmDcC5Dye2PbnXjTkKf266Zw0PtT9h+lI
8
- S3ts9HO+vaCFSMwFFZmnWJSpQ3CNw2RcHxjWkk9yF7imEM8Kz9ojhiDXzBetdV6M
9
- gr0lV/alUr7TNVBDngbXEfTWscyXh1qd7xZ4EcOdsDktCe5G45N/o3662tPQvJsi
10
- FOF0CM/KuBsa/HL1/eoEmF4B3EKIRfTHrQ3hu20Kv3RJ88QM4ec2+0dd97uX693O
11
- zv6981fyEg+aXLkxrkViM/tz2qR2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19
- EJYzxdPOrx2n6NYR3Hk+vHP0U7UBSveI6+qx+ndQYaeyCn+GRX2PKS9h66YF/Q1V
20
- tGSHgAmcLlkdGgan182qsE/4kKM=
15
+ ggEBAEYzyGzoleAO3i6mOBi/Px1yWdVuU4ejvxrj8axHRK+wHQ+bYvx9eEosuRHB
16
+ mXjRvpN9UnOiY7wYbK36MpAALBq3swpcBpYXyfBOdv0JQvjMEGmKqXJS7AbNHNPc
17
+ ZbpPrVSdJJ+aTWEDvybl693eEUvEuiSkVIz8w4yNcJP1zOBRBKxG2viJdMKz5Ho7
18
+ 2M9INmGCv3GCv4bljYlIIg4YYAyOaBbSQeAb2/F5XAlOR2oEB8ipB+RKGZXR8rq5
19
+ EkhPwYAx+jZ4KyPve9JKm34Du9veVFEzq3aW+opaveK167NEorK7xLpmdEcdo9bR
20
+ 9CkYV0lClarK7w1ykAePuEeXD7k=
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.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) > 0.30
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+.
@@ -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.3'
7
- spec.license = 'Artistic 2.0'
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['**/*'] << '.gemtest'
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']
@@ -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
@@ -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.3', File::PTOOLS_VERSION)
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.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
- MB4XDTE1MDkwMjIwNDkxOFoXDTE2MDkwMTIwNDkxOFowPzERMA8GA1UEAwwIZGpi
15
+ MB4XDTE2MTAzMTE4NTcyNVoXDTE3MTAzMTE4NTcyNVowPzERMA8GA1UEAwwIZGpi
16
16
  ZXJnOTYxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkWA2Nv
17
- bTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMyTkvXqRp6hLs9eoJOS
18
- Hmi8kRYbq9Vkf15/hMxJpotYMgJVHHWrmDcC5Dye2PbnXjTkKf266Zw0PtT9h+lI
19
- S3ts9HO+vaCFSMwFFZmnWJSpQ3CNw2RcHxjWkk9yF7imEM8Kz9ojhiDXzBetdV6M
20
- gr0lV/alUr7TNVBDngbXEfTWscyXh1qd7xZ4EcOdsDktCe5G45N/o3662tPQvJsi
21
- FOF0CM/KuBsa/HL1/eoEmF4B3EKIRfTHrQ3hu20Kv3RJ88QM4ec2+0dd97uX693O
22
- zv6981fyEg+aXLkxrkViM/tz2qR2ZE0jPhHTREPYeMEgptRkTmWSKAuLVWrJEfgl
23
- DtkCAwEAAaN3MHUwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFEwe
24
- nn6bfJADmuIDiMSOzedOrL+xMB0GA1UdEQQWMBSBEmRqYmVyZzk2QGdtYWlsLmNv
17
+ bTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALwqllig3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JS7AbNHNPc
28
+ ZbpPrVSdJJ+aTWEDvybl693eEUvEuiSkVIz8w4yNcJP1zOBRBKxG2viJdMKz5Ho7
29
+ 2M9INmGCv3GCv4bljYlIIg4YYAyOaBbSQeAb2/F5XAlOR2oEB8ipB+RKGZXR8rq5
30
+ EkhPwYAx+jZ4KyPve9JKm34Du9veVFEzq3aW+opaveK167NEorK7xLpmdEcdo9bR
31
+ 9CkYV0lClarK7w1ykAePuEeXD7k=
32
32
  -----END CERTIFICATE-----
33
- date: 2015-09-25 00:00:00.000000000 Z
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
- - ".gemtest"
75
+ - certs
76
+ - certs/djberg96_pub.pem
76
77
  - CHANGES
77
78
  - Gemfile
78
- - MANIFEST
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 2.0
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.4.5
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