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/ops/stream.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.
|
@@ -55,13 +55,12 @@ module RIO
|
|
55
55
|
def to_io() ioh ? ioh.to_io : nil end
|
56
56
|
def tty?() ioh ? ioh.tty? : false end
|
57
57
|
def isatty() ioh ? ioh.isatty : false end
|
58
|
-
# def binmode() rtn_self { self.ioh.binmode } end
|
59
58
|
def flush() rtn_self { self.ioh.flush } end
|
60
59
|
def fsync() rtn_self { self.ioh.fsync } end
|
61
60
|
def seek(amount,whence=IO::SEEK_SET) rtn_self { self.ioh.seek(amount,whence) } end
|
62
|
-
extend
|
63
|
-
|
64
|
-
|
61
|
+
extend RIO::Fwd
|
62
|
+
fwd :ioh,:pos
|
63
|
+
fwd_readers :ioh, :fileno, :to_i, :fcntl, :ioctl
|
65
64
|
end
|
66
65
|
end
|
67
66
|
module Stream
|
data/lib/rio/ops/stream/input.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.
|
@@ -70,7 +70,6 @@ module RIO
|
|
70
70
|
|
71
71
|
def each_row(*args,&block)
|
72
72
|
#p callstr('each_row',*args)
|
73
|
-
#rows(*args).each_row_(*args,&block)
|
74
73
|
rows(*args,&block)
|
75
74
|
self
|
76
75
|
end
|
@@ -99,14 +98,8 @@ module RIO
|
|
99
98
|
raw_rec = self._get_rec
|
100
99
|
return to_rec_(raw_rec) if @get_selrej.match?(raw_rec,@recno)
|
101
100
|
end
|
102
|
-
#loop do
|
103
|
-
# raw_rec = self._get_rec
|
104
|
-
# return to_rec_(raw_rec) if @get_selrej.match?(raw_rec,@recno)
|
105
|
-
# break if self.eof?
|
106
|
-
#end
|
107
101
|
self.close if closeoneof?
|
108
102
|
nil
|
109
|
-
# (closeoneof? ? self.on_eof_close{ nil } : nil)
|
110
103
|
end
|
111
104
|
|
112
105
|
private
|
@@ -164,7 +157,6 @@ module RIO
|
|
164
157
|
end
|
165
158
|
end
|
166
159
|
end
|
167
|
-
#return closeoneof? ? self.close : self
|
168
160
|
throw :stop_iter
|
169
161
|
end
|
170
162
|
closeoneof? ? self.close : self
|
@@ -236,7 +228,6 @@ module RIO
|
|
236
228
|
end
|
237
229
|
|
238
230
|
def on_closeoneof()
|
239
|
-
#p "on_closeoneof #{self.object_id} #{self.ior.object_id}"
|
240
231
|
self.close
|
241
232
|
end
|
242
233
|
|
@@ -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,7 +22,6 @@
|
|
22
22
|
#++
|
23
23
|
#
|
24
24
|
|
25
|
-
|
26
25
|
require 'rio/cp'
|
27
26
|
|
28
27
|
module RIO
|
@@ -76,7 +75,6 @@ module RIO
|
|
76
75
|
|
77
76
|
def copyclose()
|
78
77
|
#p "#{callstr('copyclose')} closeoncopy=#{cx['closeoncopy']} iow=#{iow}"
|
79
|
-
#raise RuntimeError,"copclose"
|
80
78
|
if cx['closeoncopy']
|
81
79
|
wclose
|
82
80
|
else
|
data/lib/rio/ops/stream/read.rb
CHANGED
data/lib/rio/ops/stream/write.rb
CHANGED
data/lib/rio/ops/symlink.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,15 +22,6 @@
|
|
22
22
|
#++
|
23
23
|
#
|
24
24
|
|
25
|
-
|
26
|
-
# module RIO
|
27
|
-
# module Impl
|
28
|
-
# module U
|
29
|
-
# def self.readlink(s,*args) ::File.readlink(s,*args) end
|
30
|
-
# def self.lstat(s,*args) ::File.lstat(s,*args) end
|
31
|
-
# end
|
32
|
-
# end
|
33
|
-
# end
|
34
25
|
module RIO
|
35
26
|
module Ops
|
36
27
|
module Symlink
|
data/lib/rio/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.
|
@@ -31,9 +31,6 @@ require 'rio/cp'
|
|
31
31
|
module RIO
|
32
32
|
|
33
33
|
module Path #:nodoc: all
|
34
|
-
|
35
|
-
|
36
|
-
|
37
34
|
# Empty:
|
38
35
|
# nil? or empty? => Emp
|
39
36
|
# else => Sin
|
data/lib/rio/path/reset.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,8 +22,6 @@
|
|
22
22
|
#++
|
23
23
|
#
|
24
24
|
|
25
|
-
|
26
|
-
# cell phone number: 954-6752.
|
27
25
|
require 'rio/state'
|
28
26
|
module RIO
|
29
27
|
|
@@ -32,7 +30,6 @@ module RIO
|
|
32
30
|
# For now this is all states, but that could change
|
33
31
|
class Reset < State::Base
|
34
32
|
def base_state()
|
35
|
-
#p "RETURNING WIERD BASE STATE"
|
36
33
|
'Path::Reset'
|
37
34
|
end
|
38
35
|
|
@@ -50,8 +47,6 @@ module RIO
|
|
50
47
|
end
|
51
48
|
end
|
52
49
|
|
53
|
-
# extend Forwardable
|
54
|
-
# def_instance_delegators(:path,:empty?)
|
55
50
|
end
|
56
51
|
end
|
57
52
|
|
data/lib/rio/piper.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.
|
@@ -80,13 +80,10 @@ module RIO
|
|
80
80
|
def wr() @rios[0] end
|
81
81
|
|
82
82
|
def run
|
83
|
-
#dups = @rios.map { |r| r.clone }
|
84
83
|
dups = @rios
|
85
84
|
(1...dups.size-1).each { |i| dups[i].w! }
|
86
85
|
(1...dups.size).each { |i|
|
87
|
-
#p "#{dups[i-1].cx.inspect} > #{dups[i].cx.inspect}"
|
88
86
|
dups[i-1] > dups[i]
|
89
|
-
#p dups[i-1].closed?
|
90
87
|
}
|
91
88
|
dups.each { |r| r.close.softreset }
|
92
89
|
dups[-1]
|
data/lib/rio/piper/cp.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,7 +22,6 @@
|
|
22
22
|
#++
|
23
23
|
#
|
24
24
|
|
25
|
-
|
26
25
|
module RIO
|
27
26
|
module Piper #:nodoc: all
|
28
27
|
module Cp
|
@@ -62,35 +61,21 @@ module RIO
|
|
62
61
|
end
|
63
62
|
module Input
|
64
63
|
include Util
|
65
|
-
#def last_rio(r)
|
66
|
-
# r.scheme == 'cmdpipe' ? last_rio(r.rl.query[-1]) : r
|
67
|
-
#end
|
68
64
|
def last_rio(r)
|
69
65
|
r = r.rl.query[-1] while r.scheme == 'cmdpipe'
|
70
66
|
r
|
71
67
|
end
|
72
|
-
#define_method(:last_rio) do |r|
|
73
|
-
# if r.scheme == 'cmdpipe'
|
74
|
-
# r = r.rl.query[-1]
|
75
|
-
# redo
|
76
|
-
# else
|
77
|
-
# r
|
78
|
-
# end
|
79
|
-
#end
|
80
68
|
def has_output_dest?(nrio)
|
81
69
|
!%w[cmdio cmdpipe].include?(last_rio(nrio).scheme)
|
82
70
|
end
|
83
71
|
|
84
72
|
def |(arg)
|
85
|
-
#p 'HERE 3'
|
86
73
|
ario = ensure_cmd_rio(arg)
|
87
74
|
nrio = new_rio(:cmdpipe,self.clone_rio,ario)
|
88
75
|
|
89
76
|
if has_output_dest?(nrio)
|
90
|
-
#p 'nrio.run'
|
91
77
|
nrio.run
|
92
78
|
else
|
93
|
-
#p 'nrio'
|
94
79
|
nrio
|
95
80
|
end
|
96
81
|
|
data/lib/rio/prompt.rb
CHANGED
data/lib/rio/rectype.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.
|
@@ -38,7 +38,6 @@ module RIO
|
|
38
38
|
def each_rec_(&block)
|
39
39
|
ih = self.ior
|
40
40
|
ih.each_line { |line|
|
41
|
-
#self.ior.each { |line|
|
42
41
|
yield line
|
43
42
|
}
|
44
43
|
self
|
@@ -47,7 +46,6 @@ module RIO
|
|
47
46
|
module Output
|
48
47
|
def put_(rec,*args)
|
49
48
|
#p callstr('put_',rec,*args)
|
50
|
-
#p self.ioh.ios
|
51
49
|
self.iow.print(rec.to_s)
|
52
50
|
end
|
53
51
|
end
|
@@ -62,7 +60,6 @@ module RIO
|
|
62
60
|
end
|
63
61
|
def each_rec_(&block)
|
64
62
|
#p callstr('each_rec_ (EachIter::Bytes)')
|
65
|
-
# p 'each_rec_ => each_line'
|
66
63
|
self.ior.each_bytes(cx['bytes_n']) { |b|
|
67
64
|
yield b
|
68
65
|
}
|
data/lib/rio/rl/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.
|
@@ -68,9 +68,6 @@ module RIO
|
|
68
68
|
end
|
69
69
|
|
70
70
|
def rl() SCHC+self.url end
|
71
|
-
|
72
|
-
# def riorl() SCHC+self.url end
|
73
|
-
|
74
71
|
def to_s() self.fspath || '' end
|
75
72
|
def ==(other) self.to_s == other.to_s end
|
76
73
|
def ===(other) self == other end
|
@@ -84,19 +81,9 @@ module RIO
|
|
84
81
|
|
85
82
|
def url() self.scheme+SUBSEPAR+self.opaque end
|
86
83
|
def close()
|
87
|
-
#p "Closing RL #{self}"
|
88
84
|
nil
|
89
85
|
end
|
90
86
|
|
91
|
-
#def fs2url(pth) RL.fs2url(pth) end
|
92
|
-
#def url2fs(pth) RL.url2fs(pth) end
|
93
|
-
#def escape(pth,esc=RL::ESCAPE)
|
94
|
-
# RL.escape(pth,esc)
|
95
|
-
#end
|
96
|
-
#def unescape(pth)
|
97
|
-
# RL.unescape(pth)
|
98
|
-
#end
|
99
|
-
|
100
87
|
def callstr(func,*args)
|
101
88
|
self.class.to_s+'['+self.to_s+']'+'.'+func.to_s+'('+args.join(',')+')'
|
102
89
|
end
|
data/lib/rio/rl/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.
|
@@ -22,7 +22,6 @@
|
|
22
22
|
#++
|
23
23
|
#
|
24
24
|
|
25
|
-
|
26
25
|
require 'rio/alturi'
|
27
26
|
require 'rio/local'
|
28
27
|
require 'rio/rl/base'
|
@@ -36,7 +35,6 @@ module RIO
|
|
36
35
|
return rl
|
37
36
|
end
|
38
37
|
def self.build(*a)
|
39
|
-
#puts "build: #{a.inspect}"
|
40
38
|
a.flatten!
|
41
39
|
a.push('') if a.empty?
|
42
40
|
case a[0]
|
@@ -55,33 +53,25 @@ module RIO
|
|
55
53
|
when %r|^//|
|
56
54
|
a[0] = 'rio:file:'+a[0]
|
57
55
|
when %r|^/|
|
58
|
-
#a[0] = 'file://'+a[0]
|
59
|
-
#p "IN BUILDER #{a.inspect}"
|
60
56
|
return Factory.instance.riorl_class('file').new(*a)
|
61
57
|
else
|
62
58
|
return Factory.instance.riorl_class('path').new(*a)
|
63
59
|
end
|
64
60
|
when RIO::Rio
|
65
|
-
#p "BUILD: a[0]=#{a[0].inspect} a[0].rl=#{a[0].rl.inspect}"
|
66
61
|
a[0] = a[0].rl
|
67
62
|
return build(*a)
|
68
63
|
when RL::Base
|
69
|
-
#p "BUILD: RL::Base a=#{a.inspect}"
|
70
64
|
a0 = a.shift.clone
|
71
65
|
cl = Factory.instance.riorl_class(a0.scheme)
|
72
66
|
o = cl.new(a0,*a) unless cl.nil?
|
73
67
|
return o
|
74
|
-
# return (a.empty? ? a0 : a0.join(*a))
|
75
68
|
when ::RIO::RRL::Base
|
76
|
-
#p "BUILD: RRL::Base a=#{a.inspect}"
|
77
69
|
a0 = a.shift.uri
|
78
70
|
cl = Factory.instance.riorl_class(a0.scheme)
|
79
71
|
o = cl.new(a0,*a) unless cl.nil?
|
80
72
|
return o
|
81
|
-
# return (a.empty? ? a0 : a0.join(*a))
|
82
73
|
when ::Alt::URI::Base
|
83
74
|
a0 = a.shift
|
84
|
-
#p "SCHEME is #{a0.scheme}"
|
85
75
|
cl = Factory.instance.riorl_class(a0.scheme)
|
86
76
|
o = cl.new(a0,*a) unless cl.nil?
|
87
77
|
return o
|
@@ -108,7 +98,6 @@ module RIO
|
|
108
98
|
a0 = a.shift
|
109
99
|
sch = Base.subscheme(a0)
|
110
100
|
cl = Factory.instance.riorl_class(sch)
|
111
|
-
#p "cl=#{cl}"
|
112
101
|
cl.parse(a0,*a) unless cl.nil?
|
113
102
|
|
114
103
|
end
|
data/lib/rio/rl/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 RL
|
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/rl/fs2url.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.
|
@@ -42,27 +42,20 @@ module RIO
|
|
42
42
|
args.map{ |pth| fs2url(pth) }
|
43
43
|
end
|
44
44
|
def fs2url(pth, esc=ESCAPE)
|
45
|
-
#pth.sub!(/^[a-zA-Z]:/,'')
|
46
45
|
pth = URI.escape(pth,esc)
|
47
46
|
pth = '/' + pth if pth =~ /^[a-zA-Z]:/
|
48
47
|
pth
|
49
|
-
# (Local::SEPARATOR == '/' ? pth : pth.gsub(Local::SEPARATOR,%r|/|))
|
50
48
|
end
|
51
49
|
|
52
50
|
def url2fs(pth)
|
53
|
-
# pth = pth.chop if pth.length > 1 and pth[-1] == ?/ cwd = RIO::RL.fs2url(::Dir.getwd)
|
54
|
-
|
55
|
-
#pth = pth.chop if pth != '/' and pth[-1] == ?/
|
56
51
|
pth = ::URI.unescape(pth)
|
57
52
|
if pth =~ %r#^/[a-zA-Z]:#
|
58
53
|
pth = pth[1..-1]
|
59
54
|
end
|
60
55
|
pth
|
61
|
-
# (Local::SEPARATOR == '/' ? pth : pth.gsub(%r|/|,Local::SEPARATOR))
|
62
56
|
end
|
63
57
|
|
64
58
|
def getwd()
|
65
|
-
#::URI::FILE.build({:path => fs2url(::Dir.getwd)+'/'})
|
66
59
|
::URI::FILE.build({:path => fs2url(::Dir.getwd)})
|
67
60
|
end
|
68
61
|
|