ptools 1.3.5 → 1.4.2

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
- SHA1:
3
- metadata.gz: d84987b222f9b080bd61559d152790acfc5c17c9
4
- data.tar.gz: 05f9fbe563ca0e70cdbe4983a43e0ae1132c8ee9
2
+ SHA256:
3
+ metadata.gz: 36406684b5e92604183390f36512e57d842143d4f7cdc29f9f728cb8085c99f6
4
+ data.tar.gz: 736ef4ab5f6ff12ec22e4158eeb09f1a5d3db94f969ae4991ac7732fa2d4b0e5
5
5
  SHA512:
6
- metadata.gz: dd49ca3dee0986e8f9d287de7fbfcad81492858b556a678692ff3510fd5400928b44b84b8fb701d13c40b3f34953ca213c849709f0c8666aacad6a8b2001314e
7
- data.tar.gz: b0d5eb2e3b457c4d9ff23866b385e209c46e8f8b394ba0c29d45520b906b09173fb14dbdc436f344f8e65b7236b842277a9ba61d1f28dc746c36b5f6f8c891ad
6
+ metadata.gz: 872ba6353a2e52e845bb2b2e6b1fced1e334873b5da3edcd9764d481f4db1434b07d8b85e5e60e222e467b9ca67e36b019aac639a172c414f64398a1a29cf463
7
+ data.tar.gz: b38ac907b048d378c89807fae43e3a6d5c38e2f34b3afbfbacd333cb0860393e2be4faab59bcb0f800cb2f02f49e5110b05fc21b6a870ce2f2829560fdf1759e
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,34 +1,62 @@
1
- == 1.3.5 - 3-Sep-2017
1
+ ## 1.4.2 - 6-Jan-2021
2
+ * Fixed a private access modifier that wasn't actually working as intended.
3
+ * Two Windows constants that were never meant for public consumption have been marked private.
4
+ * Minor tweak to one of the touch specs.
5
+ * The Gemfile now just uses the gemspec.
6
+ * The image? singleton method was effectively ignoring filename extensions. This
7
+ has been fixed, though with the option to disable that check if desired.
8
+
9
+ ## 1.4.1 - 29-Dec-2020
10
+ * Switch from rdoc to markdown since github is not rendering rdoc properly.
11
+ * Added metadata to gemspec.
12
+
13
+ ## 1.4.0 - 20-Aug-2020
14
+ * Switched from test-unit to rspec, and reworked the tests bit in general.
15
+ * Removed the File.null method since Ruby has IO::NULL.
16
+
17
+ ## 1.3.7 - 24-Jun-2020
18
+ * Fixed a bug where the File.binary? method would bomb on a zero byte file.
19
+ Thanks go to Alexandru Emil Lupu for the spot and patch.
20
+ * Remove Gemfile.lock from repo. You can generate that yourself locally if
21
+ you want.
22
+
23
+ ## 1.3.6 - 7-Jun-2020
24
+ * Updated gemspec, added more versions to .travis.yml file, fixed typo.
25
+ Thanks go to Al Snow for the updates.
26
+ * Fixed a bug where the File.binary? method would return true for utf16
27
+ or utf32 encoded files. Thanks go to Andrew McAndre for the spot.
28
+ * Updated cert.
29
+
30
+ ## 1.3.5 - 3-Sep-2017
2
31
  * The File.image? method now checks against .ico files.
3
32
  * Eliminated Fixnum warning that showed up in Ruby 2.4.x.
4
33
  * Updated cert.
5
34
 
6
- == 1.3.4 - 4-Jul-2017
35
+ ## 1.3.4 - 4-Jul-2017
7
36
  * The File.binary? method now lets you set your own percentage for the
8
37
  internal heuristic as an optional second argument.
9
38
  * The VERSION constant is now frozen.
10
39
  * Minor updates to the Rakefile and gemspec.
11
40
  * Updated cert file.
12
41
 
13
- == 1.3.3 - 25-Sep-2015
42
+ ## 1.3.3 - 25-Sep-2015
14
43
  * This gem is now signed.
15
44
  * The Rakefile tasks now assume Rubygems 2.x.
16
45
 
17
- == 1.3.2 - 11-Dec-2014
18
- * Update to the File.tail method that deals prevents potential line ending
19
- issues in JRuby.
46
+ ## 1.3.2 - 11-Dec-2014
47
+ * Update to the File.tail method that prevents potential line ending issues in JRuby.
20
48
  * Added known issues with JRuby to the README.
21
49
 
22
- == 1.3.1 - 9-Dec-2014
50
+ ## 1.3.1 - 9-Dec-2014
23
51
  * Fixed some potential issues with File.tail. Thanks go to Matt Hoyle for
24
52
  the patch.
25
53
 
26
- == 1.3.0 - 8-Dec-2014
54
+ ## 1.3.0 - 8-Dec-2014
27
55
  * Made the File.tail method efficient. It's no longer slurpy, and it also no
28
56
  longer includes line endings in the result.
29
57
  * Removed the File.middle method. I don't think it's useful.
30
58
 
31
- == 1.2.7 - 6-Dec-2014
59
+ ## 1.2.7 - 6-Dec-2014
32
60
  * File.which now expands ~ for paths. Thanks go to dg-vrnetze for the patch.
33
61
  * Use /dev/null for cygwin instead of NUL.
34
62
  * Use mv instead of cp in the nl_convert method.
@@ -36,12 +64,12 @@
36
64
  * Modified the binary? method to check 4096 bytes at most.
37
65
  * Thanks to Matt Hoyle for many of the changes implemented in this release.
38
66
 
39
- == 1.2.6 - 14-Jul-2014
67
+ ## 1.2.6 - 14-Jul-2014
40
68
  * Updated the png? and jpg? methods so they explicitly specify the
41
69
  offset argument so that it works with 1.9.2 and earlier. Thanks go to
42
70
  Anurag Priyam for the spot.
43
71
 
44
- == 1.2.5 - 11-Jul-2014
72
+ ## 1.2.5 - 11-Jul-2014
45
73
  * Added a Gemfile, mostly for Travis CI.
46
74
  * Added rake as a development dependency.
47
75
  * Revert back to hash syntax supported by 1.8.x.
@@ -49,19 +77,19 @@
49
77
  * Updated the tests for File.sparse? so that it doesn't rely on
50
78
  an external file.
51
79
 
52
- == 1.2.4 - 25-Feb-2014
80
+ ## 1.2.4 - 25-Feb-2014
53
81
  * The File.binary method now always returns false for images. It is meant to
54
82
  detect executables, shared objects, etc. Use File.image? to detect images.
55
83
  * Encoding fixes for the File.image? method.
56
84
 
57
- == 1.2.3 - 19-Feb-2014
85
+ ## 1.2.3 - 19-Feb-2014
58
86
  * Fixed a bug where File.binary? would return true for unicode text. Thanks go
59
87
  to Ben Hollis for the spot.
60
88
  * Updated the win32-file and test-unit dependencies.
61
89
  * Replace all instances of File.exists? with File.exist? because the former
62
90
  is deprecated in Ruby 2.1 and later.
63
91
 
64
- == 1.2.2 - 6-Apr-2012
92
+ ## 1.2.2 - 6-Apr-2012
65
93
  * Yet another sparse file test fix for OSX, which does not support
66
94
  sparse file generation on HFS+.
67
95
  * Fixed a bug in the File.whereis method on Windows when dealing with
@@ -69,15 +97,15 @@
69
97
  * Some Config vs RbConfig fixes to silence 1.9.3 warnings.
70
98
  * Refactored and cleaned up some tests.
71
99
 
72
- == 1.2.1 - 20-May-2011
100
+ ## 1.2.1 - 20-May-2011
73
101
  * Added an (empty) .gemtest file so that it can be used with test.rubygems.org.
74
102
  * Fixed a sparse file test.
75
103
 
76
- == 1.2.0 - 8-Jan-2011
104
+ ## 1.2.0 - 8-Jan-2011
77
105
  * Added the File.sparse? method for Unix platforms. This method already
78
106
  exists on Windows courtesy of the win32-file library.
79
107
 
80
- == 1.1.9 - 25-Mar-2010
108
+ ## 1.1.9 - 25-Mar-2010
81
109
  * Refactored File.which and File.whereis and added additional tests for each.
82
110
  * Removed the block form of File.whereis.
83
111
  * Reorganized the Rakefile a bit and put the test tasks under the 'test'
@@ -85,7 +113,7 @@
85
113
  * Updated the test-unit development dependency.
86
114
  * Updates the README.
87
115
 
88
- == 1.1.8 - 6-Oct-2009
116
+ ## 1.1.8 - 6-Oct-2009
89
117
  * Fixed some bad variable names that crept into the File.nl_convert method.
90
118
  * Added the File.null_device alias for File.null.
91
119
  * Added cygwin and mingw to Windows detection code.
@@ -97,7 +125,7 @@
97
125
  * Documentation updates.
98
126
  * Added the :gem rake task.
99
127
 
100
- == 1.1.7 - 28-Jul-2009
128
+ ## 1.1.7 - 28-Jul-2009
101
129
  * Now compatible with Ruby 1.9.x.
102
130
  * Replaced RUBY_PLATFORM with rbconfig check for the sake of other
103
131
  implementations, such as JRuby.
@@ -105,35 +133,35 @@
105
133
  * Added Test::Unit 2.x as a development dependency.
106
134
  * Renamed the test files.
107
135
 
108
- == 1.1.6 - 31-Aug-2007
136
+ ## 1.1.6 - 31-Aug-2007
109
137
  * Fixed the File.touch method so that it doesn't whack existing files. Thanks
110
138
  go to Thomas Preymesser for the spot.
111
139
  * Added corresponding tests to the tc_touch.rb file.
112
140
 
113
- == 1.1.5 - 19-Jul-2007
141
+ ## 1.1.5 - 19-Jul-2007
114
142
  * Added the File.image? method. Inspired by ruby-talk: 260487.
115
143
 
116
- == 1.1.4 - 21-May-2007
144
+ ## 1.1.4 - 21-May-2007
117
145
  * Removed the install.rb file. Installation is now handled exclusively by the
118
146
  rake install task.
119
147
  * Updated the MANIFEST file, and made it rdoc friendly.
120
148
  * Manual installation corrections in the README file.
121
149
 
122
- == 1.1.3 - 29-Apr-2007
150
+ ## 1.1.3 - 29-Apr-2007
123
151
  * I changed the way that the constants IS_WINDOWS and WIN32EXTS are defined.
124
152
  * The IS_WINDOWS and WIN32EXTS are no long documented publically. They were
125
153
  never meant for public use.
126
154
  * The tc_constants.rb file was modified to only run certain tests on Windows.
127
155
 
128
- == 1.1.2 - 28-Apr-2007
156
+ ## 1.1.2 - 28-Apr-2007
129
157
  * Fixed a require line that could cause problems on MS Windows.
130
158
  * Added a Rakefile which includes tasks for installation and testing.
131
159
  * Some cleanup and improvement in the various test files.
132
160
 
133
- == 1.1.1 - 24-Aug-2006
161
+ ## 1.1.1 - 24-Aug-2006
134
162
  * Added the File.binary? method, based on code from Ryan Davis.
135
163
 
136
- == 1.1.0 - 23-Aug-2006
164
+ ## 1.1.0 - 23-Aug-2006
137
165
  * Added the File.null method which returns the bit bucket on your platform.
138
166
  * The suffixes on MS Windows are now based on the PATHEXT environment variable,
139
167
  and defaults to '.com', '.bat' and '.exe' only if it's not defined.
@@ -142,7 +170,7 @@
142
170
  * Modified the platform checking and path separator handling.
143
171
  * Added and tweaked some tests.
144
172
 
145
- == 1.0.0 - 2-Jun-2005
173
+ ## 1.0.0 - 2-Jun-2005
146
174
  * Modified the File.middle method to accept an optional block.
147
175
  * File.whereis is now limited to unique values so that redundant PATH entries
148
176
  do not cause redundant entries in the returned array (or block).
@@ -156,12 +184,12 @@
156
184
  * Removed the INSTALL file. See the README instead.
157
185
  * Moved project to RubyForge.
158
186
 
159
- == 0.1.3 - 5-Dec-2003
187
+ ## 0.1.3 - 5-Dec-2003
160
188
  * Modified File#which and File#whereis for Win32 to handle extensions better,
161
189
  i.e. you can send "ruby" or "ruby.exe" and get back the same result.
162
190
  * Minor test changes to tc_which.rb and tc_whereis.rb.
163
191
 
164
- == 0.1.2 - 14-May-2003
192
+ ## 0.1.2 - 14-May-2003
165
193
  * Modified nl_convert() to allow the destination filename to be the same as the
166
194
  source file. In that case, a tempfile is used and copied back over the
167
195
  original file.
@@ -171,7 +199,7 @@
171
199
  * Test suite additions/fixes.
172
200
  * Updates to MANIFEST.
173
201
 
174
- == 0.1.1 - 21-Mar-2003
202
+ ## 0.1.1 - 21-Mar-2003
175
203
  * Modified File.tail to return data in the same order that 'tail' does.
176
204
  * Modified File.which to return nil if the program is not found.
177
205
  * Modified File.whereis now uses '\' instead of '/' on MS Windows.
@@ -180,5 +208,5 @@
180
208
  * Thanks go to Shanko for both the spot and patch for tail, which, whereis
181
209
  and middle.
182
210
 
183
- == 0.1.0 - 18-Mar-2003
211
+ ## 0.1.0 - 18-Mar-2003
184
212
  * Initial release
data/Gemfile CHANGED
@@ -1,12 +1,3 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'structured_warnings'
4
-
5
- group :production do
6
- gem 'win32-file' if File::ALT_SEPARATOR
7
- end
8
-
9
- group :test do
10
- gem 'rake'
11
- gem 'test-unit'
12
- end
3
+ gemspec
@@ -0,0 +1,27 @@
1
+ * CHANGES.md
2
+ * README.md
3
+ * MANIFEST.md
4
+ * Gemfile
5
+ * Rakefile
6
+ * ptools.gemspec
7
+ * certs/djberg96_pub.pem
8
+ * lib/ptools.rb
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
@@ -1,32 +1,34 @@
1
- == Description
1
+ ## Description
2
2
  The ptools (power tools) library is an additional set of commands for the
3
3
  File class based on Unix command line tools.
4
4
 
5
- == Prerequisites
5
+ ## Prerequisites
6
6
  On MS Windows you will need the win32-file gem.
7
7
 
8
- == Installation
9
- gem install ptools
8
+ ## Installation
9
+ `gem install ptools`
10
10
 
11
- == Synopsis
12
- require "ptools"
11
+ ## Synopsis
12
+ ```ruby
13
+ require "ptools"
13
14
 
14
- File.which("ruby") # '/usr/local/bin/ruby'
15
- File.whereis("ruby") # ['/usr/local/bin/ruby','/opt/bin/ruby']
15
+ File.which("ruby") # '/usr/local/bin/ruby'
16
+ File.whereis("ruby") # ['/usr/local/bin/ruby','/opt/bin/ruby']
16
17
 
17
- File.head("myfile") # Returns first 10 lines of 'myfile'
18
- File.tail("myfile",3) # Returns last 3 lines of 'myfile'
19
- File.wc("myfile",'words') # Returns the number of words in 'myfile'
18
+ File.head("myfile") # Returns first 10 lines of 'myfile'
19
+ File.tail("myfile",3) # Returns last 3 lines of 'myfile'
20
+ File.wc("myfile",'words') # Returns the number of words in 'myfile'
20
21
 
21
- File.touch("newfile") # "newfile" now exists
22
- File.null # '/dev/null' on Unix, 'NUL' on Windows
23
- File.binary?('some_file') # true or false
24
- File.sparse?('some_file') # true or false
22
+ File.touch("newfile") # "newfile" now exists
23
+ File.null # '/dev/null' on Unix, 'NUL' on Windows
24
+ File.binary?('some_file') # true or false
25
+ File.sparse?('some_file') # true or false
25
26
 
26
- # Creates a copy of 'myfile' called 'newfile', in DOS format
27
- File.nl_convert("myfile", "newfile", "dos")
27
+ # Creates a copy of 'myfile' called 'newfile', in DOS format
28
+ File.nl_convert("myfile", "newfile", "dos")
29
+ ```
28
30
 
29
- == Known Bugs
31
+ ## Known Bugs
30
32
  The File.which and File.whereis methods may fail when using JRuby on Windows.
31
33
  See https://github.com/jruby/jruby/issues/2291 for details.
32
34
 
@@ -34,7 +36,7 @@
34
36
 
35
37
  http://www.github.com/djberg96/ptools
36
38
 
37
- == Acknowledgements
39
+ ## Acknowledgements
38
40
  The File.which method was originally adopted from the FileWhich code posted
39
41
  by Michael Granger on the now defunct rubygarden.org website. That code was
40
42
  later replaced by a version based on the ruby-which library.
@@ -47,20 +49,22 @@
47
49
 
48
50
  Thanks go to Matt Hoyle for help with the File.tail method.
49
51
 
50
- == Future Plans
52
+ And thanks to any and all contributors!
53
+
54
+ ## Future Plans
51
55
  Add whatever other tools people think might be useful.
52
56
 
53
- == License
54
- Artistic 2.0
57
+ ## License
58
+ Artistic-2.0
55
59
 
56
- == Copyright
57
- (C) 2003-2014 Daniel J. Berger
60
+ ## Copyright
61
+ (C) 2003-2020 Daniel J. Berger
58
62
  All Rights Reserved.
59
63
 
60
- == Warranty
64
+ ## Warranty
61
65
  This package is provided "as is" and without any express or
62
66
  implied warranties, including, without limitation, the implied
63
67
  warranties of merchantability and fitness for a particular purpose.
64
68
 
65
- == Author
69
+ ## Author
66
70
  Daniel J. Berger
data/Rakefile CHANGED
@@ -2,9 +2,10 @@ 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
- CLEAN.include("**/*.gem", "**/*.rbc", "**/*coverage*")
8
+ CLEAN.include("**/*.gem", "**/*.rbc", "**/*coverage*", "**/*.lock")
8
9
 
9
10
  desc 'Install the ptools package (non-gem)'
10
11
  task :install do
@@ -19,7 +20,7 @@ namespace 'gem' do
19
20
  require 'rubygems/package'
20
21
  spec = eval(IO.read('ptools.gemspec'))
21
22
  spec.signing_key = File.join(Dir.home, '.ssh', 'gem-private_key.pem')
22
- Gem::Package.build(spec, true)
23
+ Gem::Package.build(spec)
23
24
  end
24
25
 
25
26
  desc 'Install the ptools gem'
@@ -33,103 +34,54 @@ namespace 'gem' do
33
34
  end
34
35
  end
35
36
 
36
- Rake::TestTask.new do |t|
37
- task :test => :clean
38
- t.verbose = true
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
- Rake::TestTask.new('binary') do |t|
51
- t.libs << 'test'
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
- Rake::TestTask.new('constants') do |t|
58
- t.libs << 'test'
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
- Rake::TestTask.new('head') do |t|
65
- t.libs << 'test'
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
- Rake::TestTask.new('image') do |t|
72
- t.libs << 'test'
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
- Rake::TestTask.new('nlconvert') do |t|
79
- t.libs << 'test'
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
- Rake::TestTask.new('null') do |t|
86
- t.libs << 'test'
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
- Rake::TestTask.new('sparse') do |t|
93
- t.libs << 'test'
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
- Rake::TestTask.new('tail') do |t|
100
- t.libs << 'test'
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
- Rake::TestTask.new('touch') do |t|
107
- t.libs << 'test'
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
- Rake::TestTask.new('whereis') do |t|
121
- t.libs << 'test'
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
- Rake::TestTask.new('which') do |t|
128
- t.libs << 'test'
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 => :test
87
+ task :default => 'spec:all'