ptools 1.3.4 → 1.4.1

Sign up to get free protection for your applications and to get access to all the features.
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.4
4
+ version: 1.4.1
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
- MB4XDTE2MTAzMTE4NTcyNVoXDTE3MTAzMTE4NTcyNVowPzERMA8GA1UEAwwIZGpi
15
+ MB4XDTE4MDMxODE1MjIwN1oXDTI4MDMxNTE1MjIwN1owPzERMA8GA1UEAwwIZGpi
16
16
  ZXJnOTYxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkWA2Nv
17
- bTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALwqllig3Tyc29Y3SZgK
18
- fFaApRB5R3l8KkOog3rwqr4Rr8bc8MfAMwHOzfqUMQRF7bPIyd5jLu24tPSC2X8D
19
- SKDS3069iTzTEDSPin90MVes+nd/ngys93lgmJ9DSwpGXQzZ7sWqdaJjzqLqDMhZ
20
- 3LhTRZeMpDA8hyEiX7GmVp+VvhAXQ1pjfoFBmMNrzibUmYXcyllzqfEFcbI31/EK
21
- vlkEmcTKdNyd4aIOFLadZpzVvLxWsxFqi6qwteAwlNk3zxaik6O82iAXq2tcnk8p
22
- asWidshXCiRunncPhVogVYNCS4ISfYD6b/f85T9DsxJ6tsADNfeXnMTRxQcQ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Iq6fCpu5slAipvxZ3ZkZpEXZFr3cIBtO1gFvQWW7E/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-07-04 00:00:00.000000000 Z
38
+ date: 2020-12-29 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,46 +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.jpg
89
- - test/img/test.png
90
- - test/test_binary.rb
91
- - test/test_constants.rb
92
- - test/test_head.rb
93
- - test/test_image.rb
94
- - test/test_is_sparse.rb
95
- - test/test_nlconvert.rb
96
- - test/test_null.rb
97
- - test/test_tail.rb
98
- - test/test_touch.rb
99
- - test/test_wc.rb
100
- - test/test_whereis.rb
101
- - test/test_which.rb
102
- - test/txt
103
- - test/txt/english.txt
104
- - 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
105
104
  homepage: https://github.com/djberg96/ptools
106
105
  licenses:
107
106
  - Artistic-2.0
108
- metadata: {}
109
- 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:
110
115
  rdoc_options: []
111
116
  require_paths:
112
117
  - lib
@@ -121,21 +126,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
126
  - !ruby/object:Gem::Version
122
127
  version: '0'
123
128
  requirements: []
124
- rubyforge_project:
125
- rubygems_version: 2.6.12
126
- signing_key:
129
+ rubygems_version: 3.2.3
130
+ signing_key:
127
131
  specification_version: 4
128
132
  summary: Extra methods for the File class
129
- test_files:
130
- - test/test_binary.rb
131
- - test/test_constants.rb
132
- - test/test_head.rb
133
- - test/test_image.rb
134
- - test/test_is_sparse.rb
135
- - test/test_nlconvert.rb
136
- - test/test_null.rb
137
- - test/test_tail.rb
138
- - test/test_touch.rb
139
- - test/test_wc.rb
140
- - test/test_whereis.rb
141
- - test/test_which.rb
133
+ test_files: []
metadata.gz.sig CHANGED
Binary file
data/MANIFEST DELETED
@@ -1,20 +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
@@ -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.4', 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,57 +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
- end
22
-
23
- test "image? method basic functionality" do
24
- assert_respond_to(File, :image?)
25
- assert_nothing_raised{ File.image?(@txt_file) }
26
- assert_boolean(File.image?(@txt_file))
27
- end
28
-
29
- test "image? method returns false for a text file" do
30
- assert_false(File.image?(@txt_file))
31
- assert_false(File.image?(@uni_file))
32
- end
33
-
34
- test "image? method returns true for a gif" do
35
- assert_true(File.image?(@gif_file))
36
- end
37
-
38
- test "image? method returns true for a jpeg" do
39
- assert_true(File.image?(@jpg_file))
40
- end
41
-
42
- test "image? method returns true for a png" do
43
- assert_true(File.image?(@png_file))
44
- end
45
-
46
- test "image? method raises an error if the file does not exist" do
47
- assert_raises(Errno::ENOENT, ArgumentError){ File.image?('bogus') }
48
- end
49
-
50
- def teardown
51
- @txt_file = nil
52
- @uni_file = nil
53
- @jpg_file = nil
54
- @png_file = nil
55
- @gif_file = nil
56
- end
57
- 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