rio 0.3.7 → 0.3.8
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +1273 -1482
- data/README +2 -2
- data/Rakefile +5 -5
- data/VERSION +1 -1
- data/{RUNME.1st.rb → build_doc.rb} +4 -10
- data/doc/ANNOUNCE +33 -80
- data/doc/RELEASE_NOTES +31 -1
- data/doc/generators/template/html/rio.rb +3 -3
- data/lib/rio/abstract_method.rb +2 -2
- data/lib/rio/argv.rb +2 -2
- data/lib/rio/arycopy.rb +2 -2
- data/lib/rio/assert.rb +2 -2
- data/lib/rio/base.rb +2 -2
- data/lib/rio/callstr.rb +47 -0
- data/lib/rio/const.rb +52 -0
- data/lib/rio/construct.rb +6 -24
- data/lib/rio/constructor.rb +12 -2
- data/lib/rio/context/autoclose.rb +73 -0
- data/lib/rio/context/copying.rb +2 -2
- data/lib/rio/context/cxx.rb +2 -2
- data/lib/rio/context/dir.rb +2 -2
- data/lib/rio/context/gzip.rb +2 -2
- data/lib/rio/context/methods.rb +6 -34
- data/lib/rio/context/skip.rb +2 -2
- data/lib/rio/context/stream.rb +2 -2
- data/lib/rio/context.rb +17 -2
- data/lib/rio/cp.rb +35 -9
- data/lib/rio/def.rb +54 -0
- data/lib/rio/dir.rb +19 -20
- data/lib/rio/doc/HOWTO.rb +23 -7
- data/lib/rio/doc/INTRO.rb +57 -23
- data/lib/rio/doc/MISC.rb +2 -2
- data/lib/rio/doc/OPTIONAL.rb +134 -0
- data/lib/rio/doc/SYNOPSIS.rb +11 -4
- data/lib/rio/doc.rb +2 -2
- data/lib/rio/entrysel.rb +25 -6
- data/lib/rio/exception/copy.rb +2 -2
- data/lib/rio/exception/notsupported.rb +47 -0
- data/lib/rio/exception/open.rb +2 -2
- data/lib/rio/exception/state.rb +2 -2
- data/lib/rio/exception.rb +2 -2
- data/lib/rio/ext/csv.rb +56 -11
- data/lib/rio/ext/yaml.rb +2 -2
- data/lib/rio/ext/zipfile.rb +91 -0
- data/lib/rio/ext.rb +38 -3
- data/lib/rio/factory.rb +17 -34
- data/lib/rio/file.rb +48 -8
- data/lib/rio/filter/closeoneof.rb +36 -16
- data/lib/rio/filter/gzip.rb +2 -2
- data/lib/rio/filter.rb +2 -2
- data/lib/rio/fs/base.rb +42 -0
- data/lib/rio/fs/impl.rb +123 -0
- data/lib/rio/fs/native.rb +76 -0
- data/lib/rio/{record.rb → fs/stream.rb} +21 -18
- data/lib/rio/fs/url.rb +64 -0
- data/lib/rio/ftp/{ioh.rb → conncache.rb} +38 -39
- data/lib/rio/ftp/dir.rb +95 -0
- data/lib/rio/ftp/fs.rb +173 -0
- data/lib/rio/ftp/ftpfile.rb +20 -0
- data/lib/rio/grande.rb +2 -2
- data/lib/rio/handle.rb +2 -2
- data/lib/rio/if/basic.rb +2 -2
- data/lib/rio/if/csv.rb +2 -2
- data/lib/rio/if/dir.rb +2 -2
- data/lib/rio/if/file.rb +26 -2
- data/lib/rio/if/fileordir.rb +44 -49
- data/lib/rio/if/grande.rb +32 -10
- data/lib/rio/if/grande_entry.rb +12 -2
- data/lib/rio/if/grande_stream.rb +17 -28
- data/lib/rio/if/internal.rb +2 -2
- data/lib/rio/if/path.rb +7 -6
- data/lib/rio/if/stream.rb +85 -29
- data/lib/rio/if/string.rb +2 -2
- data/lib/rio/if/temp.rb +2 -2
- data/lib/rio/if/test.rb +37 -4
- data/lib/rio/if/yaml.rb +2 -2
- data/lib/rio/if.rb +2 -2
- data/lib/rio/impl/path.rb +2 -2
- data/lib/rio/ioh.rb +17 -6
- data/lib/rio/iomode.rb +4 -3
- data/lib/rio/ios/fail.rb +107 -0
- data/lib/rio/ios/generic.rb +120 -0
- data/lib/rio/ios/mode.rb +61 -0
- data/lib/rio/ios/null.rb +120 -0
- data/lib/rio/iowrap.rb +129 -0
- data/lib/rio/kernel.rb +12 -3
- data/lib/rio/local.rb +2 -2
- data/lib/rio/match.rb +3 -3
- data/lib/rio/matchrecord.rb +2 -2
- data/lib/rio/no_warn.rb +50 -0
- data/lib/rio/{arrayio.rb → nullio.rb} +47 -86
- data/lib/rio/open3.rb +2 -2
- data/lib/rio/ops/construct.rb +20 -13
- data/lib/rio/ops/create.rb +10 -19
- data/lib/rio/ops/dir.rb +60 -54
- data/lib/rio/ops/either.rb +11 -9
- data/lib/rio/ops/file.rb +28 -24
- data/lib/rio/ops/path.rb +45 -43
- data/lib/rio/ops/stream/input.rb +12 -8
- data/lib/rio/ops/stream/output.rb +2 -2
- data/lib/rio/ops/stream/read.rb +35 -32
- data/lib/rio/ops/stream/write.rb +5 -5
- data/lib/rio/ops/stream.rb +7 -3
- data/lib/rio/ops/symlink.rb +12 -10
- data/lib/rio/path/reset.rb +5 -5
- data/lib/rio/path.rb +32 -24
- data/lib/rio/piper/cp.rb +2 -2
- data/lib/rio/piper.rb +2 -2
- data/lib/rio/prompt.rb +2 -2
- data/lib/rio/rectype.rb +9 -7
- data/lib/rio/rl/base.rb +5 -4
- data/lib/rio/rl/builder.rb +17 -5
- data/lib/rio/rl/ioi.rb +14 -4
- data/lib/rio/rl/path.rb +23 -15
- data/lib/rio/rl/pathmethods.rb +12 -2
- data/lib/rio/rl/uri.rb +13 -6
- data/lib/rio/scheme/aryio.rb +3 -3
- data/lib/rio/scheme/cmdio.rb +4 -3
- data/lib/rio/scheme/cmdpipe.rb +3 -35
- data/lib/rio/scheme/fd.rb +4 -3
- data/lib/rio/scheme/ftp.rb +36 -7
- data/lib/rio/scheme/http.rb +2 -2
- data/lib/rio/{context/closeoneof.rb → scheme/null.rb} +17 -11
- data/lib/rio/scheme/path.rb +28 -30
- data/lib/rio/scheme/stderr.rb +4 -4
- data/lib/rio/scheme/stdio.rb +6 -5
- data/lib/rio/scheme/strio.rb +10 -20
- data/lib/rio/scheme/sysio.rb +5 -2
- data/lib/rio/scheme/tcp.rb +4 -3
- data/lib/rio/scheme/temp.rb +14 -1
- data/lib/rio/state/error.rb +2 -2
- data/lib/rio/state.rb +80 -34
- data/lib/rio/stream/base.rb +7 -2
- data/lib/rio/stream/duplex.rb +13 -10
- data/lib/rio/stream/open.rb +74 -79
- data/lib/rio/stream.rb +15 -23
- data/lib/rio/symantics.rb +2 -2
- data/lib/rio/tempdir.rb +132 -132
- data/lib/rio/to_rio/all.rb +40 -0
- data/lib/rio/to_rio/array.rb +40 -0
- data/lib/rio/to_rio/io.rb +41 -0
- data/lib/rio/to_rio/object.rb +43 -0
- data/lib/rio/to_rio/string.rb +41 -0
- data/lib/rio/to_rio.rb +13 -2
- data/lib/rio/uri/file.rb +2 -2
- data/lib/rio/util.rb +2 -2
- data/lib/rio/version.rb +3 -3
- data/lib/rio.rb +16 -25
- data/test/bin/count_lines.rb +11 -0
- data/test/bin/find_lines.rb +13 -0
- data/test/bin/list_dir.rb +14 -0
- data/test/ftp/all.rb +9 -0
- data/test/ftp/anon_misc.rb +112 -0
- data/test/ftp/anon_read.rb +105 -0
- data/test/ftp/anon_special.rb +68 -0
- data/test/ftp/anon_write.rb +63 -0
- data/test/ftp/ftp2ftp.rb +51 -0
- data/test/ftp/initftpfiles.rb +14 -0
- data/test/ftp/testdef.rb +51 -0
- data/test/gem_runtests.rb +15 -15
- data/test/runalltests.rb +15 -0
- data/test/runftptests.rb +14 -0
- data/test/{1.rb → runhttptests.rb} +14 -14
- data/test/runtests.rb +14 -14
- data/test/tc/all.rb +36 -21
- data/test/tc/cmdpipe.rb +18 -15
- data/test/tc/copy-from-http.rb +89 -0
- data/test/tc/copy-from.rb +1 -52
- data/test/tc/copy.rb +19 -17
- data/test/tc/csv2.rb +6 -3
- data/test/tc/empty.rb +47 -0
- data/test/tc/emptyriodir.rb +129 -0
- data/test/tc/entsel.rb +110 -0
- data/test/tc/files_select.rb +92 -0
- data/test/tc/get.rb +7 -6
- data/test/tc/getrec.rb +2 -5
- data/test/tc/gzip.rb +82 -0
- data/test/tc/io_each_byte.rb +60 -0
- data/test/tc/io_read.rb +80 -0
- data/test/tc/iometh.rb +149 -0
- data/test/tc/likeio.rb +112 -0
- data/test/tc/methods.rb +10 -9
- data/test/tc/misc.rb +1 -37
- data/test/tc/null.rb +45 -0
- data/test/tc/pid.rb +31 -0
- data/test/tc/piper.rb +34 -37
- data/test/tc/programs_util.rb +24 -0
- data/test/tc/readline.rb +30 -0
- data/test/tc/rename.rb +12 -0
- data/test/tc/tempfile.rb +14 -0
- data/test/tc/testcase.rb +6 -0
- data/test/tc/tonl.rb +37 -0
- metadata +181 -144
- data/ex/colx.rb +0 -8
- data/ex/findinruby +0 -16
- data/ex/findruby +0 -15
- data/ex/passwd_report.rb +0 -8
- data/ex/prompt.rb +0 -25
- data/ex/rgb.txt.gz +0 -0
- data/ex/riocat +0 -35
- data/ex/riogunzip +0 -31
- data/ex/riogzip +0 -24
- data/ex/rioprompt.rb +0 -6
- data/ex/targz2zip +0 -17
- data/ex/tolf +0 -11
- data/lib/rio/ftp/conn.rb +0 -167
- data/lib/rio/ftp.rb +0 -275
- data/test/once.rb +0 -7
data/README
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright (c) 2005, Christopher Kleckner
|
1
|
+
Copyright (c) 2005, 2006 Christopher Kleckner
|
2
2
|
All rights reserved
|
3
3
|
|
4
4
|
This file is part of the Rio library for ruby.
|
@@ -27,7 +27,7 @@ Rio is a convenience class wrapping much of the functionality of
|
|
27
27
|
IO, File, Dir, Pathname, FileUtils, Tempfile, StringIO, OpenURI, Zlib, and CSV.
|
28
28
|
|
29
29
|
To create the documentation for Rio run the command
|
30
|
-
ruby
|
30
|
+
ruby build_doc.rb
|
31
31
|
from the distribution directory.
|
32
32
|
|
33
33
|
Then point your browser at the 'doc/rdoc' directory.
|
data/Rakefile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#--
|
2
2
|
# ===============================================================================
|
3
|
-
# Copyright (c) 2005, Christopher Kleckner
|
3
|
+
# Copyright (c) 2005, 2006 Christopher Kleckner
|
4
4
|
# All rights reserved
|
5
5
|
#
|
6
6
|
# This file is part of the Rio library for ruby.
|
@@ -21,7 +21,7 @@
|
|
21
21
|
# ===============================================================================
|
22
22
|
#
|
23
23
|
# To create the documentation for Rio run the command
|
24
|
-
#
|
24
|
+
# ruby build_doc.rb
|
25
25
|
# from the distribution directory.
|
26
26
|
#++
|
27
27
|
|
@@ -42,7 +42,7 @@ $:.push 'lib'
|
|
42
42
|
require 'rio/version'
|
43
43
|
require 'rio/doc'
|
44
44
|
|
45
|
-
SVN_REPOSITORY_URL = '
|
45
|
+
SVN_REPOSITORY_URL = ''
|
46
46
|
|
47
47
|
SRC_FILES = FileList['lib/**/*.rb']
|
48
48
|
DOC_FILES = FileList['README','lib/rio.rb','lib/rio/doc/*.rb',
|
@@ -52,11 +52,11 @@ XMP_FILES = FileList['ex/*']
|
|
52
52
|
module PKG
|
53
53
|
NAME = "rio"
|
54
54
|
TITLE = RIO::TITLE
|
55
|
-
VERSION =
|
55
|
+
VERSION = RIO::VERSION
|
56
56
|
FULLNAME = PKG::NAME + "-" + PKG::VERSION
|
57
57
|
SUMMARY = RIO::SUMMARY
|
58
58
|
DESCRIPTION = RIO::DESCRIPTION
|
59
|
-
FILES = FileList.new(['setup.rb', '
|
59
|
+
FILES = FileList.new(['setup.rb', 'build_doc.rb', 'COPYING', 'Rakefile', 'ChangeLog', 'VERSION',
|
60
60
|
'test/**/*.rb','doc/**/*'] + SRC_FILES.to_a + DOC_FILES.to_a + XMP_FILES.to_a
|
61
61
|
) do |fl|
|
62
62
|
fl.exclude( /\bsvn\b/ )
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.8
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
#--
|
3
3
|
# ===============================================================================
|
4
|
-
# Copyright (c) 2005, Christopher Kleckner
|
4
|
+
# Copyright (c) 2005, 2006 Christopher Kleckner
|
5
5
|
# All rights reserved
|
6
6
|
#
|
7
7
|
# This file is part of the Rio library for ruby.
|
@@ -22,18 +22,10 @@
|
|
22
22
|
# ===============================================================================
|
23
23
|
#
|
24
24
|
# To create the documentation for Rio run the command
|
25
|
-
#
|
25
|
+
# ruby build_doc.rb
|
26
26
|
# from the distribution directory.
|
27
27
|
#++
|
28
28
|
|
29
|
-
# It is not really necessary to run this first.
|
30
|
-
# It simply builds the Rio RDoc documentation, and is provided
|
31
|
-
# to support those who have not installed +rake+ and to demonstrate Rio.
|
32
|
-
# The preferred method of building the documentation is
|
33
|
-
# rake rdoc
|
34
|
-
#
|
35
|
-
|
36
|
-
|
37
29
|
$:.unshift 'lib'
|
38
30
|
require 'rio'
|
39
31
|
|
@@ -61,6 +53,8 @@ rdoc_files = [
|
|
61
53
|
|
62
54
|
cmd = sprintf("rdoc %s %s",RDOC_OPTIONS.join(' '),rdoc_files.join(' '))
|
63
55
|
|
56
|
+
rio(?-,cmd) > ?-
|
57
|
+
|
64
58
|
docindex = (rdoc_dir/'index.html').abs.to_url
|
65
59
|
msg = "Please point your browser at '#{docindex}'"
|
66
60
|
lin = ">" + ">" * (msg.length+2) + ">"
|
data/doc/ANNOUNCE
CHANGED
@@ -1,33 +1,43 @@
|
|
1
|
-
|
1
|
+
Rio 0.3.8
|
2
2
|
|
3
3
|
== Overview
|
4
4
|
|
5
5
|
Rio is a Ruby I/O convenience class wrapping much of the functionality
|
6
6
|
of IO, File and Dir. Rio also uses FileUtils, Tempfile, StringIO,
|
7
|
-
OpenURI, Zlib, and CSV to provide similar functionality
|
8
|
-
consistent interface. In addition to forwarding the
|
9
|
-
provided by IO, File, and Dir to an appropriate object, Rio
|
10
|
-
"grande" interface that allows many common application
|
11
|
-
file-system tasks to be expressed succinctly.
|
7
|
+
OpenURI, Net::FTP, Zlib, and CSV to provide similar functionality
|
8
|
+
using a simple consistent interface. In addition to forwarding the
|
9
|
+
interfaces provided by IO, File, and Dir to an appropriate object, Rio
|
10
|
+
provides a "grande" interface that allows many common application
|
11
|
+
level I/O and file-system tasks to be expressed succinctly.
|
12
12
|
|
13
13
|
== New
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
Enhanced support for FTP file-systems. All of Rio's most powerful
|
16
|
+
idioms are now supported seamlessly on FTP servers.
|
17
|
+
|
18
|
+
# copy a file from or to an FTP server
|
19
|
+
rio('ftp://ahost/adir/afile') > rio('localfile') # server -> local file
|
20
|
+
rio('ftp://ahost/adir/afile') < rio('localfile') # local file -> server
|
21
|
+
|
22
|
+
# copy an entire directory structure from or to an FTP server
|
23
|
+
rio('ftp://ahost/adir') > rio('localdir') # server -> local directory
|
24
|
+
rio('ftp://ahost/adir') < rio('localdir') # local directory -> server
|
25
|
+
|
26
|
+
All of Rio's grande selection and filtering options are available for
|
27
|
+
files and directories on FTP servers.
|
28
|
+
|
29
|
+
# create a gzipped copy of a web page on an ftp server
|
30
|
+
rio('ftp://ftphost/f.html.gz').gzip < rio('http://httphost/f.html')
|
31
|
+
|
32
|
+
# dump the first 10 lines of a gzipped log file on an FTP server to stdout
|
33
|
+
rio('ftp://ftphost/logfile.txt').lines(0...10) > ?-
|
18
34
|
|
19
|
-
#
|
20
|
-
|
21
|
-
rio('infile1') | cmdpipe | rio('outfile1')
|
22
|
-
rio('infile2') | cmdpipe | rio('outfile2')
|
35
|
+
# iterate through the entries of a directory on an FTP server
|
36
|
+
rio('ftp://ftphost/adir').entries { |entrio| ... }
|
23
37
|
|
24
|
-
|
25
|
-
rio('
|
26
|
-
rio(?-) | cmdpipe2 # same commands with input from stdin
|
38
|
+
# get an array of all .rb files on an ftp server
|
39
|
+
rb_files = rio('ftp://ftphost/').all.files['*.rb']
|
27
40
|
|
28
|
-
Improved support for MS Windows path specifications
|
29
|
-
rio('D:/adir/afile')
|
30
|
-
rio('//ahost/adir/afile')
|
31
41
|
|
32
42
|
== SYNOPSIS
|
33
43
|
|
@@ -135,75 +145,18 @@ Create a tab separated file of accounts in a UNIX passwd file,
|
|
135
145
|
listing only the username, uid, and realname fields
|
136
146
|
rio('/etc/passwd').csv(':').columns(0,2,4) > rio('rpt').csv("\t")
|
137
147
|
|
138
|
-
|
139
|
-
|
140
|
-
* New Grande Selection parameter.
|
141
|
-
|
142
|
-
A major weakness of Rio's selection methods (lines, files, etc.)
|
143
|
-
has always been that it only implemented a logical OR.
|
144
|
-
|
145
|
-
rio('afile').lines(0..10,/Rio/) {...}
|
146
|
-
iterates through lines that are in the range 0..10 OR
|
147
|
-
contain 'Rio'.
|
148
|
-
|
149
|
-
rio('adir').files(:executable?,'*.rb') {...}
|
150
|
-
iterates through files that are executable OR match '*.rb'
|
151
|
-
|
152
|
-
Selecting files that matched both required using a proc.
|
153
|
-
rio('adir').files(proc{ |f| f.executable? and f.fnmatch?('*.rb')}) {...}
|
154
|
-
|
155
|
-
Rio's grande selection methods will now accept an array of conditions
|
156
|
-
which must all be matched, in order to be selected. A logical AND.
|
157
|
-
|
158
|
-
rio('adir').files([:executable?,'*.rb']) {...}
|
159
|
-
|
160
|
-
The array, of course, need not be the only paramter.
|
161
|
-
|
162
|
-
rio('adir').files('*.exe',[:executable?,'*.rb']) {...}
|
163
|
-
|
164
|
-
selects .exe files and .rb files that are executable.
|
165
|
-
|
166
|
-
* Renamed some of grande rejection methods.
|
167
|
-
(based on a suggestion by Gavin Sinclair)
|
168
|
-
nolines => skiplines
|
169
|
-
nofiles => skipfiles
|
170
|
-
etc.
|
171
|
-
|
172
|
-
* New skip() grande method
|
173
|
-
rio('afile').skip.lines(/Rio/) # same as skiplines(/Rio/)
|
174
|
-
rio('afile').lines(/Rio/).skip(0..9) # lines with 'Rio', exclude
|
175
|
-
# the first ten lines
|
176
|
-
|
177
|
-
* Alternative syntaxes for creating Rios that have no path.
|
178
|
-
rio(?-) # create a Rio refering to stdio
|
179
|
-
rio(:stdio) # same thing.
|
180
|
-
rio.stdio # same thing
|
181
|
-
RIO.stdio # ditto
|
182
|
-
RIO::Rio.stdio # once again
|
183
|
-
|
184
|
-
* From Pathname added
|
185
|
-
* root?
|
186
|
-
* mountpoint?
|
187
|
-
* realpath
|
188
|
-
* cleanpath
|
189
|
-
|
190
|
-
* Removed Rio#slurp in favor of Rio#contents.
|
148
|
+
Pipe multiple commands
|
149
|
+
rio('afile') | rio(?-,'acmd') | 'another_cmd' | ?-
|
191
150
|
|
192
|
-
|
193
|
-
* copy_to >
|
194
|
-
* append_to >>
|
195
|
-
* copy_from <
|
196
|
-
* append_from <<
|
151
|
+
== Contact
|
197
152
|
|
198
|
-
* Bug fixes and corrections
|
199
|
-
|
200
153
|
Project:: http://rubyforge.org/projects/rio/
|
201
154
|
Documentation:: http://rio.rubyforge.org/
|
202
155
|
Bugs:: http://rubyforge.org/tracker/?group_id=821
|
203
156
|
Email:: rio4ruby@rubyforge.org
|
204
157
|
|
205
158
|
== Copyright
|
206
|
-
Copyright (c) 2005, Christopher Kleckner. All rights reserved
|
159
|
+
Copyright (c) 2005, 2006 Christopher Kleckner. All rights reserved
|
207
160
|
|
208
161
|
== License
|
209
162
|
Rio is released under the GNU General Public License
|
data/doc/RELEASE_NOTES
CHANGED
@@ -9,7 +9,7 @@ Rio is a convenience class wrapping much of the functionality of
|
|
9
9
|
IO, File, Dir, Pathname, FileUtils, Tempfile, StringIO, OpenURI, Zlib, and CSV.
|
10
10
|
|
11
11
|
To create the documentation for Rio run the command
|
12
|
-
ruby
|
12
|
+
ruby build_doc.rb
|
13
13
|
from the distribution directory.
|
14
14
|
|
15
15
|
Then point your browser at the 'doc/rdoc' directory.
|
@@ -20,6 +20,36 @@ Suggested Reading
|
|
20
20
|
* RIO::Doc::HOWTO
|
21
21
|
* RIO::Rio
|
22
22
|
|
23
|
+
== New for version 0.3.8
|
24
|
+
* Enhanced support for FTP file-systems. All of Rio's most powerful
|
25
|
+
idioms are now supported seamlessly on FTP servers.
|
26
|
+
|
27
|
+
# copy a file from or to an FTP server
|
28
|
+
rio('ftp://ahost/adir/afile') > rio('localfile') # server -> local file
|
29
|
+
rio('ftp://ahost/adir/afile') < rio('localfile') # local file -> server
|
30
|
+
|
31
|
+
# copy an entire directory structure from or to an FTP server
|
32
|
+
rio('ftp://ahost/adir') > rio('localdir') # server -> local directory
|
33
|
+
rio('ftp://ahost/adir') < rio('localdir') # local directory -> server
|
34
|
+
|
35
|
+
All of Rio's grande selection and filtering options are available for
|
36
|
+
files and directories on FTP servers.
|
37
|
+
|
38
|
+
# create a gzipped copy of a web page on an ftp server
|
39
|
+
rio('ftp://ftphost/f.html.gz').gzip < rio('http://httphost/f.html')
|
40
|
+
|
41
|
+
# dump the first 10 lines of a gzipped log file on an FTP server to stdout
|
42
|
+
rio('ftp://ftphost/logfile.txt').lines(0...10) > ?-
|
43
|
+
|
44
|
+
# iterate through the entries of a directory on an FTP server
|
45
|
+
rio('ftp://ftphost/adir').entries { |entrio| ... }
|
46
|
+
|
47
|
+
# get an array of all .rb files on an ftp server
|
48
|
+
rb_files = rio('ftp://ftphost/').all.files['*.rb']
|
49
|
+
|
50
|
+
* More tests
|
51
|
+
* Bug fixes
|
52
|
+
|
23
53
|
== Version 0.3.7
|
24
54
|
* Maintenance release
|
25
55
|
|
@@ -20,8 +20,8 @@
|
|
20
20
|
#
|
21
21
|
|
22
22
|
# Modified by Christopher Kleckner
|
23
|
-
# Copyright (c) 2005. Some rights reserved.
|
24
|
-
# Licensed under the same terms as the original
|
23
|
+
# Copyright (c) 2005,2006. Some rights reserved.
|
24
|
+
# Licensed under the same terms as the original.
|
25
25
|
|
26
26
|
|
27
27
|
module RDoc
|
@@ -483,7 +483,7 @@ CONTEXT_CONTENT = %{
|
|
483
483
|
#####################################################################
|
484
484
|
FOOTER = %{
|
485
485
|
<div id="validator-badges">
|
486
|
-
<p><small>Copyright © 2005 Christopher Kleckner. <a href="http://www.gnu.org/licenses/gpl.html">All rights reserved</a>.</small></p>
|
486
|
+
<p><small>Copyright © 2005, 2006 Christopher Kleckner. <a href="http://www.gnu.org/licenses/gpl.html">All rights reserved</a>.</small></p>
|
487
487
|
</div>
|
488
488
|
|
489
489
|
</body>
|
data/lib/rio/abstract_method.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#--
|
2
2
|
# ===============================================================================
|
3
|
-
# Copyright (c) 2005, Christopher Kleckner
|
3
|
+
# Copyright (c) 2005, 2006 Christopher Kleckner
|
4
4
|
# All rights reserved
|
5
5
|
#
|
6
6
|
# This file is part of the Rio library for ruby.
|
@@ -22,7 +22,7 @@
|
|
22
22
|
#++
|
23
23
|
#
|
24
24
|
# To create the documentation for Rio run the command
|
25
|
-
#
|
25
|
+
# ruby build_doc.rb
|
26
26
|
# from the distribution directory. Then point your browser at the 'doc/rdoc' directory.
|
27
27
|
#
|
28
28
|
# Suggested Reading
|
data/lib/rio/argv.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#--
|
2
2
|
# ===============================================================================
|
3
|
-
# Copyright (c) 2005, Christopher Kleckner
|
3
|
+
# Copyright (c) 2005, 2006 Christopher Kleckner
|
4
4
|
# All rights reserved
|
5
5
|
#
|
6
6
|
# This file is part of the Rio library for ruby.
|
@@ -22,7 +22,7 @@
|
|
22
22
|
#++
|
23
23
|
#
|
24
24
|
# To create the documentation for Rio run the command
|
25
|
-
#
|
25
|
+
# ruby build_doc.rb
|
26
26
|
# from the distribution directory. Then point your browser at the 'doc/rdoc' directory.
|
27
27
|
#
|
28
28
|
# Suggested Reading
|
data/lib/rio/arycopy.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#--
|
2
2
|
# ===============================================================================
|
3
|
-
# Copyright (c) 2005, Christopher Kleckner
|
3
|
+
# Copyright (c) 2005, 2006 Christopher Kleckner
|
4
4
|
# All rights reserved
|
5
5
|
#
|
6
6
|
# This file is part of the Rio library for ruby.
|
@@ -22,7 +22,7 @@
|
|
22
22
|
#++
|
23
23
|
#
|
24
24
|
# To create the documentation for Rio run the command
|
25
|
-
#
|
25
|
+
# ruby build_doc.rb
|
26
26
|
# from the distribution directory. Then point your browser at the 'doc/rdoc' directory.
|
27
27
|
#
|
28
28
|
# Suggested Reading
|
data/lib/rio/assert.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#--
|
2
2
|
# ===============================================================================
|
3
|
-
# Copyright (c) 2005, Christopher Kleckner
|
3
|
+
# Copyright (c) 2005, 2006 Christopher Kleckner
|
4
4
|
# All rights reserved
|
5
5
|
#
|
6
6
|
# This file is part of the Rio library for ruby.
|
@@ -22,7 +22,7 @@
|
|
22
22
|
#++
|
23
23
|
#
|
24
24
|
# To create the documentation for Rio run the command
|
25
|
-
#
|
25
|
+
# ruby build_doc.rb
|
26
26
|
# from the distribution directory. Then point your browser at the 'doc/rdoc' directory.
|
27
27
|
#
|
28
28
|
# Suggested Reading
|
data/lib/rio/base.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#--
|
2
2
|
# ===============================================================================
|
3
|
-
# Copyright (c) 2005, Christopher Kleckner
|
3
|
+
# Copyright (c) 2005, 2006 Christopher Kleckner
|
4
4
|
# All rights reserved
|
5
5
|
#
|
6
6
|
# This file is part of the Rio library for ruby.
|
@@ -22,7 +22,7 @@
|
|
22
22
|
#++
|
23
23
|
#
|
24
24
|
# To create the documentation for Rio run the command
|
25
|
-
#
|
25
|
+
# ruby build_doc.rb
|
26
26
|
# from the distribution directory. Then point your browser at the 'doc/rdoc' directory.
|
27
27
|
#
|
28
28
|
# Suggested Reading
|
data/lib/rio/callstr.rb
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
#--
|
2
|
+
# ===============================================================================
|
3
|
+
# Copyright (c) 2005, 2006 Christopher Kleckner
|
4
|
+
# All rights reserved
|
5
|
+
#
|
6
|
+
# This file is part of the Rio library for ruby.
|
7
|
+
#
|
8
|
+
# Rio is free software; you can redistribute it and/or modify
|
9
|
+
# it under the terms of the GNU General Public License as published by
|
10
|
+
# the Free Software Foundation; either version 2 of the License, or
|
11
|
+
# (at your option) any later version.
|
12
|
+
#
|
13
|
+
# Rio is distributed in the hope that it will be useful,
|
14
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
+
# GNU General Public License for more details.
|
17
|
+
#
|
18
|
+
# You should have received a copy of the GNU General Public License
|
19
|
+
# along with Rio; if not, write to the Free Software
|
20
|
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
21
|
+
# ===============================================================================
|
22
|
+
#++
|
23
|
+
#
|
24
|
+
# To create the documentation for Rio run the command
|
25
|
+
# ruby build_doc.rb
|
26
|
+
# from the distribution directory. Then point your browser at the 'doc/rdoc' directory.
|
27
|
+
#
|
28
|
+
# Suggested Reading
|
29
|
+
# * RIO::Doc::SYNOPSIS
|
30
|
+
# * RIO::Doc::INTRO
|
31
|
+
# * RIO::Doc::HOWTO
|
32
|
+
# * RIO::Rio
|
33
|
+
#
|
34
|
+
# <b>Rio is pre-alpha software.
|
35
|
+
# The documented interface and behavior is subject to change without notice.</b>
|
36
|
+
|
37
|
+
|
38
|
+
module RIO
|
39
|
+
module CallStr #:nodoc: all
|
40
|
+
def callstr(func,*args)
|
41
|
+
self.class.to_s+'['+self.to_url+']'+'.'+func.to_s+'('+args.join(',')+')'
|
42
|
+
end
|
43
|
+
def scallstr(func,*args)
|
44
|
+
self.class.to_s+'['+self.to_s+']'+'.'+func.to_s+'('+args.join(',')+')'
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
data/lib/rio/const.rb
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
#--
|
2
|
+
# ===============================================================================
|
3
|
+
# Copyright (c) 2005, 2006 Christopher Kleckner
|
4
|
+
# All rights reserved
|
5
|
+
#
|
6
|
+
# This file is part of the Rio library for ruby.
|
7
|
+
#
|
8
|
+
# Rio is free software; you can redistribute it and/or modify
|
9
|
+
# it under the terms of the GNU General Public License as published by
|
10
|
+
# the Free Software Foundation; either version 2 of the License, or
|
11
|
+
# (at your option) any later version.
|
12
|
+
#
|
13
|
+
# Rio is distributed in the hope that it will be useful,
|
14
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
+
# GNU General Public License for more details.
|
17
|
+
#
|
18
|
+
# You should have received a copy of the GNU General Public License
|
19
|
+
# along with Rio; if not, write to the Free Software
|
20
|
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
21
|
+
# ===============================================================================
|
22
|
+
#++
|
23
|
+
#
|
24
|
+
# To create the documentation for Rio run the command
|
25
|
+
# ruby build_doc.rb
|
26
|
+
# from the distribution directory. Then point your browser at the 'doc/rdoc' directory.
|
27
|
+
#
|
28
|
+
# Suggested Reading
|
29
|
+
# * RIO::Doc::SYNOPSIS
|
30
|
+
# * RIO::Doc::INTRO
|
31
|
+
# * RIO::Doc::HOWTO
|
32
|
+
# * RIO::Rio
|
33
|
+
#
|
34
|
+
# <b>Rio is pre-alpha software.
|
35
|
+
# The documented interface and behavior is subject to change without notice.</b>
|
36
|
+
|
37
|
+
module RIO
|
38
|
+
SEEK_SET = IO::SEEK_SET
|
39
|
+
SEEK_END = IO::SEEK_END
|
40
|
+
SEEK_CUR = IO::SEEK_CUR
|
41
|
+
end
|
42
|
+
|
43
|
+
if $0 == __FILE__
|
44
|
+
eval DATA.read, nil, $0, __LINE__+4
|
45
|
+
end
|
46
|
+
|
47
|
+
__END__
|
48
|
+
|
49
|
+
puts
|
50
|
+
puts("Run the tests that came with the distribution")
|
51
|
+
puts("From the distribution directory use 'test/runtests.rb'")
|
52
|
+
puts
|
data/lib/rio/construct.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#--
|
2
2
|
# ===============================================================================
|
3
|
-
# Copyright (c) 2005, Christopher Kleckner
|
3
|
+
# Copyright (c) 2005, 2006 Christopher Kleckner
|
4
4
|
# All rights reserved
|
5
5
|
#
|
6
6
|
# This file is part of the Rio library for ruby.
|
@@ -22,7 +22,7 @@
|
|
22
22
|
#++
|
23
23
|
#
|
24
24
|
# To create the documentation for Rio run the command
|
25
|
-
#
|
25
|
+
# ruby build_doc.rb
|
26
26
|
# from the distribution directory. Then point your browser at the 'doc/rdoc' directory.
|
27
27
|
#
|
28
28
|
# Suggested Reading
|
@@ -39,31 +39,13 @@ module RIO
|
|
39
39
|
require 'rio/ops/construct'
|
40
40
|
include Ops::Construct
|
41
41
|
|
42
|
-
module_function
|
43
|
-
module_function :stdio
|
44
|
-
module_function :stderr
|
45
|
-
module_function :temp
|
46
|
-
module_function :tempfile
|
47
|
-
module_function :tempdir
|
48
|
-
module_function :tcp
|
49
|
-
module_function :cmdio
|
50
|
-
module_function :cmdpipe
|
51
|
-
module_function :sysio
|
52
|
-
module_function :fd
|
42
|
+
module_function(*RIO::CONSTRUCTOR_SYMS)
|
53
43
|
end
|
54
44
|
|
55
45
|
module RIO
|
56
46
|
class Rio
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
def self.temp(*args,&block) rio(:temp,*args,&block) end
|
61
|
-
def self.tempfile(*args,&block) rio(:tempfile,*args,&block) end
|
62
|
-
def self.tempdir(*args,&block) rio(:tempdir,*args,&block) end
|
63
|
-
def self.tcp(*args,&block) rio(:tcp,*args,&block) end
|
64
|
-
def self.cmdio(*args,&block) rio(:cmdio,*args,&block) end
|
65
|
-
def self.cmdpipe(*args,&block) rio(:cmdpipe,*args,&block) end
|
66
|
-
def self.sysio(*args,&block) rio(:sysio,*args,&block) end
|
67
|
-
def self.fd(*args,&block) rio(:fd,*args,&block) end
|
47
|
+
RIO::CONSTRUCTOR_SYMS.each { |sym|
|
48
|
+
class_eval "def self.#{sym}(*args,&block) self.rio(:#{sym},*args,&block) end"
|
49
|
+
}
|
68
50
|
end
|
69
51
|
end
|
data/lib/rio/constructor.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#--
|
2
2
|
# ===============================================================================
|
3
|
-
# Copyright (c) 2005, Christopher Kleckner
|
3
|
+
# Copyright (c) 2005, 2006 Christopher Kleckner
|
4
4
|
# All rights reserved
|
5
5
|
#
|
6
6
|
# This file is part of the Rio library for ruby.
|
@@ -22,7 +22,7 @@
|
|
22
22
|
#++
|
23
23
|
#
|
24
24
|
# To create the documentation for Rio run the command
|
25
|
-
#
|
25
|
+
# ruby build_doc.rb
|
26
26
|
# from the distribution directory. Then point your browser at the 'doc/rdoc' directory.
|
27
27
|
#
|
28
28
|
# Suggested Reading
|
@@ -198,6 +198,16 @@ module RIO
|
|
198
198
|
#
|
199
199
|
# This is Rio's interface to IO#popen
|
200
200
|
#
|
201
|
+
# ===== Creating a Rio that acts like /dev/null
|
202
|
+
#
|
203
|
+
# <tt>rio(nil)</tt>
|
204
|
+
#
|
205
|
+
# <tt>rio(:null)</tt>
|
206
|
+
#
|
207
|
+
# This rio behaves like the Unix file /dev/null, but does depend on it -
|
208
|
+
# and thus will work on non-Unix systems. Reading behaves as if reading from
|
209
|
+
# an empty file, and writing to it discards anything written.
|
210
|
+
#
|
201
211
|
# ===== Creating a Rio Pipe
|
202
212
|
#
|
203
213
|
# A Rio Pipe is a sequence of Rios that are run with the output of each being
|
@@ -0,0 +1,73 @@
|
|
1
|
+
#--
|
2
|
+
# ===============================================================================
|
3
|
+
# Copyright (c) 2005, 2006 Christopher Kleckner
|
4
|
+
# All rights reserved
|
5
|
+
#
|
6
|
+
# This file is part of the Rio library for ruby.
|
7
|
+
#
|
8
|
+
# Rio is free software; you can redistribute it and/or modify
|
9
|
+
# it under the terms of the GNU General Public License as published by
|
10
|
+
# the Free Software Foundation; either version 2 of the License, or
|
11
|
+
# (at your option) any later version.
|
12
|
+
#
|
13
|
+
# Rio is distributed in the hope that it will be useful,
|
14
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
+
# GNU General Public License for more details.
|
17
|
+
#
|
18
|
+
# You should have received a copy of the GNU General Public License
|
19
|
+
# along with Rio; if not, write to the Free Software
|
20
|
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
21
|
+
# ===============================================================================
|
22
|
+
#++
|
23
|
+
#
|
24
|
+
# To create the documentation for Rio run the command
|
25
|
+
# ruby build_doc.rb
|
26
|
+
# from the distribution directory. Then point your browser at the 'doc/rdoc' directory.
|
27
|
+
#
|
28
|
+
# Suggested Reading
|
29
|
+
# * RIO::Doc::SYNOPSIS
|
30
|
+
# * RIO::Doc::INTRO
|
31
|
+
# * RIO::Doc::HOWTO
|
32
|
+
# * RIO::Rio
|
33
|
+
#
|
34
|
+
# <b>Rio is pre-alpha software.
|
35
|
+
# The documented interface and behavior is subject to change without notice.</b>
|
36
|
+
|
37
|
+
|
38
|
+
require 'rio/context/cxx.rb'
|
39
|
+
|
40
|
+
module RIO
|
41
|
+
module Cx
|
42
|
+
module Methods
|
43
|
+
def closeoneof(arg=true,&block) cxx('closeoneof',arg,&block) end
|
44
|
+
def nocloseoneof(arg=false,&block) nocxx('closeoneof',arg,&block) end
|
45
|
+
def closeoneof?() cxx?('closeoneof') end
|
46
|
+
def closeoneof_(arg=true) cxx_('closeoneof',arg) end
|
47
|
+
protected :closeoneof_
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
module Cx
|
52
|
+
module Methods
|
53
|
+
def closeoncopy(arg=true,&block) cxx('closeoncopy',arg,&block) end
|
54
|
+
def nocloseoncopy(arg=false,&block) nocxx('closeoncopy',arg,&block) end
|
55
|
+
def closeoncopy?() cxx?('closeoncopy') end
|
56
|
+
def closeoncopy_(arg=true) cxx_('closeoncopy',arg) end
|
57
|
+
protected :closeoncopy_
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
module Cx
|
62
|
+
module Methods
|
63
|
+
def noautoclose(arg=false,&block)
|
64
|
+
closeoncopy(arg).closeoneof(arg,&block)
|
65
|
+
end
|
66
|
+
def noautoclose_(arg=false)
|
67
|
+
closeoncopy_(arg).closeoneof_(arg)
|
68
|
+
end
|
69
|
+
protected :noautoclose_
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
data/lib/rio/context/copying.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#--
|
2
2
|
# ===============================================================================
|
3
|
-
# Copyright (c) 2005, Christopher Kleckner
|
3
|
+
# Copyright (c) 2005, 2006 Christopher Kleckner
|
4
4
|
# All rights reserved
|
5
5
|
#
|
6
6
|
# This file is part of the Rio library for ruby.
|
@@ -22,7 +22,7 @@
|
|
22
22
|
#++
|
23
23
|
#
|
24
24
|
# To create the documentation for Rio run the command
|
25
|
-
#
|
25
|
+
# ruby build_doc.rb
|
26
26
|
# from the distribution directory. Then point your browser at the 'doc/rdoc' directory.
|
27
27
|
#
|
28
28
|
# Suggested Reading
|