rio 0.5.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +1 -1
- data/README +1 -1
- data/lib/rio.rb +5 -4
- data/lib/rio/abstract_method.rb +1 -1
- data/lib/rio/alturi.rb +10 -69
- data/lib/rio/alturi/algorithm.rb +1 -18
- data/lib/rio/alturi/escape.rb +0 -4
- data/lib/rio/alturi/parse.rb +0 -29
- data/lib/rio/alturi/path_parts.rb +0 -2
- data/lib/rio/alturi/uri_parts.rb +3 -32
- data/lib/rio/argv.rb +1 -1
- data/lib/rio/arraynge.rb +1 -3
- data/lib/rio/arycopy.rb +1 -1
- data/lib/rio/assert.rb +31 -47
- data/lib/rio/base.rb +1 -1
- data/lib/rio/callstr.rb +1 -1
- data/lib/rio/const.rb +1 -1
- data/lib/rio/construct.rb +1 -1
- data/lib/rio/constructor.rb +1 -1
- data/lib/rio/context.rb +8 -4
- data/lib/rio/context/autoclose.rb +1 -1
- data/lib/rio/context/binmode.rb +1 -7
- data/lib/rio/context/copying.rb +1 -1
- data/lib/rio/context/cxx.rb +1 -1
- data/lib/rio/context/dir.rb +1 -1
- data/lib/rio/context/encoding.rb +1 -2
- data/lib/rio/context/gzip.rb +1 -1
- data/lib/rio/context/methods.rb +1 -6
- data/lib/rio/context/skip.rb +1 -1
- data/lib/rio/context/stream.rb +1 -8
- data/lib/rio/cp.rb +1 -1
- data/lib/rio/cxuri.rb +11 -7
- data/lib/rio/dbg/trace_states.rb +0 -2
- data/lib/rio/def.rb +1 -1
- data/lib/rio/dir.rb +2 -2
- data/lib/rio/doc.rb +1 -1
- data/lib/rio/entrysel.rb +6 -6
- data/lib/rio/exception.rb +1 -1
- data/lib/rio/exception/copy.rb +1 -1
- data/lib/rio/exception/notimplemented.rb +1 -1
- data/lib/rio/exception/notsupported.rb +1 -1
- data/lib/rio/exception/open.rb +1 -12
- data/lib/rio/exception/state.rb +1 -1
- data/lib/rio/ext.rb +1 -8
- data/lib/rio/ext/csv.rb +1 -25
- data/lib/rio/ext/csv/csv-legacy.rb +1 -49
- data/lib/rio/ext/csv/csv.rb +1 -24
- data/lib/rio/ext/csv/filter.rb +1 -19
- data/lib/rio/ext/if.rb +1 -1
- data/lib/rio/ext/mp3info.rb +6 -5
- data/lib/rio/ext/splitlines.rb +1 -23
- data/lib/rio/ext/yaml.rb +1 -16
- data/lib/rio/ext/yaml/doc.rb +1 -6
- data/lib/rio/ext/yaml/tie.rb +4 -7
- data/lib/rio/ext/zipfile.rb +1 -56
- data/lib/rio/ext/zipfile/fs.rb +1 -30
- data/lib/rio/ext/zipfile/rl.rb +1 -128
- data/lib/rio/ext/zipfile/rootdir.rb +1 -30
- data/lib/rio/ext/zipfile/state.rb +1 -105
- data/lib/rio/ext/zipfile/wrap.rb +1 -86
- data/lib/rio/factory.rb +2 -100
- data/lib/rio/fibpipe.rb +0 -98
- data/lib/rio/file.rb +1 -12
- data/lib/rio/filter.rb +1 -1
- data/lib/rio/filter/closeoneof.rb +1 -10
- data/lib/rio/filter/gzip.rb +1 -16
- data/lib/rio/fs.rb +75 -92
- data/lib/rio/fs/base.rb +1 -1
- data/lib/rio/fs/impl.rb +1 -1
- data/lib/rio/fs/native.rb +1 -1
- data/lib/rio/fs/stream.rb +1 -1
- data/lib/rio/fs/url.rb +1 -1
- data/lib/rio/ftp/conncache.rb +1 -15
- data/lib/rio/ftp/dir.rb +1 -2
- data/lib/rio/ftp/fs.rb +1 -13
- data/lib/rio/fwd.rb +31 -8
- data/lib/rio/grande.rb +2 -4
- data/lib/rio/handle.rb +1 -1
- data/lib/rio/if.rb +1 -7
- data/lib/rio/if/basic.rb +1 -5
- data/lib/rio/if/csv.rb +1 -1
- data/lib/rio/if/dir.rb +1 -1
- data/lib/rio/if/file.rb +1 -1
- data/lib/rio/if/fileordir.rb +1 -1
- data/lib/rio/if/grande.rb +1 -1
- data/lib/rio/if/grande_entry.rb +1 -1
- data/lib/rio/if/grande_stream.rb +1 -1
- data/lib/rio/if/internal.rb +1 -1
- data/lib/rio/if/path.rb +1 -1
- data/lib/rio/if/rubyio.rb +1 -1
- data/lib/rio/if/string.rb +1 -1
- data/lib/rio/if/temp.rb +1 -1
- data/lib/rio/if/test.rb +1 -1
- data/lib/rio/if/yaml.rb +1 -1
- data/lib/rio/ioh.rb +42 -24
- data/lib/rio/iomode.rb +3 -3
- data/lib/rio/ios/fail.rb +1 -1
- data/lib/rio/ios/generic.rb +1 -1
- data/lib/rio/ios/mode.rb +1 -1
- data/lib/rio/ios/null.rb +1 -13
- data/lib/rio/iowrap.rb +1 -14
- data/lib/rio/kernel.rb +1 -2
- data/lib/rio/local.rb +1 -13
- data/lib/rio/match.rb +1 -2
- data/lib/rio/matchrecord.rb +5 -34
- data/lib/rio/no_warn.rb +1 -1
- data/lib/rio/nullio.rb +1 -1
- data/lib/rio/open3.rb +1 -10
- data/lib/rio/ops.rb +1 -1
- data/lib/rio/ops/construct.rb +1 -1
- data/lib/rio/ops/create.rb +1 -3
- data/lib/rio/ops/dir.rb +4 -46
- data/lib/rio/ops/either.rb +1 -3
- data/lib/rio/ops/file.rb +1 -25
- data/lib/rio/ops/path.rb +1 -18
- data/lib/rio/ops/stream.rb +4 -5
- data/lib/rio/ops/stream/input.rb +1 -10
- data/lib/rio/ops/stream/output.rb +1 -3
- data/lib/rio/ops/stream/read.rb +1 -1
- data/lib/rio/ops/stream/write.rb +1 -1
- data/lib/rio/ops/symlink.rb +1 -10
- data/lib/rio/path.rb +1 -4
- data/lib/rio/path/reset.rb +1 -6
- data/lib/rio/piper.rb +1 -4
- data/lib/rio/piper/cp.rb +1 -16
- data/lib/rio/prompt.rb +1 -1
- data/lib/rio/rectype.rb +1 -4
- data/lib/rio/rl/base.rb +1 -14
- data/lib/rio/rl/builder.rb +1 -12
- data/lib/rio/rl/chmap.rb +1 -11
- data/lib/rio/rl/fs2url.rb +1 -8
- data/lib/rio/rl/ioi.rb +1 -2
- data/lib/rio/rl/path.rb +1 -20
- data/lib/rio/rl/pathmethods.rb +1 -3
- data/lib/rio/rl/uri.rb +1 -11
- data/lib/rio/rl/withpath.rb +2 -30
- data/lib/rio/rrl/base.rb +1 -6
- data/lib/rio/rrl/builder.rb +2 -8
- data/lib/rio/rrl/chmap.rb +1 -11
- data/lib/rio/rrl/ioi.rb +1 -3
- data/lib/rio/rrl/path.rb +1 -11
- data/lib/rio/rrl/withpath.rb +8 -48
- data/lib/rio/scheme/aryio.rb +1 -1
- data/lib/rio/scheme/cmdio.rb +3 -15
- data/lib/rio/scheme/cmdpipe.rb +1 -5
- data/lib/rio/scheme/fd.rb +1 -1
- data/lib/rio/scheme/ftp.rb +1 -40
- data/lib/rio/scheme/http.rb +10 -7
- data/lib/rio/scheme/null.rb +1 -1
- data/lib/rio/scheme/path.rb +1 -63
- data/lib/rio/scheme/stderr.rb +1 -2
- data/lib/rio/scheme/stdio.rb +3 -3
- data/lib/rio/scheme/strio.rb +1 -3
- data/lib/rio/scheme/sysio.rb +1 -1
- data/lib/rio/scheme/tcp.rb +1 -2
- data/lib/rio/scheme/temp.rb +9 -38
- data/lib/rio/state.rb +4 -38
- data/lib/rio/state/data.rb +4 -5
- data/lib/rio/state/error.rb +2 -6
- data/lib/rio/stream.rb +1 -31
- data/lib/rio/stream/base.rb +1 -5
- data/lib/rio/stream/duplex.rb +1 -16
- data/lib/rio/stream/open.rb +1 -11
- data/lib/rio/symantics.rb +1 -1
- data/lib/rio/tempdir.rb +0 -2
- data/lib/rio/to_rio.rb +1 -1
- data/lib/rio/to_rio/all.rb +1 -1
- data/lib/rio/to_rio/array.rb +1 -1
- data/lib/rio/to_rio/io.rb +1 -1
- data/lib/rio/to_rio/object.rb +1 -1
- data/lib/rio/to_rio/string.rb +1 -1
- data/lib/rio/undef_rake_dsl.rb +3 -0
- data/lib/rio/uri/file.rb +1 -18
- data/lib/rio/uriref.rb +1 -18
- data/lib/rio/util.rb +1 -1
- data/lib/rio/version.rb +2 -2
- data/misc/update-copyright.rb +2 -2
- data/rio.gemspec +2 -3
- data/test/env.sh +1 -2
- data/test/http/tc/copy_from_http.rb +0 -1
- data/test/runhttp.rb +2 -1
- data/test/runtests.rb +7 -5
- data/test/tc/copyarray.rb +4 -4
- data/test/tc/copydir.rb +1 -1
- metadata +15 -47
@@ -1,6 +1,6 @@
|
|
1
1
|
#--
|
2
2
|
# ===========================================================================
|
3
|
-
# Copyright (c) 2005-
|
3
|
+
# Copyright (c) 2005-2017 Christopher Kleckner
|
4
4
|
# All rights reserved
|
5
5
|
#
|
6
6
|
# This file is part of the Rio library for ruby.
|
@@ -36,7 +36,6 @@ module RIO
|
|
36
36
|
def initialize(zipfilepath)
|
37
37
|
@zipfilepath = zipfilepath
|
38
38
|
@zipfile = Zip::ZipFile.new(@zipfilepath)
|
39
|
-
#puts @zipfile.methods.sort
|
40
39
|
@topents = get_topents_
|
41
40
|
@entidx = 0
|
42
41
|
end
|
@@ -76,31 +75,3 @@ module RIO
|
|
76
75
|
end
|
77
76
|
|
78
77
|
__END__
|
79
|
-
|
80
|
-
|
81
|
-
class CentralDir < RIO::FS::Native
|
82
|
-
def initialize(zipfilepath)
|
83
|
-
@zipfilepath = zipfilepath
|
84
|
-
@zipfile = Zip::ZipFile.new(@zipfilepath)
|
85
|
-
super
|
86
|
-
end
|
87
|
-
def mkdir(path)
|
88
|
-
@zipfile.mkdir(path)
|
89
|
-
end
|
90
|
-
def rmdir(path)
|
91
|
-
@zipfile.remove(path)
|
92
|
-
end
|
93
|
-
def file()
|
94
|
-
self
|
95
|
-
end
|
96
|
-
def open(zipfilepath)
|
97
|
-
@zipfilepath = zipfilepath
|
98
|
-
@zipfile = Zip::ZipFile.new(@zipfilepath)
|
99
|
-
RIO::ZipFile::CentralDir.new(@zipfile)
|
100
|
-
end
|
101
|
-
|
102
|
-
end
|
103
|
-
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#--
|
2
2
|
# ===========================================================================
|
3
|
-
# Copyright (c) 2005-
|
3
|
+
# Copyright (c) 2005-2017 Christopher Kleckner
|
4
4
|
# All rights reserved
|
5
5
|
#
|
6
6
|
# This file is part of the Rio library for ruby.
|
@@ -38,113 +38,9 @@ module RIO
|
|
38
38
|
else
|
39
39
|
become('Path::Reset')
|
40
40
|
end
|
41
|
-
#gofigure(sym,*args)
|
42
41
|
end
|
43
42
|
end
|
44
43
|
end
|
45
44
|
end
|
46
45
|
end
|
47
46
|
__END__
|
48
|
-
class Base < State::Base
|
49
|
-
include Ops::Path::Str
|
50
|
-
def open?() !ioh.nil? end
|
51
|
-
end
|
52
|
-
|
53
|
-
class NonExisting < Base
|
54
|
-
include Ops::Dir::NonExisting
|
55
|
-
def check?() not self.exist? end
|
56
|
-
def when_missing(sym,*args) gofigure(sym,*args) end
|
57
|
-
end
|
58
|
-
|
59
|
-
class Existing < Base
|
60
|
-
include Ops::Dir::Existing
|
61
|
-
|
62
|
-
def check?() self.directory? end
|
63
|
-
def when_missing(sym,*args) dopen() end
|
64
|
-
|
65
|
-
protected
|
66
|
-
|
67
|
-
def stream_rl_
|
68
|
-
self.rl.dir_rl()
|
69
|
-
#RIO::Dir::RL.new(self.to_uri, {:fs => self.fs})
|
70
|
-
end
|
71
|
-
|
72
|
-
public
|
73
|
-
|
74
|
-
def dopen()
|
75
|
-
self.rl = self.stream_rl_
|
76
|
-
become 'Dir::Open'
|
77
|
-
end
|
78
|
-
end
|
79
|
-
class Open < Base
|
80
|
-
def check?() true end
|
81
|
-
def open(m=nil,*args) open_(*args) end
|
82
|
-
def open_(*args)
|
83
|
-
unless open?
|
84
|
-
self.ioh = self.rl.open()
|
85
|
-
end
|
86
|
-
self
|
87
|
-
end
|
88
|
-
def when_missing(sym,*args)
|
89
|
-
nobj = open_.dstream()
|
90
|
-
return nobj unless nobj.nil?
|
91
|
-
gofigure(sym,*args)
|
92
|
-
end
|
93
|
-
|
94
|
-
def dstream()
|
95
|
-
cl = 'Dir::Stream'
|
96
|
-
#p "LOOP: retry: #{cx['retrystate'].inspect} => #{cl}"
|
97
|
-
return nil if cx['retrystate'] == cl
|
98
|
-
cx['retrystate'] = cl
|
99
|
-
|
100
|
-
become(cl)
|
101
|
-
end
|
102
|
-
end
|
103
|
-
class Stream < Base
|
104
|
-
include Ops::Dir::Stream
|
105
|
-
def check?() open? end
|
106
|
-
def when_missing(sym,*args) retryreset() end
|
107
|
-
def base_state() 'Dir::Close' end
|
108
|
-
def reset() self.close.softreset() end
|
109
|
-
alias :copyclose :reset
|
110
|
-
end
|
111
|
-
class Close < Base
|
112
|
-
def reopen(*args) self.close_.softreset.open(*args) end
|
113
|
-
|
114
|
-
def close()
|
115
|
-
#p callstr('close')+" mode='#{mode?}' ioh=#{self.ioh} open?=#{open?}"
|
116
|
-
return self unless self.open?
|
117
|
-
self.close_
|
118
|
-
cx['retrystate'] = nil
|
119
|
-
self
|
120
|
-
end
|
121
|
-
|
122
|
-
def close_()
|
123
|
-
#p callstr('close_')+" ioh=#{self.ioh} open?=#{open?}"
|
124
|
-
return self unless self.open?
|
125
|
-
self.clear_selection
|
126
|
-
self.ioh.close
|
127
|
-
self.ioh = nil
|
128
|
-
self.rl.close
|
129
|
-
self
|
130
|
-
end
|
131
|
-
protected :close_
|
132
|
-
|
133
|
-
CX_ENTRY_SEL_KEYS = %w[nostreamenum entry_sel skip_args ss_skipped]
|
134
|
-
def clear_selection()
|
135
|
-
CX_ENTRY_SEL_KEYS.each { |k|
|
136
|
-
cx.delete(k)
|
137
|
-
}
|
138
|
-
self
|
139
|
-
end
|
140
|
-
|
141
|
-
def check?() true end
|
142
|
-
def when_missing(sym,*args)
|
143
|
-
# p callstr('when_missing',sym,*args)
|
144
|
-
self.close_.retryreset()
|
145
|
-
end
|
146
|
-
end
|
147
|
-
end
|
148
|
-
end
|
149
|
-
end
|
150
|
-
end # module RIO
|
data/lib/rio/ext/zipfile/wrap.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#--
|
2
2
|
# ===========================================================================
|
3
|
-
# Copyright (c) 2005-
|
3
|
+
# Copyright (c) 2005-2017 Christopher Kleckner
|
4
4
|
# All rights reserved
|
5
5
|
#
|
6
6
|
# This file is part of the Rio library for ruby.
|
@@ -48,8 +48,6 @@ module RIO
|
|
48
48
|
super
|
49
49
|
end
|
50
50
|
def close()
|
51
|
-
p "CLOSE: #{@zipstream.inspect}"
|
52
|
-
#p self.__getobj__.methods.sort
|
53
51
|
super
|
54
52
|
@closed = true
|
55
53
|
end
|
@@ -60,7 +58,6 @@ module RIO
|
|
60
58
|
def initialize(zipfile)
|
61
59
|
@zipfile = zipfile
|
62
60
|
@infs = RIO::ZipFile::InFile::FS.new(@zipfile)
|
63
|
-
#puts @zipfile.methods.sort
|
64
61
|
@topents = get_topents_
|
65
62
|
@entidx = 0
|
66
63
|
end
|
@@ -83,7 +80,6 @@ module RIO
|
|
83
80
|
}
|
84
81
|
end
|
85
82
|
def close
|
86
|
-
p "JERE"
|
87
83
|
@zipfile.commit if @zipfile.commit_required?
|
88
84
|
end
|
89
85
|
end
|
@@ -110,84 +106,3 @@ module RIO
|
|
110
106
|
end
|
111
107
|
end
|
112
108
|
__END__
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
class CentralDir
|
117
|
-
include Enumerable
|
118
|
-
|
119
|
-
def initialize(zipfilepath)
|
120
|
-
@zipfilepath = zipfilepath
|
121
|
-
@zipfile = Zip::ZipFile.new(@zipfilepath)
|
122
|
-
#puts @zipfile.methods.sort
|
123
|
-
topents = {}
|
124
|
-
@zipfile.entries.map{ |ent|
|
125
|
-
top = ent.to_s.match(%r|^(/?[^/]+(/)?)|)[1]
|
126
|
-
topents[top] = ent if top == ent.to_s
|
127
|
-
}
|
128
|
-
fs = RIO::ZipFile::FS::InFile.new(@zipfile)
|
129
|
-
@topents = topents.values.map{ |v| rio(RIO::Path::RL.new(v.to_s,{:fs => fs})) }
|
130
|
-
@entidx = 0
|
131
|
-
end
|
132
|
-
# def method_missing(sym,*args,&block)
|
133
|
-
# @zipfile.__send__(sym,*args,&block)
|
134
|
-
# end
|
135
|
-
def read
|
136
|
-
return nil if @entidx >= @topents.size
|
137
|
-
@entidx += 1
|
138
|
-
@topents[@entidx-1]
|
139
|
-
end
|
140
|
-
def rewind
|
141
|
-
@entidx = 0
|
142
|
-
end
|
143
|
-
def each(&block)
|
144
|
-
@topents.each { |ent|
|
145
|
-
yield ent
|
146
|
-
}
|
147
|
-
end
|
148
|
-
def close
|
149
|
-
end
|
150
|
-
end
|
151
|
-
module FS
|
152
|
-
class Base < RIO::FS::Base
|
153
|
-
end
|
154
|
-
class InFile < Base
|
155
|
-
attr_reader :file,:dir
|
156
|
-
def initialize(zipfile)
|
157
|
-
@zipfile = zipfile
|
158
|
-
@file = @zipfile.file
|
159
|
-
@dir = @zipfile.dir
|
160
|
-
@test = @zipfile.file
|
161
|
-
end
|
162
|
-
include RIO::FS::File
|
163
|
-
include RIO::FS::Dir
|
164
|
-
include RIO::FS::Test
|
165
|
-
include RIO::FS::Str
|
166
|
-
end
|
167
|
-
|
168
|
-
class CentralDir < RIO::FS::Native
|
169
|
-
def initialize(zipfilepath)
|
170
|
-
@zipfilepath = zipfilepath
|
171
|
-
@zipfile = Zip::ZipFile.new(@zipfilepath)
|
172
|
-
super
|
173
|
-
end
|
174
|
-
def mkdir(path)
|
175
|
-
@zipfile.mkdir(path)
|
176
|
-
end
|
177
|
-
def rmdir(path)
|
178
|
-
@zipfile.remove(path)
|
179
|
-
end
|
180
|
-
def file()
|
181
|
-
self
|
182
|
-
end
|
183
|
-
def open(zipfilepath)
|
184
|
-
@zipfilepath = zipfilepath
|
185
|
-
@zipfile = Zip::ZipFile.new(@zipfilepath)
|
186
|
-
RIO::ZipFile::CentralDir.new(@zipfile)
|
187
|
-
end
|
188
|
-
|
189
|
-
end
|
190
|
-
|
191
|
-
end
|
192
|
-
end
|
193
|
-
end
|
data/lib/rio/factory.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#--
|
2
2
|
# ===========================================================================
|
3
|
-
# Copyright (c) 2005-
|
3
|
+
# Copyright (c) 2005-2017 Christopher Kleckner
|
4
4
|
# All rights reserved
|
5
5
|
#
|
6
6
|
# This file is part of the Rio library for ruby.
|
@@ -27,104 +27,6 @@ require 'singleton'
|
|
27
27
|
require 'rio/handle'
|
28
28
|
require 'rio/rrl/builder'
|
29
29
|
|
30
|
-
# module RIO
|
31
|
-
# autoload :Path, 'rio/rrl/path'
|
32
|
-
# module Path
|
33
|
-
# autoload :Str,'rio/path'
|
34
|
-
# autoload :Reset , 'rio/path/reset'
|
35
|
-
# autoload :Empty , 'rio/path'
|
36
|
-
# autoload :NonExisting , 'rio/path'
|
37
|
-
# module Stream
|
38
|
-
# autoload :Open , 'rio/scheme/path'
|
39
|
-
# end
|
40
|
-
# end
|
41
|
-
# autoload :StdIO, 'rio/scheme/stdio'
|
42
|
-
# autoload :StdErr, 'rio/scheme/stderr'
|
43
|
-
# autoload :Null, 'rio/scheme/null'
|
44
|
-
# module Null
|
45
|
-
# module Stream
|
46
|
-
# autoload :Open , 'rio/scheme/null'
|
47
|
-
# end
|
48
|
-
# end
|
49
|
-
# autoload :Temp, 'rio/scheme/temp'
|
50
|
-
# module Temp
|
51
|
-
# autoload :Reset , 'rio/scheme/temp'
|
52
|
-
# module Stream
|
53
|
-
# autoload :Open , 'rio/scheme/temp'
|
54
|
-
# end
|
55
|
-
# end
|
56
|
-
# autoload :StrIO, 'rio/scheme/strio'
|
57
|
-
# module StrIO
|
58
|
-
# module Stream
|
59
|
-
# autoload :Open , 'rio/scheme/strio'
|
60
|
-
# end
|
61
|
-
# end
|
62
|
-
# autoload :CmdPipe, 'rio/scheme/cmdpipe'
|
63
|
-
# module CmdPipe
|
64
|
-
# module Stream
|
65
|
-
# autoload :Reset , 'rio/scheme/cmdpipe'
|
66
|
-
# end
|
67
|
-
# end
|
68
|
-
# autoload :AryIO, 'rio/scheme/aryio'
|
69
|
-
# autoload :HTTP, 'rio/scheme/http'
|
70
|
-
# module HTTP
|
71
|
-
# module Stream
|
72
|
-
# autoload :Input , 'rio/scheme/http'
|
73
|
-
# autoload :Open , 'rio/scheme/http'
|
74
|
-
# end
|
75
|
-
# end
|
76
|
-
# autoload :FTP, 'rio/scheme/ftp'
|
77
|
-
# autoload :TCP, 'rio/scheme/tcp'
|
78
|
-
# autoload :SysIO, 'rio/scheme/sysio'
|
79
|
-
# autoload :FD, 'rio/scheme/fd'
|
80
|
-
# autoload :CmdIO, 'rio/scheme/cmdio'
|
81
|
-
|
82
|
-
# end
|
83
|
-
# module RIO
|
84
|
-
# module Dir
|
85
|
-
# autoload :Existing, 'rio/dir'
|
86
|
-
# autoload :NonExisting, 'rio/dir'
|
87
|
-
# autoload :Open , 'rio/dir'
|
88
|
-
# autoload :Close , 'rio/dir'
|
89
|
-
# autoload :Stream , 'rio/dir'
|
90
|
-
# end
|
91
|
-
# module File
|
92
|
-
# autoload :NonExisting, 'rio/file'
|
93
|
-
# autoload :Existing, 'rio/file'
|
94
|
-
# end
|
95
|
-
# end
|
96
|
-
# module RIO
|
97
|
-
# module Stream
|
98
|
-
# autoload :Close , 'rio/stream/open'
|
99
|
-
# autoload :Reset , 'rio/stream'
|
100
|
-
# autoload :Open , 'rio/stream/open'
|
101
|
-
# autoload :Input , 'rio/stream'
|
102
|
-
# autoload :Output , 'rio/stream'
|
103
|
-
# autoload :InOut , 'rio/stream'
|
104
|
-
# module Duplex
|
105
|
-
# autoload :Open , 'rio/stream/duplex'
|
106
|
-
# autoload :Input , 'rio/stream/duplex'
|
107
|
-
# autoload :Ouput , 'rio/stream/duplex'
|
108
|
-
# autoload :InOut , 'rio/stream/duplex'
|
109
|
-
# autoload :Close , 'rio/stream/duplex'
|
110
|
-
# autoload :Reset , 'rio/stream/duplex'
|
111
|
-
# end
|
112
|
-
# end
|
113
|
-
# end
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
# 'Ext::YAML::Doc::Existing' , 'rio/ext/yaml/doc',
|
121
|
-
# 'Ext::YAML::Doc::Open' , 'rio/ext/yaml/doc',
|
122
|
-
# 'Ext::YAML::Doc::Stream' , 'rio/ext/yaml/doc',
|
123
|
-
# 'Ext::YAML::Doc::Close' , 'rio/ext/yaml/doc',
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
30
|
module RIO
|
129
31
|
|
130
32
|
class Factory #:nodoc: all
|
@@ -295,7 +197,7 @@ module RIO
|
|
295
197
|
# factory creates a state from args
|
296
198
|
def create_state(*args)
|
297
199
|
riorl = RIO::RRL::Builder.build(*args)
|
298
|
-
create_handle(state2class(reset_state(riorl)).new(rl:
|
200
|
+
create_handle(state2class(reset_state(riorl)).new(rl:riorl))
|
299
201
|
end
|
300
202
|
def clone_state(state)
|
301
203
|
create_handle(state.target.clone)
|
data/lib/rio/fibpipe.rb
CHANGED
@@ -41,13 +41,11 @@ module RIO
|
|
41
41
|
fib.resume(*args)
|
42
42
|
end
|
43
43
|
def source_resume(*args)
|
44
|
-
# $stdout.printf("\n%s%-9s resumes-> %-12s (%s) ... "," "*@@depth,self.fib.name,source.fib.name,args.join(","))
|
45
44
|
@@depth += 1
|
46
45
|
source.resume(*args)
|
47
46
|
end
|
48
47
|
def fiber_yield(*args)
|
49
48
|
@@depth -= 1
|
50
|
-
# $stdout.printf("%s%s yields (%s)\n"," "*@@depth,self.fib.name,args.join(","))
|
51
49
|
Fiber.yield(*args)
|
52
50
|
end
|
53
51
|
def dest_wait_for_reader
|
@@ -104,7 +102,6 @@ module RIO
|
|
104
102
|
def duplex?() @is_duplex end
|
105
103
|
def put(rec)
|
106
104
|
data.out.write(rec)
|
107
|
-
#data.out.flush
|
108
105
|
end
|
109
106
|
def process_loop
|
110
107
|
loop do
|
@@ -117,14 +114,12 @@ module RIO
|
|
117
114
|
rescue Errno::EINTR
|
118
115
|
break
|
119
116
|
rescue EOFError
|
120
|
-
# p "ToOutput: Loop Closing"
|
121
117
|
data.in.close_read
|
122
118
|
if duplex?
|
123
119
|
data.out.close_write
|
124
120
|
else
|
125
121
|
data.out.close
|
126
122
|
end
|
127
|
-
# p data.out.closed?
|
128
123
|
dest_report_data_done unless dest?
|
129
124
|
break
|
130
125
|
end
|
@@ -256,9 +251,7 @@ module RIO
|
|
256
251
|
|
257
252
|
class FibSourceProc < FromInput
|
258
253
|
def initialize(*args)
|
259
|
-
#p "FibSourceProc args=#{args.inspect}"
|
260
254
|
super(IO.popen(*args))
|
261
|
-
# @to_proc = ToProc.new(data.in)
|
262
255
|
end
|
263
256
|
end
|
264
257
|
|
@@ -280,94 +273,3 @@ module RIO
|
|
280
273
|
end
|
281
274
|
|
282
275
|
__END__
|
283
|
-
ior = File.open('lines10.txt')
|
284
|
-
iow = $stdout
|
285
|
-
#input = RIO::Cmd::FromInput.new(ior)
|
286
|
-
#input = RIO::Cmd::FromFile.new('lines10.txt')
|
287
|
-
input = RIO::Cmd::FromEnum.new(ior.to_enum)
|
288
|
-
#to_out = RIO::Cmd::ToStdout.new
|
289
|
-
output = RIO::Cmd::ToOutput.new($stdout)
|
290
|
-
cat = RIO::Cmd::FibPipeProc.new(['cat','-n'],'w+')
|
291
|
-
cat2 = RIO::Cmd::FibPipeProc.new(['cat','-n'],'w+')
|
292
|
-
|
293
|
-
output.resume [cat,cat2,input]
|
294
|
-
puts
|
295
|
-
puts
|
296
|
-
|
297
|
-
ls = RIO::Cmd::FibSourceProc.new(['ls','-l'])
|
298
|
-
grepc = RIO::Cmd::FibPipeProc.new(['grep','2010-02-06'],'w+')
|
299
|
-
output = RIO::Cmd::ToOutput.new($stdout)
|
300
|
-
|
301
|
-
output.resume [grepc,ls]
|
302
|
-
|
303
|
-
__END__
|
304
|
-
__END__
|
305
|
-
|
306
|
-
ls = RIO::Cmd::FibSourceProc.new(['ls','-l'])
|
307
|
-
output = RIO::Cmd::ToOutput.new($stdout)
|
308
|
-
output.resume [ls]
|
309
|
-
|
310
|
-
|
311
|
-
__END__
|
312
|
-
cat = RIO::Cmd::FibPipeProc.new(['cat','-n'],'w+')
|
313
|
-
|
314
|
-
p '--------------------------------------------------------->>>>>>>>>>>'
|
315
|
-
to_stdout.resume [cat,from_file]
|
316
|
-
|
317
|
-
|
318
|
-
__END__
|
319
|
-
from_file = RIO::Cmd::FromFile.new("lines10.txt")
|
320
|
-
cat = RIO::Cmd::FibPipeProc.new(['cat','-n'],'w+')
|
321
|
-
to_stdout = RIO::Cmd::ToStdout.new
|
322
|
-
|
323
|
-
p '--------------------------------------------------------->>>>>>>>>>>'
|
324
|
-
to_stdout.resume [cat,from_file]
|
325
|
-
|
326
|
-
|
327
|
-
__END__
|
328
|
-
from_file = FromFile.new("lines10.txt")
|
329
|
-
|
330
|
-
ioproc = IO.popen(['cat','-n'],'w+')
|
331
|
-
to_proc = ToProc.new(ioproc)
|
332
|
-
from_proc = FromProc.new(ioproc)
|
333
|
-
|
334
|
-
ioproc2 = IO.popen(['cat','-n'],'w+')
|
335
|
-
to_proc2 = ToProc.new(ioproc2)
|
336
|
-
from_proc2 = FromProc.new(ioproc2)
|
337
|
-
|
338
|
-
to_stdout = ToStdout.new
|
339
|
-
|
340
|
-
|
341
|
-
to_stdout.resume [from_proc,to_proc,from_proc2,to_proc2,from_file]
|
342
|
-
|
343
|
-
|
344
|
-
__END__
|
345
|
-
from_proc = FromProc.new(IO.popen(['ls','-l']))
|
346
|
-
fpi = ToStdout.new
|
347
|
-
fpi.resume [from_proc]
|
348
|
-
|
349
|
-
|
350
|
-
__END__
|
351
|
-
#from_file = FromFile.new("lines10.txt")
|
352
|
-
from_file = FromFile.new("lines10.txt")
|
353
|
-
#from_procy = FromProc.new(IO.popen(['yes','what is the deal']))
|
354
|
-
from_proc = FromProcSelect.new(['cat','-n'])
|
355
|
-
to_stdout = ToStdout.new
|
356
|
-
|
357
|
-
|
358
|
-
to_stdout.resume [from_proc,from_file]
|
359
|
-
|
360
|
-
|
361
|
-
__END__
|
362
|
-
feeder = FromFile.new("lines10.txt")
|
363
|
-
fpi = ToStdout.new
|
364
|
-
fpi.resume [feeder]
|
365
|
-
|
366
|
-
__END__
|
367
|
-
|
368
|
-
|
369
|
-
feeder = FromFile.new("lines10.txt")
|
370
|
-
fpi = ToStdout.new
|
371
|
-
fpi.resume [feeder]
|
372
|
-
|
373
|
-
__END__
|