ptools 1.2.6-universal-mingw32 → 1.2.7-universal-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +13 -5
- data/CHANGES +154 -146
- data/Gemfile +12 -12
- data/MANIFEST +3 -0
- data/README +64 -64
- data/Rakefile +142 -142
- data/lib/ptools.rb +465 -431
- data/ptools.gemspec +30 -30
- data/test/test_binary.rb +65 -65
- data/test/test_constants.rb +38 -38
- data/test/test_head.rb +48 -48
- data/test/test_image.rb +57 -57
- data/test/test_is_sparse.rb +53 -53
- data/test/test_middle.rb +58 -58
- data/test/test_nlconvert.rb +110 -99
- data/test/test_tail.rb +53 -53
- data/test/test_touch.rb +52 -52
- data/test/test_wc.rb +73 -73
- data/test/test_which.rb +126 -110
- data/test/txt/english.txt +1 -1
- data/test/txt/korean.txt +1 -1
- metadata +14 -15
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NDMxZTBhOTQ5MTAzMDU5ODRmMTQ0MjRjZGQyM2Y4NjEyMGYyMmJhYQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
NGI1MmIyZWE2NGY4YTc2ZTA3ZjAzODJiMzcxMjM2OWFmY2QwMTZlOQ==
|
5
7
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
N2VjZmYxZGUwOTI2OGI1MjY3ZDY3NzJlMDRmMDViZGZmM2FiOGI3MmNlNDk1
|
10
|
+
ODAyMjFkOTliM2U4MGQ2MzIxNGU0MTBiM2Q1OWRkNzdkOTQ3NzcyNDc3OWNj
|
11
|
+
OTFhMzQxMDM0NDliYjBjZjkwY2E2OTYxZWE3ZTlkMzdjYjE2ZDE=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ZmFjYWM0Y2EyZDhkZjUxYTI5ZTE2N2Q3NjFkYmFjNWRkMWJmYTc4YWRiOTg4
|
14
|
+
YzAwYjM1YTkzZjQyNGZhZWUzODdjNTg3OGJmZDM0ZWQwZDIzM2EwM2NjZTU1
|
15
|
+
OWI3ZGJjNTMzZmI5ZjQ5YzAwMWUzNjNlOGU4M2NkM2IyMTVhYmE=
|
data/CHANGES
CHANGED
@@ -1,146 +1,154 @@
|
|
1
|
-
== 1.2.
|
2
|
-
*
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
*
|
8
|
-
|
9
|
-
|
10
|
-
*
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
== 1.2.
|
15
|
-
*
|
16
|
-
|
17
|
-
*
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
*
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
*
|
32
|
-
|
33
|
-
|
34
|
-
== 1.2.
|
35
|
-
*
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
*
|
40
|
-
|
41
|
-
|
42
|
-
== 1.1
|
43
|
-
*
|
44
|
-
*
|
45
|
-
|
46
|
-
|
47
|
-
*
|
48
|
-
|
49
|
-
|
50
|
-
== 1.1.
|
51
|
-
*
|
52
|
-
*
|
53
|
-
*
|
54
|
-
|
55
|
-
*
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
*
|
60
|
-
* Added the
|
61
|
-
|
62
|
-
|
63
|
-
*
|
64
|
-
|
65
|
-
|
66
|
-
*
|
67
|
-
*
|
68
|
-
*
|
69
|
-
|
70
|
-
== 1.1.
|
71
|
-
*
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
*
|
77
|
-
|
78
|
-
== 1.1.
|
79
|
-
*
|
80
|
-
|
81
|
-
*
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
*
|
94
|
-
|
95
|
-
|
96
|
-
*
|
97
|
-
|
98
|
-
== 1.1.
|
99
|
-
*
|
100
|
-
*
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
*
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
*
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
*
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
*
|
117
|
-
*
|
118
|
-
|
119
|
-
*
|
120
|
-
|
121
|
-
|
122
|
-
*
|
123
|
-
|
124
|
-
*
|
125
|
-
|
126
|
-
|
127
|
-
*
|
128
|
-
|
129
|
-
|
130
|
-
*
|
131
|
-
|
132
|
-
*
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
*
|
139
|
-
|
140
|
-
* Added
|
141
|
-
* Test suite
|
142
|
-
*
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
*
|
1
|
+
== 1.2.7 - 6-Dec-2014
|
2
|
+
* File.which now expands ~ for paths. Thanks go to dg-vrnetze for the patch.
|
3
|
+
* Use /dev/null for cygwin instead of NUL.
|
4
|
+
* Use mv instead of cp in the nl_convert method.
|
5
|
+
* Solaris now handled explicitly in nl_convert, and OSX now considered Unix.
|
6
|
+
* Modified the binary? method to check 4096 bytes at most.
|
7
|
+
* Thanks to Matt Hoyle for many of the changes implemented in this release.
|
8
|
+
|
9
|
+
== 1.2.6 - 14-Jul-2014
|
10
|
+
* Updated the png? and jpg? methods so they explicitly specify the
|
11
|
+
offset argument so that it works with 1.9.2 and earlier. Thanks go to
|
12
|
+
Anurag Priyam for the spot.
|
13
|
+
|
14
|
+
== 1.2.5 - 11-Jul-2014
|
15
|
+
* Added a Gemfile, mostly for Travis CI.
|
16
|
+
* Added rake as a development dependency.
|
17
|
+
* Revert back to hash syntax supported by 1.8.x.
|
18
|
+
* Removed rubyforge_project from gemspec.
|
19
|
+
* Updated the tests for File.sparse? so that it doesn't rely on
|
20
|
+
an external file.
|
21
|
+
|
22
|
+
== 1.2.4 - 25-Feb-2014
|
23
|
+
* The File.binary method now always returns false for images. It is meant to
|
24
|
+
detect executables, shared objects, etc. Use File.image? to detect images.
|
25
|
+
* Encoding fixes for the File.image? method.
|
26
|
+
|
27
|
+
== 1.2.3 - 19-Feb-2014
|
28
|
+
* Fixed a bug where File.binary? would return true for unicode text. Thanks go
|
29
|
+
to Ben Hollis for the spot.
|
30
|
+
* Updated the win32-file and test-unit dependencies.
|
31
|
+
* Replace all instances of File.exists? with File.exist? because the former
|
32
|
+
is deprecated in Ruby 2.1 and later.
|
33
|
+
|
34
|
+
== 1.2.2 - 6-Apr-2012
|
35
|
+
* Yet another sparse file test fix for OSX, which does not support
|
36
|
+
sparse file generation on HFS+.
|
37
|
+
* Fixed a bug in the File.whereis method on Windows when dealing with
|
38
|
+
absolute paths.
|
39
|
+
* Some Config vs RbConfig fixes to silence 1.9.3 warnings.
|
40
|
+
* Refactored and cleaned up some tests.
|
41
|
+
|
42
|
+
== 1.2.1 - 20-May-2011
|
43
|
+
* Added an (empty) .gemtest file so that it can be used with test.rubygems.org.
|
44
|
+
* Fixed a sparse file test.
|
45
|
+
|
46
|
+
== 1.2.0 - 8-Jan-2011
|
47
|
+
* Added the File.sparse? method for Unix platforms. This method already
|
48
|
+
exists on Windows courtesy of the win32-file library.
|
49
|
+
|
50
|
+
== 1.1.9 - 25-Mar-2010
|
51
|
+
* Refactored File.which and File.whereis and added additional tests for each.
|
52
|
+
* Removed the block form of File.whereis.
|
53
|
+
* Reorganized the Rakefile a bit and put the test tasks under the 'test'
|
54
|
+
namespace, and the gem tasks under the 'gem' namespace.
|
55
|
+
* Updated the test-unit development dependency.
|
56
|
+
* Updates the README.
|
57
|
+
|
58
|
+
== 1.1.8 - 6-Oct-2009
|
59
|
+
* Fixed some bad variable names that crept into the File.nl_convert method.
|
60
|
+
* Added the File.null_device alias for File.null.
|
61
|
+
* Added cygwin and mingw to Windows detection code.
|
62
|
+
* One of the nlconvert tests is now skipped on Windows.
|
63
|
+
* Two text files that were previously bundled as part of this library for
|
64
|
+
testing purposes have been removed. Those are now dynamically generated
|
65
|
+
within the tests themselves.
|
66
|
+
* Gemspec updates.
|
67
|
+
* Documentation updates.
|
68
|
+
* Added the :gem rake task.
|
69
|
+
|
70
|
+
== 1.1.7 - 28-Jul-2009
|
71
|
+
* Now compatible with Ruby 1.9.x.
|
72
|
+
* Replaced RUBY_PLATFORM with rbconfig check for the sake of other
|
73
|
+
implementations, such as JRuby.
|
74
|
+
* Updated the tests to be more friendly to JRuby.
|
75
|
+
* Added Test::Unit 2.x as a development dependency.
|
76
|
+
* Renamed the test files.
|
77
|
+
|
78
|
+
== 1.1.6 - 31-Aug-2007
|
79
|
+
* Fixed the File.touch method so that it doesn't whack existing files. Thanks
|
80
|
+
go to Thomas Preymesser for the spot.
|
81
|
+
* Added corresponding tests to the tc_touch.rb file.
|
82
|
+
|
83
|
+
== 1.1.5 - 19-Jul-2007
|
84
|
+
* Added the File.image? method. Inspired by ruby-talk: 260487.
|
85
|
+
|
86
|
+
== 1.1.4 - 21-May-2007
|
87
|
+
* Removed the install.rb file. Installation is now handled exclusively by the
|
88
|
+
rake install task.
|
89
|
+
* Updated the MANIFEST file, and made it rdoc friendly.
|
90
|
+
* Manual installation corrections in the README file.
|
91
|
+
|
92
|
+
== 1.1.3 - 29-Apr-2007
|
93
|
+
* I changed the way that the constants IS_WINDOWS and WIN32EXTS are defined.
|
94
|
+
* The IS_WINDOWS and WIN32EXTS are no long documented publically. They were
|
95
|
+
never meant for public use.
|
96
|
+
* The tc_constants.rb file was modified to only run certain tests on Windows.
|
97
|
+
|
98
|
+
== 1.1.2 - 28-Apr-2007
|
99
|
+
* Fixed a require line that could cause problems on MS Windows.
|
100
|
+
* Added a Rakefile which includes tasks for installation and testing.
|
101
|
+
* Some cleanup and improvement in the various test files.
|
102
|
+
|
103
|
+
== 1.1.1 - 24-Aug-2006
|
104
|
+
* Added the File.binary? method, based on code from Ryan Davis.
|
105
|
+
|
106
|
+
== 1.1.0 - 23-Aug-2006
|
107
|
+
* Added the File.null method which returns the bit bucket on your platform.
|
108
|
+
* The suffixes on MS Windows are now based on the PATHEXT environment variable,
|
109
|
+
and defaults to '.com', '.bat' and '.exe' only if it's not defined.
|
110
|
+
* The File.which and File.whereis methods were tweaked a bit for Windows so
|
111
|
+
that they ignore the case of suffixes.
|
112
|
+
* Modified the platform checking and path separator handling.
|
113
|
+
* Added and tweaked some tests.
|
114
|
+
|
115
|
+
== 1.0.0 - 2-Jun-2005
|
116
|
+
* Modified the File.middle method to accept an optional block.
|
117
|
+
* File.whereis is now limited to unique values so that redundant PATH entries
|
118
|
+
do not cause redundant entries in the returned array (or block).
|
119
|
+
* File.nl_convert and File.touch now return self.
|
120
|
+
* File.nl_convert now raises ArgumentError (instead of StandardError) if
|
121
|
+
an unknown platform is provided.
|
122
|
+
* File.wc now raises ArgumentError (instead of RuntimeError) if a bad option
|
123
|
+
is provided.
|
124
|
+
* Made documentation rdoc friendly.
|
125
|
+
* Test suite updates, corrections and additions.
|
126
|
+
* Removed the INSTALL file. See the README instead.
|
127
|
+
* Moved project to RubyForge.
|
128
|
+
|
129
|
+
== 0.1.3 - 5-Dec-2003
|
130
|
+
* Modified File#which and File#whereis for Win32 to handle extensions better,
|
131
|
+
i.e. you can send "ruby" or "ruby.exe" and get back the same result.
|
132
|
+
* Minor test changes to tc_which.rb and tc_whereis.rb.
|
133
|
+
|
134
|
+
== 0.1.2 - 14-May-2003
|
135
|
+
* Modified nl_convert() to allow the destination filename to be the same as the
|
136
|
+
source file. In that case, a tempfile is used and copied back over the
|
137
|
+
original file.
|
138
|
+
* The target file name for nl_convert() now defaults to the source file name and
|
139
|
+
the default format is now "dos".
|
140
|
+
* Added a tc_constants.rb test suite.
|
141
|
+
* Test suite additions/fixes.
|
142
|
+
* Updates to MANIFEST.
|
143
|
+
|
144
|
+
== 0.1.1 - 21-Mar-2003
|
145
|
+
* Modified File.tail to return data in the same order that 'tail' does.
|
146
|
+
* Modified File.which to return nil if the program is not found.
|
147
|
+
* Modified File.whereis now uses '\' instead of '/' on MS Windows.
|
148
|
+
* Added File.middle class method.
|
149
|
+
* Test suite modification & additions.
|
150
|
+
* Thanks go to Shanko for both the spot and patch for tail, which, whereis
|
151
|
+
and middle.
|
152
|
+
|
153
|
+
== 0.1.0 - 18-Mar-2003
|
154
|
+
* Initial release
|
data/Gemfile
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
source 'https://rubygems.org'
|
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
|
1
|
+
source 'https://rubygems.org'
|
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
|
data/MANIFEST
CHANGED
data/README
CHANGED
@@ -1,64 +1,64 @@
|
|
1
|
-
== Description
|
2
|
-
The ptools (power tools) library is an additional set of commands for the
|
3
|
-
File class based on Unix command line tools.
|
4
|
-
|
5
|
-
== Prerequisites
|
6
|
-
On MS Windows you will need win32-file 0.5.4 or later.
|
7
|
-
|
8
|
-
== Installation
|
9
|
-
gem install ptools
|
10
|
-
|
11
|
-
== Synopsis
|
12
|
-
require "ptools"
|
13
|
-
|
14
|
-
File.which("ruby") # '/usr/local/bin/ruby'
|
15
|
-
File.whereis("ruby") # ['/usr/local/bin/ruby','/opt/bin/ruby']
|
16
|
-
|
17
|
-
File.head("myfile") # Returns first 10 lines of 'myfile'
|
18
|
-
File.middle("myfile",8,12) # Returns lines 8-12 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'
|
21
|
-
|
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
|
26
|
-
|
27
|
-
# Creates a copy of 'myfile' called 'newfile', in DOS format
|
28
|
-
File.nl_convert("myfile", "newfile", "dos")
|
29
|
-
|
30
|
-
== Known Bugs
|
31
|
-
None known. Please report any bugs on the github project page.
|
32
|
-
|
33
|
-
http://www.github.com/djberg96/ptools
|
34
|
-
|
35
|
-
== Acknowledgements
|
36
|
-
The File.which method was originally adopted from the FileWhich code posted
|
37
|
-
by Michael Granger on the now defunct rubygarden.org website. That code was
|
38
|
-
later replaced by a version based on the ruby-which library.
|
39
|
-
|
40
|
-
The File.nl_convert method is based on the nlcvt program found at
|
41
|
-
http://www.perl.com/language/ppt/src/nlcvt/nlcvt, written by Tom Christiansen.
|
42
|
-
|
43
|
-
The middle() method was provided by Shashank Date.
|
44
|
-
|
45
|
-
The binary?() method was based almost entirely on a blog post by Ryan
|
46
|
-
Davis (who, in turn, based his code on Perl's -B switch).
|
47
|
-
|
48
|
-
== Future Plans
|
49
|
-
Add whatever other tools people think might be useful.
|
50
|
-
|
51
|
-
== License
|
52
|
-
Artistic 2.0
|
53
|
-
|
54
|
-
== Copyright
|
55
|
-
(C) 2003-2014 Daniel J. Berger
|
56
|
-
All Rights Reserved.
|
57
|
-
|
58
|
-
== Warranty
|
59
|
-
This package is provided "as is" and without any express or
|
60
|
-
implied warranties, including, without limitation, the implied
|
61
|
-
warranties of merchantability and fitness for a particular purpose.
|
62
|
-
|
63
|
-
== Author
|
64
|
-
Daniel J. Berger
|
1
|
+
== Description
|
2
|
+
The ptools (power tools) library is an additional set of commands for the
|
3
|
+
File class based on Unix command line tools.
|
4
|
+
|
5
|
+
== Prerequisites
|
6
|
+
On MS Windows you will need win32-file 0.5.4 or later.
|
7
|
+
|
8
|
+
== Installation
|
9
|
+
gem install ptools
|
10
|
+
|
11
|
+
== Synopsis
|
12
|
+
require "ptools"
|
13
|
+
|
14
|
+
File.which("ruby") # '/usr/local/bin/ruby'
|
15
|
+
File.whereis("ruby") # ['/usr/local/bin/ruby','/opt/bin/ruby']
|
16
|
+
|
17
|
+
File.head("myfile") # Returns first 10 lines of 'myfile'
|
18
|
+
File.middle("myfile",8,12) # Returns lines 8-12 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'
|
21
|
+
|
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
|
26
|
+
|
27
|
+
# Creates a copy of 'myfile' called 'newfile', in DOS format
|
28
|
+
File.nl_convert("myfile", "newfile", "dos")
|
29
|
+
|
30
|
+
== Known Bugs
|
31
|
+
None known. Please report any bugs on the github project page.
|
32
|
+
|
33
|
+
http://www.github.com/djberg96/ptools
|
34
|
+
|
35
|
+
== Acknowledgements
|
36
|
+
The File.which method was originally adopted from the FileWhich code posted
|
37
|
+
by Michael Granger on the now defunct rubygarden.org website. That code was
|
38
|
+
later replaced by a version based on the ruby-which library.
|
39
|
+
|
40
|
+
The File.nl_convert method is based on the nlcvt program found at
|
41
|
+
http://www.perl.com/language/ppt/src/nlcvt/nlcvt, written by Tom Christiansen.
|
42
|
+
|
43
|
+
The middle() method was provided by Shashank Date.
|
44
|
+
|
45
|
+
The binary?() method was based almost entirely on a blog post by Ryan
|
46
|
+
Davis (who, in turn, based his code on Perl's -B switch).
|
47
|
+
|
48
|
+
== Future Plans
|
49
|
+
Add whatever other tools people think might be useful.
|
50
|
+
|
51
|
+
== License
|
52
|
+
Artistic 2.0
|
53
|
+
|
54
|
+
== Copyright
|
55
|
+
(C) 2003-2014 Daniel J. Berger
|
56
|
+
All Rights Reserved.
|
57
|
+
|
58
|
+
== Warranty
|
59
|
+
This package is provided "as is" and without any express or
|
60
|
+
implied warranties, including, without limitation, the implied
|
61
|
+
warranties of merchantability and fitness for a particular purpose.
|
62
|
+
|
63
|
+
== Author
|
64
|
+
Daniel J. Berger
|