ptools 1.3.3 → 1.4.0
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 +0 -0
- data/CHANGES +30 -2
- data/Gemfile +1 -1
- data/MANIFEST +20 -13
- data/README +4 -2
- data/Rakefile +31 -79
- data/certs/djberg96_pub.pem +22 -17
- data/lib/ptools.rb +31 -37
- data/ptools.gemspec +6 -7
- data/spec/binary_spec.rb +59 -0
- data/spec/constants_spec.rb +33 -0
- data/spec/head_spec.rb +41 -0
- data/spec/image_spec.rb +51 -0
- data/{test → spec}/img/test.gif +0 -0
- data/spec/img/test.ico +0 -0
- data/{test → spec}/img/test.jpg +0 -0
- data/{test → spec}/img/test.png +0 -0
- data/spec/nlconvert_spec.rb +104 -0
- data/spec/sparse_spec.rb +43 -0
- data/spec/tail_spec.rb +107 -0
- data/spec/touch_spec.rb +47 -0
- data/{.gemtest → spec/txt/empty.txt} +0 -0
- data/{test → spec}/txt/english.txt +0 -0
- data/spec/txt/english.utf16 +0 -0
- data/{test → spec}/txt/korean.txt +0 -0
- data/spec/wc_spec.rb +65 -0
- data/spec/whereis_spec.rb +87 -0
- data/spec/which_spec.rb +112 -0
- metadata +54 -61
- metadata.gz.sig +0 -0
- data/test/test_binary.rb +0 -65
- data/test/test_constants.rb +0 -38
- data/test/test_head.rb +0 -48
- data/test/test_image.rb +0 -57
- data/test/test_is_sparse.rb +0 -53
- data/test/test_nlconvert.rb +0 -110
- data/test/test_null.rb +0 -40
- data/test/test_tail.rb +0 -124
- data/test/test_touch.rb +0 -53
- data/test/test_wc.rb +0 -73
- data/test/test_whereis.rb +0 -98
- data/test/test_which.rb +0 -126
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: be2c833dd51c09611f84da85481ae3b8039d427955fa951c5aab0745bef680d7
|
4
|
+
data.tar.gz: 612f6f1ab4cb5e605d9b1c18d26a9b35b95e798a9e9e11d54f539bb5ee1f1082
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ec40d7c6e2d9edb2cc0e5a41a74469d7a17d208cd67d0461963488c20f97ab06b125c17903c976c6f741f93a36612ccdd63fde6c9ac0a64671340b2dbe7d78c
|
7
|
+
data.tar.gz: 7cd78b2d229c8f98a7df154275d74cb0055336bac5b40368112dd83a3cf5b8ed96c3b708b5fe5cda543a263041ab2ab44fe1a656e8be70f5d4c0c36259646bb0
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGES
CHANGED
@@ -1,10 +1,38 @@
|
|
1
|
+
== 1.4.0 - 20-Aug-2020
|
2
|
+
* Switched from test-unit to rspec, and reworked the tests bit in general.
|
3
|
+
* Removed the File.null method since Ruby has IO::NULL.
|
4
|
+
|
5
|
+
== 1.3.7 - 24-Jun-2020
|
6
|
+
* Fixed a bug where the File.binary? method would bomb on a zero byte file.
|
7
|
+
Thanks go to Alexandru Emil Lupu for the spot and patch.
|
8
|
+
* Remove Gemfile.lock from repo. You can generate that yourself locally if
|
9
|
+
you want.
|
10
|
+
|
11
|
+
== 1.3.6 - 7-Jun-2020
|
12
|
+
* Updated gemspec, added more versions to .travis.yml file, fixed typo.
|
13
|
+
Thanks go to Al Snow for the updates.
|
14
|
+
* Fixed a bug where the File.binary? method would return true for utf16
|
15
|
+
or utf32 encoded files. Thanks go to Andrew McAndre for the spot.
|
16
|
+
* Updated cert.
|
17
|
+
|
18
|
+
== 1.3.5 - 3-Sep-2017
|
19
|
+
* The File.image? method now checks against .ico files.
|
20
|
+
* Eliminated Fixnum warning that showed up in Ruby 2.4.x.
|
21
|
+
* Updated cert.
|
22
|
+
|
23
|
+
== 1.3.4 - 4-Jul-2017
|
24
|
+
* The File.binary? method now lets you set your own percentage for the
|
25
|
+
internal heuristic as an optional second argument.
|
26
|
+
* The VERSION constant is now frozen.
|
27
|
+
* Minor updates to the Rakefile and gemspec.
|
28
|
+
* Updated cert file.
|
29
|
+
|
1
30
|
== 1.3.3 - 25-Sep-2015
|
2
31
|
* This gem is now signed.
|
3
32
|
* The Rakefile tasks now assume Rubygems 2.x.
|
4
33
|
|
5
34
|
== 1.3.2 - 11-Dec-2014
|
6
|
-
* Update to the File.tail method that
|
7
|
-
issues in JRuby.
|
35
|
+
* Update to the File.tail method that prevents potential line ending issues in JRuby.
|
8
36
|
* Added known issues with JRuby to the README.
|
9
37
|
|
10
38
|
== 1.3.1 - 9-Dec-2014
|
data/Gemfile
CHANGED
data/MANIFEST
CHANGED
@@ -1,20 +1,27 @@
|
|
1
1
|
* CHANGES
|
2
2
|
* README
|
3
3
|
* MANIFEST
|
4
|
+
* Gemfile
|
4
5
|
* Rakefile
|
5
6
|
* ptools.gemspec
|
6
7
|
* certs/djberg96_pub.pem
|
7
8
|
* lib/ptools.rb
|
8
|
-
*
|
9
|
-
*
|
10
|
-
*
|
11
|
-
*
|
12
|
-
*
|
13
|
-
*
|
14
|
-
*
|
15
|
-
*
|
16
|
-
*
|
17
|
-
*
|
18
|
-
*
|
19
|
-
*
|
20
|
-
*
|
9
|
+
* spec/binary_spec.rb
|
10
|
+
* spec/constants_spec.rb
|
11
|
+
* spec/head_spec.rb
|
12
|
+
* spec/image_spec.rb
|
13
|
+
* spec/nlconvert_spec.rb
|
14
|
+
* spec/sparse_spec.rb
|
15
|
+
* spec/tail_spec.rb
|
16
|
+
* spec/touch_spec.rb
|
17
|
+
* spec/wc_spec.rb
|
18
|
+
* spec/whereis_spec.rb
|
19
|
+
* spec/which_spec.rb
|
20
|
+
* spec/img/test.gif
|
21
|
+
* spec/img/test.ico
|
22
|
+
* spec/img/test.jpg
|
23
|
+
* spec/img/test.png
|
24
|
+
* spec/txt/empty.txt
|
25
|
+
* spec/txt/english.txt
|
26
|
+
* spec/txt/english.utf16
|
27
|
+
* spec/txt/korean.txt
|
data/README
CHANGED
@@ -47,14 +47,16 @@
|
|
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
|
|
53
55
|
== License
|
54
|
-
Artistic
|
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/Rakefile
CHANGED
@@ -2,15 +2,16 @@ require 'rake'
|
|
2
2
|
require 'rake/clean'
|
3
3
|
require 'rake/testtask'
|
4
4
|
require 'rbconfig'
|
5
|
+
require 'rspec/core/rake_task'
|
5
6
|
include RbConfig
|
6
7
|
|
7
8
|
CLEAN.include("**/*.gem", "**/*.rbc", "**/*coverage*")
|
8
9
|
|
9
10
|
desc 'Install the ptools package (non-gem)'
|
10
11
|
task :install do
|
11
|
-
|
12
|
-
|
13
|
-
|
12
|
+
sitelibdir = CONFIG["sitelibdir"]
|
13
|
+
file = "lib/ptools.rb"
|
14
|
+
FileUtils.cp(file, sitelibdir, :verbose => true)
|
14
15
|
end
|
15
16
|
|
16
17
|
namespace 'gem' do
|
@@ -33,103 +34,54 @@ namespace 'gem' do
|
|
33
34
|
end
|
34
35
|
end
|
35
36
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
t.warning = true
|
40
|
-
end
|
41
|
-
|
42
|
-
namespace 'test' do
|
43
|
-
desc "Check test coverage using rcov"
|
44
|
-
task :coverage => [:clean] do
|
45
|
-
require 'rcov'
|
46
|
-
rm_rf 'coverage'
|
47
|
-
sh "rcov -Ilib test/test*.rb"
|
37
|
+
namespace 'spec' do
|
38
|
+
RSpec::Core::RakeTask.new(:binary) do |t|
|
39
|
+
t.pattern = 'spec/binary_spec.rb'
|
48
40
|
end
|
49
41
|
|
50
|
-
|
51
|
-
t.
|
52
|
-
t.verbose = true
|
53
|
-
t.warning = true
|
54
|
-
t.test_files = FileList['test/test_binary.rb']
|
42
|
+
RSpec::Core::RakeTask.new(:constants) do |t|
|
43
|
+
t.pattern = 'spec/constants_spec.rb'
|
55
44
|
end
|
56
45
|
|
57
|
-
|
58
|
-
t.
|
59
|
-
t.verbose = true
|
60
|
-
t.warning = true
|
61
|
-
t.test_files = FileList['test/test_constants.rb']
|
46
|
+
RSpec::Core::RakeTask.new(:head) do |t|
|
47
|
+
t.pattern = 'spec/head_spec.rb'
|
62
48
|
end
|
63
49
|
|
64
|
-
|
65
|
-
t.
|
66
|
-
t.verbose = true
|
67
|
-
t.warning = true
|
68
|
-
t.test_files = FileList['test/test_head.rb']
|
50
|
+
RSpec::Core::RakeTask.new(:image) do |t|
|
51
|
+
t.pattern = 'spec/image_spec.rb'
|
69
52
|
end
|
70
53
|
|
71
|
-
|
72
|
-
t.
|
73
|
-
t.verbose = true
|
74
|
-
t.warning = true
|
75
|
-
t.test_files = FileList['test/test_image.rb']
|
54
|
+
RSpec::Core::RakeTask.new(:nlconvert) do |t|
|
55
|
+
t.pattern = 'spec/nlconvert_spec.rb'
|
76
56
|
end
|
77
57
|
|
78
|
-
|
79
|
-
t.
|
80
|
-
t.verbose = true
|
81
|
-
t.warning = true
|
82
|
-
t.test_files = FileList['test/test_nlconvert.rb']
|
58
|
+
RSpec::Core::RakeTask.new(:sparse) do |t|
|
59
|
+
t.pattern = 'spec/sparse_spec.rb'
|
83
60
|
end
|
84
61
|
|
85
|
-
|
86
|
-
t.
|
87
|
-
t.verbose = true
|
88
|
-
t.warning = true
|
89
|
-
t.test_files = FileList['test/test_null.rb']
|
62
|
+
RSpec::Core::RakeTask.new(:tail) do |t|
|
63
|
+
t.pattern = 'spec/tail_spec.rb'
|
90
64
|
end
|
91
65
|
|
92
|
-
|
93
|
-
t.
|
94
|
-
t.verbose = true
|
95
|
-
t.warning = true
|
96
|
-
t.test_files = FileList['test/test_is_sparse.rb']
|
66
|
+
RSpec::Core::RakeTask.new(:touch) do |t|
|
67
|
+
t.pattern = 'spec/touch_spec.rb'
|
97
68
|
end
|
98
69
|
|
99
|
-
|
100
|
-
t.
|
101
|
-
t.verbose = true
|
102
|
-
t.warning = true
|
103
|
-
t.test_files = FileList['test/test_tail.rb']
|
70
|
+
RSpec::Core::RakeTask.new(:wc) do |t|
|
71
|
+
t.pattern = 'spec/wc_spec.rb'
|
104
72
|
end
|
105
|
-
|
106
|
-
|
107
|
-
t.
|
108
|
-
t.verbose = true
|
109
|
-
t.warning = true
|
110
|
-
t.test_files = FileList['test/test_touch.rb']
|
111
|
-
end
|
112
|
-
|
113
|
-
Rake::TestTask.new('wc') do |t|
|
114
|
-
t.libs << 'test'
|
115
|
-
t.verbose = true
|
116
|
-
t.warning = true
|
117
|
-
t.test_files = FileList['test/test_wc.rb']
|
73
|
+
|
74
|
+
RSpec::Core::RakeTask.new(:whereis) do |t|
|
75
|
+
t.pattern = 'spec/whereis_spec.rb'
|
118
76
|
end
|
119
77
|
|
120
|
-
|
121
|
-
t.
|
122
|
-
t.verbose = true
|
123
|
-
t.warning = true
|
124
|
-
t.test_files = FileList['test/test_whereis.rb']
|
78
|
+
RSpec::Core::RakeTask.new(:which) do |t|
|
79
|
+
t.pattern = 'spec/which_spec.rb'
|
125
80
|
end
|
126
81
|
|
127
|
-
|
128
|
-
t.
|
129
|
-
t.verbose = true
|
130
|
-
t.warning = true
|
131
|
-
t.test_files = FileList['test/test_which.rb']
|
82
|
+
RSpec::Core::RakeTask.new(:all) do |t|
|
83
|
+
t.pattern = 'spec/*_spec.rb'
|
132
84
|
end
|
133
85
|
end
|
134
86
|
|
135
|
-
task :default => :
|
87
|
+
task :default => 'spec:all'
|
data/certs/djberg96_pub.pem
CHANGED
@@ -1,21 +1,26 @@
|
|
1
1
|
-----BEGIN CERTIFICATE-----
|
2
|
-
|
2
|
+
MIIEcDCCAtigAwIBAgIBATANBgkqhkiG9w0BAQsFADA/MREwDwYDVQQDDAhkamJl
|
3
3
|
cmc5NjEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYDY29t
|
4
|
-
|
4
|
+
MB4XDTE4MDMxODE1MjIwN1oXDTI4MDMxNTE1MjIwN1owPzERMA8GA1UEAwwIZGpi
|
5
5
|
ZXJnOTYxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkWA2Nv
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
6
|
+
bTCCAaIwDQYJKoZIhvcNAQEBBQADggGPADCCAYoCggGBALgfaroVM6CI06cxr0/h
|
7
|
+
A+j+pc8fgpRgBVmHFaFunq28GPC3IvW7Nvc3Y8SnAW7pP1EQIbhlwRIaQzJ93/yj
|
8
|
+
u95KpkP7tA9erypnV7dpzBkzNlX14ACaFD/6pHoXoe2ltBxk3CCyyzx70mTqJpph
|
9
|
+
75IB03ni9a8yqn8pmse+s83bFJOAqddSj009sGPcQO+QOWiNxqYv1n5EHcvj2ebO
|
10
|
+
6hN7YTmhx7aSia4qL/quc4DlIaGMWoAhvML7u1fmo53CYxkKskfN8MOecq2vfEmL
|
11
|
+
iLu+SsVVEAufMDDFMXMJlvDsviolUSGMSNRTujkyCcJoXKYYxZSNtIiyd9etI0X3
|
12
|
+
ctu0uhrFyrMZXCedutvXNjUolD5r9KGBFSWH1R9u2I3n3SAyFF2yzv/7idQHLJJq
|
13
|
+
74BMnx0FIq6fCpu5slAipvxZ3ZkZpEXZFr3cIBtO1gFvQWW7E/Y3ijliWJS1GQFq
|
14
|
+
058qERadHGu1yu1dojmFRo6W2KZvY9al2yIlbkpDrD5MYQIDAQABo3cwdTAJBgNV
|
15
|
+
HRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQUFZsMapgzJimzsbaBG2Tm8j5e
|
16
|
+
AzgwHQYDVR0RBBYwFIESZGpiZXJnOTZAZ21haWwuY29tMB0GA1UdEgQWMBSBEmRq
|
17
|
+
YmVyZzk2QGdtYWlsLmNvbTANBgkqhkiG9w0BAQsFAAOCAYEAW2tnYixXQtKxgGXq
|
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.
|
6
|
+
PTOOLS_VERSION = '1.4.0'.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
|
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,46 +39,20 @@ 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)
|
43
|
-
bool = bmp?(file) || jpg?(file) || png?(file) || gif?(file) || tiff?(file)
|
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
|
|
47
|
-
# Returns the name of the null device (aka bitbucket) on your platform.
|
48
|
-
#
|
49
|
-
# Examples:
|
50
|
-
#
|
51
|
-
# # On Linux
|
52
|
-
# File.null # => '/dev/null'
|
53
|
-
#
|
54
|
-
# # On MS Windows
|
55
|
-
# File.null # => 'NUL'
|
56
|
-
#--
|
57
|
-
# The values I used here are based on information from
|
58
|
-
# http://en.wikipedia.org/wiki//dev/null
|
59
|
-
#
|
60
|
-
def self.null
|
61
|
-
case RbConfig::CONFIG['host_os']
|
62
|
-
when /mswin|win32|msdos|mingw|windows/i
|
63
|
-
'NUL'
|
64
|
-
when /amiga/i
|
65
|
-
'NIL:'
|
66
|
-
when /openvms/i
|
67
|
-
'NL:'
|
68
|
-
else
|
69
|
-
'/dev/null'
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
class << self
|
74
|
-
alias null_device null
|
75
|
-
end
|
76
|
-
|
77
47
|
# Returns whether or not +file+ is a binary non-image file, i.e. executable,
|
78
48
|
# shared object, ect. Note that this is NOT guaranteed to be 100% accurate.
|
79
49
|
# It performs a "best guess" based on a simple test of the first
|
80
50
|
# +File.blksize+ characters, or 4096, whichever is smaller.
|
81
51
|
#
|
52
|
+
# By default it will check to see if more than 30 percent of the characters
|
53
|
+
# are non-text characters. If so, the method returns true. You can configure
|
54
|
+
# this percentage by passing your own as a second argument.
|
55
|
+
#
|
82
56
|
# Example:
|
83
57
|
#
|
84
58
|
# File.binary?('somefile.exe') # => true
|
@@ -87,13 +61,15 @@ class File
|
|
87
61
|
# Based on code originally provided by Ryan Davis (which, in turn, is
|
88
62
|
# based on Perl's -B switch).
|
89
63
|
#
|
90
|
-
def self.binary?(file)
|
64
|
+
def self.binary?(file, percentage = 0.30)
|
65
|
+
return false if File.stat(file).zero?
|
91
66
|
return false if image?(file)
|
67
|
+
return false if check_bom?(file)
|
92
68
|
bytes = File.stat(file).blksize
|
93
69
|
bytes = 4096 if bytes > 4096
|
94
70
|
s = (File.read(file, bytes) || "")
|
95
71
|
s = s.encode('US-ASCII', :undef => :replace).split(//)
|
96
|
-
((s.size - s.grep(" ".."~").size) / s.size.to_f) >
|
72
|
+
((s.size - s.grep(" ".."~").size) / s.size.to_f) > percentage
|
97
73
|
end
|
98
74
|
|
99
75
|
# Looks for the first occurrence of +program+ within +path+.
|
@@ -428,6 +404,20 @@ class File
|
|
428
404
|
|
429
405
|
private
|
430
406
|
|
407
|
+
# Returns whether or not the given +text+ contains a BOM marker.
|
408
|
+
# If present, we can generally assume it's a text file.
|
409
|
+
#
|
410
|
+
def self.check_bom?(file)
|
411
|
+
text = File.read(file, 4).force_encoding('utf-8')
|
412
|
+
|
413
|
+
bool = false
|
414
|
+
bool = true if text[0,3] == "\xEF\xBB\xBF"
|
415
|
+
bool = true if text[0,4] == "\x00\x00\xFE\xFF" || text[0,4] == "\xFF\xFE\x00\x00"
|
416
|
+
bool = true if text[0,2] == "\xFF\xFE" || text[0,2] == "\xFE\xFF"
|
417
|
+
|
418
|
+
bool
|
419
|
+
end
|
420
|
+
|
431
421
|
def self.nl_for_platform(platform)
|
432
422
|
platform = RbConfig::CONFIG["host_os"] if platform == 'local'
|
433
423
|
|
@@ -479,4 +469,8 @@ class File
|
|
479
469
|
|
480
470
|
true
|
481
471
|
end
|
472
|
+
|
473
|
+
def self.ico?(file)
|
474
|
+
["\000\000\001\000", "\000\000\002\000"].include?(IO.read(file, 4, nil, :encoding => 'binary'))
|
475
|
+
end
|
482
476
|
end
|
data/ptools.gemspec
CHANGED
@@ -1,16 +1,15 @@
|
|
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.
|
7
|
-
spec.license = 'Artistic
|
5
|
+
spec.version = '1.4.0'
|
6
|
+
spec.license = 'Artistic-2.0'
|
8
7
|
spec.author = 'Daniel J. Berger'
|
9
8
|
spec.email = 'djberg96@gmail.com'
|
10
9
|
spec.homepage = 'https://github.com/djberg96/ptools'
|
11
10
|
spec.summary = 'Extra methods for the File class'
|
12
|
-
spec.test_files = Dir['
|
13
|
-
spec.files = Dir['**/*']
|
11
|
+
spec.test_files = Dir['spec/_spec*']
|
12
|
+
spec.files = Dir['**/*'].reject{ |f| f.include?('git') }
|
14
13
|
spec.cert_chain = ['certs/djberg96_pub.pem']
|
15
14
|
|
16
15
|
spec.extra_rdoc_files = ['README', 'CHANGES', 'MANIFEST']
|
@@ -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('
|
24
|
+
spec.add_development_dependency('rspec', '~> 3.9')
|
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
|