rio 0.5.1 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (186) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +1 -1
  3. data/README +1 -1
  4. data/lib/rio.rb +5 -4
  5. data/lib/rio/abstract_method.rb +1 -1
  6. data/lib/rio/alturi.rb +10 -69
  7. data/lib/rio/alturi/algorithm.rb +1 -18
  8. data/lib/rio/alturi/escape.rb +0 -4
  9. data/lib/rio/alturi/parse.rb +0 -29
  10. data/lib/rio/alturi/path_parts.rb +0 -2
  11. data/lib/rio/alturi/uri_parts.rb +3 -32
  12. data/lib/rio/argv.rb +1 -1
  13. data/lib/rio/arraynge.rb +1 -3
  14. data/lib/rio/arycopy.rb +1 -1
  15. data/lib/rio/assert.rb +31 -47
  16. data/lib/rio/base.rb +1 -1
  17. data/lib/rio/callstr.rb +1 -1
  18. data/lib/rio/const.rb +1 -1
  19. data/lib/rio/construct.rb +1 -1
  20. data/lib/rio/constructor.rb +1 -1
  21. data/lib/rio/context.rb +8 -4
  22. data/lib/rio/context/autoclose.rb +1 -1
  23. data/lib/rio/context/binmode.rb +1 -7
  24. data/lib/rio/context/copying.rb +1 -1
  25. data/lib/rio/context/cxx.rb +1 -1
  26. data/lib/rio/context/dir.rb +1 -1
  27. data/lib/rio/context/encoding.rb +1 -2
  28. data/lib/rio/context/gzip.rb +1 -1
  29. data/lib/rio/context/methods.rb +1 -6
  30. data/lib/rio/context/skip.rb +1 -1
  31. data/lib/rio/context/stream.rb +1 -8
  32. data/lib/rio/cp.rb +1 -1
  33. data/lib/rio/cxuri.rb +11 -7
  34. data/lib/rio/dbg/trace_states.rb +0 -2
  35. data/lib/rio/def.rb +1 -1
  36. data/lib/rio/dir.rb +2 -2
  37. data/lib/rio/doc.rb +1 -1
  38. data/lib/rio/entrysel.rb +6 -6
  39. data/lib/rio/exception.rb +1 -1
  40. data/lib/rio/exception/copy.rb +1 -1
  41. data/lib/rio/exception/notimplemented.rb +1 -1
  42. data/lib/rio/exception/notsupported.rb +1 -1
  43. data/lib/rio/exception/open.rb +1 -12
  44. data/lib/rio/exception/state.rb +1 -1
  45. data/lib/rio/ext.rb +1 -8
  46. data/lib/rio/ext/csv.rb +1 -25
  47. data/lib/rio/ext/csv/csv-legacy.rb +1 -49
  48. data/lib/rio/ext/csv/csv.rb +1 -24
  49. data/lib/rio/ext/csv/filter.rb +1 -19
  50. data/lib/rio/ext/if.rb +1 -1
  51. data/lib/rio/ext/mp3info.rb +6 -5
  52. data/lib/rio/ext/splitlines.rb +1 -23
  53. data/lib/rio/ext/yaml.rb +1 -16
  54. data/lib/rio/ext/yaml/doc.rb +1 -6
  55. data/lib/rio/ext/yaml/tie.rb +4 -7
  56. data/lib/rio/ext/zipfile.rb +1 -56
  57. data/lib/rio/ext/zipfile/fs.rb +1 -30
  58. data/lib/rio/ext/zipfile/rl.rb +1 -128
  59. data/lib/rio/ext/zipfile/rootdir.rb +1 -30
  60. data/lib/rio/ext/zipfile/state.rb +1 -105
  61. data/lib/rio/ext/zipfile/wrap.rb +1 -86
  62. data/lib/rio/factory.rb +2 -100
  63. data/lib/rio/fibpipe.rb +0 -98
  64. data/lib/rio/file.rb +1 -12
  65. data/lib/rio/filter.rb +1 -1
  66. data/lib/rio/filter/closeoneof.rb +1 -10
  67. data/lib/rio/filter/gzip.rb +1 -16
  68. data/lib/rio/fs.rb +75 -92
  69. data/lib/rio/fs/base.rb +1 -1
  70. data/lib/rio/fs/impl.rb +1 -1
  71. data/lib/rio/fs/native.rb +1 -1
  72. data/lib/rio/fs/stream.rb +1 -1
  73. data/lib/rio/fs/url.rb +1 -1
  74. data/lib/rio/ftp/conncache.rb +1 -15
  75. data/lib/rio/ftp/dir.rb +1 -2
  76. data/lib/rio/ftp/fs.rb +1 -13
  77. data/lib/rio/fwd.rb +31 -8
  78. data/lib/rio/grande.rb +2 -4
  79. data/lib/rio/handle.rb +1 -1
  80. data/lib/rio/if.rb +1 -7
  81. data/lib/rio/if/basic.rb +1 -5
  82. data/lib/rio/if/csv.rb +1 -1
  83. data/lib/rio/if/dir.rb +1 -1
  84. data/lib/rio/if/file.rb +1 -1
  85. data/lib/rio/if/fileordir.rb +1 -1
  86. data/lib/rio/if/grande.rb +1 -1
  87. data/lib/rio/if/grande_entry.rb +1 -1
  88. data/lib/rio/if/grande_stream.rb +1 -1
  89. data/lib/rio/if/internal.rb +1 -1
  90. data/lib/rio/if/path.rb +1 -1
  91. data/lib/rio/if/rubyio.rb +1 -1
  92. data/lib/rio/if/string.rb +1 -1
  93. data/lib/rio/if/temp.rb +1 -1
  94. data/lib/rio/if/test.rb +1 -1
  95. data/lib/rio/if/yaml.rb +1 -1
  96. data/lib/rio/ioh.rb +42 -24
  97. data/lib/rio/iomode.rb +3 -3
  98. data/lib/rio/ios/fail.rb +1 -1
  99. data/lib/rio/ios/generic.rb +1 -1
  100. data/lib/rio/ios/mode.rb +1 -1
  101. data/lib/rio/ios/null.rb +1 -13
  102. data/lib/rio/iowrap.rb +1 -14
  103. data/lib/rio/kernel.rb +1 -2
  104. data/lib/rio/local.rb +1 -13
  105. data/lib/rio/match.rb +1 -2
  106. data/lib/rio/matchrecord.rb +5 -34
  107. data/lib/rio/no_warn.rb +1 -1
  108. data/lib/rio/nullio.rb +1 -1
  109. data/lib/rio/open3.rb +1 -10
  110. data/lib/rio/ops.rb +1 -1
  111. data/lib/rio/ops/construct.rb +1 -1
  112. data/lib/rio/ops/create.rb +1 -3
  113. data/lib/rio/ops/dir.rb +4 -46
  114. data/lib/rio/ops/either.rb +1 -3
  115. data/lib/rio/ops/file.rb +1 -25
  116. data/lib/rio/ops/path.rb +1 -18
  117. data/lib/rio/ops/stream.rb +4 -5
  118. data/lib/rio/ops/stream/input.rb +1 -10
  119. data/lib/rio/ops/stream/output.rb +1 -3
  120. data/lib/rio/ops/stream/read.rb +1 -1
  121. data/lib/rio/ops/stream/write.rb +1 -1
  122. data/lib/rio/ops/symlink.rb +1 -10
  123. data/lib/rio/path.rb +1 -4
  124. data/lib/rio/path/reset.rb +1 -6
  125. data/lib/rio/piper.rb +1 -4
  126. data/lib/rio/piper/cp.rb +1 -16
  127. data/lib/rio/prompt.rb +1 -1
  128. data/lib/rio/rectype.rb +1 -4
  129. data/lib/rio/rl/base.rb +1 -14
  130. data/lib/rio/rl/builder.rb +1 -12
  131. data/lib/rio/rl/chmap.rb +1 -11
  132. data/lib/rio/rl/fs2url.rb +1 -8
  133. data/lib/rio/rl/ioi.rb +1 -2
  134. data/lib/rio/rl/path.rb +1 -20
  135. data/lib/rio/rl/pathmethods.rb +1 -3
  136. data/lib/rio/rl/uri.rb +1 -11
  137. data/lib/rio/rl/withpath.rb +2 -30
  138. data/lib/rio/rrl/base.rb +1 -6
  139. data/lib/rio/rrl/builder.rb +2 -8
  140. data/lib/rio/rrl/chmap.rb +1 -11
  141. data/lib/rio/rrl/ioi.rb +1 -3
  142. data/lib/rio/rrl/path.rb +1 -11
  143. data/lib/rio/rrl/withpath.rb +8 -48
  144. data/lib/rio/scheme/aryio.rb +1 -1
  145. data/lib/rio/scheme/cmdio.rb +3 -15
  146. data/lib/rio/scheme/cmdpipe.rb +1 -5
  147. data/lib/rio/scheme/fd.rb +1 -1
  148. data/lib/rio/scheme/ftp.rb +1 -40
  149. data/lib/rio/scheme/http.rb +10 -7
  150. data/lib/rio/scheme/null.rb +1 -1
  151. data/lib/rio/scheme/path.rb +1 -63
  152. data/lib/rio/scheme/stderr.rb +1 -2
  153. data/lib/rio/scheme/stdio.rb +3 -3
  154. data/lib/rio/scheme/strio.rb +1 -3
  155. data/lib/rio/scheme/sysio.rb +1 -1
  156. data/lib/rio/scheme/tcp.rb +1 -2
  157. data/lib/rio/scheme/temp.rb +9 -38
  158. data/lib/rio/state.rb +4 -38
  159. data/lib/rio/state/data.rb +4 -5
  160. data/lib/rio/state/error.rb +2 -6
  161. data/lib/rio/stream.rb +1 -31
  162. data/lib/rio/stream/base.rb +1 -5
  163. data/lib/rio/stream/duplex.rb +1 -16
  164. data/lib/rio/stream/open.rb +1 -11
  165. data/lib/rio/symantics.rb +1 -1
  166. data/lib/rio/tempdir.rb +0 -2
  167. data/lib/rio/to_rio.rb +1 -1
  168. data/lib/rio/to_rio/all.rb +1 -1
  169. data/lib/rio/to_rio/array.rb +1 -1
  170. data/lib/rio/to_rio/io.rb +1 -1
  171. data/lib/rio/to_rio/object.rb +1 -1
  172. data/lib/rio/to_rio/string.rb +1 -1
  173. data/lib/rio/undef_rake_dsl.rb +3 -0
  174. data/lib/rio/uri/file.rb +1 -18
  175. data/lib/rio/uriref.rb +1 -18
  176. data/lib/rio/util.rb +1 -1
  177. data/lib/rio/version.rb +2 -2
  178. data/misc/update-copyright.rb +2 -2
  179. data/rio.gemspec +2 -3
  180. data/test/env.sh +1 -2
  181. data/test/http/tc/copy_from_http.rb +0 -1
  182. data/test/runhttp.rb +2 -1
  183. data/test/runtests.rb +7 -5
  184. data/test/tc/copyarray.rb +4 -4
  185. data/test/tc/copydir.rb +1 -1
  186. metadata +15 -47
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  # ===========================================================================
3
- # Copyright (c) 2005-2012 Christopher Kleckner
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.
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  # ===========================================================================
3
- # Copyright (c) 2005-2012 Christopher Kleckner
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.
@@ -40,7 +40,6 @@ module RIO
40
40
 
41
41
  attr_reader :ior,:iow
42
42
  def initialize(u,*a)
43
- # p "CMDIO initialize: u=#{u.inspect} a=#{a.inspect}"
44
43
  super(u)
45
44
  a = a.map(&:to_s)
46
45
  com = case c = a.shift
@@ -52,8 +51,8 @@ module RIO
52
51
  self.query = a
53
52
  end
54
53
  end
55
- extend Forwardable
56
- def_delegators :uri, :path=, :path
54
+ extend RIO::Fwd
55
+ fwd :uri, :path
57
56
  def query
58
57
  uri.query
59
58
  end
@@ -67,8 +66,6 @@ module RIO
67
66
  alias :cmd :path
68
67
  alias :args :query
69
68
  def fib_proc(m)
70
- #fibproc
71
- #p "CMD=#{cmd},args=#{args.inspect}"
72
69
  poargs = args.nil? ? cmd : [cmd,args]
73
70
  if m.allows_write?
74
71
  Cmd::FibPipeProc.new(poargs,m.to_s)
@@ -82,7 +79,6 @@ module RIO
82
79
  end
83
80
  def open(m)
84
81
  poarg = args.nil? ? cmd : [cmd,args].flatten
85
- #p "CMDIO poarg=#{poarg.inspect}"
86
82
  io = IO.popen(poarg,m.to_s)
87
83
  super(io)
88
84
  end
@@ -97,14 +93,6 @@ module RIO
97
93
 
98
94
  def cmd() rl.path end
99
95
  def cmd_args() rl.query end
100
- #def cmd_str() [cmd,cmd_args].flatten.join(' ') end
101
- #def |(arg)
102
- # #p "CMDIO#| #{self}|#{arg}"
103
- # nrio = new_rio(:cmdpipe,self,arg)
104
- # end_rio = nrio.rl.query[-1]
105
- # p "CmdIO#end_rio=#{end_rio}"
106
- # nrio
107
- #end
108
96
  end
109
97
  end
110
98
  end
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  # ===========================================================================
3
- # Copyright (c) 2005-2012 Christopher Kleckner
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.
@@ -130,9 +130,6 @@ module RIO
130
130
  nrio = new_rio(self,ario)
131
131
  has_output_dest?(nrio) ? nrio.run : nrio
132
132
  end
133
- #def last_rio(r)
134
- # r.scheme == 'cmdpipe' ? last_rio(r.rl.query[-1]) : r
135
- #end
136
133
  def last_rio(r)
137
134
  r = r.rl.query[-1] while r.scheme == 'cmdpipe'
138
135
  r
@@ -159,7 +156,6 @@ module RIO
159
156
  orio.touch if orio && orio.scheme.nil? # TODO: is this right???
160
157
  output = Cmd::ToOutput.new(orio)
161
158
  output.resume procs + [input]
162
- #p "RUN orio.scheme=#{orio.scheme}"
163
159
  orio
164
160
  end
165
161
 
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  # ===========================================================================
3
- # Copyright (c) 2005-2012 Christopher Kleckner
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.
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  # ===========================================================================
3
- # Copyright (c) 2005-2012 Christopher Kleckner
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,18 +32,11 @@ require 'rio/ftp/ftpfile'
32
32
 
33
33
  module RIO
34
34
  module FTP #:nodoc: all
35
- #RESET_STATE = 'FTP::State::Reset'
36
35
  RESET_STATE = RIO::RRL::PathBase::RESET_STATE
37
36
 
38
37
  require 'rio/rrl/withpath'
39
38
 
40
39
  class RRL < RIO::RRL::URIBase
41
- # def initialize(arg0,*args)
42
- # p callstr('initialize',arg0.inspect,args.inspect)
43
- # super(*_sup_args(arg0,*args))
44
- # @ftype = nil
45
- # @names = nil
46
- # end
47
40
  def _sup_args(arg0,*args)
48
41
  if arg0 == 'ftp:'
49
42
  hn = args.shift || 'localhost'
@@ -58,39 +51,9 @@ module RIO
58
51
  return [arg0] + args
59
52
  end
60
53
  end
61
- # def arg0_info_(arg0,*args)
62
- # #p "arg0_info_(#{arg0.inspect},#{args.inspect})"
63
- # vuri,vbase,vfs = nil,nil,nil
64
- # case arg0
65
- # when RIO::Rio
66
- # return _init_from_arg(arg0.rl)
67
- # when RIO::RRL::URIBase,RIO::FTP::RL
68
- # vuri,vbase,vfs = arg0.uri,arg0.base,arg0.fs
69
- # when ::URI
70
- # vuri = arg0
71
- # when ::String
72
- # vuri = uri_from_string_(arg0) || ::URI.parse(arg0)
73
- # else
74
- # raise(ArgumentError,"'#{arg0}'[#{arg0.class}] can not be used to create a Rio")
75
- # end
76
- # [vuri,vbase,vfs]
77
- # end
78
- # def build_arg0_(path_str)
79
- # path_str
80
- # end
81
- # def join(*args)
82
- # return self if args.empty?
83
- # join_(args.map{ |arg| RIO::RL.fs2url(arg.to_s)})
84
- # end
85
54
  def typecode() uri.typecode end
86
55
  def typecode=(val) uri.typecode = val end
87
56
 
88
- # def self.splitrl(s)
89
- # #p "splitrl(#{s})"
90
- # sub,opq,whole = split_riorl(s)
91
- # #p sub,opq,whole
92
- # [whole]
93
- # end
94
57
  def openfs_
95
58
  #p callstr('openfs_',self.uri)
96
59
  RIO::FTP::FS.create(self.uri)
@@ -119,9 +82,7 @@ module RIO
119
82
  when m.primarily_write?
120
83
  RIO::IOH::Stream.new(RIO::FTP::FTPFile.new(fs.remote_path(@uri.to_s),fs.conn))
121
84
  else
122
- #p "scheme/ftp uri=#{@uri.inspect}"
123
85
  u = URI.parse(@uri.to_s)
124
- #p "scheme/ftp u=#{u.inspect}"
125
86
  hndl = u.open
126
87
  RIO::IOH::Stream.new(hndl)
127
88
  end
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  # ===========================================================================
3
- # Copyright (c) 2005-2012 Christopher Kleckner
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.
@@ -29,10 +29,6 @@ module RIO
29
29
 
30
30
  require 'rio/rrl/withpath'
31
31
  class RRL < RIO::RRL::URIBase
32
- #def self.splitrl(s)
33
- # sub,opq,whole = split_riorl(s)
34
- # [whole]
35
- #end
36
32
  require 'uri'
37
33
  require 'open-uri'
38
34
  def open(*args)
@@ -60,8 +56,15 @@ module RIO
60
56
  include Ops::Path::Status
61
57
  include Ops::Path::URI
62
58
  include Ops::Path::Query
63
- extend Forwardable
64
- def_instance_delegators(:ioh,:meta,:status,:charset,:content_encoding,:content_type,:last_modified,:base_uri)
59
+ extend RIO::Fwd
60
+ fwd_readers :ioh,
61
+ :meta,
62
+ :status,
63
+ :charset,
64
+ :content_encoding,
65
+ :content_type,
66
+ :last_modified,
67
+ :base_uri
65
68
  end
66
69
 
67
70
  end
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  # ===========================================================================
3
- # Copyright (c) 2005-2012 Christopher Kleckner
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.
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  # ===========================================================================
3
- # Copyright (c) 2005-2012 Christopher Kleckner
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,66 +22,4 @@
22
22
  #++
23
23
  #
24
24
 
25
-
26
- # require 'rio/rl/path'
27
- # require 'rio/ioh'
28
- # module RIO
29
- # module Path #:nodoc: all
30
- # RESET_STATE = RIO::RL::PathBase::RESET_STATE
31
-
32
- # class RL < RIO::RL::PathBase
33
- # def file_rl()
34
- # RIO::File::RL.new(self.uri, {:fs => self.fs})
35
- # end
36
- # def dir_rl()
37
- # RIO::Dir::RL.new(self.uri, {:fs => self.fs})
38
- # end
39
- # end
40
- # end
41
- # module File
42
- # RESET_STATE = RIO::RL::PathBase::RESET_STATE
43
-
44
- # class RL < RIO::Path::RL
45
- # def open(m)
46
- # IOH::Stream.new(fs.file.open(self.fspath,m.to_s))
47
- # end
48
- # def file_rl()
49
- # self
50
- # end
51
- # end
52
- # end
53
- # module Dir
54
- # RESET_STATE = RIO::RL::PathBase::RESET_STATE
55
-
56
- # class RL < RIO::Path::RL
57
- # def open()
58
- # IOH::Dir.new(fs.dir.open(self.fspath))
59
- # end
60
- # def dir_rl()
61
- # self
62
- # end
63
- # end
64
- # end
65
- # require 'rio/stream'
66
- # require 'rio/stream/open'
67
- # require 'rio/ops/symlink'
68
- # module Path
69
- # module Stream
70
- # module Ops
71
- # include RIO::Ops::Path::Str
72
- # end
73
-
74
- # class Open < RIO::Stream::Open
75
- # include RIO::Ops::Path::Status
76
- # include RIO::Ops::Path::URI
77
- # include RIO::Ops::Path::Query
78
- # def stream_state(cl)
79
- # next_state = super
80
- # next_state.extend(RIO::Ops::Symlink::Existing) if symlink?
81
- # next_state.extend(Ops)
82
- # end
83
- # end
84
- # end
85
- # end
86
- # end
87
25
  __END__
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  # ===========================================================================
3
- # Copyright (c) 2005-2012 Christopher Kleckner
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
  super(::Alt::URI.parse(u))
36
36
  end
37
37
  def open(*args)
38
- #self.ios = $stderr
39
38
  super($stderr)
40
39
  end
41
40
  end
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  # ===========================================================================
3
- # Copyright (c) 2005-2012 Christopher Kleckner
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.
@@ -34,8 +34,8 @@ module RIO
34
34
  def initialize(u)
35
35
  super(u)
36
36
  end
37
- extend Forwardable
38
- def_delegators :uri, :path=, :path
37
+ extend RIO::Fwd
38
+ fwd :uri, :path
39
39
  require 'rio/iomode'
40
40
  def open(m)
41
41
  case
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  # ===========================================================================
3
- # Copyright (c) 2005-2012 Christopher Kleckner
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
  RIOPATH = RIO::RRL::CHMAP.invert[RIOSCHEME].to_s.freeze
38
38
  attr_accessor :str
39
39
  def initialize(u,str="")
40
- #p "StrIO::RRL initialize: u=#{u.inspect} str=#{str.inspect}"
41
40
  alturi = ::Alt::URI.parse(u.to_s)
42
41
  super(alturi)
43
42
  self.query ||= str
@@ -62,7 +61,6 @@ module RIO
62
61
  alias :stringio :query
63
62
  alias :stringio= :query=
64
63
  def open(m,*args)
65
- #p "STRIO open: m=#{m} args=#{args.inspect}"
66
64
  strio = self.stringio
67
65
  str = strio.string
68
66
  nstrio = self.stringio.reopen(str,m.to_s)
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  # ===========================================================================
3
- # Copyright (c) 2005-2012 Christopher Kleckner
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.
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  # ===========================================================================
3
- # Copyright (c) 2005-2012 Christopher Kleckner
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
  end
42
42
  require 'socket'
43
43
  def open(*args)
44
- # @host = 'localhost' if @host.nil? or @host.empty?
45
44
  super(::TCPSocket.new(@host || 'localhost',@port))
46
45
  end
47
46
  def to_s() self.url end
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  # ===========================================================================
3
- # Copyright (c) 2005-2012 Christopher Kleckner
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.
@@ -34,10 +34,7 @@ module RIO
34
34
  RIOPATH = RIO::RRL::CHMAP.invert[RIOSCHEME].to_s.freeze
35
35
  DFLT_PREFIX = 'rio'
36
36
  DFLT_TMPDIR = ::Dir::tmpdir
37
- # p 'DFLT_TMPDIR=' + DFLT_TMPDIR
38
37
  def initialize(u,file_prefix=DFLT_PREFIX,temp_dir=DFLT_TMPDIR)
39
- # p "Temp::RRL::initialize u=#{u} file_prefix=#{file_prefix} temp_dir=#{temp_dir}"
40
- # puts "Temp::RRL CALLER: ",caller[0..8]
41
38
  alturi = case u
42
39
  when ::Alt::URI::Base then u
43
40
  else ::Alt::URI.parse(u.to_s)
@@ -45,17 +42,15 @@ module RIO
45
42
  prefix = alturi.query || file_prefix.to_s
46
43
  tmpdir = (alturi.path.nil? || alturi.path.empty?) ?
47
44
  temp_dir.to_s : alturi.path
48
- #alturi = ::Alt::URI.create(:scheme => 'temp', :path => temp_dir,
49
- # :query => file_prefix)
50
- # p 'HERE'
51
45
  super(alturi)
52
- # p "alturi=#{alturi}"
53
46
  self.path = tmpdir
54
47
  self.query = prefix
55
48
  end
56
49
 
57
- extend Forwardable
58
- def_delegators :uri, :path=, :path, :query, :query=, :scheme
50
+ extend RIO::Fwd
51
+ fwd :uri, :path, :query
52
+ fwd_reader :uri, :scheme
53
+
59
54
  alias :prefix :query
60
55
  alias :tmpdir :path
61
56
 
@@ -71,7 +66,6 @@ module RIO
71
66
 
72
67
  def initialize(u,file_prefix=DFLT_PREFIX,temp_dir=DFLT_TMPDIR)
73
68
  require 'rio/tempdir'
74
- # p "Temp::Dir u=#{u.inspect} file_prefix=#{file_prefix} temp_dir=#{temp_dir}"
75
69
  alturi = case u
76
70
  when ::Alt::URI::Base then u
77
71
  else ::Alt::URI.parse(u.to_s)
@@ -79,17 +73,12 @@ module RIO
79
73
  prefix = alturi.query || file_prefix.to_s
80
74
  tmpdir = (alturi.path.nil? || alturi.path.empty?) ?
81
75
  temp_dir.to_s : alturi.path
82
- #p "Temp::Dir prefix=#{prefix} tmpdir=#{tmpdir}"
83
76
  td = ::Tempdir.new( prefix, tmpdir)
84
- #td = "file:///" + td if td.to_s =~ /^[a-zA-Z]:/
85
- #p "Temp::Dir td=#{td.to_s.inspect}"
86
77
  td = "file:///" + td.to_s if td.to_s =~ /^[a-zA-Z]:/
87
78
  super(td.to_s)
88
- #self.query = file_prefix.to_s
89
- #self.path = temp_dir.to_s
90
79
  end
91
- extend Forwardable
92
- def_delegators :uri, :path=, :path, :query, :query=
80
+ extend RIO::Fwd
81
+ fwd :uri, :path, :query
93
82
  alias :prefix :query
94
83
  alias :tmpdir :path
95
84
 
@@ -108,8 +97,6 @@ module RIO
108
97
 
109
98
  def initialize(u,file_prefix=DFLT_PREFIX,temp_dir=DFLT_TMPDIR)
110
99
  require 'tempfile'
111
- #p "Temp::File::initialize u=#{u.inspect} file_prefix=#{file_prefix.inspect} temp_dir=#{temp_dir.inspect}"
112
- # puts "Temp::File CALLER: ",caller[0..8]
113
100
  # FIXME: Temporary fix for jruby 1.4 - make tmpdir absolute
114
101
  #tmpdir_rio = rio(@tmpdir).abs
115
102
  alturi = case u
@@ -119,28 +106,18 @@ module RIO
119
106
  prefix = alturi.query || file_prefix.to_s
120
107
  tmpdir = (alturi.path.nil? || alturi.path.empty?) ?
121
108
  temp_dir.to_s : alturi.path
122
- # p "Temp::File::initialize alturi=#{alturi} prefix=#{prefix} tmpdir=#{tmpdir}"
123
109
 
124
110
  @tf = ::Tempfile.new( prefix, tmpdir)
125
111
 
126
- #puts "TF=#{@tf.inspect}"
127
- # @tf = ::Tempfile.new( @prefix.to_s, @tmpdir.to_s)
128
-
129
112
  # FIXME: Temporary fix for jruby 1.4 - fix slashes
130
113
  pth = @tf.path
131
114
  pth.gsub!("\\","/")
132
115
  pth = "file:///" + pth if pth =~ /^[a-zA-Z]:/
133
116
 
134
- #p "PTH=#{pth}"
135
- # @tf = "file:///" + @tf if @tf.to_s =~ /^[a-zA-Z]:/
136
- #
137
- #p "Temp::File pth=#{pth.inspect}"
138
117
  super(::Alt::URI.parse(pth))
139
- #self.query = file_prefix
140
- #self.path = temp_dir
141
118
  end
142
- extend Forwardable
143
- def_delegators :uri, :path=, :path, :query, :query=
119
+ extend RIO::Fwd
120
+ fwd :uri, :path, :query
144
121
  def file_rl()
145
122
  RIO::File::RRL.new(self.uri,{:fs => self.fs})
146
123
  end
@@ -157,7 +134,6 @@ module RIO
157
134
  class Reset < State::Base
158
135
  def initialize(*args)
159
136
  super
160
- #p args
161
137
  @tempobj = nil
162
138
  end
163
139
  def self.default_cx
@@ -166,13 +142,9 @@ module RIO
166
142
 
167
143
  def check?() true end
168
144
  def mkdir(prefix=rl.prefix,tmpdir=rl.tmpdir)
169
- # p "scheme/temp.rb mkdir(): prefix="+prefix+" tmpdir="+tmpdir
170
145
  self.rl = RIO::Temp::Dir::RRL.new("",prefix, tmpdir)
171
146
  become 'Dir::Existing'
172
147
  end
173
- # def mkdir()
174
- # dir()
175
- # end
176
148
  def chdir(&block)
177
149
  self.mkdir.chdir(&block)
178
150
  end
@@ -205,7 +177,6 @@ module RIO
205
177
  mode_('w+').open_.inout()
206
178
  end
207
179
  end
208
-
209
180
  end
210
181
  end
211
182
  end