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/argv.rb
CHANGED
data/lib/rio/arraynge.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.
|
@@ -59,7 +59,6 @@ module RIO
|
|
59
59
|
end
|
60
60
|
|
61
61
|
def self.arraynge(mx,rng)
|
62
|
-
#p "arraynge(#{mx},#{rng})"
|
63
62
|
begr = rng.begin
|
64
63
|
mxlim = (rng.exclude_end? ? mx.succ : mx)
|
65
64
|
endr = (rng.end > mxlim ? mxlim : rng.end)
|
@@ -78,7 +77,6 @@ module RIO
|
|
78
77
|
def self.reduce(rl)
|
79
78
|
return rl if rl.empty?
|
80
79
|
rl = rl.sort {|a,b| a.begin <=> b.begin}
|
81
|
-
#p rl
|
82
80
|
(1...rl.size).inject([rl[0]]) do |ans,i|
|
83
81
|
ans[0...ans.size-1] + reduce_ranges(ans[-1],rl[i])
|
84
82
|
end
|
data/lib/rio/arycopy.rb
CHANGED
data/lib/rio/assert.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
|
end
|
34
34
|
def nok(a,b,msg=nil)
|
35
35
|
calla = caller.grep(/^#{Regexp.escape($0)}/)
|
36
|
-
#calla = caller
|
37
|
-
#calls = " " + (calla[0] || "")
|
38
36
|
calls = calla.join("\n") + "\n"
|
39
37
|
puts "FAIL" + (msg.nil? ? "" : ": #{msg}") + calls
|
40
38
|
puts " exp: #{a.inspect}"
|
@@ -52,9 +50,6 @@ module RIO
|
|
52
50
|
end
|
53
51
|
return nok(exc,nil,msg)
|
54
52
|
end
|
55
|
-
|
56
|
-
|
57
|
-
|
58
53
|
|
59
54
|
def assert_equal(a,b,msg=nil)
|
60
55
|
if a == b
|
@@ -77,7 +72,7 @@ module RIO
|
|
77
72
|
nok(nil,nil,msg)
|
78
73
|
end
|
79
74
|
end
|
80
|
-
|
75
|
+
|
81
76
|
def assert_not_equal(a,b,msg=nil)
|
82
77
|
if a != b
|
83
78
|
ok(a,b,msg)
|
@@ -131,56 +126,45 @@ module RIO
|
|
131
126
|
def assert_equal_s(a,b,msg=nil) assert_equal(a.to_s,b.to_s,msg) end
|
132
127
|
def assert_equal_a(a,b,msg=nil) assert_equal(a.sort,b.sort,msg) end
|
133
128
|
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
129
|
def assert!(a,msg="negative assertion")
|
141
130
|
assert((!(a)),msg)
|
142
131
|
end
|
143
132
|
|
144
133
|
def smap(a) a.map { |el| el.to_s } end
|
145
|
-
|
146
134
|
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
elsif b.nil?
|
155
|
-
assert_nil(a)
|
156
|
-
else
|
157
|
-
assert_equal(smap(a).sort,smap(b).sort,msg)
|
158
|
-
end
|
135
|
+
def assert_array_equal(a,b,msg="array same regardless of order")
|
136
|
+
if a.nil?
|
137
|
+
assert_nil(b)
|
138
|
+
elsif b.nil?
|
139
|
+
assert_nil(a)
|
140
|
+
else
|
141
|
+
assert_equal(smap(a).sort,smap(b).sort,msg)
|
159
142
|
end
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
assert_equal(ent.ftype,ds.ftype,"same ftype")
|
168
|
-
assert_rios_equal(ent,ds,"sub rios are the same")
|
143
|
+
end
|
144
|
+
def assert_dirs_equal(exp,d,msg="")
|
145
|
+
exp.each do |ent|
|
146
|
+
ds = rio(d,ent.filename)
|
147
|
+
assert_equal(ent.symlink?,ds.symlink?,"both symlinks, or not")
|
148
|
+
unless ent.symlink?
|
149
|
+
assert(ds.exist?,"entry '#{ds}' exists")
|
169
150
|
end
|
151
|
+
assert_equal(ent.ftype,ds.ftype,"same ftype")
|
152
|
+
assert_rios_equal(ent,ds,"sub rios are the same")
|
170
153
|
end
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
154
|
+
end
|
155
|
+
def assert_rios_equal(exp,ans,msg="")
|
156
|
+
case
|
157
|
+
when exp.symlink?
|
158
|
+
assert(ans.symlink?,"entry is a symlink")
|
159
|
+
assert_equal(exp.readlink,ans.readlink,"symlinks read the same")
|
160
|
+
when exp.file?
|
161
|
+
assert(ans.file?,"entry is a file")
|
162
|
+
assert_equal(exp.chomp.lines[],ans.chomp.lines[],"file has same contents")
|
163
|
+
when exp.dir?
|
164
|
+
assert(ans.dir?,"entry is a dir")
|
165
|
+
assert_dirs_equal(exp,ans,"directories are the same")
|
183
166
|
end
|
167
|
+
end
|
184
168
|
|
185
169
|
end
|
186
170
|
end
|
data/lib/rio/base.rb
CHANGED
data/lib/rio/callstr.rb
CHANGED
data/lib/rio/const.rb
CHANGED
data/lib/rio/construct.rb
CHANGED
data/lib/rio/constructor.rb
CHANGED
data/lib/rio/context.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.
|
@@ -41,7 +41,6 @@ module RIO
|
|
41
41
|
@explicit = @explicit.clone
|
42
42
|
end
|
43
43
|
BEQUEATH_KEYS = %w[chomp strip rename closeoneof closeoncopy]
|
44
|
-
#BEQUEATH_KEYS = %w[chomp strip rename]
|
45
44
|
def bequeath(oldcx)
|
46
45
|
keys = BEQUEATH_KEYS
|
47
46
|
ncx = oldcx.clone
|
@@ -113,8 +112,13 @@ module RIO
|
|
113
112
|
str
|
114
113
|
end
|
115
114
|
|
116
|
-
extend
|
117
|
-
|
115
|
+
extend RIO::Fwd
|
116
|
+
fwd_readers :@values,
|
117
|
+
:has_key?,
|
118
|
+
:values_at,
|
119
|
+
:keys,
|
120
|
+
:[]
|
121
|
+
|
118
122
|
end
|
119
123
|
end
|
120
124
|
end
|
data/lib/rio/context/binmode.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,14 +22,9 @@
|
|
22
22
|
#++
|
23
23
|
#
|
24
24
|
|
25
|
-
|
26
|
-
#require 'rio/context/cxx.rb'
|
27
|
-
#require 'rio/iomode'
|
28
|
-
|
29
25
|
require 'rio/context/stream'
|
30
26
|
require 'rio/context/dir'
|
31
27
|
require 'rio/context/skip'
|
32
|
-
#require 'rio/filter'
|
33
28
|
require 'rio/context/autoclose'
|
34
29
|
require 'rio/context/gzip'
|
35
30
|
require 'rio/context/copying'
|
@@ -59,5 +54,4 @@ module RIO
|
|
59
54
|
end
|
60
55
|
end
|
61
56
|
|
62
|
-
|
63
57
|
end
|
data/lib/rio/context/copying.rb
CHANGED
data/lib/rio/context/cxx.rb
CHANGED
data/lib/rio/context/dir.rb
CHANGED
data/lib/rio/context/encoding.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.
|
@@ -30,7 +30,6 @@ module RIO
|
|
30
30
|
|
31
31
|
module Methods
|
32
32
|
def enc(*args,&block)
|
33
|
-
#ioh.set_encoding(*args) if ioh
|
34
33
|
_set_enc_from_args(*args)
|
35
34
|
cxx(:enc_args,args,&block)
|
36
35
|
end
|
data/lib/rio/context/gzip.rb
CHANGED
data/lib/rio/context/methods.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,14 +22,9 @@
|
|
22
22
|
#++
|
23
23
|
#
|
24
24
|
|
25
|
-
|
26
|
-
#require 'rio/context/cxx.rb'
|
27
|
-
#require 'rio/iomode'
|
28
|
-
|
29
25
|
require 'rio/context/stream'
|
30
26
|
require 'rio/context/dir'
|
31
27
|
require 'rio/context/skip'
|
32
|
-
#require 'rio/filter'
|
33
28
|
require 'rio/context/autoclose'
|
34
29
|
require 'rio/context/gzip'
|
35
30
|
require 'rio/context/copying'
|
data/lib/rio/context/skip.rb
CHANGED
data/lib/rio/context/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.
|
@@ -22,7 +22,6 @@
|
|
22
22
|
#++
|
23
23
|
#
|
24
24
|
|
25
|
-
|
26
25
|
require 'rio/context/cxx.rb'
|
27
26
|
require 'rio/iomode'
|
28
27
|
|
@@ -192,9 +191,6 @@ module RIO
|
|
192
191
|
_set_sstype('skiprows')
|
193
192
|
_rows(args,false,&block)
|
194
193
|
end
|
195
|
-
|
196
|
-
|
197
|
-
|
198
194
|
def bytes(nb=1,*args,&block)
|
199
195
|
_set_sstype('bytes')
|
200
196
|
_set_bytes(nb)
|
@@ -210,9 +206,6 @@ module RIO
|
|
210
206
|
each(&block) if block_given?
|
211
207
|
self
|
212
208
|
end
|
213
|
-
|
214
|
-
|
215
|
-
|
216
209
|
end
|
217
210
|
end
|
218
211
|
end
|
data/lib/rio/cp.rb
CHANGED
data/lib/rio/cxuri.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
|
-
require 'forwardable'
|
26
25
|
require 'rio/alturi'
|
27
26
|
|
28
27
|
module RIO
|
@@ -52,12 +51,17 @@ module RIO
|
|
52
51
|
YAML.load(@parts.fragment) unless @parts.fragment.nil?
|
53
52
|
end
|
54
53
|
|
55
|
-
extend
|
54
|
+
extend RIO::Fwd
|
55
|
+
|
56
|
+
fwd :@parts,
|
57
|
+
:authority,
|
58
|
+
:scheme,
|
59
|
+
:path,
|
60
|
+
:query,
|
61
|
+
:userinfo,
|
62
|
+
:host,
|
63
|
+
:port
|
56
64
|
|
57
|
-
def_delegators :@parts, :authority,:scheme,:path
|
58
|
-
def_delegators :@parts, :authority=,:scheme=,:path=,:query=,:query
|
59
|
-
def_delegators :@parts, :userinfo,:host
|
60
|
-
def_delegators :@parts, :userinfo=,:host=,:port=, :port
|
61
65
|
def to_s
|
62
66
|
@parts.uri
|
63
67
|
end
|