ptools 1.2.2-universal-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/.gemtest +0 -0
- data/CHANGES +121 -0
- data/MANIFEST +17 -0
- data/README +65 -0
- data/Rakefile +130 -0
- data/lib/ptools.rb +429 -0
- data/ptools.gemspec +30 -0
- data/test/test_binary.rb +47 -0
- data/test/test_constants.rb +38 -0
- data/test/test_head.rb +51 -0
- data/test/test_image.rb +43 -0
- data/test/test_is_sparse.rb +52 -0
- data/test/test_middle.rb +61 -0
- data/test/test_nlconvert.rb +99 -0
- data/test/test_null.rb +40 -0
- data/test/test_tail.rb +56 -0
- data/test/test_touch.rb +55 -0
- data/test/test_wc.rb +76 -0
- data/test/test_whereis.rb +98 -0
- data/test/test_which.rb +113 -0
- metadata +129 -0
data/.gemtest
ADDED
File without changes
|
data/CHANGES
ADDED
@@ -0,0 +1,121 @@
|
|
1
|
+
== 1.2.2 - 6-Apr-2012
|
2
|
+
* Yet another sparse file test fix for OSX, which does not support
|
3
|
+
sparse file generation on HFS+.
|
4
|
+
* Fixed a bug in the File.whereis method on Windows when dealing with
|
5
|
+
absolute paths.
|
6
|
+
* Some Config vs RbConfig fixes to silence 1.9.3 warnings.
|
7
|
+
* Refactored and cleaned up some tests.
|
8
|
+
|
9
|
+
== 1.2.1 - 20-May-2011
|
10
|
+
* Added an (empty) .gemtest file so that it can be used with test.rubygems.org.
|
11
|
+
* Fixed a sparse file test.
|
12
|
+
|
13
|
+
== 1.2.0 - 8-Jan-2011
|
14
|
+
* Added the File.sparse? method for Unix platforms. This method already
|
15
|
+
exists on Windows courtesy of the win32-file library.
|
16
|
+
|
17
|
+
== 1.1.9 - 25-Mar-2010
|
18
|
+
* Refactored File.which and File.whereis and added additional tests for each.
|
19
|
+
* Removed the block form of File.whereis.
|
20
|
+
* Reorganized the Rakefile a bit and put the test tasks under the 'test'
|
21
|
+
namespace, and the gem tasks under the 'gem' namespace.
|
22
|
+
* Updated the test-unit development dependency.
|
23
|
+
* Updates the README.
|
24
|
+
|
25
|
+
== 1.1.8 - 6-Oct-2009
|
26
|
+
* Fixed some bad variable names that crept into the File.nl_convert method.
|
27
|
+
* Added the File.null_device alias for File.null.
|
28
|
+
* Added cygwin and mingw to Windows detection code.
|
29
|
+
* One of the nlconvert tests is now skipped on Windows.
|
30
|
+
* Two text files that were previously bundled as part of this library for
|
31
|
+
testing purposes have been removed. Those are now dynamically generated
|
32
|
+
within the tests themselves.
|
33
|
+
* Gemspec updates.
|
34
|
+
* Documentation updates.
|
35
|
+
* Added the :gem rake task.
|
36
|
+
|
37
|
+
== 1.1.7 - 28-Jul-2009
|
38
|
+
* Now compatible with Ruby 1.9.x.
|
39
|
+
* Replaced RUBY_PLATFORM with rbconfig check for the sake of other
|
40
|
+
implementations, such as JRuby.
|
41
|
+
* Updated the tests to be more friendly to JRuby.
|
42
|
+
* Added Test::Unit 2.x as a development dependency.
|
43
|
+
* Renamed the test files.
|
44
|
+
|
45
|
+
== 1.1.6 - 31-Aug-2007
|
46
|
+
* Fixed the File.touch method so that it doesn't whack existing files. Thanks
|
47
|
+
go to Thomas Preymesser for the spot.
|
48
|
+
* Added corresponding tests to the tc_touch.rb file.
|
49
|
+
|
50
|
+
== 1.1.5 - 19-Jul-2007
|
51
|
+
* Added the File.image? method. Inspired by ruby-talk: 260487.
|
52
|
+
|
53
|
+
== 1.1.4 - 21-May-2007
|
54
|
+
* Removed the install.rb file. Installation is now handled exclusively by the
|
55
|
+
rake install task.
|
56
|
+
* Updated the MANIFEST file, and made it rdoc friendly.
|
57
|
+
* Manual installation corrections in the README file.
|
58
|
+
|
59
|
+
== 1.1.3 - 29-Apr-2007
|
60
|
+
* I changed the way that the constants IS_WINDOWS and WIN32EXTS are defined.
|
61
|
+
* The IS_WINDOWS and WIN32EXTS are no long documented publically. They were
|
62
|
+
never meant for public use.
|
63
|
+
* The tc_constants.rb file was modified to only run certain tests on Windows.
|
64
|
+
|
65
|
+
== 1.1.2 - 28-Apr-2007
|
66
|
+
* Fixed a require line that could cause problems on MS Windows.
|
67
|
+
* Added a Rakefile which includes tasks for installation and testing.
|
68
|
+
* Some cleanup and improvement in the various test files.
|
69
|
+
|
70
|
+
== 1.1.1 - 24-Aug-2006
|
71
|
+
* Added the File.binary? method, based on code from Ryan Davis.
|
72
|
+
|
73
|
+
== 1.1.0 - 23-Aug-2006
|
74
|
+
* Added the File.null method which returns the bit bucket on your platform.
|
75
|
+
* The suffixes on MS Windows are now based on the PATHEXT environment variable,
|
76
|
+
and defaults to '.com', '.bat' and '.exe' only if it's not defined.
|
77
|
+
* The File.which and File.whereis methods were tweaked a bit for Windows so
|
78
|
+
that they ignore the case of suffixes.
|
79
|
+
* Modified the platform checking and path separator handling.
|
80
|
+
* Added and tweaked some tests.
|
81
|
+
|
82
|
+
== 1.0.0 - 2-Jun-2005
|
83
|
+
* Modified the File.middle method to accept an optional block.
|
84
|
+
* File.whereis is now limited to unique values so that redundant PATH entries
|
85
|
+
do not cause redundant entries in the returned array (or block).
|
86
|
+
* File.nl_convert and File.touch now return self.
|
87
|
+
* File.nl_convert now raises ArgumentError (instead of StandardError) if
|
88
|
+
an unknown platform is provided.
|
89
|
+
* File.wc now raises ArgumentError (instead of RuntimeError) if a bad option
|
90
|
+
is provided.
|
91
|
+
* Made documentation rdoc friendly.
|
92
|
+
* Test suite updates, corrections and additions.
|
93
|
+
* Removed the INSTALL file. See the README instead.
|
94
|
+
* Moved project to RubyForge.
|
95
|
+
|
96
|
+
== 0.1.3 - 5-Dec-2003
|
97
|
+
* Modified File#which and File#whereis for Win32 to handle extensions better,
|
98
|
+
i.e. you can send "ruby" or "ruby.exe" and get back the same result.
|
99
|
+
* Minor test changes to tc_which.rb and tc_whereis.rb.
|
100
|
+
|
101
|
+
== 0.1.2 - 14-May-2003
|
102
|
+
* Modified nl_convert() to allow the destination filename to be the same as the
|
103
|
+
source file. In that case, a tempfile is used and copied back over the
|
104
|
+
original file.
|
105
|
+
* The target file name for nl_convert() now defaults to the source file name and
|
106
|
+
the default format is now "dos".
|
107
|
+
* Added a tc_constants.rb test suite.
|
108
|
+
* Test suite additions/fixes.
|
109
|
+
* Updates to MANIFEST.
|
110
|
+
|
111
|
+
== 0.1.1 - 21-Mar-2003
|
112
|
+
* Modified File.tail to return data in the same order that 'tail' does.
|
113
|
+
* Modified File.which to return nil if the program is not found.
|
114
|
+
* Modified File.whereis now uses '\' instead of '/' on MS Windows.
|
115
|
+
* Added File.middle class method.
|
116
|
+
* Test suite modification & additions.
|
117
|
+
* Thanks go to Shanko for both the spot and patch for tail, which, whereis
|
118
|
+
and middle.
|
119
|
+
|
120
|
+
== 0.1.0 - 18-Mar-2003
|
121
|
+
* Initial release
|
data/MANIFEST
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
* CHANGES
|
2
|
+
* README
|
3
|
+
* MANIFEST
|
4
|
+
* Rakefile
|
5
|
+
* ptools.gemspec
|
6
|
+
* lib/ptools.rb
|
7
|
+
* test/test_constants.rb
|
8
|
+
* test/test_head.rb
|
9
|
+
* test/test_image.rb
|
10
|
+
* test/test_middle.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
|
data/README
ADDED
@@ -0,0 +1,65 @@
|
|
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 or RubyForge project page.
|
32
|
+
|
33
|
+
http://www.rubyforge.org/projects/shards
|
34
|
+
http://www.github.com/djberg96/ptools
|
35
|
+
|
36
|
+
== Acknowledgements
|
37
|
+
The File.which method was originally adopted from the FileWhich code posted
|
38
|
+
by Michael Granger on the now defunct rubygarden.org website. That code was
|
39
|
+
later replaced by a version based on the ruby-which library.
|
40
|
+
|
41
|
+
The File.nl_convert method is based on the nlcvt program found at
|
42
|
+
http://www.perl.com/language/ppt/src/nlcvt/nlcvt, written by Tom Christiansen.
|
43
|
+
|
44
|
+
The middle() method was provided by Shashank Date.
|
45
|
+
|
46
|
+
The binary?() method was based almost entirely on a blog post by Ryan
|
47
|
+
Davis (who, in turn, based his code on Perl's -B switch).
|
48
|
+
|
49
|
+
== Future Plans
|
50
|
+
Add whatever other tools people think might be useful.
|
51
|
+
|
52
|
+
== License
|
53
|
+
Artistic 2.0
|
54
|
+
|
55
|
+
== Copyright
|
56
|
+
(C) 2003-2012 Daniel J. Berger
|
57
|
+
All Rights Reserved.
|
58
|
+
|
59
|
+
== Warranty
|
60
|
+
This package is provided "as is" and without any express or
|
61
|
+
implied warranties, including, without limitation, the implied
|
62
|
+
warranties of merchantability and fitness for a particular purpose.
|
63
|
+
|
64
|
+
== Author
|
65
|
+
Daniel J. Berger
|
data/Rakefile
ADDED
@@ -0,0 +1,130 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/clean'
|
3
|
+
require 'rake/testtask'
|
4
|
+
require 'rbconfig'
|
5
|
+
include RbConfig
|
6
|
+
|
7
|
+
CLEAN.include("**/*.gem", "**/*.rbc", "**/*coverage*")
|
8
|
+
|
9
|
+
desc 'Install the ptools package (non-gem)'
|
10
|
+
task :install do
|
11
|
+
sitelibdir = CONFIG["sitelibdir"]
|
12
|
+
file = "lib/ptools.rb"
|
13
|
+
FileUtils.cp(file, sitelibdir, :verbose => true)
|
14
|
+
end
|
15
|
+
|
16
|
+
namespace 'gem' do
|
17
|
+
desc 'Create the ptools gem'
|
18
|
+
task :create => [:clean] do
|
19
|
+
Dir["*.gem"].each{ |f| File.delete(f) } # Clean first
|
20
|
+
spec = eval(IO.read('ptools.gemspec'))
|
21
|
+
Gem::Builder.new(spec).build
|
22
|
+
end
|
23
|
+
|
24
|
+
desc 'Install the ptools gem'
|
25
|
+
task :install => [:create] do
|
26
|
+
file = Dir["*.gem"].first
|
27
|
+
sh "gem install #{file}"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
Rake::TestTask.new do |t|
|
32
|
+
task :test => :clean
|
33
|
+
t.verbose = true
|
34
|
+
t.warning = true
|
35
|
+
end
|
36
|
+
|
37
|
+
namespace 'test' do
|
38
|
+
desc "Check test coverage using rcov"
|
39
|
+
task :coverage => [:clean] do
|
40
|
+
require 'rcov'
|
41
|
+
rm_rf 'coverage'
|
42
|
+
sh "rcov -Ilib test/test*.rb"
|
43
|
+
end
|
44
|
+
|
45
|
+
Rake::TestTask.new('binary') do |t|
|
46
|
+
t.libs << 'test'
|
47
|
+
t.verbose = true
|
48
|
+
t.warning = true
|
49
|
+
t.test_files = FileList['test/test_binary.rb']
|
50
|
+
end
|
51
|
+
|
52
|
+
Rake::TestTask.new('constants') do |t|
|
53
|
+
t.libs << 'test'
|
54
|
+
t.verbose = true
|
55
|
+
t.warning = true
|
56
|
+
t.test_files = FileList['test/test_constants.rb']
|
57
|
+
end
|
58
|
+
|
59
|
+
Rake::TestTask.new('head') do |t|
|
60
|
+
t.libs << 'test'
|
61
|
+
t.verbose = true
|
62
|
+
t.warning = true
|
63
|
+
t.test_files = FileList['test/test_head.rb']
|
64
|
+
end
|
65
|
+
|
66
|
+
Rake::TestTask.new('middle') do |t|
|
67
|
+
t.libs << 'test'
|
68
|
+
t.verbose = true
|
69
|
+
t.warning = true
|
70
|
+
t.test_files = FileList['test/test_middle.rb']
|
71
|
+
end
|
72
|
+
|
73
|
+
Rake::TestTask.new('nlconvert') do |t|
|
74
|
+
t.libs << 'test'
|
75
|
+
t.verbose = true
|
76
|
+
t.warning = true
|
77
|
+
t.test_files = FileList['test/test_nlconvert.rb']
|
78
|
+
end
|
79
|
+
|
80
|
+
Rake::TestTask.new('null') do |t|
|
81
|
+
t.libs << 'test'
|
82
|
+
t.verbose = true
|
83
|
+
t.warning = true
|
84
|
+
t.test_files = FileList['test/test_null.rb']
|
85
|
+
end
|
86
|
+
|
87
|
+
Rake::TestTask.new('sparse') do |t|
|
88
|
+
t.libs << 'test'
|
89
|
+
t.verbose = true
|
90
|
+
t.warning = true
|
91
|
+
t.test_files = FileList['test/test_is_sparse.rb']
|
92
|
+
end
|
93
|
+
|
94
|
+
Rake::TestTask.new('tail') do |t|
|
95
|
+
t.libs << 'test'
|
96
|
+
t.verbose = true
|
97
|
+
t.warning = true
|
98
|
+
t.test_files = FileList['test/test_tail.rb']
|
99
|
+
end
|
100
|
+
|
101
|
+
Rake::TestTask.new('touch') do |t|
|
102
|
+
t.libs << 'test'
|
103
|
+
t.verbose = true
|
104
|
+
t.warning = true
|
105
|
+
t.test_files = FileList['test/test_touch.rb']
|
106
|
+
end
|
107
|
+
|
108
|
+
Rake::TestTask.new('wc') do |t|
|
109
|
+
t.libs << 'test'
|
110
|
+
t.verbose = true
|
111
|
+
t.warning = true
|
112
|
+
t.test_files = FileList['test/test_wc.rb']
|
113
|
+
end
|
114
|
+
|
115
|
+
Rake::TestTask.new('whereis') do |t|
|
116
|
+
t.libs << 'test'
|
117
|
+
t.verbose = true
|
118
|
+
t.warning = true
|
119
|
+
t.test_files = FileList['test/test_whereis.rb']
|
120
|
+
end
|
121
|
+
|
122
|
+
Rake::TestTask.new('which') do |t|
|
123
|
+
t.libs << 'test'
|
124
|
+
t.verbose = true
|
125
|
+
t.warning = true
|
126
|
+
t.test_files = FileList['test/test_which.rb']
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
task :default => :test
|