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/kernel.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,4 +38,3 @@ module RIO
|
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
|
-
#require 'rio'
|
data/lib/rio/local.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,15 +37,3 @@ if $0 == __FILE__
|
|
37
37
|
end
|
38
38
|
|
39
39
|
__END__
|
40
|
-
|
41
|
-
require 'test/unit'
|
42
|
-
|
43
|
-
class TC_FS_Local < Test::Unit::TestCase
|
44
|
-
|
45
|
-
def test_to_a
|
46
|
-
require 'rio/log'
|
47
|
-
RIO::Log.init
|
48
|
-
raise 'RuntimeError',"No tests defined for RIO::Args",callee
|
49
|
-
end
|
50
|
-
|
51
|
-
end
|
data/lib/rio/match.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,7 +28,6 @@ module RIO
|
|
28
28
|
module Common
|
29
29
|
|
30
30
|
def ss_type?(keys)
|
31
|
-
#p cx,keys
|
32
31
|
case cx['ss_type']
|
33
32
|
when nil
|
34
33
|
keys[0]
|
data/lib/rio/matchrecord.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,11 @@ module RIO
|
|
55
55
|
end
|
56
56
|
class Range < Base
|
57
57
|
def match?(val,recno)
|
58
|
-
#p "match?(#{val},#{recno}) select_arg=#{@select_arg}"
|
59
58
|
@select_arg === recno
|
60
59
|
end
|
61
60
|
end
|
62
|
-
class
|
61
|
+
class Integer < Base
|
63
62
|
def match?(val,recno)
|
64
|
-
#p "match?(#{val},#{recno}) select_arg=#{@select_arg}"
|
65
63
|
@select_arg === recno
|
66
64
|
end
|
67
65
|
end
|
@@ -71,14 +69,12 @@ module RIO
|
|
71
69
|
@therio = therio
|
72
70
|
end
|
73
71
|
def match?(val,recno)
|
74
|
-
#p "match?(#{val},#{recno}) select_arg=#{@select_arg}"
|
75
72
|
args = [val,recno,@therio]
|
76
73
|
@select_arg.call(*args[0,@select_arg.arity])
|
77
74
|
end
|
78
75
|
end
|
79
76
|
class Symbol < Base
|
80
77
|
def match?(val,recno)
|
81
|
-
#p "match?(#{val},#{recno}) select_arg=#{@select_arg}"
|
82
78
|
val.__send__(@select_arg)
|
83
79
|
end
|
84
80
|
end
|
@@ -92,13 +88,11 @@ module RIO
|
|
92
88
|
@therio = therio
|
93
89
|
end
|
94
90
|
def match?(val,recno)
|
95
|
-
#p "match?(#{val},#{recno}) select_arg=#{@select_arg}"
|
96
91
|
@select_arg.all? { |sel| sel.match?(val,recno) }
|
97
92
|
end
|
98
93
|
end
|
99
94
|
class Case < Base
|
100
95
|
def match?(val,recno)
|
101
|
-
#p "match?(#{val},#{recno}) select_arg=#{@select_arg}"
|
102
96
|
@select_arg === val
|
103
97
|
end
|
104
98
|
end
|
@@ -112,8 +106,8 @@ module RIO
|
|
112
106
|
Match::Record::Proc.new(arg,therio)
|
113
107
|
when ::Symbol
|
114
108
|
Match::Record::Symbol.new(arg)
|
115
|
-
when ::
|
116
|
-
Match::Record::
|
109
|
+
when ::Integer
|
110
|
+
Match::Record::Integer.new(arg)
|
117
111
|
when ::Array
|
118
112
|
Match::Record::And.new(arg,therio)
|
119
113
|
else
|
@@ -141,14 +135,13 @@ module RIO
|
|
141
135
|
@list << create_sel(therio,arg)
|
142
136
|
end
|
143
137
|
end
|
144
|
-
#p "SelList(#{args.inspect},#{@list.inspect})"
|
145
138
|
end
|
146
139
|
def inspect
|
147
140
|
@list.inspect
|
148
141
|
end
|
149
142
|
def size() @list.size unless @list.nil? end
|
150
143
|
def only_one_fixnum?()
|
151
|
-
@list && @list.size == 1 && @list[0].kind_of?(Match::Record::
|
144
|
+
@list && @list.size == 1 && @list[0].kind_of?(Match::Record::Integer)
|
152
145
|
end
|
153
146
|
def delete_at(index)
|
154
147
|
@list.delete_at(index)
|
@@ -172,33 +165,14 @@ module RIO
|
|
172
165
|
end
|
173
166
|
def create_sel(therio,arg)
|
174
167
|
Match::Record.create(therio,arg)
|
175
|
-
# case arg
|
176
|
-
# when ::Regexp
|
177
|
-
# Match::Record::RegExp.new(arg)
|
178
|
-
# when ::Range
|
179
|
-
# Match::Record::Range.new(arg)
|
180
|
-
# when ::Proc
|
181
|
-
# Match::Record::Proc.new(arg,therio)
|
182
|
-
# when ::Symbol
|
183
|
-
# Match::Record::Symbol.new(arg)
|
184
|
-
# when ::Fixnum
|
185
|
-
# Match::Record::Fixnum.new(arg)
|
186
|
-
# when ::Array
|
187
|
-
# Match::Record::And.new(arg)
|
188
|
-
# else
|
189
|
-
# raise ArgumentError,"Argument must be a Regexp,Range,Fixnum,Proc, or Symbol"
|
190
|
-
# end
|
191
168
|
end
|
192
169
|
def match?(val,recno)
|
193
|
-
# !@list.nil? && (@list.empty? || @list.detect { |sel| sel.match?(val,recno) } || false) && true
|
194
170
|
return false unless @list
|
195
171
|
return true if @list.empty?
|
196
172
|
as = nil
|
197
173
|
al = @list.detect { |sel| as = sel.match?(val,recno)
|
198
|
-
#p "1: #{$1} as[match?]: #{as.inspect}"
|
199
174
|
as
|
200
175
|
}
|
201
|
-
#p "[SelList.match?] as:#{as.inspect} al:#{al.inspect}"
|
202
176
|
return as if al
|
203
177
|
return false
|
204
178
|
end
|
@@ -256,11 +230,8 @@ module RIO
|
|
256
230
|
@always == false
|
257
231
|
end
|
258
232
|
def match?(val,recno)
|
259
|
-
#p "match?(#{val},#{recno}) #{self.inspect}"
|
260
233
|
return @always if @always
|
261
|
-
#return @always unless @always.nil?
|
262
234
|
as = nil
|
263
|
-
#ok = ((!@sel.nil? && (as = @sel.match?(val,recno))) && !(!@rej.nil? && @rej.match?(val,recno)))
|
264
235
|
ok = ((@sel && (as = @sel.match?(val,recno))) && !(@rej && @rej.match?(val,recno)))
|
265
236
|
return (ok ? as : ok)
|
266
237
|
end
|
data/lib/rio/no_warn.rb
CHANGED
data/lib/rio/nullio.rb
CHANGED
data/lib/rio/open3.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
|
-
#
|
27
|
-
# = open3.rb
|
28
|
-
#
|
29
|
-
# = Rio
|
30
|
-
#
|
31
|
-
#
|
32
|
-
|
33
|
-
|
34
25
|
require 'rio'
|
35
26
|
require 'open3'
|
36
27
|
|
data/lib/rio/ops.rb
CHANGED
data/lib/rio/ops/construct.rb
CHANGED
data/lib/rio/ops/create.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,13 +32,11 @@ module RIO
|
|
32
32
|
uri.clone.join(*args)
|
33
33
|
}
|
34
34
|
end
|
35
|
-
#alias :catpath :join
|
36
35
|
def join!(*args)
|
37
36
|
rtn_reset {
|
38
37
|
uri.join(*args)
|
39
38
|
}
|
40
39
|
end
|
41
|
-
#alias :catpath! :join!
|
42
40
|
def /(arg)
|
43
41
|
join(arg)
|
44
42
|
end
|
data/lib/rio/ops/dir.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,40 +25,8 @@
|
|
25
25
|
|
26
26
|
require 'rio/grande'
|
27
27
|
require 'rio/cp'
|
28
|
-
#require 'rio/ops/either'
|
29
28
|
|
30
29
|
module RIO
|
31
|
-
# module Impl
|
32
|
-
# module U
|
33
|
-
# def self.rmdir(s) ::Dir.rmdir(s.to_s) end
|
34
|
-
# def self.mkdir(s,*args) ::Dir.mkdir(s.to_s,*args) end
|
35
|
-
# def self.chdir(s,&block) ::Dir.chdir(s.to_s,&block) end
|
36
|
-
# def self.foreach(s,&block) ::Dir.foreach(s.to_s,&block) end
|
37
|
-
# def self.entries(s) ::Dir.entries(s.to_s) end
|
38
|
-
# def self.cp_r(s,d)
|
39
|
-
# require 'fileutils'
|
40
|
-
# ::FileUtils.cp_r(s.to_s,d.to_s)
|
41
|
-
# end
|
42
|
-
# def self.find(s,&block)
|
43
|
-
# require 'find'
|
44
|
-
# Find.find(s.to_s) do |f|
|
45
|
-
# yield f
|
46
|
-
# end
|
47
|
-
# end
|
48
|
-
# def self.glob(gstr,*args,&block)
|
49
|
-
# ::Dir.glob(gstr,*args,&block)
|
50
|
-
# end
|
51
|
-
# def self.rmtree(s)
|
52
|
-
# require 'fileutils'
|
53
|
-
# ::FileUtils.rmtree(s.to_s)
|
54
|
-
# end
|
55
|
-
# def self.mkpath(s)
|
56
|
-
# require 'fileutils'
|
57
|
-
# ::FileUtils.mkpath(s.to_s)
|
58
|
-
# end
|
59
|
-
# end
|
60
|
-
# end
|
61
|
-
|
62
30
|
module Ops
|
63
31
|
module Dir
|
64
32
|
module ExistOrNot
|
@@ -72,15 +40,11 @@ module RIO
|
|
72
40
|
include ExistOrNot
|
73
41
|
include ::RIO::Ops::FileOrDir::NonExisting
|
74
42
|
def mkdir(*args)
|
75
|
-
#p "ops/dir/mkdir: self=#{self.to_s}"
|
76
|
-
#p "ops/dir/mkdir: self.path=#{self.path.inspect}"
|
77
43
|
fs.mkdir(self.path,*args);
|
78
44
|
softreset()
|
79
45
|
end
|
80
46
|
def mkpath(*args)
|
81
|
-
# p callstr('mkpath',*args)
|
82
47
|
fs.mkpath(self.path,*args);
|
83
|
-
#fs.mkpath(self,*args);
|
84
48
|
softreset()
|
85
49
|
end
|
86
50
|
def rmdir(*args) self end
|
@@ -122,7 +86,6 @@ module RIO
|
|
122
86
|
softreset()
|
123
87
|
end
|
124
88
|
def rmtree(*args) fs.rmtree(self.path,*args); softreset() end
|
125
|
-
# def rm(*args) fs.rm(self.path,*args); softreset() end
|
126
89
|
|
127
90
|
alias :delete :rmdir
|
128
91
|
alias :unlink :delete
|
@@ -191,8 +154,9 @@ module RIO
|
|
191
154
|
def rewind() ioh.rewind(); self end
|
192
155
|
def seek(integer) ioh.seek(integer); self end
|
193
156
|
|
194
|
-
extend
|
195
|
-
|
157
|
+
extend RIO::Fwd
|
158
|
+
fwd_reader :ioh,:tell
|
159
|
+
fwd :ioh, :pos
|
196
160
|
|
197
161
|
protected
|
198
162
|
require 'rio/entrysel'
|
@@ -216,13 +180,11 @@ module RIO
|
|
216
180
|
end
|
217
181
|
end
|
218
182
|
def handle_skipped
|
219
|
-
#return unless cx.has_key?('skip_args') or cx['skipping']
|
220
183
|
return self unless cx.has_key?('skip_args')
|
221
184
|
args = cx['skip_args'] || []
|
222
185
|
self.skipentries(*args)
|
223
186
|
end
|
224
187
|
def ent_to_rio_(ent,indir)
|
225
|
-
#p "ent_to_rio: ent=#{ent.inspect} indir=#{indir}"
|
226
188
|
if ent.kind_of?(RIO::Rio)
|
227
189
|
oldpath = ent.to_s
|
228
190
|
ent.rl.urlpath = indir.to_s
|
@@ -240,9 +202,6 @@ module RIO
|
|
240
202
|
end
|
241
203
|
def handle_ent_(ent,indir,sel,&block)
|
242
204
|
begin
|
243
|
-
#p "ENT=#{ent.inspect}"
|
244
|
-
#p "FS=#{rl.fs.inspect}"
|
245
|
-
#p "FS.ENCODING=#{rl.fs.encoding}"
|
246
205
|
ent.force_encoding(rl.fs.encoding)
|
247
206
|
erio = ent_to_rio_(ent,indir)
|
248
207
|
if stream_iter?
|
@@ -251,7 +210,6 @@ module RIO
|
|
251
210
|
else
|
252
211
|
yield _add_iter_cx(erio) if sel.match?(erio)
|
253
212
|
end
|
254
|
-
#p "handle_ent_2: #{erio.cx.inspect}"
|
255
213
|
|
256
214
|
if cx.has_key?('all') and erio.directory?
|
257
215
|
rsel = Match::Entry::SelectorClassic.new(cx['r_sel'],cx['r_nosel'])
|
data/lib/rio/ops/either.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.
|
@@ -61,7 +61,6 @@ module RIO
|
|
61
61
|
else
|
62
62
|
rtn_reset {
|
63
63
|
dst = args.shift.to_s
|
64
|
-
#p "rename: #{self} => #{dst}"
|
65
64
|
fs.mv(uri.path,dst,*args) unless uri.path == dst
|
66
65
|
}
|
67
66
|
end
|
@@ -73,7 +72,6 @@ module RIO
|
|
73
72
|
rtn_reset {
|
74
73
|
cpath = uri.path
|
75
74
|
uri.path = args.shift.to_s
|
76
|
-
#p "rename!: #{cpath} => #{uri.path}"
|
77
75
|
fs.mv(cpath,uri.path,*args) unless uri.path == cpath
|
78
76
|
}
|
79
77
|
end
|
data/lib/rio/ops/file.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,29 +22,6 @@
|
|
22
22
|
#++
|
23
23
|
#
|
24
24
|
|
25
|
-
|
26
|
-
#require 'rio/cp'
|
27
|
-
#require 'rio/piper/cp'
|
28
|
-
#require 'rio/ops/either'
|
29
|
-
|
30
|
-
# module RIO
|
31
|
-
# module Impl
|
32
|
-
# module U
|
33
|
-
# def self.copy(s,d)
|
34
|
-
# require 'fileutils'
|
35
|
-
# ::FileUtils.cp(s.to_s,d.to_s)
|
36
|
-
# end
|
37
|
-
# def self.rm(s)
|
38
|
-
# require 'fileutils'
|
39
|
-
# ::FileUtils.rm(s.to_s)
|
40
|
-
# end
|
41
|
-
# def self.touch(s)
|
42
|
-
# require 'fileutils'
|
43
|
-
# ::FileUtils.touch(s.to_s)
|
44
|
-
# end
|
45
|
-
# end
|
46
|
-
# end
|
47
|
-
# end
|
48
25
|
module RIO
|
49
26
|
module Ops
|
50
27
|
module File
|
@@ -91,7 +68,6 @@ module RIO
|
|
91
68
|
alias :delete! :delete
|
92
69
|
def touch(*args)
|
93
70
|
rtn_reset {
|
94
|
-
# fs.touch(self,*args)
|
95
71
|
::File.open(self.to_s, 'a') {
|
96
72
|
;
|
97
73
|
}
|
data/lib/rio/ops/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.
|
@@ -24,7 +24,6 @@
|
|
24
24
|
|
25
25
|
|
26
26
|
require 'rio/fwd'
|
27
|
-
#require 'rio/impl/path'
|
28
27
|
require 'rio/ops/create'
|
29
28
|
require 'rio/ops/construct'
|
30
29
|
module RIO
|
@@ -85,20 +84,14 @@ module RIO
|
|
85
84
|
nrio = new_rio(rl.abs)
|
86
85
|
nrio
|
87
86
|
else
|
88
|
-
#new_rio(rl,{:base => ensure_rio(base).abs.to_uri}).abs
|
89
87
|
brio = ensure_rio(base)
|
90
88
|
new_rio(rl.abs(ensure_rio(base).to_s))
|
91
89
|
end
|
92
90
|
end
|
93
91
|
def absolute?
|
94
|
-
#p "ops/path.rb absolute?"
|
95
92
|
rl.absolute?
|
96
93
|
end
|
97
94
|
alias :abs? :absolute?
|
98
|
-
#def abs?
|
99
|
-
# p "ops/path.rb abs?"
|
100
|
-
# rl.abs?
|
101
|
-
#end
|
102
95
|
def route_from(other)
|
103
96
|
this_uri = rl.uri.abs
|
104
97
|
other_uri = ensure_rio(other).rl.uri.abs
|
@@ -121,14 +114,12 @@ module RIO
|
|
121
114
|
new_rio(rl.merge(ensure_rio(other).rl))
|
122
115
|
end
|
123
116
|
def base()
|
124
|
-
#p "BASE: " + rl.class.to_s
|
125
117
|
new_rio(rl.base())
|
126
118
|
end
|
127
119
|
def setbase(b)
|
128
120
|
rl.base(b)
|
129
121
|
self
|
130
122
|
end
|
131
|
-
extend Forwardable
|
132
123
|
extend Fwd
|
133
124
|
fwd :rl,:scheme,:host,:user,:password
|
134
125
|
fwd :rl,:query,:fragment,:userinfo
|
@@ -159,12 +150,6 @@ module RIO
|
|
159
150
|
parts << new_rio(sparts[n], {:base => bparts[n]})
|
160
151
|
end
|
161
152
|
parts.extend(ToRio::Array)
|
162
|
-
#parts.each do |part|
|
163
|
-
# p "part=#{part.uri} abs=#{part.abs.uri}"
|
164
|
-
#end
|
165
|
-
# map to rios and extend the array with to_array
|
166
|
-
#parts.map { |arl| new_rio(arl) }.extend(ToRio::Array)
|
167
|
-
#parts.map { |arl| new_rio(arl) }
|
168
153
|
end
|
169
154
|
def basename(*args)
|
170
155
|
unless args.empty?
|
@@ -185,7 +170,6 @@ module RIO
|
|
185
170
|
softreset
|
186
171
|
uri.ref.sub(re,arg.to_s)
|
187
172
|
}
|
188
|
-
#new_rio(softreset.to_s.sub(re,arg.to_s))
|
189
173
|
end
|
190
174
|
def gsub(re,arg)
|
191
175
|
new_rio(softreset.to_s.gsub(re,arg.to_s))
|
@@ -292,7 +276,6 @@ module RIO
|
|
292
276
|
if self.abs?
|
293
277
|
fs.symlink(self,dst)
|
294
278
|
else
|
295
|
-
#p "symlink(#{dst.route_to(self)},#{dst})"
|
296
279
|
fs.symlink(dst.route_to(self).to_s,dst.to_s)
|
297
280
|
end
|
298
281
|
dst.reset
|