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/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,16 +22,7 @@
|
|
22
22
|
#++
|
23
23
|
#
|
24
24
|
|
25
|
-
|
26
|
-
#require 'rio/state'
|
27
|
-
#require 'rio/ops/path'
|
28
|
-
#require 'rio/ops/file'
|
29
|
-
|
30
|
-
|
31
|
-
|
32
25
|
module RIO
|
33
|
-
|
34
|
-
|
35
26
|
module File #:nodoc: all
|
36
27
|
class Base < State::Base
|
37
28
|
include Ops::Path::Str
|
@@ -39,14 +30,12 @@ module RIO
|
|
39
30
|
protected
|
40
31
|
|
41
32
|
def stream_rl_
|
42
|
-
#RIO::File::RL.new(self.to_uri,{:fs => self.fs})
|
43
33
|
self.rl.file_rl
|
44
34
|
end
|
45
35
|
|
46
36
|
public
|
47
37
|
|
48
38
|
def fstream()
|
49
|
-
#p self.rl.class
|
50
39
|
self.rl = self.stream_rl_
|
51
40
|
become 'Path::Stream::Open'
|
52
41
|
end
|
data/lib/rio/filter.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,15 +36,6 @@ module RIO
|
|
36
36
|
def autoclosed?
|
37
37
|
@autoclosed
|
38
38
|
end
|
39
|
-
# def close_on_eof_raise(&block)
|
40
|
-
# begin
|
41
|
-
# rtn = yield
|
42
|
-
# rescue EOFError
|
43
|
-
# close_on_eof_(rtn)
|
44
|
-
# raise
|
45
|
-
# end
|
46
|
-
# rtn
|
47
|
-
# end
|
48
39
|
def close_on_eof(&block)
|
49
40
|
#p callstr('close_on_eof',rtn)
|
50
41
|
rtn = yield
|
data/lib/rio/filter/gzip.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,23 +38,8 @@ module RIO
|
|
38
38
|
end
|
39
39
|
end
|
40
40
|
module GZipRead
|
41
|
-
# def self.extend_object(ioh_stream)
|
42
|
-
# super
|
43
|
-
# gz = Zlib::GzipReader.new(ioh_stream.ios)
|
44
|
-
# gz.extend Filter::GZipMissing
|
45
|
-
# gz.extend Filter::GZipWin32MissingEachLine
|
46
|
-
# #ioh_stream.iostack.push(gz)
|
47
|
-
# ioh_stream.ios = gz
|
48
|
-
# end
|
49
41
|
end
|
50
42
|
module GZipWrite
|
51
|
-
# def self.extend_object(ioh_stream)
|
52
|
-
# super
|
53
|
-
# gz = Zlib::GzipWriter.new(ioh_stream.ios)
|
54
|
-
# gz.extend Filter::GZipMissing
|
55
|
-
# #ioh_stream.iostack.push(gz)
|
56
|
-
# ioh_stream.ios = gz
|
57
|
-
# end
|
58
43
|
end
|
59
44
|
end
|
60
45
|
end
|
data/lib/rio/fs.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'rio/fwd'
|
2
2
|
|
3
3
|
module RIO
|
4
4
|
module FS
|
@@ -14,8 +14,6 @@ module RIO
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def method_missing(sym,*args,&block)
|
17
|
-
#a = convert_args(args)
|
18
|
-
# puts "FS::Handle:method_missing(#{sym.inspect},#{args.inspect}) #{@fs.inspect}"
|
19
17
|
@fs.__send__(sym,*args,&block)
|
20
18
|
end
|
21
19
|
end
|
@@ -27,102 +25,92 @@ module RIO
|
|
27
25
|
module FS #:nodoc: all
|
28
26
|
module Fwd
|
29
27
|
module Str
|
30
|
-
extend
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
:join,
|
39
|
-
:cleanpath
|
28
|
+
extend ::RIO::Fwd
|
29
|
+
fwd_readers :@file,
|
30
|
+
:fnmatch?,
|
31
|
+
:extname,
|
32
|
+
:basename,
|
33
|
+
:dirname,
|
34
|
+
:join,
|
35
|
+
:cleanpath
|
40
36
|
end
|
41
37
|
module File
|
42
|
-
extend
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
:chmod,
|
57
|
-
:chown,
|
58
|
-
|
59
|
-
:readlink,
|
60
|
-
:lstat,
|
61
|
-
|
62
|
-
:truncate
|
38
|
+
extend ::RIO::Fwd
|
39
|
+
fwd_readers :@file,
|
40
|
+
:expand_path,
|
41
|
+
:ftype,
|
42
|
+
:symlink,
|
43
|
+
:stat,
|
44
|
+
:atime,
|
45
|
+
:ctime,
|
46
|
+
:mtime,
|
47
|
+
:chmod,
|
48
|
+
:chown,
|
49
|
+
:readlink,
|
50
|
+
:lstat,
|
51
|
+
:truncate
|
63
52
|
|
64
53
|
end
|
65
54
|
module Dir
|
66
|
-
extend
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
:getwd
|
55
|
+
extend ::RIO::Fwd
|
56
|
+
fwd_readers :@dir,
|
57
|
+
:rmdir,
|
58
|
+
:mkdir,
|
59
|
+
:chdir,
|
60
|
+
:foreach,
|
61
|
+
:entries,
|
62
|
+
:glob,
|
63
|
+
:pwd,
|
64
|
+
:getwd
|
77
65
|
end
|
78
66
|
module Test
|
79
|
-
extend
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
67
|
+
extend ::RIO::Fwd
|
68
|
+
fwd_readers :@test,
|
69
|
+
:blockdev?,
|
70
|
+
:chardev?,
|
71
|
+
:directory?,
|
72
|
+
:dir?,
|
73
|
+
:executable?,
|
74
|
+
:executable_real?,
|
75
|
+
:exist?,
|
76
|
+
:file?,
|
77
|
+
:grpowned?,
|
78
|
+
:owned?,
|
79
|
+
:pipe?,
|
80
|
+
:readable?,
|
81
|
+
:readable_real?,
|
82
|
+
:setgid?,
|
83
|
+
:setuid?,
|
84
|
+
:size,
|
85
|
+
:size?,
|
86
|
+
:socket?,
|
87
|
+
:sticky?,
|
88
|
+
:symlink?,
|
89
|
+
:writable?,
|
90
|
+
:writable_real?,
|
91
|
+
:zero?
|
104
92
|
end
|
105
93
|
module Path
|
106
|
-
extend
|
94
|
+
extend ::RIO::Fwd
|
107
95
|
require 'pathname'
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
96
|
+
fwd_readers :@path,
|
97
|
+
:root?,
|
98
|
+
:mountpoint?,
|
99
|
+
:realpath
|
112
100
|
end
|
113
101
|
module Util
|
114
|
-
extend
|
102
|
+
extend ::RIO::Fwd
|
115
103
|
# Directory stuff
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
104
|
+
fwd_readers :@util,
|
105
|
+
:cp_r,
|
106
|
+
:rmtree,
|
107
|
+
:mkpath,
|
108
|
+
:mv,
|
109
|
+
:touch
|
110
|
+
|
123
111
|
# file
|
124
|
-
|
125
|
-
|
112
|
+
fwd_readers :@file,
|
113
|
+
:delete
|
126
114
|
end
|
127
115
|
end
|
128
116
|
end
|
@@ -133,7 +121,6 @@ module RIO
|
|
133
121
|
FS_ENCODING = Dir.pwd.encoding
|
134
122
|
attr_reader :file,:dir
|
135
123
|
def initialize(*args)
|
136
|
-
#p "RIO::FS::Local.initialize(#{args}) pwdenc=#{}"
|
137
124
|
@file = ::File
|
138
125
|
@test = ::FileTest
|
139
126
|
@dir = ::Dir
|
@@ -149,8 +136,7 @@ module RIO
|
|
149
136
|
require 'rio/local'
|
150
137
|
::RIO::Local::ROOT_DIR
|
151
138
|
end
|
152
|
-
|
153
|
-
# 'def_delegators :@test,:directory?,:file?,:exist?
|
139
|
+
|
154
140
|
include RIO::FS::Fwd::Str
|
155
141
|
include RIO::FS::Fwd::Test
|
156
142
|
include RIO::FS::Fwd::Path
|
@@ -158,13 +144,10 @@ module RIO
|
|
158
144
|
include RIO::FS::Fwd::Dir
|
159
145
|
include RIO::FS::Fwd::Util
|
160
146
|
|
161
|
-
|
162
|
-
|
163
147
|
end
|
164
|
-
|
165
|
-
|
166
148
|
end
|
167
149
|
end
|
150
|
+
|
168
151
|
module RIO
|
169
152
|
module FS
|
170
153
|
LOCAL = Handle.new(Local.new)
|
data/lib/rio/fs/base.rb
CHANGED
data/lib/rio/fs/impl.rb
CHANGED
data/lib/rio/fs/native.rb
CHANGED
data/lib/rio/fs/stream.rb
CHANGED
data/lib/rio/fs/url.rb
CHANGED
data/lib/rio/ftp/conncache.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.
|
@@ -39,13 +39,10 @@ module RIO
|
|
39
39
|
_init_connection()
|
40
40
|
end
|
41
41
|
def remote_root
|
42
|
-
#p "conncache: remote_root=#{@remote_root.inspect}"
|
43
42
|
@remote_root
|
44
43
|
end
|
45
44
|
def _init_connection
|
46
|
-
#p "_init_connection: uri=#{@uri.inspect}"
|
47
45
|
@netftp = ::Net::FTP.new()
|
48
|
-
#p @uri.host,@uri.port
|
49
46
|
@netftp.connect(@uri.host,@uri.port||21)
|
50
47
|
if @uri.user
|
51
48
|
@netftp.login(@uri.user,@uri.password)
|
@@ -54,8 +51,6 @@ module RIO
|
|
54
51
|
end
|
55
52
|
@remote_root = @netftp.pwd
|
56
53
|
@encoding = @remote_root.encoding
|
57
|
-
#p "FTP._init_connection @remote_root=#{remote_root} enc=#{@remote_root.encoding}"
|
58
|
-
# @remote_root = '' if @remote_root == '/'
|
59
54
|
end
|
60
55
|
def method_missing(sym,*args,&block)
|
61
56
|
@netftp.__send__(sym,*args,&block)
|
@@ -76,14 +71,6 @@ module RIO
|
|
76
71
|
key = urikey(uri)
|
77
72
|
unless @conns.has_key?(key)
|
78
73
|
@conns[key] = Connection.new(uri)
|
79
|
-
# c = @conns[key]
|
80
|
-
# ObjectSpace.define_finalizer(c,proc {
|
81
|
-
# p "Quit and Close #{uri}"
|
82
|
-
# if c and !c.closed?
|
83
|
-
# c.quit
|
84
|
-
# c.close
|
85
|
-
# end
|
86
|
-
# })
|
87
74
|
@count[key] = 0
|
88
75
|
end
|
89
76
|
@count[key] += 1
|
@@ -92,7 +79,6 @@ module RIO
|
|
92
79
|
def close(uri)
|
93
80
|
key = urikey(uri)
|
94
81
|
@count[key] -= 1
|
95
|
-
#p "Closed #{uri} count=#{@count[key]}"
|
96
82
|
end
|
97
83
|
end
|
98
84
|
end
|
data/lib/rio/ftp/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.
|
@@ -70,7 +70,6 @@ module RIO
|
|
70
70
|
end
|
71
71
|
end
|
72
72
|
def each(&block)
|
73
|
-
p "Hello Mr. Phelps"
|
74
73
|
names.each { |ent|
|
75
74
|
@entidx += 1
|
76
75
|
yield entpath(ent)
|
data/lib/rio/ftp/fs.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.
|
@@ -63,7 +63,6 @@ module RIO
|
|
63
63
|
|
64
64
|
def pwd() conn.pwd end
|
65
65
|
def getwd()
|
66
|
-
#p "GETWD self.pwd=#{self.pwd}"
|
67
66
|
self.pwd
|
68
67
|
end
|
69
68
|
def cwd()
|
@@ -74,11 +73,9 @@ module RIO
|
|
74
73
|
wduri.to_s
|
75
74
|
end
|
76
75
|
def remote_path(url)
|
77
|
-
#p "remote_path: url=#{url.inspect}"
|
78
76
|
uri = Alt::URI.parse(url)
|
79
77
|
path = uri.path
|
80
78
|
wd = self.pwd
|
81
|
-
#p "remote_path remote_root=#{self.remote_root} path=#{path} wd=#{wd}"
|
82
79
|
rpth = if path.start_with?('/')
|
83
80
|
path
|
84
81
|
else
|
@@ -87,7 +84,6 @@ module RIO
|
|
87
84
|
rpth
|
88
85
|
end
|
89
86
|
def chdir(url,&block)
|
90
|
-
#p "ftp::fs chdir url=#{url}"
|
91
87
|
if block_given?
|
92
88
|
wd = conn.pwd
|
93
89
|
conn.chdir(remote_path(url))
|
@@ -102,11 +98,7 @@ module RIO
|
|
102
98
|
end
|
103
99
|
end
|
104
100
|
def mkdir(url)
|
105
|
-
#p "ftp/fs/mkdir: url=#{url}"
|
106
101
|
rp = remote_path(url)
|
107
|
-
#p "ftp/fs/mkdir: rp=#{rp}"
|
108
|
-
#wd = conn.pwd
|
109
|
-
#p "ftp/fs/mkdir: wd=#{wd}"
|
110
102
|
conn.mkdir(rp)
|
111
103
|
end
|
112
104
|
def mv(src_url,dst_url)
|
@@ -132,9 +124,7 @@ module RIO
|
|
132
124
|
end
|
133
125
|
|
134
126
|
def get_ftype(url)
|
135
|
-
#p "get_ftype(#{url})"
|
136
127
|
pth = remote_path(url)
|
137
|
-
#p "URL=#{url},PTH=#{pth}"
|
138
128
|
ftype = nil
|
139
129
|
begin
|
140
130
|
conn.mdtm(pth)
|
@@ -165,7 +155,6 @@ module RIO
|
|
165
155
|
false
|
166
156
|
end
|
167
157
|
def mkpath(url)
|
168
|
-
#p "mkpath: #{url.inspect}"
|
169
158
|
pathparts = url.split('/')
|
170
159
|
pathparts.shift if pathparts[0] == ""
|
171
160
|
pathparts[0] = '/' + pathparts[0] if url.start_with?('/')
|
@@ -182,7 +171,6 @@ module RIO
|
|
182
171
|
private
|
183
172
|
|
184
173
|
def _rment(url)
|
185
|
-
#p "_rment(#{url})"
|
186
174
|
ftype = get_ftype(url)
|
187
175
|
case ftype
|
188
176
|
when :file
|