ptools 1.3.5 → 1.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
metadata CHANGED
@@ -1,36 +1,41 @@
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.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel J. Berger
8
- autorequire:
8
+ autorequire:
9
9
  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
- mYMP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vXNjUolD5r9KGBFSWH1R9u2I3n3SAyFF2yzv/7idQHLJJq
24
+ 74BMnx0FIq6fCpu5slAipvxZ3ZkZpEXZFr3cIBtO1gFvQWW7E/Y3ijliWJS1GQFq
25
+ 058qERadHGu1yu1dojmFRo6W2KZvY9al2yIlbkpDrD5MYQIDAQABo3cwdTAJBgNV
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: 2017-09-03 00:00:00.000000000 Z
38
+ date: 2021-01-06 00:00:00.000000000 Z
34
39
  dependencies:
35
40
  - !ruby/object:Gem::Dependency
36
41
  name: rake
@@ -47,19 +52,19 @@ dependencies:
47
52
  - !ruby/object:Gem::Version
48
53
  version: '0'
49
54
  - !ruby/object:Gem::Dependency
50
- name: test-unit
55
+ name: rspec
51
56
  requirement: !ruby/object:Gem::Requirement
52
57
  requirements:
53
- - - ">="
58
+ - - "~>"
54
59
  - !ruby/object:Gem::Version
55
- version: 2.5.0
60
+ version: '3.9'
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: '3.9'
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,
@@ -67,47 +72,46 @@ description: |2
67
72
  email: djberg96@gmail.com
68
73
  executables: []
69
74
  extensions: []
70
- extra_rdoc_files:
71
- - README
72
- - CHANGES
73
- - MANIFEST
75
+ extra_rdoc_files: []
74
76
  files:
75
- - certs
76
- - certs/djberg96_pub.pem
77
- - CHANGES
77
+ - CHANGES.md
78
78
  - Gemfile
79
- - lib
79
+ - MANIFEST.md
80
+ - README.md
81
+ - Rakefile
82
+ - certs/djberg96_pub.pem
80
83
  - lib/ptools.rb
81
- - MANIFEST
82
84
  - ptools.gemspec
83
- - Rakefile
84
- - README
85
- - test
86
- - test/img
87
- - test/img/test.gif
88
- - test/img/test.ico
89
- - test/img/test.jpg
90
- - test/img/test.png
91
- - test/test_binary.rb
92
- - test/test_constants.rb
93
- - test/test_head.rb
94
- - test/test_image.rb
95
- - test/test_is_sparse.rb
96
- - test/test_nlconvert.rb
97
- - test/test_null.rb
98
- - test/test_tail.rb
99
- - test/test_touch.rb
100
- - test/test_wc.rb
101
- - test/test_whereis.rb
102
- - test/test_which.rb
103
- - test/txt
104
- - test/txt/english.txt
105
- - test/txt/korean.txt
85
+ - spec/binary_spec.rb
86
+ - spec/constants_spec.rb
87
+ - spec/head_spec.rb
88
+ - spec/image_spec.rb
89
+ - spec/img/test.gif
90
+ - spec/img/test.ico
91
+ - spec/img/test.jpg
92
+ - spec/img/test.png
93
+ - spec/nlconvert_spec.rb
94
+ - spec/sparse_spec.rb
95
+ - spec/tail_spec.rb
96
+ - spec/touch_spec.rb
97
+ - spec/txt/empty.txt
98
+ - spec/txt/english.txt
99
+ - spec/txt/english.utf16
100
+ - spec/txt/korean.txt
101
+ - spec/wc_spec.rb
102
+ - spec/whereis_spec.rb
103
+ - spec/which_spec.rb
106
104
  homepage: https://github.com/djberg96/ptools
107
105
  licenses:
108
106
  - Artistic-2.0
109
- metadata: {}
110
- post_install_message:
107
+ metadata:
108
+ homepage_uri: https://github.com/djberg96/ptools
109
+ bug_tracker_uri: https://github.com/djberg96/ptools/issues
110
+ changelog_uri: https://github.com/djberg96/ptools/blob/master/CHANGES.md
111
+ documentation_uri: https://github.com/djberg96/ptools/wiki
112
+ source_code_uri: https://github.com/djberg96/ptools
113
+ wiki_uri: https://github.com/djberg96/ptools/wiki
114
+ post_install_message:
111
115
  rdoc_options: []
112
116
  require_paths:
113
117
  - lib
@@ -122,21 +126,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
122
126
  - !ruby/object:Gem::Version
123
127
  version: '0'
124
128
  requirements: []
125
- rubyforge_project:
126
- rubygems_version: 2.6.12
127
- signing_key:
129
+ rubygems_version: 3.0.3
130
+ signing_key:
128
131
  specification_version: 4
129
132
  summary: Extra methods for the File class
130
- test_files:
131
- - test/test_binary.rb
132
- - test/test_constants.rb
133
- - test/test_head.rb
134
- - test/test_image.rb
135
- - test/test_is_sparse.rb
136
- - test/test_nlconvert.rb
137
- - test/test_null.rb
138
- - test/test_tail.rb
139
- - test/test_touch.rb
140
- - test/test_wc.rb
141
- - test/test_whereis.rb
142
- - test/test_which.rb
133
+ test_files: []
metadata.gz.sig CHANGED
Binary file
data/MANIFEST DELETED
@@ -1,21 +0,0 @@
1
- * CHANGES
2
- * README
3
- * MANIFEST
4
- * Rakefile
5
- * ptools.gemspec
6
- * certs/djberg96_pub.pem
7
- * lib/ptools.rb
8
- * test/test_constants.rb
9
- * test/test_head.rb
10
- * test/test_image.rb
11
- * test/test_nlconvert.rb
12
- * test/test_null.rb
13
- * test/test_tail.rb
14
- * test/test_touch.rb
15
- * test/test_wc.rb
16
- * test/test_which.rb
17
- * test/test_whereis.rb
18
- * test/img/test.gif
19
- * test/img/test.jpg
20
- * test/img/test.png
21
- * test/img/test.ico
@@ -1,70 +0,0 @@
1
- #####################################################################
2
- # test_binary.rb
3
- #
4
- # Test case for the File.binary? method. You should run this test
5
- # via the 'rake test_binary' task.
6
- #####################################################################
7
- require 'rubygems'
8
- require 'test-unit'
9
- require 'ptools'
10
-
11
- class TC_Ptools_Binary < Test::Unit::TestCase
12
- def self.startup
13
- if File::ALT_SEPARATOR
14
- @@bin_file = File.join(ENV['windir'], 'notepad.exe')
15
- else
16
- @@bin_file = '/bin/ls'
17
- end
18
-
19
- @@dirname = File.dirname(__FILE__)
20
- end
21
-
22
- def setup
23
- @txt_file = File.join(@@dirname, 'txt', 'english.txt')
24
- @uni_file = File.join(@@dirname, 'txt', 'korean.txt')
25
- @png_file = File.join(@@dirname, 'img', 'test.png')
26
- @jpg_file = File.join(@@dirname, 'img', 'test.jpg')
27
- @gif_file = File.join(@@dirname, 'img', 'test.gif')
28
- end
29
-
30
- test "File.binary? basic functionality" do
31
- assert_respond_to(File, :binary?)
32
- assert_nothing_raised{ File.binary?(@txt_file) }
33
- end
34
-
35
- test "File.binary? returns true for binary files" do
36
- assert_true(File.binary?(@@bin_file))
37
- end
38
-
39
- test "File.binary? returns false for text files" do
40
- assert_false(File.binary?(@txt_file))
41
- assert_false(File.binary?(@uni_file))
42
- end
43
-
44
- test "File.binary? returns false for image files" do
45
- assert_false(File.binary?(@png_file))
46
- assert_false(File.binary?(@jpg_file))
47
- assert_false(File.binary?(@gif_file))
48
- end
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
-
55
- test "File.binary? raises an error if the file cannot be found" do
56
- assert_raise_kind_of(SystemCallError){ File.binary?('bogus') }
57
- end
58
-
59
- test "File.binary? only accepts one argument" do
60
- assert_raise_kind_of(ArgumentError){ File.binary?(@txt_file, @@bin_file) }
61
- end
62
-
63
- def teardown
64
- @txt_file = nil
65
- @uni_file = nil
66
- @png_file = nil
67
- @jpg_file = nil
68
- @gif_file = nil
69
- end
70
- end
@@ -1,38 +0,0 @@
1
- #####################################################################
2
- # test_constants.rb
3
- #
4
- # Tests the constants that have been defined for our package. This
5
- # test case should be run via the 'rake test_constants' task.
6
- #####################################################################
7
- require 'rubygems'
8
- require 'test-unit'
9
- require 'rbconfig'
10
- require 'ptools'
11
-
12
- class TC_Ptools_Constants < Test::Unit::TestCase
13
- def self.startup
14
- @@windows = File::ALT_SEPARATOR
15
- end
16
-
17
- test "PTOOLS_VERSION constant is set to expected value" do
18
- assert_equal('1.3.5', File::PTOOLS_VERSION)
19
- end
20
-
21
- test "IMAGE_EXT constant is set to array of values" do
22
- assert_equal(%w[.bmp .gif .jpeg .jpg .png], File::IMAGE_EXT.sort)
23
- end
24
-
25
- test "WINDOWS constant is defined on MS Windows" do
26
- omit_unless(@@windows, "Skipping on Unix systems")
27
- assert_not_nil(File::MSWINDOWS)
28
- end
29
-
30
- test "WIN32EXTS constant is defiend on MS Windows" do
31
- omit_unless(@@windows, "Skipping on Unix systems")
32
- assert_not_nil(File::WIN32EXTS)
33
- end
34
-
35
- def self.shutdown
36
- @@windows = nil
37
- end
38
- end
@@ -1,48 +0,0 @@
1
- ######################################################################
2
- # test_head.rb
3
- #
4
- # Test case for the File.head method. This test should be run via
5
- # the 'rake test_head' task.
6
- ######################################################################
7
- require 'test-unit'
8
- require 'ptools'
9
-
10
- class TC_FileHead < Test::Unit::TestCase
11
- def self.startup
12
- Dir.chdir('test') if File.exist?('test')
13
- File.open('test_file1.txt', 'w'){ |fh| 25.times{ |n| fh.puts "line#{n+1}" } }
14
- end
15
-
16
- def setup
17
- @test_file = 'test_file1.txt'
18
- @expected_head1 = ["line1\n","line2\n","line3\n","line4\n","line5\n"]
19
- @expected_head1.push("line6\n","line7\n","line8\n","line9\n","line10\n")
20
- @expected_head2 = ["line1\n","line2\n","line3\n","line4\n","line5\n"]
21
- end
22
-
23
- def test_head_basic
24
- assert_respond_to(File, :head)
25
- assert_nothing_raised{ File.head(@test_file) }
26
- assert_nothing_raised{ File.head(@test_file, 5) }
27
- assert_nothing_raised{ File.head(@test_file){} }
28
- end
29
-
30
- def test_head_expected_results
31
- assert_kind_of(Array, File.head(@test_file))
32
- assert_equal(@expected_head1, File.head(@test_file))
33
- assert_equal(@expected_head2, File.head(@test_file, 5))
34
- end
35
-
36
- def test_head_expected_errors
37
- assert_raises(ArgumentError){ File.head(@test_file, 5, "foo") }
38
- assert_raises(Errno::ENOENT){ File.head("bogus") }
39
- end
40
-
41
- def teardown
42
- @test_file = nil
43
- end
44
-
45
- def self.shutdown
46
- File.delete('test_file1.txt') if File.exist?('test_file1.txt')
47
- end
48
- end
@@ -1,62 +0,0 @@
1
- #####################################################################
2
- # test_image.rb
3
- #
4
- # Test case for the File.image? method. You should run this test
5
- # via the 'rake test:image' task.
6
- #####################################################################
7
- require 'test-unit'
8
- require 'ptools'
9
-
10
- class TC_Ptools_Image < Test::Unit::TestCase
11
- def self.startup
12
- Dir.chdir('test') if File.exist?('test')
13
- end
14
-
15
- def setup
16
- @txt_file = File.join(Dir.pwd, 'txt', 'english.txt')
17
- @uni_file = File.join(Dir.pwd, 'txt', 'korean.txt')
18
- @jpg_file = File.join(Dir.pwd, 'img', 'test.jpg')
19
- @png_file = File.join(Dir.pwd, 'img', 'test.png')
20
- @gif_file = File.join(Dir.pwd, 'img', 'test.gif')
21
- @ico_file = File.join(Dir.pwd, 'img', 'test.ico')
22
- end
23
-
24
- test "image? method basic functionality" do
25
- assert_respond_to(File, :image?)
26
- assert_nothing_raised{ File.image?(@txt_file) }
27
- assert_boolean(File.image?(@txt_file))
28
- end
29
-
30
- test "image? method returns false for a text file" do
31
- assert_false(File.image?(@txt_file))
32
- assert_false(File.image?(@uni_file))
33
- end
34
-
35
- test "image? method returns true for a gif" do
36
- assert_true(File.image?(@gif_file))
37
- end
38
-
39
- test "image? method returns true for a jpeg" do
40
- assert_true(File.image?(@jpg_file))
41
- end
42
-
43
- test "image? method returns true for a png" do
44
- assert_true(File.image?(@png_file))
45
- end
46
-
47
- test "image? method returns true for an ico" do
48
- assert_true(File.image?(@ico_file))
49
- end
50
-
51
- test "image? method raises an error if the file does not exist" do
52
- assert_raises(Errno::ENOENT, ArgumentError){ File.image?('bogus') }
53
- end
54
-
55
- def teardown
56
- @txt_file = nil
57
- @uni_file = nil
58
- @jpg_file = nil
59
- @png_file = nil
60
- @gif_file = nil
61
- end
62
- end
@@ -1,53 +0,0 @@
1
- #####################################################################
2
- # test_is_sparse.rb
3
- #
4
- # Test case for the File.sparse? method. You should run this test
5
- # via the 'rake test:is_sparse' task.
6
- #####################################################################
7
- require 'test-unit'
8
- require 'ptools'
9
-
10
- class TC_IsSparse < Test::Unit::TestCase
11
- def self.startup
12
- Dir.chdir("test") if File.exist?("test")
13
- @@win = File::ALT_SEPARATOR
14
- @@osx = RbConfig::CONFIG['host_os'] =~ /darwin|osx/i
15
- system("dd of=test_sparse bs=1k seek=5120 count=0 2>/dev/null") unless @@win
16
- end
17
-
18
- def setup
19
- @sparse_file = 'test_sparse'
20
- @non_sparse_file = File.expand_path(File.basename(__FILE__))
21
- end
22
-
23
- test "is_sparse basic functionality" do
24
- omit_if(@@win, "File.sparse? tests skipped on MS Windows")
25
- omit_if(@@osx, "File.sparse? tests skipped on OS X")
26
-
27
- assert_respond_to(File, :sparse?)
28
- assert_nothing_raised{ File.sparse?(@sparse_file) }
29
- assert_boolean(File.sparse?(@sparse_file))
30
- end
31
-
32
- test "is_sparse returns the expected results" do
33
- omit_if(@@win, "File.sparse? tests skipped on MS Windows")
34
- omit_if(@@osx, "File.sparse? tests skipped on OS X")
35
-
36
- assert_true(File.sparse?(@sparse_file))
37
- assert_false(File.sparse?(@non_sparse_file))
38
- end
39
-
40
- test "is_sparse only accepts one argument" do
41
- omit_if(@@win, "File.sparse? tests skipped on MS Windows")
42
- assert_raise(ArgumentError){ File.sparse?(@sparse_file, @sparse_file) }
43
- end
44
-
45
- def teardown
46
- @sparse_file = nil
47
- @non_sparse_file = nil
48
- end
49
-
50
- def self.shutdown
51
- File.delete('test_sparse') if File.exist?('test_sparse')
52
- end
53
- end