rio 0.3.7 → 0.3.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (208) hide show
  1. data/ChangeLog +1273 -1482
  2. data/README +2 -2
  3. data/Rakefile +5 -5
  4. data/VERSION +1 -1
  5. data/{RUNME.1st.rb → build_doc.rb} +4 -10
  6. data/doc/ANNOUNCE +33 -80
  7. data/doc/RELEASE_NOTES +31 -1
  8. data/doc/generators/template/html/rio.rb +3 -3
  9. data/lib/rio/abstract_method.rb +2 -2
  10. data/lib/rio/argv.rb +2 -2
  11. data/lib/rio/arycopy.rb +2 -2
  12. data/lib/rio/assert.rb +2 -2
  13. data/lib/rio/base.rb +2 -2
  14. data/lib/rio/callstr.rb +47 -0
  15. data/lib/rio/const.rb +52 -0
  16. data/lib/rio/construct.rb +6 -24
  17. data/lib/rio/constructor.rb +12 -2
  18. data/lib/rio/context/autoclose.rb +73 -0
  19. data/lib/rio/context/copying.rb +2 -2
  20. data/lib/rio/context/cxx.rb +2 -2
  21. data/lib/rio/context/dir.rb +2 -2
  22. data/lib/rio/context/gzip.rb +2 -2
  23. data/lib/rio/context/methods.rb +6 -34
  24. data/lib/rio/context/skip.rb +2 -2
  25. data/lib/rio/context/stream.rb +2 -2
  26. data/lib/rio/context.rb +17 -2
  27. data/lib/rio/cp.rb +35 -9
  28. data/lib/rio/def.rb +54 -0
  29. data/lib/rio/dir.rb +19 -20
  30. data/lib/rio/doc/HOWTO.rb +23 -7
  31. data/lib/rio/doc/INTRO.rb +57 -23
  32. data/lib/rio/doc/MISC.rb +2 -2
  33. data/lib/rio/doc/OPTIONAL.rb +134 -0
  34. data/lib/rio/doc/SYNOPSIS.rb +11 -4
  35. data/lib/rio/doc.rb +2 -2
  36. data/lib/rio/entrysel.rb +25 -6
  37. data/lib/rio/exception/copy.rb +2 -2
  38. data/lib/rio/exception/notsupported.rb +47 -0
  39. data/lib/rio/exception/open.rb +2 -2
  40. data/lib/rio/exception/state.rb +2 -2
  41. data/lib/rio/exception.rb +2 -2
  42. data/lib/rio/ext/csv.rb +56 -11
  43. data/lib/rio/ext/yaml.rb +2 -2
  44. data/lib/rio/ext/zipfile.rb +91 -0
  45. data/lib/rio/ext.rb +38 -3
  46. data/lib/rio/factory.rb +17 -34
  47. data/lib/rio/file.rb +48 -8
  48. data/lib/rio/filter/closeoneof.rb +36 -16
  49. data/lib/rio/filter/gzip.rb +2 -2
  50. data/lib/rio/filter.rb +2 -2
  51. data/lib/rio/fs/base.rb +42 -0
  52. data/lib/rio/fs/impl.rb +123 -0
  53. data/lib/rio/fs/native.rb +76 -0
  54. data/lib/rio/{record.rb → fs/stream.rb} +21 -18
  55. data/lib/rio/fs/url.rb +64 -0
  56. data/lib/rio/ftp/{ioh.rb → conncache.rb} +38 -39
  57. data/lib/rio/ftp/dir.rb +95 -0
  58. data/lib/rio/ftp/fs.rb +173 -0
  59. data/lib/rio/ftp/ftpfile.rb +20 -0
  60. data/lib/rio/grande.rb +2 -2
  61. data/lib/rio/handle.rb +2 -2
  62. data/lib/rio/if/basic.rb +2 -2
  63. data/lib/rio/if/csv.rb +2 -2
  64. data/lib/rio/if/dir.rb +2 -2
  65. data/lib/rio/if/file.rb +26 -2
  66. data/lib/rio/if/fileordir.rb +44 -49
  67. data/lib/rio/if/grande.rb +32 -10
  68. data/lib/rio/if/grande_entry.rb +12 -2
  69. data/lib/rio/if/grande_stream.rb +17 -28
  70. data/lib/rio/if/internal.rb +2 -2
  71. data/lib/rio/if/path.rb +7 -6
  72. data/lib/rio/if/stream.rb +85 -29
  73. data/lib/rio/if/string.rb +2 -2
  74. data/lib/rio/if/temp.rb +2 -2
  75. data/lib/rio/if/test.rb +37 -4
  76. data/lib/rio/if/yaml.rb +2 -2
  77. data/lib/rio/if.rb +2 -2
  78. data/lib/rio/impl/path.rb +2 -2
  79. data/lib/rio/ioh.rb +17 -6
  80. data/lib/rio/iomode.rb +4 -3
  81. data/lib/rio/ios/fail.rb +107 -0
  82. data/lib/rio/ios/generic.rb +120 -0
  83. data/lib/rio/ios/mode.rb +61 -0
  84. data/lib/rio/ios/null.rb +120 -0
  85. data/lib/rio/iowrap.rb +129 -0
  86. data/lib/rio/kernel.rb +12 -3
  87. data/lib/rio/local.rb +2 -2
  88. data/lib/rio/match.rb +3 -3
  89. data/lib/rio/matchrecord.rb +2 -2
  90. data/lib/rio/no_warn.rb +50 -0
  91. data/lib/rio/{arrayio.rb → nullio.rb} +47 -86
  92. data/lib/rio/open3.rb +2 -2
  93. data/lib/rio/ops/construct.rb +20 -13
  94. data/lib/rio/ops/create.rb +10 -19
  95. data/lib/rio/ops/dir.rb +60 -54
  96. data/lib/rio/ops/either.rb +11 -9
  97. data/lib/rio/ops/file.rb +28 -24
  98. data/lib/rio/ops/path.rb +45 -43
  99. data/lib/rio/ops/stream/input.rb +12 -8
  100. data/lib/rio/ops/stream/output.rb +2 -2
  101. data/lib/rio/ops/stream/read.rb +35 -32
  102. data/lib/rio/ops/stream/write.rb +5 -5
  103. data/lib/rio/ops/stream.rb +7 -3
  104. data/lib/rio/ops/symlink.rb +12 -10
  105. data/lib/rio/path/reset.rb +5 -5
  106. data/lib/rio/path.rb +32 -24
  107. data/lib/rio/piper/cp.rb +2 -2
  108. data/lib/rio/piper.rb +2 -2
  109. data/lib/rio/prompt.rb +2 -2
  110. data/lib/rio/rectype.rb +9 -7
  111. data/lib/rio/rl/base.rb +5 -4
  112. data/lib/rio/rl/builder.rb +17 -5
  113. data/lib/rio/rl/ioi.rb +14 -4
  114. data/lib/rio/rl/path.rb +23 -15
  115. data/lib/rio/rl/pathmethods.rb +12 -2
  116. data/lib/rio/rl/uri.rb +13 -6
  117. data/lib/rio/scheme/aryio.rb +3 -3
  118. data/lib/rio/scheme/cmdio.rb +4 -3
  119. data/lib/rio/scheme/cmdpipe.rb +3 -35
  120. data/lib/rio/scheme/fd.rb +4 -3
  121. data/lib/rio/scheme/ftp.rb +36 -7
  122. data/lib/rio/scheme/http.rb +2 -2
  123. data/lib/rio/{context/closeoneof.rb → scheme/null.rb} +17 -11
  124. data/lib/rio/scheme/path.rb +28 -30
  125. data/lib/rio/scheme/stderr.rb +4 -4
  126. data/lib/rio/scheme/stdio.rb +6 -5
  127. data/lib/rio/scheme/strio.rb +10 -20
  128. data/lib/rio/scheme/sysio.rb +5 -2
  129. data/lib/rio/scheme/tcp.rb +4 -3
  130. data/lib/rio/scheme/temp.rb +14 -1
  131. data/lib/rio/state/error.rb +2 -2
  132. data/lib/rio/state.rb +80 -34
  133. data/lib/rio/stream/base.rb +7 -2
  134. data/lib/rio/stream/duplex.rb +13 -10
  135. data/lib/rio/stream/open.rb +74 -79
  136. data/lib/rio/stream.rb +15 -23
  137. data/lib/rio/symantics.rb +2 -2
  138. data/lib/rio/tempdir.rb +132 -132
  139. data/lib/rio/to_rio/all.rb +40 -0
  140. data/lib/rio/to_rio/array.rb +40 -0
  141. data/lib/rio/to_rio/io.rb +41 -0
  142. data/lib/rio/to_rio/object.rb +43 -0
  143. data/lib/rio/to_rio/string.rb +41 -0
  144. data/lib/rio/to_rio.rb +13 -2
  145. data/lib/rio/uri/file.rb +2 -2
  146. data/lib/rio/util.rb +2 -2
  147. data/lib/rio/version.rb +3 -3
  148. data/lib/rio.rb +16 -25
  149. data/test/bin/count_lines.rb +11 -0
  150. data/test/bin/find_lines.rb +13 -0
  151. data/test/bin/list_dir.rb +14 -0
  152. data/test/ftp/all.rb +9 -0
  153. data/test/ftp/anon_misc.rb +112 -0
  154. data/test/ftp/anon_read.rb +105 -0
  155. data/test/ftp/anon_special.rb +68 -0
  156. data/test/ftp/anon_write.rb +63 -0
  157. data/test/ftp/ftp2ftp.rb +51 -0
  158. data/test/ftp/initftpfiles.rb +14 -0
  159. data/test/ftp/testdef.rb +51 -0
  160. data/test/gem_runtests.rb +15 -15
  161. data/test/runalltests.rb +15 -0
  162. data/test/runftptests.rb +14 -0
  163. data/test/{1.rb → runhttptests.rb} +14 -14
  164. data/test/runtests.rb +14 -14
  165. data/test/tc/all.rb +36 -21
  166. data/test/tc/cmdpipe.rb +18 -15
  167. data/test/tc/copy-from-http.rb +89 -0
  168. data/test/tc/copy-from.rb +1 -52
  169. data/test/tc/copy.rb +19 -17
  170. data/test/tc/csv2.rb +6 -3
  171. data/test/tc/empty.rb +47 -0
  172. data/test/tc/emptyriodir.rb +129 -0
  173. data/test/tc/entsel.rb +110 -0
  174. data/test/tc/files_select.rb +92 -0
  175. data/test/tc/get.rb +7 -6
  176. data/test/tc/getrec.rb +2 -5
  177. data/test/tc/gzip.rb +82 -0
  178. data/test/tc/io_each_byte.rb +60 -0
  179. data/test/tc/io_read.rb +80 -0
  180. data/test/tc/iometh.rb +149 -0
  181. data/test/tc/likeio.rb +112 -0
  182. data/test/tc/methods.rb +10 -9
  183. data/test/tc/misc.rb +1 -37
  184. data/test/tc/null.rb +45 -0
  185. data/test/tc/pid.rb +31 -0
  186. data/test/tc/piper.rb +34 -37
  187. data/test/tc/programs_util.rb +24 -0
  188. data/test/tc/readline.rb +30 -0
  189. data/test/tc/rename.rb +12 -0
  190. data/test/tc/tempfile.rb +14 -0
  191. data/test/tc/testcase.rb +6 -0
  192. data/test/tc/tonl.rb +37 -0
  193. metadata +181 -144
  194. data/ex/colx.rb +0 -8
  195. data/ex/findinruby +0 -16
  196. data/ex/findruby +0 -15
  197. data/ex/passwd_report.rb +0 -8
  198. data/ex/prompt.rb +0 -25
  199. data/ex/rgb.txt.gz +0 -0
  200. data/ex/riocat +0 -35
  201. data/ex/riogunzip +0 -31
  202. data/ex/riogzip +0 -24
  203. data/ex/rioprompt.rb +0 -6
  204. data/ex/targz2zip +0 -17
  205. data/ex/tolf +0 -11
  206. data/lib/rio/ftp/conn.rb +0 -167
  207. data/lib/rio/ftp.rb +0 -275
  208. 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
- # rake rdoc
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 = _get_base_from_args(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 _get_base_from_args(args)
98
+ def _get_opts_from_args(args)
93
99
  @base = nil
94
- if !args.empty? and args[-1].kind_of?(::Hash) and (b = args.pop[:base])
95
- @base = case b
96
- when %r%^file://(#{HOST})?(/.*)?$% then b
97
- when %r%^/% then b
98
- else RL.fs2url(::Dir.getwd)+'/'+b
99
- end
100
- @base.squeeze('/')
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
@@ -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
- # rake rdoc
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
- # rake rdoc
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 = _get_base_from_args(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 _get_base_from_args(args)
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])
@@ -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
- # rake rdoc
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'
@@ -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
- # rake rdoc
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
@@ -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
- # rake rdoc
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
- # rake rdoc
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
@@ -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
- # rake rdoc
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/conn'
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::Conn.new(@uri)
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 open(*args)
64
- @uri.open
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
@@ -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
- # rake rdoc
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
- # rake rdoc
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/context/cxx.rb'
38
+ require 'rio/rl/ioi'
39
+ require 'rio/stream'
40
+ require 'rio/stream/open'
39
41
 
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_
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__
@@ -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
- # rake rdoc
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::PathBase
56
+ class RL < RIO::Path::RL
50
57
  def open(m)
51
- ::File.open(self.fspath,m.to_s)
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::PathBase
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__
@@ -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
- # rake rdoc
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
@@ -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
- # rake rdoc
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
- self.ios = $stdin.clone
57
+ return super($stdin.clone)
57
58
  when m.primarily_write?
58
59
  @scheme = 'stdout'
59
- self.ios = $stdout.clone
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
- super()
64
+ nil
64
65
  end
65
66
  def close()
66
67
  @scheme = RIOSCHEME