rio 0.3.7 → 0.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/lib/rio/rl/path.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
|
|
@@ -47,6 +47,7 @@ module RIO
|
|
|
47
47
|
HOST = URI::REGEXP::PATTERN::HOST
|
|
48
48
|
SCHEME = URI::REGEXP::PATTERN::SCHEME
|
|
49
49
|
|
|
50
|
+
#attr :fs
|
|
50
51
|
def initialize(pth,*args)
|
|
51
52
|
|
|
52
53
|
@host = nil # host or nil
|
|
@@ -71,12 +72,17 @@ module RIO
|
|
|
71
72
|
else
|
|
72
73
|
self.fspath = pth
|
|
73
74
|
end
|
|
74
|
-
args =
|
|
75
|
+
args = _get_opts_from_args(args)
|
|
75
76
|
self.join(*args) unless args.empty?
|
|
76
77
|
unless self.absolute? or @base
|
|
77
78
|
@base = RL.fs2url(::Dir.getwd)+'/'
|
|
78
79
|
end
|
|
79
80
|
@fspath.sub!(%r|/\.$|,'/')
|
|
81
|
+
#@fs = openfs_
|
|
82
|
+
super
|
|
83
|
+
end
|
|
84
|
+
def openfs_
|
|
85
|
+
RIO::FS::Native.create()
|
|
80
86
|
end
|
|
81
87
|
def pathroot()
|
|
82
88
|
return nil unless absolute?
|
|
@@ -89,15 +95,21 @@ module RIO
|
|
|
89
95
|
end
|
|
90
96
|
include PathMethods
|
|
91
97
|
|
|
92
|
-
def
|
|
98
|
+
def _get_opts_from_args(args)
|
|
93
99
|
@base = nil
|
|
94
|
-
if !args.empty? and args[-1].kind_of?(::Hash)
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
100
|
+
if !args.empty? and args[-1].kind_of?(::Hash)
|
|
101
|
+
opts = args.pop
|
|
102
|
+
if b = opts[:base]
|
|
103
|
+
@base = case b
|
|
104
|
+
when %r%^file://(#{HOST})?(/.*)?$% then b
|
|
105
|
+
when %r%^/% then b
|
|
106
|
+
else RL.fs2url(::Dir.getwd)+'/'+b
|
|
107
|
+
end
|
|
108
|
+
@base.squeeze('/')
|
|
109
|
+
end
|
|
110
|
+
if fs = opts[:fs]
|
|
111
|
+
@fs = fs
|
|
112
|
+
end
|
|
101
113
|
end
|
|
102
114
|
args
|
|
103
115
|
end
|
|
@@ -170,10 +182,6 @@ module RIO
|
|
|
170
182
|
end
|
|
171
183
|
|
|
172
184
|
|
|
173
|
-
def dirname()
|
|
174
|
-
Impl::U.dirname(self.path_no_slash)
|
|
175
|
-
end
|
|
176
|
-
|
|
177
185
|
end
|
|
178
186
|
end
|
|
179
187
|
end
|
data/lib/rio/rl/pathmethods.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
|
|
@@ -52,6 +52,10 @@ module RIO
|
|
|
52
52
|
|
|
53
53
|
[ur,pr,up]
|
|
54
54
|
end
|
|
55
|
+
def pathdepth()
|
|
56
|
+
pth = self.path_no_slash
|
|
57
|
+
(pth == '/' ? 0 : pth.count('/'))
|
|
58
|
+
end
|
|
55
59
|
def split()
|
|
56
60
|
if absolute?
|
|
57
61
|
parts = self._parts
|
|
@@ -74,6 +78,7 @@ module RIO
|
|
|
74
78
|
sa = args.map { |arg| ::URI.escape(arg.to_s,ESCAPE) }
|
|
75
79
|
sa.unshift(self.urlpath) unless self.urlpath.empty?
|
|
76
80
|
self.urlpath = sa.join('/').squeeze('/')
|
|
81
|
+
self
|
|
77
82
|
end
|
|
78
83
|
|
|
79
84
|
def parse_url(str)
|
|
@@ -90,6 +95,11 @@ module RIO
|
|
|
90
95
|
self.class.new(uri.merge(other.uri))
|
|
91
96
|
end
|
|
92
97
|
|
|
98
|
+
def dirname()
|
|
99
|
+
::File.dirname(self.path_no_slash)
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
|
|
93
103
|
end
|
|
94
104
|
end
|
|
95
105
|
end
|
data/lib/rio/rl/uri.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
|
|
@@ -36,26 +36,33 @@
|
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
require 'rio/rl/base'
|
|
39
|
+
require 'rio/fs/url'
|
|
40
|
+
|
|
39
41
|
module RIO
|
|
40
42
|
module RL
|
|
41
43
|
class URIBase < Base
|
|
42
|
-
attr_reader :uri
|
|
43
|
-
attr_writer :base
|
|
44
44
|
SCHEME = URI::REGEXP::PATTERN::SCHEME
|
|
45
|
+
attr_reader :uri
|
|
46
|
+
#attr :fs
|
|
45
47
|
def initialize(u,*args)
|
|
46
48
|
#p callstr('initialize',u,*args)
|
|
47
49
|
# u should be a ::URI or something that can be parsed to one
|
|
48
|
-
args =
|
|
50
|
+
args = _get_opts_from_args(args)
|
|
49
51
|
@uri = _mkuri(u)
|
|
50
52
|
self.join(*args)
|
|
51
53
|
@uri.path = '/' if @uri.absolute? and @uri.path == ''
|
|
54
|
+
#@fs = self.openfs_
|
|
55
|
+
super
|
|
56
|
+
end
|
|
57
|
+
def openfs_()
|
|
58
|
+
RIO::FS::URL.create()
|
|
52
59
|
end
|
|
53
60
|
def initialize_copy(*args)
|
|
54
61
|
super
|
|
55
62
|
@uri = @uri.clone unless @uri.nil?
|
|
56
63
|
@base = @base.clone unless @base.nil?
|
|
57
64
|
end
|
|
58
|
-
def
|
|
65
|
+
def _get_opts_from_args(args)
|
|
59
66
|
# args.each { |a| p "get_base len=#{args.length} #{a.class}##{a.to_s}" }
|
|
60
67
|
@base = nil
|
|
61
68
|
if !args.empty? and args[-1].kind_of?(::Hash) and (b = args.pop[:base])
|
data/lib/rio/scheme/aryio.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
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
# <b>Rio is pre-alpha software.
|
|
35
35
|
# The documented interface and behavior is subject to change without notice.</b>
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
__END__
|
|
38
38
|
require 'rio/rl/ioi'
|
|
39
39
|
require 'rio/arrayio'
|
|
40
40
|
require 'rio/stream'
|
data/lib/rio/scheme/cmdio.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
|
|
@@ -49,6 +49,7 @@ module RIO
|
|
|
49
49
|
when self.class then @cmd = cmd.cmd
|
|
50
50
|
else @cmd = cmd
|
|
51
51
|
end
|
|
52
|
+
super
|
|
52
53
|
end
|
|
53
54
|
def opaque()
|
|
54
55
|
URI.escape(@cmd,RIO::RL::ESCAPE)
|
|
@@ -59,7 +60,7 @@ module RIO
|
|
|
59
60
|
def open(m)
|
|
60
61
|
#p "opening #{@cmd}"
|
|
61
62
|
#raise RuntimeError, "Should Not Open"
|
|
62
|
-
::IO.popen(@cmd,m.to_s)
|
|
63
|
+
super(::IO.popen(@cmd,m.to_s))
|
|
63
64
|
end
|
|
64
65
|
|
|
65
66
|
# must be able to process
|
data/lib/rio/scheme/cmdpipe.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
|
|
@@ -58,6 +58,7 @@ module RIO
|
|
|
58
58
|
else
|
|
59
59
|
@piper = Piper::Base.new(*args)
|
|
60
60
|
end
|
|
61
|
+
super
|
|
61
62
|
end
|
|
62
63
|
def initialize_copy(*args)
|
|
63
64
|
@piper = @piper.clone
|
|
@@ -112,39 +113,6 @@ module RIO
|
|
|
112
113
|
# become 'CmdPipe::Stream::Open'
|
|
113
114
|
# end
|
|
114
115
|
end
|
|
115
|
-
class Open < RIO::Stream::Open
|
|
116
|
-
def input() stream_state('CmdPipe::Stream::Input') end
|
|
117
|
-
def output() stream_state('CmdPipe::Stream::Output') end
|
|
118
|
-
def inout() stream_state('CmdPipe::Stream::InOut') end
|
|
119
|
-
def open_(*args)
|
|
120
|
-
unless open?
|
|
121
|
-
ios = self.rl.open(mode?,*args)
|
|
122
|
-
self.ioh = ios #IOH::Stream.new(ios)
|
|
123
|
-
end
|
|
124
|
-
self
|
|
125
|
-
end
|
|
126
|
-
end
|
|
127
|
-
|
|
128
|
-
module Ops
|
|
129
|
-
end
|
|
130
|
-
|
|
131
|
-
class Input < RIO::Stream::Input
|
|
132
|
-
include Ops
|
|
133
|
-
def ior
|
|
134
|
-
ioh.rd
|
|
135
|
-
end
|
|
136
|
-
end
|
|
137
|
-
|
|
138
|
-
class Output < RIO::Stream::Output
|
|
139
|
-
include Ops
|
|
140
|
-
def iow
|
|
141
|
-
ioh.wr
|
|
142
|
-
end
|
|
143
|
-
end
|
|
144
|
-
|
|
145
|
-
class InOut < RIO::Stream::InOut
|
|
146
|
-
include Ops
|
|
147
|
-
end
|
|
148
116
|
end
|
|
149
117
|
end
|
|
150
118
|
end
|
data/lib/rio/scheme/fd.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
|
|
@@ -45,9 +45,10 @@ module RIO
|
|
|
45
45
|
RIOPATH = RIO::RL::CHMAP.invert[RIOSCHEME].freeze
|
|
46
46
|
def initialize(fd)
|
|
47
47
|
@fd = fd
|
|
48
|
+
super
|
|
48
49
|
end
|
|
49
50
|
def open(m,*args)
|
|
50
|
-
::IO.new(@fd,m.to_s)
|
|
51
|
+
super(::IO.new(@fd,m.to_s))
|
|
51
52
|
end
|
|
52
53
|
def opaque() "#{@fd}" end
|
|
53
54
|
# must be able to process
|
data/lib/rio/scheme/ftp.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
|
|
@@ -37,21 +37,39 @@
|
|
|
37
37
|
|
|
38
38
|
require 'net/ftp'
|
|
39
39
|
require 'open-uri'
|
|
40
|
-
require 'rio/ftp/
|
|
40
|
+
require 'rio/ftp/fs'
|
|
41
|
+
require 'rio/rl/path'
|
|
42
|
+
require 'rio/ftp/dir'
|
|
43
|
+
require 'rio/ftp/ftpfile'
|
|
41
44
|
|
|
42
45
|
module RIO
|
|
43
46
|
module FTP #:nodoc: all
|
|
44
|
-
RESET_STATE = 'FTP::State::Reset'
|
|
47
|
+
#RESET_STATE = 'FTP::State::Reset'
|
|
48
|
+
RESET_STATE = RIO::RL::PathBase::RESET_STATE
|
|
45
49
|
|
|
46
50
|
require 'rio/rl/uri'
|
|
47
51
|
|
|
48
52
|
class RL < RIO::RL::URIBase
|
|
53
|
+
def initialize(*args)
|
|
54
|
+
super
|
|
55
|
+
@ftype = nil
|
|
56
|
+
@names = nil
|
|
57
|
+
end
|
|
49
58
|
def self.splitrl(s)
|
|
50
59
|
sub,opq,whole = split_riorl(s)
|
|
51
60
|
[whole]
|
|
52
61
|
end
|
|
62
|
+
def openfs_
|
|
63
|
+
RIO::FTP::FS.create(@uri)
|
|
64
|
+
end
|
|
53
65
|
def open(*args)
|
|
54
|
-
RIO::FTP::
|
|
66
|
+
IOH::Dir.new(RIO::FTP::Dir::Stream.new(@uri))
|
|
67
|
+
end
|
|
68
|
+
def file_rl()
|
|
69
|
+
RIO::FTP::Stream::RL.new(@uri)
|
|
70
|
+
end
|
|
71
|
+
def dir_rl()
|
|
72
|
+
self
|
|
55
73
|
end
|
|
56
74
|
end
|
|
57
75
|
module Stream
|
|
@@ -60,8 +78,19 @@ module RIO
|
|
|
60
78
|
sub,opq,whole = split_riorl(s)
|
|
61
79
|
[whole]
|
|
62
80
|
end
|
|
63
|
-
def
|
|
64
|
-
@uri
|
|
81
|
+
def openfs_
|
|
82
|
+
RIO::FTP::FS.create(@uri)
|
|
83
|
+
end
|
|
84
|
+
def open(m)
|
|
85
|
+
case
|
|
86
|
+
when m.primarily_write?
|
|
87
|
+
RIO::IOH::Stream.new(RIO::FTP::FTPFile.new(fs.remote_path(@uri.to_s),fs.conn))
|
|
88
|
+
else
|
|
89
|
+
RIO::IOH::Stream.new(@uri.open)
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
def file_rl()
|
|
93
|
+
self
|
|
65
94
|
end
|
|
66
95
|
end
|
|
67
96
|
end
|
data/lib/rio/scheme/http.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
|
|
@@ -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
|
|
@@ -35,16 +35,22 @@
|
|
|
35
35
|
# The documented interface and behavior is subject to change without notice.</b>
|
|
36
36
|
|
|
37
37
|
|
|
38
|
-
require 'rio/
|
|
38
|
+
require 'rio/rl/ioi'
|
|
39
|
+
require 'rio/stream'
|
|
40
|
+
require 'rio/stream/open'
|
|
39
41
|
|
|
40
|
-
module RIO
|
|
41
|
-
module
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
42
|
+
module RIO
|
|
43
|
+
module Null #:nodoc: all
|
|
44
|
+
RESET_STATE = RL::IOIBase::RESET_STATE
|
|
45
|
+
|
|
46
|
+
class RL < RL::IOIBase
|
|
47
|
+
RIOSCHEME = 'null'
|
|
48
|
+
|
|
49
|
+
def open(m,*args)
|
|
50
|
+
require 'rio/ios/null'
|
|
51
|
+
super(RIO::IOS::Null.new(nil,m))
|
|
52
|
+
end
|
|
48
53
|
end
|
|
49
54
|
end
|
|
50
55
|
end
|
|
56
|
+
__END__
|
data/lib/rio/scheme/path.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
|
|
@@ -36,28 +36,41 @@
|
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
require 'rio/rl/path'
|
|
39
|
+
require 'rio/ioh'
|
|
39
40
|
module RIO
|
|
40
41
|
module Path #:nodoc: all
|
|
41
42
|
RESET_STATE = RL::PathBase::RESET_STATE
|
|
42
43
|
|
|
43
44
|
class RL < RL::PathBase
|
|
45
|
+
def file_rl()
|
|
46
|
+
RIO::File::RL.new(self.uri, {:fs => self.fs})
|
|
47
|
+
end
|
|
48
|
+
def dir_rl()
|
|
49
|
+
RIO::Dir::RL.new(self.uri, {:fs => self.fs})
|
|
50
|
+
end
|
|
44
51
|
end
|
|
45
52
|
end
|
|
46
53
|
module File
|
|
47
54
|
RESET_STATE = RL::PathBase::RESET_STATE
|
|
48
55
|
|
|
49
|
-
class RL < RL
|
|
56
|
+
class RL < RIO::Path::RL
|
|
50
57
|
def open(m)
|
|
51
|
-
::
|
|
58
|
+
IOH::Stream.new(fs.file.open(self.fspath,m.to_s))
|
|
59
|
+
end
|
|
60
|
+
def file_rl()
|
|
61
|
+
self
|
|
52
62
|
end
|
|
53
63
|
end
|
|
54
64
|
end
|
|
55
65
|
module Dir
|
|
56
66
|
RESET_STATE = RL::PathBase::RESET_STATE
|
|
57
67
|
|
|
58
|
-
class RL < RL
|
|
68
|
+
class RL < RIO::Path::RL
|
|
59
69
|
def open()
|
|
60
|
-
::Dir.open(self.fspath)
|
|
70
|
+
IOH::Dir.new(fs.dir.open(self.fspath))
|
|
71
|
+
end
|
|
72
|
+
def dir_rl()
|
|
73
|
+
self
|
|
61
74
|
end
|
|
62
75
|
end
|
|
63
76
|
end
|
|
@@ -66,36 +79,21 @@ module RIO
|
|
|
66
79
|
require 'rio/ops/symlink'
|
|
67
80
|
module Path
|
|
68
81
|
module Stream
|
|
82
|
+
module Ops
|
|
83
|
+
include RIO::Ops::Path::Str
|
|
84
|
+
end
|
|
85
|
+
|
|
69
86
|
class Open < RIO::Stream::Open
|
|
70
|
-
include Ops::Path::Status
|
|
71
|
-
include Ops::Path::URI
|
|
72
|
-
include Ops::Path::Query
|
|
87
|
+
include RIO::Ops::Path::Status
|
|
88
|
+
include RIO::Ops::Path::URI
|
|
89
|
+
include RIO::Ops::Path::Query
|
|
73
90
|
def stream_state(cl)
|
|
74
91
|
next_state = super
|
|
75
92
|
next_state.extend(RIO::Ops::Symlink::Existing) if symlink?
|
|
76
|
-
next_state
|
|
93
|
+
next_state.extend(Ops)
|
|
77
94
|
end
|
|
78
|
-
def input() stream_state('Path::Stream::Input') end
|
|
79
|
-
def output() stream_state('Path::Stream::Output') end
|
|
80
|
-
|
|
81
|
-
def inout() stream_state('Path::Stream::InOut') end
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
module Ops
|
|
85
|
-
include RIO::Ops::Path::Str
|
|
86
|
-
end
|
|
87
|
-
|
|
88
|
-
class Input < RIO::Stream::Input
|
|
89
|
-
include Ops
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
class Output < RIO::Stream::Output
|
|
93
|
-
include Ops
|
|
94
|
-
end
|
|
95
|
-
|
|
96
|
-
class InOut < RIO::Stream::InOut
|
|
97
|
-
include Ops
|
|
98
95
|
end
|
|
99
96
|
end
|
|
100
97
|
end
|
|
101
98
|
end
|
|
99
|
+
__END__
|
data/lib/rio/scheme/stderr.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
|
|
@@ -48,8 +48,8 @@ module RIO
|
|
|
48
48
|
end
|
|
49
49
|
def opaque() '' end
|
|
50
50
|
def open(*args)
|
|
51
|
-
self.ios = $stderr
|
|
52
|
-
super()
|
|
51
|
+
#self.ios = $stderr
|
|
52
|
+
super($stderr)
|
|
53
53
|
end
|
|
54
54
|
end
|
|
55
55
|
end
|
data/lib/rio/scheme/stdio.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
|
|
@@ -46,6 +46,7 @@ module RIO
|
|
|
46
46
|
attr_reader :scheme
|
|
47
47
|
def initialize(sch=RIOSCHEME)
|
|
48
48
|
@scheme = sch
|
|
49
|
+
#super
|
|
49
50
|
end
|
|
50
51
|
def opaque() '' end
|
|
51
52
|
require 'rio/iomode'
|
|
@@ -53,14 +54,14 @@ module RIO
|
|
|
53
54
|
case
|
|
54
55
|
when m.primarily_read?
|
|
55
56
|
@scheme = 'stdin'
|
|
56
|
-
|
|
57
|
+
return super($stdin.clone)
|
|
57
58
|
when m.primarily_write?
|
|
58
59
|
@scheme = 'stdout'
|
|
59
|
-
|
|
60
|
+
return super($stdout.clone)
|
|
60
61
|
else
|
|
61
62
|
raise ArgumentError,sprintf("Can not %s a %s with mode '%s'",'open',self.class,m)
|
|
62
63
|
end
|
|
63
|
-
|
|
64
|
+
nil
|
|
64
65
|
end
|
|
65
66
|
def close()
|
|
66
67
|
@scheme = RIOSCHEME
|