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
data/lib/rio/rl/ioi.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.
|
@@ -37,7 +37,6 @@ module RIO
|
|
37
37
|
def scheme() self.class.const_get(:RIOSCHEME) end
|
38
38
|
def opaque() '' end
|
39
39
|
def self.splitrl(s) nil end
|
40
|
-
#def path() self.class.const_get(:RIOPATH) end
|
41
40
|
def to_s() url() end
|
42
41
|
def open(ios)
|
43
42
|
IOH::Stream.new(ios)
|
data/lib/rio/rl/path.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.
|
@@ -33,8 +33,6 @@ module RIO
|
|
33
33
|
RESET_STATE = 'Path::Reset'
|
34
34
|
|
35
35
|
def arg0_info_(arg0,*args)
|
36
|
-
#p "arg0_info_(#{arg0.inspect},#{args.inspect})"
|
37
|
-
#p callstr('init_from_args_',arg0.inspect,args)
|
38
36
|
vuri,vbase,vfs = nil,nil,nil
|
39
37
|
case arg0
|
40
38
|
when RIO::Rio, URIBase, ::Alt::URI::Base, ::Alt::URI::File
|
@@ -44,7 +42,6 @@ module RIO
|
|
44
42
|
else
|
45
43
|
raise(ArgumentError,"'#{arg0}'[#{arg0.class}] can not be used to create a Rio")
|
46
44
|
end
|
47
|
-
#puts "path.rb arg0_info_: vuri=#{vuri}"
|
48
45
|
[vuri,vbase,vfs]
|
49
46
|
end
|
50
47
|
def build_arg0_(path_str)
|
@@ -67,27 +64,11 @@ module RIO
|
|
67
64
|
return self if args.empty?
|
68
65
|
join_(args.map{ |arg| arg.to_s})
|
69
66
|
end
|
70
|
-
#def fspath()
|
71
|
-
# if use_host?
|
72
|
-
# '//' + uri.host + RL.url2fs(self.urlpath)
|
73
|
-
# else
|
74
|
-
# RL.url2fs(self.urlpath)
|
75
|
-
# end
|
76
|
-
#end
|
77
|
-
# def fspath=(pt)
|
78
|
-
# if pt =~ %r|^//(#{HOST})(/.*)?$|
|
79
|
-
# @host = $1
|
80
|
-
# @fspath = $2 || '/'
|
81
|
-
# else
|
82
|
-
# @fspath = pt
|
83
|
-
# end
|
84
|
-
# end
|
85
67
|
def to_s()
|
86
68
|
self.fspath
|
87
69
|
end
|
88
70
|
def self.splitrl(s)
|
89
71
|
sch,opq,whole = split_riorl(s)
|
90
|
-
#p sch,opq,whole
|
91
72
|
case sch
|
92
73
|
when 'file' then [whole]
|
93
74
|
else [opq]
|
data/lib/rio/rl/pathmethods.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.
|
@@ -83,7 +83,6 @@ module RIO
|
|
83
83
|
self.class.new(uri.merge(other.uri))
|
84
84
|
end
|
85
85
|
def calc_abs_uri_(path_str,base_str)
|
86
|
-
#p path_str,base_str
|
87
86
|
path = URI(path_str)
|
88
87
|
return path unless base_str
|
89
88
|
if path_str[0,1] != '/' and base_str[0,1] == '/'
|
@@ -99,7 +98,6 @@ module RIO
|
|
99
98
|
::File.dirname(self.path_no_slash)
|
100
99
|
end
|
101
100
|
|
102
|
-
|
103
101
|
end
|
104
102
|
end
|
105
103
|
end
|
data/lib/rio/rl/uri.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.
|
@@ -32,9 +32,6 @@ require 'rio/alturi'
|
|
32
32
|
module RIO
|
33
33
|
module RL
|
34
34
|
class URIBase < WithPath
|
35
|
-
#SCHEME = URI::REGEXP::PATTERN::SCHEME
|
36
|
-
#HOST = URI::REGEXP::PATTERN::HOST
|
37
|
-
|
38
35
|
attr_accessor :uri
|
39
36
|
def initialize(u,*args)
|
40
37
|
# u should be a ::URI or something that can be parsed to one
|
@@ -50,7 +47,6 @@ module RIO
|
|
50
47
|
@uri.path = '/' if @uri.absolute? and @uri.path == ''
|
51
48
|
end
|
52
49
|
def arg0_info_(arg0,*args)
|
53
|
-
#p "arg0_info_(#{arg0.inspect},#{args.inspect})"
|
54
50
|
vuri,vbase,vfs = nil,nil,nil
|
55
51
|
case arg0
|
56
52
|
when RIO::Rio
|
@@ -64,7 +60,6 @@ module RIO
|
|
64
60
|
else
|
65
61
|
raise(ArgumentError,"'#{arg0}'[#{arg0.class}] can not be used to create a Rio")
|
66
62
|
end
|
67
|
-
#puts "uri.rb arg0_info_: vuri=#{vuri}"
|
68
63
|
[vuri,vbase,vfs]
|
69
64
|
end
|
70
65
|
def init_from_args_(arg0,*args)
|
@@ -75,7 +70,6 @@ module RIO
|
|
75
70
|
fs = vfs if vfs
|
76
71
|
end
|
77
72
|
def _get_base_from_arg(arg)
|
78
|
-
#p "_get_base: #{arg.inspect}"
|
79
73
|
case arg
|
80
74
|
when RIO::Rio
|
81
75
|
arg.abs.to_uri
|
@@ -94,7 +88,6 @@ module RIO
|
|
94
88
|
opts = args.pop
|
95
89
|
if b = opts[:base]
|
96
90
|
@base = _get_base_from_arg(b)
|
97
|
-
#@base.path.sub!(%r{/*$},'/')
|
98
91
|
end
|
99
92
|
if fs = opts[:fs]
|
100
93
|
@fs = fs
|
@@ -123,7 +116,6 @@ module RIO
|
|
123
116
|
end
|
124
117
|
def urlpath() uri.path end
|
125
118
|
def urlpath=(arg)
|
126
|
-
#p uri,arg
|
127
119
|
uri.path = arg
|
128
120
|
end
|
129
121
|
def path()
|
@@ -149,7 +141,6 @@ module RIO
|
|
149
141
|
end
|
150
142
|
def pathroot()
|
151
143
|
u = uri.clone
|
152
|
-
#u.query = nil
|
153
144
|
case scheme
|
154
145
|
when 'file'
|
155
146
|
if self.urlpath =~ %r'^(/[a-zA-Z]):' then $1+':/'
|
@@ -170,7 +161,6 @@ module RIO
|
|
170
161
|
@base || self.uri
|
171
162
|
end
|
172
163
|
def base=(arg)
|
173
|
-
#p "uri.rb:base= arg=#{arg.inspect}"
|
174
164
|
@base = _uri(arg)
|
175
165
|
end
|
176
166
|
def join(*args)
|
data/lib/rio/rl/withpath.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.
|
@@ -100,9 +100,6 @@ end
|
|
100
100
|
module RIO
|
101
101
|
module RL
|
102
102
|
class WithPath < RIO::RL::Base
|
103
|
-
#SCHEME = URI::REGEXP::PATTERN::SCHEME
|
104
|
-
#HOST = URI::REGEXP::PATTERN::HOST
|
105
|
-
|
106
103
|
# returns the path as the file system sees it. Spaces are spaces and not
|
107
104
|
# %20 etc. This is the path that would be passed to the fs object.
|
108
105
|
# For windows RLs this includes the '//host' part and the 'C:' part
|
@@ -112,7 +109,6 @@ module RIO
|
|
112
109
|
end
|
113
110
|
|
114
111
|
def fspath=(fpth)
|
115
|
-
#p "FSPATH= #{fpth} => #{RL.fs2url(fpth)}"
|
116
112
|
uri.netpath = fpth
|
117
113
|
end
|
118
114
|
|
@@ -132,7 +128,6 @@ module RIO
|
|
132
128
|
end
|
133
129
|
def pathdepth()
|
134
130
|
pth = self.path_no_slash
|
135
|
-
#is_root?(pth) ? 0 : pth.count('/')
|
136
131
|
pth.count('/')
|
137
132
|
end
|
138
133
|
|
@@ -147,14 +142,11 @@ module RIO
|
|
147
142
|
thebase ||= self.base
|
148
143
|
base_uri = _uri(thebase)
|
149
144
|
path_uri = self.uri.clone
|
150
|
-
#p "abs: base_uri=#{base_uri.inspect}"
|
151
|
-
#p "abs: path_uri=#{path_uri.inspect}"
|
152
145
|
if path_uri.scheme == 'file' and base_uri.scheme != 'file'
|
153
146
|
abs_uri = path_uri.abs(base_uri)
|
154
147
|
else
|
155
148
|
abs_uri = path_uri.abs(base_uri)
|
156
149
|
end
|
157
|
-
#p "abs: abs_uri=#{abs_uri.inspect}"
|
158
150
|
_build(abs_uri,{:fs => self.fs})
|
159
151
|
end
|
160
152
|
|
@@ -194,11 +186,10 @@ module RIO
|
|
194
186
|
|
195
187
|
end
|
196
188
|
|
197
|
-
# changes this RLs path so that
|
189
|
+
# changes this RLs path so that it consists of this RL's path
|
198
190
|
# combined with those of its arguments.
|
199
191
|
def join(*args)
|
200
192
|
return self if args.empty?
|
201
|
-
#sa = args.map { |arg| ::URI.escape(arg.to_s,ESCAPE) }
|
202
193
|
sa = args.map { |arg| arg.to_s }
|
203
194
|
join_(sa)
|
204
195
|
end
|
@@ -213,15 +204,6 @@ module RIO
|
|
213
204
|
# like File#dirname
|
214
205
|
# returns a RL
|
215
206
|
def dirname()
|
216
|
-
#u = uri.clone
|
217
|
-
#u.path = fs.dirname(uri.path).sub(%r{/*$},'/')
|
218
|
-
#puts
|
219
|
-
#if uri.scheme == 'file'
|
220
|
-
# u.host = self.host
|
221
|
-
#else
|
222
|
-
# u.scheme = uri.scheme
|
223
|
-
# u.host = uri.host
|
224
|
-
#end
|
225
207
|
RIO::RL::Builder.build(uri.dirname)
|
226
208
|
end
|
227
209
|
|
@@ -260,17 +242,7 @@ module RIO
|
|
260
242
|
def _build(*args) RIO::RL::Builder.build(*args) end
|
261
243
|
|
262
244
|
def uri_from_string_(str)
|
263
|
-
#p "uri_from_string(#{str})"
|
264
245
|
::Alt::URI.parse(str)
|
265
|
-
#case str
|
266
|
-
#when %r%^file://(#{HOST})?(/.*)?$% then ::URI.parse(str)
|
267
|
-
#when %r/^[a-zA-Z]:/ then
|
268
|
-
# ::URI.parse(str)
|
269
|
-
#when %r/^#{SCHEME}:/ then ::URI.parse(str)
|
270
|
-
#when %r{^/} then ::URI.parse('file://'+str+( ( str[-1,0] == '/' ) ? "" : "/"))
|
271
|
-
#when %r{^/} then ::URI.parse('file://'+RL.fs2url(str))
|
272
|
-
#else ::URI.parse(str)
|
273
|
-
#end
|
274
246
|
end
|
275
247
|
end
|
276
248
|
end
|
data/lib/rio/rrl/base.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.
|
@@ -28,9 +28,6 @@ module RIO
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
31
|
module RIO
|
35
32
|
module RRL
|
36
33
|
|
@@ -58,8 +55,6 @@ module RIO
|
|
58
55
|
def ===(other) self == other end
|
59
56
|
def =~(other) other =~ self.to_str end
|
60
57
|
def length() self.to_s.length end
|
61
|
-
|
62
|
-
extend Forwardable
|
63
58
|
def url() uri.to_s end
|
64
59
|
|
65
60
|
def close()
|
data/lib/rio/rrl/builder.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.
|
@@ -35,7 +35,6 @@ module RIO
|
|
35
35
|
return rl
|
36
36
|
end
|
37
37
|
def self.build(*a)
|
38
|
-
#puts "build: #{a.inspect} (#{a.map(&:class).inspect})"
|
39
38
|
a.flatten!
|
40
39
|
a.push('') if a.empty?
|
41
40
|
case a[0]
|
@@ -46,7 +45,6 @@ module RIO
|
|
46
45
|
when ?$
|
47
46
|
a[0] = 'rio:strio:'
|
48
47
|
when ::String
|
49
|
-
#p a[0].encoding,a[0]
|
50
48
|
case a[0]
|
51
49
|
when /^[a-zA-Z]:/
|
52
50
|
a[0] = 'rio:file:///'+a[0]
|
@@ -55,10 +53,8 @@ module RIO
|
|
55
53
|
when %r|^//|
|
56
54
|
a[0] = 'rio:file:'+a[0]
|
57
55
|
when %r|^/|
|
58
|
-
|
59
|
-
# return Factory.instance.riorl_class('file').new(*a)
|
56
|
+
a[0] = 'file://'+a[0]
|
60
57
|
else
|
61
|
-
#a[0] = 'path:'+a[0]
|
62
58
|
return Factory.instance.riorl_class('path').new(*a)
|
63
59
|
end
|
64
60
|
when RIO::Rio
|
@@ -110,9 +106,7 @@ module RIO
|
|
110
106
|
a0 = a.shift
|
111
107
|
sch = /^(rio:)?([^:]+):/.match(a0)[2]
|
112
108
|
|
113
|
-
#sch = Base.subscheme(a0)
|
114
109
|
cl = Factory.instance.riorl_class(sch)
|
115
|
-
#p "cl=#{cl} a=#{a.inspect}"
|
116
110
|
cl.parse(a0,*a) unless cl.nil?
|
117
111
|
|
118
112
|
end
|
data/lib/rio/rrl/chmap.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.
|
@@ -28,16 +28,6 @@ require 'rio/local'
|
|
28
28
|
module RIO
|
29
29
|
module RRL
|
30
30
|
CHMAP = {
|
31
|
-
'_' => 'sysio',
|
32
|
-
'-' => 'stdio',
|
33
|
-
'=' => 'stderr',
|
34
|
-
'"' => 'strio',
|
35
|
-
'?' => 'temp',
|
36
|
-
'[' => 'aryio',
|
37
|
-
'`' => 'cmdio',
|
38
|
-
'|' => 'cmdpipe',
|
39
|
-
'#' => 'fd',
|
40
|
-
|
41
31
|
?_ => 'sysio',
|
42
32
|
?- => 'stdio',
|
43
33
|
?= => 'stderr',
|
data/lib/rio/rrl/ioi.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.
|
@@ -36,10 +36,8 @@ module RIO
|
|
36
36
|
end
|
37
37
|
def scheme() self.class.const_get(:RIOSCHEME) end
|
38
38
|
def opaque() '' end
|
39
|
-
#def self.splitrl(s) nil end
|
40
39
|
def fspath() nil end
|
41
40
|
def path() uri.path end
|
42
|
-
#def path() self.class.const_get(:RIOPATH) end
|
43
41
|
def to_s() url() end
|
44
42
|
def open(ios)
|
45
43
|
IOH::Stream.new(ios)
|
data/lib/rio/rrl/path.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.
|
@@ -25,10 +25,6 @@
|
|
25
25
|
|
26
26
|
module RIO
|
27
27
|
autoload :Stream, 'rio/stream'
|
28
|
-
#autoload :Ops, 'rio/ops'
|
29
|
-
#require 'rio/stream'
|
30
|
-
#require 'rio/stream/open'
|
31
|
-
#require 'rio/ops/symlink'
|
32
28
|
end
|
33
29
|
|
34
30
|
require 'rio/rrl/withpath'
|
@@ -63,10 +59,6 @@ module RIO
|
|
63
59
|
def dir_rl()
|
64
60
|
RIO::Dir::RRL.new(self.uri, {:fs => self.fs})
|
65
61
|
end
|
66
|
-
#def absolute?
|
67
|
-
# p "Path::RRL (rrl/path.rb) absolute?"
|
68
|
-
# false
|
69
|
-
#end
|
70
62
|
end
|
71
63
|
end
|
72
64
|
module File
|
@@ -86,8 +78,6 @@ module RIO
|
|
86
78
|
|
87
79
|
class RRL < RIO::Path::RRL
|
88
80
|
def open()
|
89
|
-
#IOH::Dir.new(fs.dir.open(self.fspath, :encoding => 'UTF-8'))
|
90
|
-
#p "Dir::RRL #{self.path},#{self.fspath}"
|
91
81
|
IOH::Dir.new(fs.dir.open(self.fspath))
|
92
82
|
end
|
93
83
|
def dir_rl()
|
data/lib/rio/rrl/withpath.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.
|
@@ -22,18 +22,10 @@
|
|
22
22
|
#++
|
23
23
|
#
|
24
24
|
|
25
|
-
|
26
|
-
|
27
25
|
require 'rio/alturi'
|
28
26
|
require 'rio/uriref'
|
29
27
|
require 'rio/fwd'
|
30
|
-
|
31
|
-
#require 'rio/local'
|
32
|
-
#require 'rio/rrl/chmap'
|
33
|
-
#require 'rio/rrl/base'
|
34
|
-
|
35
28
|
require 'rio/exception/notimplemented'
|
36
|
-
#require 'rio/rrl/builder'
|
37
29
|
require 'rio/fs'
|
38
30
|
|
39
31
|
module RIO
|
@@ -53,11 +45,6 @@ module RIO
|
|
53
45
|
# returns an appriate FS object for the scheme
|
54
46
|
def openfs_() nodef() end
|
55
47
|
|
56
|
-
# returns the path portion of a URL. All spaces would be %20
|
57
|
-
# returns a String
|
58
|
-
#def urlpath() nodef() end
|
59
|
-
#def urlpath=(arg) nodef(arg) end
|
60
|
-
|
61
48
|
# For RLs that are on the file system this is fspath()
|
62
49
|
# For RLs that are remote (http,ftp) this is urlpath()
|
63
50
|
# For RLs that have no path this is nil
|
@@ -65,11 +52,6 @@ module RIO
|
|
65
52
|
def path() nodef{} end
|
66
53
|
def path=(arg) nodef(arg) end
|
67
54
|
|
68
|
-
# returns A URI object representation of the RL if one exists
|
69
|
-
# otherwise it returns nil
|
70
|
-
# returns a URI
|
71
|
-
#def uri() nodef() end
|
72
|
-
|
73
55
|
# when the URL is legal it is the URI scheme
|
74
56
|
# otherwise it is one of Rio's schemes
|
75
57
|
# returns a String
|
@@ -109,7 +91,6 @@ end
|
|
109
91
|
module RIO
|
110
92
|
module RRL
|
111
93
|
class WithPath < RIO::RRL::Base
|
112
|
-
extend Forwardable
|
113
94
|
extend Fwd
|
114
95
|
|
115
96
|
# The value of urlpath() with any trailing slash removed
|
@@ -124,34 +105,24 @@ module RIO
|
|
124
105
|
end
|
125
106
|
def pathdepth()
|
126
107
|
pth = self.path_no_slash
|
127
|
-
#is_root?(pth) ? 0 : pth.count('/')
|
128
108
|
pth.count('/')
|
129
109
|
end
|
130
110
|
|
131
|
-
|
132
|
-
|
133
|
-
|
111
|
+
fwd :uri,:netpath, :fspath
|
112
|
+
fwd_readers :uri, :abs, :rel, :route_to, :route_from
|
113
|
+
fwd_readers :uri, :join, :rel, :route_to, :route_from
|
134
114
|
fwd :uri, :dirname, :basename, :extname, :filename
|
135
115
|
fwd :uri, :scheme, :authority, :path, :query, :fragment
|
136
116
|
fwd :uri, :host, :port, :userinfo, :netpath, :user, :password
|
137
117
|
|
138
118
|
def absolute?
|
139
|
-
#p 'rrl/withpath.rb absolute?'
|
140
119
|
uri.absolute?
|
141
120
|
end
|
142
|
-
# Marty Cell 319-210-3284
|
143
|
-
#def abs?
|
144
|
-
# p 'rrl/withpath.rb abs?'
|
145
|
-
# uri.absolute?
|
146
|
-
#nd
|
147
|
-
#fwd :uri, :base
|
148
121
|
def base
|
149
|
-
#p "IN BASE: uri=#{uri.inspect}"
|
150
122
|
uri.base
|
151
123
|
end
|
152
124
|
|
153
125
|
def base=(other)
|
154
|
-
#p "IN BASE: uri=#{uri.inspect}"
|
155
126
|
uri.base = other
|
156
127
|
end
|
157
128
|
|
@@ -169,16 +140,13 @@ module RIO
|
|
169
140
|
pparts = pathpart.split("/")
|
170
141
|
|
171
142
|
rootpath = ::Alt::URI.create(:scheme => scheme, :authority => authpart, :path => rootpathpart).to_s
|
172
|
-
#p "ROOTPATH=#{rootpath}"
|
173
143
|
sparts = [rootpath,pparts].flatten
|
174
|
-
#p "SPARTS=#{sparts.inspect}"
|
175
|
-
#p ::Dir.getwd
|
176
144
|
basepart = if rootpath.empty?
|
177
145
|
::Alt::URI.create(:scheme => 'file', :authority => "", :path => ::Dir.getwd + "/").to_s
|
178
146
|
else
|
179
147
|
rootpath
|
180
148
|
end
|
181
|
-
|
149
|
+
|
182
150
|
bparts = [basepart]
|
183
151
|
bparts << basepart.clone
|
184
152
|
|
@@ -186,7 +154,7 @@ module RIO
|
|
186
154
|
basepart += sparts[n] + "/"
|
187
155
|
bparts << basepart.clone
|
188
156
|
end
|
189
|
-
|
157
|
+
|
190
158
|
if sparts[0].empty?
|
191
159
|
sparts.shift
|
192
160
|
bparts.shift
|
@@ -208,11 +176,7 @@ module RIO
|
|
208
176
|
def initialize(u,*args)
|
209
177
|
# u should be a ::URI or something that can be parsed to one
|
210
178
|
#p callstr('initialize',u,*args)
|
211
|
-
#p "URIBASE u=#{u} (#{u.class}) args=#{args.inspect} "
|
212
179
|
args,opts = _get_opts_from_args(args)
|
213
|
-
#opts[:fs] ||= openfs_
|
214
|
-
#opts[:encoding] = opts[:fs] ? opts[:fs].encoding : nil
|
215
|
-
#p "URIBase OPTS=#{opts.inspect} U=#{u.inspect}"
|
216
180
|
uriref = case u
|
217
181
|
when ::Alt::URI::Base
|
218
182
|
_uriref_from_alturi(u,opts,*args)
|
@@ -226,10 +190,10 @@ module RIO
|
|
226
190
|
else
|
227
191
|
_uriref_from_alturi(::Alt::URI.parse(u.to_s,opts),opts,*args)
|
228
192
|
end
|
229
|
-
|
193
|
+
|
230
194
|
super(uriref,opts[:fs])
|
231
195
|
opts[:fs] ||= openfs_
|
232
|
-
|
196
|
+
|
233
197
|
self.uri.parts.encoding ||= opts[:fs].encoding
|
234
198
|
end
|
235
199
|
|
@@ -237,8 +201,6 @@ module RIO
|
|
237
201
|
|
238
202
|
def _uriref_from_alturi(alturi,opts,*args)
|
239
203
|
alturi.join(*args)
|
240
|
-
#p "ZIPPY #{alturi.absolute?} #{alturi.inspect} opts=#{opts.inspect}"
|
241
|
-
#p "withpath: _uriref_from_alturi enc=#{opts[:encoding].inspect}"
|
242
204
|
::RIO::URIRef.build(alturi,opts)
|
243
205
|
end
|
244
206
|
def _get_opts_from_args(args)
|
@@ -253,7 +215,6 @@ module RIO
|
|
253
215
|
|
254
216
|
def self.parse(*a)
|
255
217
|
u = a.shift.sub(/^rio:/,'')
|
256
|
-
#p "URIBASE#parse u=#{u} (#{u.class}) args=#{a.inspect} "
|
257
218
|
new(u,*a)
|
258
219
|
end
|
259
220
|
def initialize_copy(other)
|
@@ -261,7 +222,6 @@ module RIO
|
|
261
222
|
end
|
262
223
|
def openfs_()
|
263
224
|
#p callstr('openfs_')
|
264
|
-
#p "URIBase: openfs_ enc=#{::Dir.pwd.encoding}"
|
265
225
|
self.fs || RIO::FS::LOCAL
|
266
226
|
end
|
267
227
|
end
|