ptools 1.3.4 → 1.4.1

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: 10dd763e75f62b662df564b86af1dd45a830c57d
4
- data.tar.gz: 3cff979f3aa49c9115a1b7efaa266fba060a7161
2
+ SHA256:
3
+ metadata.gz: 35f02ac0737f1acf24a7edccb33f60990b5690259fe715520eeb803badc514ae
4
+ data.tar.gz: 469380e8d9f7107868b0ec17e8ca7aa4c8e5e1db19a7263c88995e1346f9c634
5
5
  SHA512:
6
- metadata.gz: 42bf217eddaa220ae53d95566725e894c7df8093db51902411fe135cd207a2523068c177c3bf07d87c1def428ea955c2b2f0ec8f989176991c5a16728aaf72cb
7
- data.tar.gz: 959372d0a5f9144b0f8ce5f80f907316afb288fda00feddd661248734aa83393319f97787965ce0f084770adaa4f579415687b89665e24066bd2c7fb7d13ff14
6
+ metadata.gz: 114dec925795c5ebfc3f84209602490d22d54031fede8cf9914d635c4bb4180cce1d77dcb3f87d970f491a43b307f7017a29a1239b7d23442aaa01f701d13071
7
+ data.tar.gz: 60b1f3ad73a5019ed89b24ae82b0032f014b8770d8feb6b447ad72f459a6029cf678fa0fe96c5e8ec23eb1dc2818a66dbbabc499d4bc8ac858c256ad786236b0
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,29 +1,54 @@
1
- == 1.3.4 - 4-Jul-2017
1
+ ## 1.4.1 - 29-Dec-2020
2
+ * Switch from rdoc to markdown since github is not rendering rdoc properly.
3
+ * Added metadata to gemspec.
4
+
5
+ ## 1.4.0 - 20-Aug-2020
6
+ * Switched from test-unit to rspec, and reworked the tests bit in general.
7
+ * Removed the File.null method since Ruby has IO::NULL.
8
+
9
+ ## 1.3.7 - 24-Jun-2020
10
+ * Fixed a bug where the File.binary? method would bomb on a zero byte file.
11
+ Thanks go to Alexandru Emil Lupu for the spot and patch.
12
+ * Remove Gemfile.lock from repo. You can generate that yourself locally if
13
+ you want.
14
+
15
+ ## 1.3.6 - 7-Jun-2020
16
+ * Updated gemspec, added more versions to .travis.yml file, fixed typo.
17
+ Thanks go to Al Snow for the updates.
18
+ * Fixed a bug where the File.binary? method would return true for utf16
19
+ or utf32 encoded files. Thanks go to Andrew McAndre for the spot.
20
+ * Updated cert.
21
+
22
+ ## 1.3.5 - 3-Sep-2017
23
+ * The File.image? method now checks against .ico files.
24
+ * Eliminated Fixnum warning that showed up in Ruby 2.4.x.
25
+ * Updated cert.
26
+
27
+ ## 1.3.4 - 4-Jul-2017
2
28
  * The File.binary? method now lets you set your own percentage for the
3
29
  internal heuristic as an optional second argument.
4
30
  * The VERSION constant is now frozen.
5
31
  * Minor updates to the Rakefile and gemspec.
6
32
  * Updated cert file.
7
33
 
8
- == 1.3.3 - 25-Sep-2015
34
+ ## 1.3.3 - 25-Sep-2015
9
35
  * This gem is now signed.
10
36
  * The Rakefile tasks now assume Rubygems 2.x.
11
37
 
12
- == 1.3.2 - 11-Dec-2014
13
- * Update to the File.tail method that deals prevents potential line ending
14
- issues in JRuby.
38
+ ## 1.3.2 - 11-Dec-2014
39
+ * Update to the File.tail method that prevents potential line ending issues in JRuby.
15
40
  * Added known issues with JRuby to the README.
16
41
 
17
- == 1.3.1 - 9-Dec-2014
42
+ ## 1.3.1 - 9-Dec-2014
18
43
  * Fixed some potential issues with File.tail. Thanks go to Matt Hoyle for
19
44
  the patch.
20
45
 
21
- == 1.3.0 - 8-Dec-2014
46
+ ## 1.3.0 - 8-Dec-2014
22
47
  * Made the File.tail method efficient. It's no longer slurpy, and it also no
23
48
  longer includes line endings in the result.
24
49
  * Removed the File.middle method. I don't think it's useful.
25
50
 
26
- == 1.2.7 - 6-Dec-2014
51
+ ## 1.2.7 - 6-Dec-2014
27
52
  * File.which now expands ~ for paths. Thanks go to dg-vrnetze for the patch.
28
53
  * Use /dev/null for cygwin instead of NUL.
29
54
  * Use mv instead of cp in the nl_convert method.
@@ -31,12 +56,12 @@
31
56
  * Modified the binary? method to check 4096 bytes at most.
32
57
  * Thanks to Matt Hoyle for many of the changes implemented in this release.
33
58
 
34
- == 1.2.6 - 14-Jul-2014
59
+ ## 1.2.6 - 14-Jul-2014
35
60
  * Updated the png? and jpg? methods so they explicitly specify the
36
61
  offset argument so that it works with 1.9.2 and earlier. Thanks go to
37
62
  Anurag Priyam for the spot.
38
63
 
39
- == 1.2.5 - 11-Jul-2014
64
+ ## 1.2.5 - 11-Jul-2014
40
65
  * Added a Gemfile, mostly for Travis CI.
41
66
  * Added rake as a development dependency.
42
67
  * Revert back to hash syntax supported by 1.8.x.
@@ -44,19 +69,19 @@
44
69
  * Updated the tests for File.sparse? so that it doesn't rely on
45
70
  an external file.
46
71
 
47
- == 1.2.4 - 25-Feb-2014
72
+ ## 1.2.4 - 25-Feb-2014
48
73
  * The File.binary method now always returns false for images. It is meant to
49
74
  detect executables, shared objects, etc. Use File.image? to detect images.
50
75
  * Encoding fixes for the File.image? method.
51
76
 
52
- == 1.2.3 - 19-Feb-2014
77
+ ## 1.2.3 - 19-Feb-2014
53
78
  * Fixed a bug where File.binary? would return true for unicode text. Thanks go
54
79
  to Ben Hollis for the spot.
55
80
  * Updated the win32-file and test-unit dependencies.
56
81
  * Replace all instances of File.exists? with File.exist? because the former
57
82
  is deprecated in Ruby 2.1 and later.
58
83
 
59
- == 1.2.2 - 6-Apr-2012
84
+ ## 1.2.2 - 6-Apr-2012
60
85
  * Yet another sparse file test fix for OSX, which does not support
61
86
  sparse file generation on HFS+.
62
87
  * Fixed a bug in the File.whereis method on Windows when dealing with
@@ -64,15 +89,15 @@
64
89
  * Some Config vs RbConfig fixes to silence 1.9.3 warnings.
65
90
  * Refactored and cleaned up some tests.
66
91
 
67
- == 1.2.1 - 20-May-2011
92
+ ## 1.2.1 - 20-May-2011
68
93
  * Added an (empty) .gemtest file so that it can be used with test.rubygems.org.
69
94
  * Fixed a sparse file test.
70
95
 
71
- == 1.2.0 - 8-Jan-2011
96
+ ## 1.2.0 - 8-Jan-2011
72
97
  * Added the File.sparse? method for Unix platforms. This method already
73
98
  exists on Windows courtesy of the win32-file library.
74
99
 
75
- == 1.1.9 - 25-Mar-2010
100
+ ## 1.1.9 - 25-Mar-2010
76
101
  * Refactored File.which and File.whereis and added additional tests for each.
77
102
  * Removed the block form of File.whereis.
78
103
  * Reorganized the Rakefile a bit and put the test tasks under the 'test'
@@ -80,7 +105,7 @@
80
105
  * Updated the test-unit development dependency.
81
106
  * Updates the README.
82
107
 
83
- == 1.1.8 - 6-Oct-2009
108
+ ## 1.1.8 - 6-Oct-2009
84
109
  * Fixed some bad variable names that crept into the File.nl_convert method.
85
110
  * Added the File.null_device alias for File.null.
86
111
  * Added cygwin and mingw to Windows detection code.
@@ -92,7 +117,7 @@
92
117
  * Documentation updates.
93
118
  * Added the :gem rake task.
94
119
 
95
- == 1.1.7 - 28-Jul-2009
120
+ ## 1.1.7 - 28-Jul-2009
96
121
  * Now compatible with Ruby 1.9.x.
97
122
  * Replaced RUBY_PLATFORM with rbconfig check for the sake of other
98
123
  implementations, such as JRuby.
@@ -100,35 +125,35 @@
100
125
  * Added Test::Unit 2.x as a development dependency.
101
126
  * Renamed the test files.
102
127
 
103
- == 1.1.6 - 31-Aug-2007
128
+ ## 1.1.6 - 31-Aug-2007
104
129
  * Fixed the File.touch method so that it doesn't whack existing files. Thanks
105
130
  go to Thomas Preymesser for the spot.
106
131
  * Added corresponding tests to the tc_touch.rb file.
107
132
 
108
- == 1.1.5 - 19-Jul-2007
133
+ ## 1.1.5 - 19-Jul-2007
109
134
  * Added the File.image? method. Inspired by ruby-talk: 260487.
110
135
 
111
- == 1.1.4 - 21-May-2007
136
+ ## 1.1.4 - 21-May-2007
112
137
  * Removed the install.rb file. Installation is now handled exclusively by the
113
138
  rake install task.
114
139
  * Updated the MANIFEST file, and made it rdoc friendly.
115
140
  * Manual installation corrections in the README file.
116
141
 
117
- == 1.1.3 - 29-Apr-2007
142
+ ## 1.1.3 - 29-Apr-2007
118
143
  * I changed the way that the constants IS_WINDOWS and WIN32EXTS are defined.
119
144
  * The IS_WINDOWS and WIN32EXTS are no long documented publically. They were
120
145
  never meant for public use.
121
146
  * The tc_constants.rb file was modified to only run certain tests on Windows.
122
147
 
123
- == 1.1.2 - 28-Apr-2007
148
+ ## 1.1.2 - 28-Apr-2007
124
149
  * Fixed a require line that could cause problems on MS Windows.
125
150
  * Added a Rakefile which includes tasks for installation and testing.
126
151
  * Some cleanup and improvement in the various test files.
127
152
 
128
- == 1.1.1 - 24-Aug-2006
153
+ ## 1.1.1 - 24-Aug-2006
129
154
  * Added the File.binary? method, based on code from Ryan Davis.
130
155
 
131
- == 1.1.0 - 23-Aug-2006
156
+ ## 1.1.0 - 23-Aug-2006
132
157
  * Added the File.null method which returns the bit bucket on your platform.
133
158
  * The suffixes on MS Windows are now based on the PATHEXT environment variable,
134
159
  and defaults to '.com', '.bat' and '.exe' only if it's not defined.
@@ -137,7 +162,7 @@
137
162
  * Modified the platform checking and path separator handling.
138
163
  * Added and tweaked some tests.
139
164
 
140
- == 1.0.0 - 2-Jun-2005
165
+ ## 1.0.0 - 2-Jun-2005
141
166
  * Modified the File.middle method to accept an optional block.
142
167
  * File.whereis is now limited to unique values so that redundant PATH entries
143
168
  do not cause redundant entries in the returned array (or block).
@@ -151,12 +176,12 @@
151
176
  * Removed the INSTALL file. See the README instead.
152
177
  * Moved project to RubyForge.
153
178
 
154
- == 0.1.3 - 5-Dec-2003
179
+ ## 0.1.3 - 5-Dec-2003
155
180
  * Modified File#which and File#whereis for Win32 to handle extensions better,
156
181
  i.e. you can send "ruby" or "ruby.exe" and get back the same result.
157
182
  * Minor test changes to tc_which.rb and tc_whereis.rb.
158
183
 
159
- == 0.1.2 - 14-May-2003
184
+ ## 0.1.2 - 14-May-2003
160
185
  * Modified nl_convert() to allow the destination filename to be the same as the
161
186
  source file. In that case, a tempfile is used and copied back over the
162
187
  original file.
@@ -166,7 +191,7 @@
166
191
  * Test suite additions/fixes.
167
192
  * Updates to MANIFEST.
168
193
 
169
- == 0.1.1 - 21-Mar-2003
194
+ ## 0.1.1 - 21-Mar-2003
170
195
  * Modified File.tail to return data in the same order that 'tail' does.
171
196
  * Modified File.which to return nil if the program is not found.
172
197
  * Modified File.whereis now uses '\' instead of '/' on MS Windows.
@@ -175,5 +200,5 @@
175
200
  * Thanks go to Shanko for both the spot and patch for tail, which, whereis
176
201
  and middle.
177
202
 
178
- == 0.1.0 - 18-Mar-2003
203
+ ## 0.1.0 - 18-Mar-2003
179
204
  * Initial release
data/Gemfile CHANGED
@@ -8,5 +8,5 @@ end
8
8
 
9
9
  group :test do
10
10
  gem 'rake'
11
- gem 'test-unit'
11
+ gem 'rspec'
12
12
  end
@@ -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'