rio 0.3.8 → 0.3.9
Sign up to get free protection for your applications and to get access to all the features.
- data/README +18 -12
- data/Rakefile +57 -87
- data/build_doc.rb +19 -17
- data/doc/ANNOUNCE +3 -32
- data/doc/RELEASE_NOTES +4 -5
- data/doc/RIOIS +215 -0
- data/doc/generators/template/html/rio.css +428 -0
- data/doc/generators/template/html/rio.rb +18 -389
- data/doc/generators/template/html/ugly.rb +130 -0
- data/doc/pkg_def.rb +66 -0
- data/ex/catcsv.rb +64 -0
- data/ex/colx.rb +8 -0
- data/ex/findinruby +15 -0
- data/ex/findruby +14 -0
- data/ex/passwd_report.rb +8 -0
- data/ex/prompt.rb +25 -0
- data/ex/rgb.txt.gz +0 -0
- data/ex/riocat +42 -0
- data/ex/riogunzip +31 -0
- data/ex/riogzip +24 -0
- data/ex/rioprompt.rb +10 -0
- data/ex/targz2zip +17 -0
- data/ex/tonl +10 -0
- data/lib/rio.rb +16 -10
- data/lib/rio/abstract_method.rb +3 -4
- data/lib/rio/argv.rb +3 -4
- data/lib/rio/arycopy.rb +3 -4
- data/lib/rio/assert.rb +3 -4
- data/lib/rio/base.rb +3 -4
- data/lib/rio/callstr.rb +3 -4
- data/lib/rio/const.rb +3 -4
- data/lib/rio/construct.rb +3 -4
- data/lib/rio/constructor.rb +12 -8
- data/lib/rio/context.rb +15 -30
- data/lib/rio/context/autoclose.rb +3 -4
- data/lib/rio/context/copying.rb +3 -4
- data/lib/rio/context/cxx.rb +3 -4
- data/lib/rio/context/dir.rb +3 -4
- data/lib/rio/context/gzip.rb +3 -4
- data/lib/rio/context/methods.rb +16 -5
- data/lib/rio/context/skip.rb +3 -4
- data/lib/rio/context/stream.rb +42 -5
- data/lib/rio/cp.rb +7 -7
- data/lib/rio/def.rb +3 -4
- data/lib/rio/dir.rb +3 -4
- data/lib/rio/doc.rb +4 -5
- data/lib/rio/doc/EXAMPLES.rb +299 -0
- data/lib/rio/doc/HOWTO.rb +3 -4
- data/lib/rio/doc/INTRO.rb +86 -105
- data/lib/rio/doc/OPTIONAL.rb +4 -5
- data/lib/rio/doc/SYNOPSIS.rb +7 -6
- data/lib/rio/entrysel.rb +21 -23
- data/lib/rio/exception.rb +3 -4
- data/lib/rio/exception/copy.rb +3 -4
- data/lib/rio/exception/notimplemented.rb +57 -0
- data/lib/rio/exception/notsupported.rb +3 -4
- data/lib/rio/exception/open.rb +3 -4
- data/lib/rio/exception/state.rb +3 -4
- data/lib/rio/ext.rb +47 -13
- data/lib/rio/ext/csv.rb +4 -5
- data/lib/rio/ext/if.rb +45 -0
- data/lib/rio/ext/mp3info.rb +80 -0
- data/lib/rio/ext/splitlines.rb +253 -0
- data/lib/rio/ext/yaml.rb +9 -5
- data/lib/rio/ext/yaml/doc.rb +133 -0
- data/lib/rio/ext/yaml/tie.rb +149 -0
- data/lib/rio/ext/zipfile.rb +23 -4
- data/lib/rio/ext/zipfile/fs.rb +116 -0
- data/lib/rio/ext/zipfile/rl.rb +251 -0
- data/lib/rio/ext/zipfile/rootdir.rb +117 -0
- data/lib/rio/ext/zipfile/state.rb +161 -0
- data/lib/rio/ext/zipfile/wrap.rb +204 -0
- data/lib/rio/factory.rb +235 -27
- data/lib/rio/file.rb +4 -4
- data/lib/rio/filter.rb +3 -4
- data/lib/rio/filter/closeoneof.rb +3 -4
- data/lib/rio/filter/gzip.rb +9 -4
- data/lib/rio/fs/base.rb +3 -4
- data/lib/rio/fs/impl.rb +4 -5
- data/lib/rio/fs/native.rb +3 -4
- data/lib/rio/fs/stream.rb +3 -4
- data/lib/rio/fs/url.rb +3 -4
- data/lib/rio/ftp/conncache.rb +19 -5
- data/lib/rio/ftp/dir.rb +3 -4
- data/lib/rio/ftp/fs.rb +30 -24
- data/lib/rio/grande.rb +27 -7
- data/lib/rio/handle.rb +3 -4
- data/lib/rio/if.rb +19 -15
- data/lib/rio/if/basic.rb +7 -7
- data/lib/rio/if/csv.rb +5 -6
- data/lib/rio/if/dir.rb +120 -114
- data/lib/rio/if/file.rb +52 -44
- data/lib/rio/if/fileordir.rb +217 -211
- data/lib/rio/if/grande.rb +674 -644
- data/lib/rio/if/grande_entry.rb +321 -313
- data/lib/rio/if/grande_stream.rb +653 -553
- data/lib/rio/if/internal.rb +3 -4
- data/lib/rio/if/path.rb +425 -426
- data/lib/rio/if/rubyio.rb +681 -0
- data/lib/rio/if/string.rb +42 -5
- data/lib/rio/if/temp.rb +3 -4
- data/lib/rio/if/test.rb +245 -238
- data/lib/rio/if/yaml.rb +15 -41
- data/lib/rio/ioh.rb +7 -5
- data/lib/rio/iomode.rb +19 -7
- data/lib/rio/ios/fail.rb +4 -5
- data/lib/rio/ios/generic.rb +4 -5
- data/lib/rio/ios/mode.rb +4 -5
- data/lib/rio/ios/null.rb +6 -7
- data/lib/rio/iowrap.rb +3 -4
- data/lib/rio/kernel.rb +3 -5
- data/lib/rio/local.rb +3 -4
- data/lib/rio/match.rb +3 -4
- data/lib/rio/matchrecord.rb +3 -4
- data/lib/rio/no_warn.rb +3 -4
- data/lib/rio/nullio.rb +3 -4
- data/lib/rio/open3.rb +4 -5
- data/lib/rio/ops/construct.rb +3 -4
- data/lib/rio/ops/create.rb +11 -6
- data/lib/rio/ops/dir.rb +19 -8
- data/lib/rio/ops/either.rb +6 -5
- data/lib/rio/ops/file.rb +3 -4
- data/lib/rio/ops/path.rb +14 -35
- data/lib/rio/ops/stream.rb +3 -4
- data/lib/rio/ops/stream/input.rb +4 -7
- data/lib/rio/ops/stream/output.rb +3 -4
- data/lib/rio/ops/stream/read.rb +6 -5
- data/lib/rio/ops/stream/write.rb +3 -4
- data/lib/rio/ops/symlink.rb +3 -4
- data/lib/rio/path.rb +22 -18
- data/lib/rio/path/reset.rb +4 -5
- data/lib/rio/piper.rb +3 -4
- data/lib/rio/piper/cp.rb +3 -4
- data/lib/rio/prompt.rb +10 -5
- data/lib/rio/rectype.rb +5 -5
- data/lib/rio/rl/base.rb +17 -71
- data/lib/rio/rl/builder.rb +14 -38
- data/lib/rio/rl/chmap.rb +66 -0
- data/lib/rio/rl/fs2url.rb +82 -0
- data/lib/rio/rl/ioi.rb +4 -4
- data/lib/rio/rl/path.rb +44 -122
- data/lib/rio/rl/pathmethods.rb +19 -8
- data/lib/rio/rl/uri.rb +137 -60
- data/lib/rio/rl/withpath.rb +295 -0
- data/lib/rio/scheme/aryio.rb +3 -4
- data/lib/rio/scheme/cmdio.rb +3 -4
- data/lib/rio/scheme/cmdpipe.rb +4 -4
- data/lib/rio/scheme/fd.rb +3 -4
- data/lib/rio/scheme/ftp.rb +7 -7
- data/lib/rio/scheme/http.rb +4 -5
- data/lib/rio/scheme/null.rb +3 -4
- data/lib/rio/scheme/path.rb +3 -4
- data/lib/rio/scheme/stderr.rb +3 -4
- data/lib/rio/scheme/stdio.rb +3 -4
- data/lib/rio/scheme/strio.rb +3 -4
- data/lib/rio/scheme/sysio.rb +3 -4
- data/lib/rio/scheme/tcp.rb +3 -4
- data/lib/rio/scheme/temp.rb +6 -6
- data/lib/rio/state.rb +18 -46
- data/lib/rio/state/error.rb +3 -4
- data/lib/rio/stream.rb +4 -4
- data/lib/rio/stream/base.rb +3 -4
- data/lib/rio/stream/duplex.rb +3 -4
- data/lib/rio/stream/open.rb +3 -8
- data/lib/rio/symantics.rb +3 -4
- data/lib/rio/tempdir.rb +2 -2
- data/lib/rio/to_rio.rb +3 -4
- data/lib/rio/to_rio/all.rb +3 -4
- data/lib/rio/to_rio/array.rb +4 -5
- data/lib/rio/to_rio/io.rb +4 -5
- data/lib/rio/to_rio/object.rb +4 -5
- data/lib/rio/to_rio/string.rb +4 -5
- data/lib/rio/uri/file.rb +41 -5
- data/lib/rio/util.rb +3 -4
- data/lib/rio/version.rb +4 -5
- data/setup.rb +368 -339
- data/test/bin/list_dir.rb +1 -1
- data/test/ftp/anon_misc.rb +13 -1
- data/test/ftp/anon_special.rb +6 -6
- data/test/ftp/anon_write.rb +10 -3
- data/test/ftp/ftp2ftp.rb +2 -2
- data/test/ftp/testdef.rb +9 -6
- data/test/http/all.rb +3 -0
- data/test/http/copy-from-http.rb +140 -0
- data/test/lib/temp_server.rb +44 -0
- data/test/runalltests.rb +3 -1
- data/test/runhttp.rb +12 -0
- data/test/runhttptests.rb +1 -1
- data/test/runtests.rb +41 -3
- data/test/tc/abs.rb +9 -5
- data/test/tc/all.rb +9 -4
- data/test/tc/base.rb +1 -1
- data/test/tc/base2.rb +87 -0
- data/test/tc/{methods.rb → clone.rb} +72 -50
- data/test/tc/closeoncopy.rb +13 -2
- data/test/tc/copy-dir-samevar.rb +91 -0
- data/test/tc/dir_iter.rb +0 -1
- data/test/tc/empty.rb +6 -2
- data/test/tc/expand_path.rb +36 -54
- data/test/tc/ext.rb +42 -18
- data/test/tc/gzip.rb +30 -3
- data/test/tc/likeio.rb +5 -1
- data/test/tc/line_record_row.rb +51 -0
- data/test/tc/noqae.rb +71 -70
- data/test/tc/path_parts.rb +175 -0
- data/test/tc/programs_util.rb +3 -3
- data/test/tc/rename.rb +4 -5
- data/test/tc/riorl.rb +9 -7
- data/test/tc/skip.rb +35 -6
- data/test/tc/skiplines.rb +34 -5
- data/test/tc/split.rb +8 -50
- data/test/tc/splitlines.rb +65 -0
- data/test/tc/splitpath.rb +83 -0
- data/test/tc/testcase.rb +1 -1
- data/test/tc/truncate.rb +39 -0
- data/test/tc/yaml.rb +9 -8
- metadata +261 -207
- data/ChangeLog +0 -1418
- data/VERSION +0 -1
- data/lib/rio/doc/MISC.rb +0 -259
- data/lib/rio/if/stream.rb +0 -680
- data/lib/rio/impl/path.rb +0 -87
- data/test/tc/copy-from-http.rb +0 -89
data/lib/rio/if/internal.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#--
|
2
2
|
# ===============================================================================
|
3
|
-
# Copyright (c) 2005,
|
3
|
+
# Copyright (c) 2005,2006,2007 Christopher Kleckner
|
4
4
|
# All rights reserved
|
5
5
|
#
|
6
6
|
# This file is part of the Rio library for ruby.
|
@@ -23,16 +23,15 @@
|
|
23
23
|
#
|
24
24
|
# To create the documentation for Rio run the command
|
25
25
|
# ruby build_doc.rb
|
26
|
-
# from the distribution directory.
|
26
|
+
# from the distribution directory.
|
27
27
|
#
|
28
28
|
# Suggested Reading
|
29
29
|
# * RIO::Doc::SYNOPSIS
|
30
30
|
# * RIO::Doc::INTRO
|
31
31
|
# * RIO::Doc::HOWTO
|
32
|
+
# * RIO::Doc::EXAMPLES
|
32
33
|
# * RIO::Rio
|
33
34
|
#
|
34
|
-
# <b>Rio is pre-alpha software.
|
35
|
-
# The documented interface and behavior is subject to change without notice.</b>
|
36
35
|
|
37
36
|
|
38
37
|
module RIO
|
data/lib/rio/if/path.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#--
|
2
2
|
# ===============================================================================
|
3
|
-
# Copyright (c) 2005,
|
3
|
+
# Copyright (c) 2005,2006,2007 Christopher Kleckner
|
4
4
|
# All rights reserved
|
5
5
|
#
|
6
6
|
# This file is part of the Rio library for ruby.
|
@@ -23,441 +23,440 @@
|
|
23
23
|
#
|
24
24
|
# To create the documentation for Rio run the command
|
25
25
|
# ruby build_doc.rb
|
26
|
-
# from the distribution directory.
|
26
|
+
# from the distribution directory.
|
27
27
|
#
|
28
28
|
# Suggested Reading
|
29
29
|
# * RIO::Doc::SYNOPSIS
|
30
30
|
# * RIO::Doc::INTRO
|
31
31
|
# * RIO::Doc::HOWTO
|
32
|
+
# * RIO::Doc::EXAMPLES
|
32
33
|
# * RIO::Rio
|
33
34
|
#
|
34
|
-
# <b>Rio is pre-alpha software.
|
35
|
-
# The documented interface and behavior is subject to change without notice.</b>
|
36
35
|
|
37
36
|
|
38
37
|
module RIO
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
38
|
+
module IF
|
39
|
+
module Path
|
40
|
+
|
41
|
+
|
42
|
+
# Returns the path for the Rio, which is defined differently for different types of Rios.
|
43
|
+
#
|
44
|
+
# For Rios representing paths on the underlying file system this is an alias
|
45
|
+
# IF::Path#fspath. For Rios with paths that are not on the file system this is an
|
46
|
+
# alias for IF::Path#urlpath.
|
47
|
+
#
|
48
|
+
# Otherwise this returns nil.
|
49
|
+
#
|
50
|
+
def path(*args) target.path(*args) end
|
51
|
+
|
52
|
+
# For resources that have a absolute URL (RFC1738) representation,
|
53
|
+
# this returns a string containing that representation.
|
54
|
+
# For objects that do not this returns a RIORL (a descriptive pseudo-URL).
|
55
|
+
#
|
56
|
+
# rio('/var/www/') #=> "file:///var/www/"
|
57
|
+
# rio('http://rio.rubyforge.org/') #=> "http://rio.rubyforge.org"
|
58
|
+
#
|
59
|
+
def to_url() target.to_url end
|
60
|
+
|
61
|
+
# For resources that have a URL (RFC1738) representation, this returns a
|
62
|
+
# URI object referencing it. Otherwise this raises NoMethodError.
|
63
|
+
#
|
64
|
+
# rio('http://rubyforge.org/').to_uri #=> <URI::HTTP:0x818bd84 URL:http://rubyforge.org/>
|
65
|
+
# rio('adir/afile').to_uri #=> <URI::Generic:0x817d288 URL:adir/afile>
|
66
|
+
#
|
67
|
+
def to_uri() target.to_uri end
|
68
|
+
|
69
|
+
# Returns the path for the Rio on the underlying file system
|
70
|
+
# Returns nil if the Rio is not on the filesystem (i.e. stdin: or http: Rios)
|
71
|
+
def fspath() target.fspath() end
|
72
|
+
|
73
|
+
# Returns the path portion of the URL representation of the rio
|
74
|
+
# Returns nil if the Rio URL has no path (i.e. stdin: or http: Rios)
|
75
|
+
def urlpath() target.urlpath() end
|
76
|
+
|
77
|
+
# Calls File#expand_path
|
78
|
+
#
|
79
|
+
#
|
80
|
+
# Converts a pathname to an absolute pathname.
|
81
|
+
# Relative paths are referenced from the current working directory of the process
|
82
|
+
# unless dir_string is given, in which case it will be used as the starting point.
|
83
|
+
# The given pathname may start with a ``~��, which expands to the process owner�s
|
84
|
+
# home directory (the environment variable HOME must be set correctly).
|
85
|
+
# ``~user�� expands to the named user�s home directory.
|
86
|
+
#
|
87
|
+
# Returns a Rio representing the returned path
|
88
|
+
#
|
89
|
+
#
|
90
|
+
def expand_path(*args) target.expand_path(*args) end
|
91
|
+
|
92
|
+
|
93
|
+
# Returns a new rio with a path equal to the absolute path of this rio
|
94
|
+
#
|
95
|
+
# rio('/tmp').chdir
|
96
|
+
# rio('afile').abs # => rio('/tmp/afile')
|
97
|
+
def abs(*args) target.abs(*args) end
|
98
|
+
|
99
|
+
|
100
|
+
# Returns a new rio with a path equal to the relative path from _other_
|
101
|
+
# rio('/tmp/afile').rel('/tmp') #=> rio('afile')
|
102
|
+
# rio('zippy/afile').rel('zippy') #=> rio('afile')
|
103
|
+
#
|
104
|
+
def rel(other=nil) target.rel(other) end
|
105
|
+
|
106
|
+
|
107
|
+
# Returns a new Rio whose path is the base path that is used by
|
108
|
+
# IF::Path#abs to create an absolute Rio from a relative one.
|
109
|
+
#
|
110
|
+
# rio('/tmp').chdir
|
111
|
+
# rio('afile').base # => rio('/tmp/')
|
112
|
+
#
|
113
|
+
# See IF::Path#abs.
|
114
|
+
#
|
115
|
+
def base() target.base() end
|
116
|
+
|
117
|
+
|
118
|
+
# Sets the string that the Rio considers an extension. The value will be used by
|
119
|
+
# subsequent calls to IF::Path#basename. If called with no arguments resets its value
|
120
|
+
# to the value returned by File#extname. Returns the Rio.
|
121
|
+
#
|
122
|
+
# ario = rio('afile.tar.gz')
|
123
|
+
# ario.ext? #=> '.ext'
|
124
|
+
# ario.basename #=> rio('afile.tar')
|
125
|
+
# ario.ext('.tar.gz').basename #=> rio('afile')
|
126
|
+
# ario.ext? #=> '.tar.gz'
|
127
|
+
#
|
128
|
+
# ario = rio('afile.txt')
|
129
|
+
# ario.ext('.txt').basename #=> rio('afile')
|
130
|
+
# ario.ext('.zip').basename #=> rio('afile.txt')
|
131
|
+
# ario.ext.basename #=> rio('afile')
|
132
|
+
# ario.ext('').basename #=> rio('afile.txt')
|
133
|
+
#
|
134
|
+
# See also IF::Path#ext?,IF::Path#noext,IF::Path#basename,
|
135
|
+
#
|
136
|
+
def ext(arg=nil) target.ext(arg); self end
|
137
|
+
|
138
|
+
|
139
|
+
# Identical to IF::Path#ext('')
|
140
|
+
#
|
141
|
+
# ario.basename #=> rio('afile')
|
142
|
+
# ario.noext.basename #=> rio('afile.txt')
|
143
|
+
#
|
144
|
+
# See also IF::Path#ext
|
145
|
+
#
|
146
|
+
def noext() target.noext(); self end
|
147
|
+
|
148
|
+
|
149
|
+
# Returns the value of the Rio's 'ext' variable
|
150
|
+
# This defaults to the value returned by IF::Path#extname and may be set by either calling IF::Path#ext
|
151
|
+
# or by passing an argument IF::Path#basename
|
152
|
+
# See also IF::Path#basename, IF::Path#ext, IF::Path#extname, IF::Path#noext
|
153
|
+
#
|
154
|
+
# ario = rio('afile.txt')
|
155
|
+
# ario.ext? #=> '.txt'
|
156
|
+
# ario.ext('.txt').basename #=> rio('afile')
|
157
|
+
# ario.ext? #=> '.txt'
|
158
|
+
# ario.ext('.zip').basename #=> rio('afile.txt')
|
159
|
+
# ario.ext? #=> '.zip'
|
160
|
+
# ario.basename('.tar') #=> rio('afile.txt')
|
161
|
+
# ario.ext? #=> '.tar'
|
162
|
+
# ario.ext.basename #=> rio('afile')
|
163
|
+
# ario.ext? #=> '.txt'
|
164
|
+
# ario.noext.basename #=> rio('afile.txt')
|
165
|
+
# ario.ext? #=> ''
|
166
|
+
#
|
167
|
+
def ext?() target.ext?() end
|
168
|
+
|
169
|
+
|
170
|
+
# Calls File#extname
|
171
|
+
#
|
172
|
+
# Returns a String containing the path's extension
|
173
|
+
# rio('/tmp/zippy.txt').extname #=> '.txt'
|
174
|
+
#
|
175
|
+
def extname(*args) target.extname(*args) end
|
176
|
+
|
177
|
+
|
178
|
+
# Similar to File#basename
|
179
|
+
#
|
180
|
+
# Returns a Rio whose path is that returned by File#basename when passed the path
|
181
|
+
# of a rio and the value returned by File#extname. This differs from the behaviour
|
182
|
+
# of File#basename.
|
183
|
+
#
|
184
|
+
# File.basename('afile.txt') #=> 'afile.txt'
|
185
|
+
# File.basename('afile.txt',File.extname('afile.txt')) #=> 'afile'
|
186
|
+
# rio('afile.txt').basename #=> rio('afile')
|
187
|
+
# rio('afile.txt').basename('.txt') #=> same thing
|
188
|
+
# rio('afile.txt').ext('.txt').basename #=> same thing
|
189
|
+
#
|
190
|
+
# See also IF::Path#ext,IF::Path#ext?,IF::Path#filename,
|
191
|
+
#
|
192
|
+
def basename(*args) target.basename(*args) end
|
193
|
+
|
194
|
+
|
195
|
+
# Calls File#dirname
|
196
|
+
#
|
197
|
+
# Returns a new Rio referencing the directory portion of a Rio.
|
198
|
+
# rio('/tmp/zippy.txt').dirname #=> rio('/tmp')
|
199
|
+
#
|
200
|
+
def dirname(*args) target.dirname(*args) end
|
201
|
+
|
202
|
+
|
203
|
+
# Returns a new Rio with all path information stripped away. This is similar to
|
204
|
+
# IF::Path#basename, except that it always includes an extension if one exists
|
205
|
+
#
|
206
|
+
# rio('apath/afile.txt').filename #=> rio('afile.txt')
|
207
|
+
#
|
208
|
+
def filename() target.filename() end
|
209
|
+
|
210
|
+
|
211
|
+
# Replace the part of the path returned by IF::Path#extname. If in +rename+
|
212
|
+
# mode, also renames the referenced filesystem object.
|
213
|
+
#
|
214
|
+
# Returns the extension
|
215
|
+
#
|
216
|
+
# ario = rio('dirA/dirB/afile.rb')
|
217
|
+
# ario.extname = '.txt' # rio('dirC/bfile.txt')
|
218
|
+
#
|
219
|
+
# rio('adir/afile.txt').rename.extname = '.rb' # adir/afile.txt => adir/afile.rb
|
220
|
+
#
|
221
|
+
# See aslo IF::Path#extname, IF::FileOrDir#rename
|
222
|
+
#
|
223
|
+
def extname=(arg) target.extname = arg end
|
224
|
+
|
225
|
+
|
226
|
+
# Replace the part of the path returned by IF::Path#basename. If in +rename+
|
227
|
+
# mode, also renames the referenced filesystem object.
|
228
|
+
#
|
229
|
+
# Returns the new value of +basename+
|
230
|
+
#
|
231
|
+
# ario = rio('dirA/dirB/afile.rb')
|
232
|
+
# ario.dirname = 'dirC' # rio('dirC/afile.rb')
|
233
|
+
# ario.basename = 'bfile' # rio('dirC/bfile.rb')
|
234
|
+
# ario.extname = '.txt' # rio('dirC/bfile.txt')
|
235
|
+
# ario.filename = 'cfile.rb' # rio('dirC/cfile.rb')
|
236
|
+
#
|
237
|
+
# rio('adir/afile.txt').rename.filename = 'bfile.rb' # adir/afile.txt => adir/bfile.rb
|
238
|
+
# rio('adir/afile.txt').rename.basename = 'bfile' # adir/afile.txt => adir/bfile.txt
|
239
|
+
# rio('adir/afile.txt').rename.extname = '.rb' # adir/afile.txt => adir/afile.rb
|
240
|
+
# rio('adir/afile.txt').rename.dirname = 'b/c' # adir/afile.txt => b/c/afile.txt
|
241
|
+
#
|
242
|
+
# See IF::Path#basename, IF::FileOrDir#rename
|
243
|
+
#
|
244
|
+
def basename=(arg) target.basename = arg end
|
245
|
+
|
246
|
+
|
247
|
+
# Replace the part of the path returned by IF::Path#dirname. If in +rename+
|
248
|
+
# mode, also renames the referenced filesystem object.
|
249
|
+
#
|
250
|
+
# Returns the new value of +dirname+
|
251
|
+
#
|
252
|
+
# ario = rio('dirA/dirB/afile.rb')
|
253
|
+
# ario.dirname = 'dirC' # rio('dirC/afile.rb')
|
254
|
+
# ario.basename = 'bfile' # rio('dirC/bfile.rb')
|
255
|
+
# ario.extname = '.txt' # rio('dirC/bfile.txt')
|
256
|
+
# ario.filename = 'cfile.rb' # rio('dirC/cfile.rb')
|
257
|
+
#
|
258
|
+
# rio('adir/afile.txt').rename.filename = 'bfile.rb' # adir/afile.txt => adir/bfile.rb
|
259
|
+
# rio('adir/afile.txt').rename.basename = 'bfile' # adir/afile.txt => adir/bfile.txt
|
260
|
+
# rio('adir/afile.txt').rename.extname = '.rb' # adir/afile.txt => adir/afile.rb
|
261
|
+
# rio('adir/afile.txt').rename.dirname = 'b/c' # adir/afile.txt => b/c/afile.txt
|
262
|
+
#
|
263
|
+
# See IF::Path#dirname, IF::FileOrDir#rename
|
264
|
+
#
|
265
|
+
def dirname=(arg) target.dirname = arg end
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
# Replace the part of the path returned by IF::Path#filename. If in +rename+
|
270
|
+
# mode, also renames the referenced filesystem object.
|
271
|
+
#
|
272
|
+
# Returns the new value of +filename+
|
273
|
+
#
|
274
|
+
# ario = rio('dirA/dirB/afile.rb')
|
275
|
+
# ario.dirname = 'dirC' # rio('dirC/afile.rb')
|
276
|
+
# ario.basename = 'bfile' # rio('dirC/bfile.rb')
|
277
|
+
# ario.extname = '.txt' # rio('dirC/bfile.txt')
|
278
|
+
# ario.filename = 'cfile.rb' # rio('dirC/cfile.rb')
|
279
|
+
#
|
280
|
+
# rio('adir/afile.txt').rename.filename = 'bfile.rb' # adir/afile.txt => adir/bfile.rb
|
281
|
+
# rio('adir/afile.txt').rename.basename = 'bfile' # adir/afile.txt => adir/bfile.txt
|
282
|
+
# rio('adir/afile.txt').rename.extname = '.rb' # adir/afile.txt => adir/afile.rb
|
283
|
+
# rio('adir/afile.txt').rename.dirname = 'b/c' # adir/afile.txt => b/c/afile.txt
|
284
|
+
#
|
285
|
+
# See IF::Path#filename, IF::FileOrDir#rename
|
286
|
+
#
|
287
|
+
def filename=(arg) target.filename = arg end
|
288
|
+
|
289
|
+
|
290
|
+
# Creates new Rio by adding args as additional directory components like File#join.
|
291
|
+
#
|
292
|
+
# ario = rio('adir')
|
293
|
+
# brio = rio('b')
|
294
|
+
# crio = ario.join(brio) #=> rio('adir/b')
|
295
|
+
#
|
296
|
+
# ario = rio('adir')
|
297
|
+
# ario.join('b','c','d') #=> rio('ario/b/c/d')
|
298
|
+
#
|
299
|
+
# See also IF::Path#/
|
300
|
+
def join(*args) target.join(*args) end
|
301
|
+
|
302
|
+
|
303
|
+
# Returns an array of Rios, one for each path element.
|
304
|
+
# (Note that this behavior differs from File#split.)
|
305
|
+
#
|
306
|
+
# rio('a/b/c').split #=> [rio('a'),rio('b'),rio('c')]
|
307
|
+
#
|
308
|
+
# The array returned is extended with a +to_rio+ method,
|
309
|
+
# which will put the parts back together again.
|
310
|
+
#
|
311
|
+
# ary = rio('a/b/c').split #=> [rio('a'),rio('b'),rio('c')]
|
312
|
+
# ary.to_rio #=> rio('a/b/c')
|
313
|
+
#
|
314
|
+
# ary = rio('a/b/c').split #=> [rio('a'),rio('b'),rio('c')]
|
315
|
+
# ary[1] = rio('d')
|
316
|
+
# ary.to_rio #=> rio('a/d/c')
|
317
|
+
#
|
318
|
+
# See also IF::Path#join, IF::Path#/
|
319
|
+
#
|
320
|
+
def splitpath() target.splitpath() end
|
321
|
+
|
322
|
+
|
323
|
+
# Subdirectory operator.
|
324
|
+
#
|
325
|
+
# Effectively the same as IF::Path#join(arg)
|
326
|
+
#
|
327
|
+
# a = rio('a')
|
328
|
+
# b = rio('b')
|
329
|
+
# c = a/b #=> rio('a/b')
|
330
|
+
#
|
331
|
+
# ario = rio('adir')
|
332
|
+
# ario/'afile.rb' #=> rio('adir/afile.rb')
|
333
|
+
# ario/'b'/'c'/'d' #=> rio('adir/b/c/d')
|
334
|
+
#
|
335
|
+
# ario = rio('adir')
|
336
|
+
# ario /= 'afile.rb' #=> rio('adir/afile.rb')
|
337
|
+
#
|
338
|
+
def /(arg)
|
339
|
+
target / arg
|
340
|
+
end
|
341
|
+
|
342
|
+
|
343
|
+
# Rio#catpath!
|
344
|
+
#
|
345
|
+
#
|
346
|
+
#def catpath!(*args) target.catpath!(*args); self end
|
347
|
+
|
348
|
+
|
349
|
+
# Rio#catpath
|
350
|
+
#
|
351
|
+
#
|
352
|
+
#def catpath(*args) target.catpath(*args) end
|
353
|
+
|
354
|
+
|
355
|
+
# Changes a Rio inplace by adding args as additional directory components like IF::Path#join,
|
356
|
+
#
|
357
|
+
def join!(*args) target.join!(*args); self end
|
358
|
+
|
359
|
+
# IF::GrandeStream#rootpath
|
360
|
+
#
|
361
|
+
#
|
362
|
+
def rootpath(*args) # :nodoc:
|
363
|
+
target.rootpath(*args)
|
364
|
+
end
|
365
|
+
|
366
|
+
|
367
|
+
# IF::GrandeStream#root
|
368
|
+
#
|
369
|
+
#
|
370
|
+
##def root(*args,&block) target.root(*args,&block) end
|
371
|
+
|
372
|
+
|
373
|
+
# Rio#cwd
|
374
|
+
#
|
375
|
+
#
|
376
|
+
##def cwd(*args,&block) target.cwd(*args,&block) end
|
377
|
+
|
378
|
+
|
379
|
+
# IF::Grande#getwd
|
380
|
+
#
|
381
|
+
#
|
382
|
+
##def getwd(*args,&block) target.getwd(*args,&block) end
|
383
|
+
|
384
|
+
|
385
|
+
# Returns the scheme for the Rio's URI-like URI#scheme where the Rio is represented
|
386
|
+
# by a standard URI. For Rios that are not represented by standard URIs one of
|
387
|
+
# Rio's non-standard schemes is returned.
|
388
|
+
#
|
389
|
+
# rio('http://ruby-doc.org/').scheme #=> 'http'
|
390
|
+
#
|
391
|
+
def scheme(*args) target.scheme(*args) end
|
392
|
+
|
393
|
+
# Calls URI#host for Rios which have a URI. Otherwise raises NoMethodError.
|
394
|
+
#
|
395
|
+
# rio('http://ruby-doc.org/').host #=> 'ruby-doc'
|
396
|
+
#
|
397
|
+
def host(*args) target.host(*args) end
|
398
|
+
|
399
|
+
# Calls URI#opaque for Rios which have URI representations. The opaque portion
|
400
|
+
# of a URI is the portion after the colon and before the question-mark beginning
|
401
|
+
# the query.
|
402
|
+
#
|
403
|
+
# rio('http://example.org/do.cgi?n=1').opaque #=> '//example.org/do.cgi'
|
404
|
+
#
|
405
|
+
# For Rios that do not have URL representations, returns the same part of
|
406
|
+
# Rio's internal psuedo-URL
|
407
|
+
def opaque(*args) target.opaque(*args) end
|
408
|
+
|
409
|
+
|
410
|
+
|
411
|
+
# Calls URI#merge
|
412
|
+
#
|
413
|
+
# Merges two Rios. URI#merge does not document exactly what merging two URIs means.
|
414
|
+
# This appears to join the paths like <tt>other + path</tt>.
|
415
|
+
# See URI#merge for less information.
|
416
|
+
#
|
417
|
+
def merge(other) target.merge(other) end
|
418
|
+
|
419
|
+
|
420
|
+
# Calls URI#route_from
|
421
|
+
#
|
422
|
+
# Returns a new rio representing the path to this Rio from the perspective of _other_.
|
423
|
+
# URI#route_from requires that absolute URIs be used. IF::Path#route_from does not.
|
424
|
+
#
|
425
|
+
def route_from(other) target.route_from(other) end
|
426
|
+
|
427
|
+
# Calls URI#route_to
|
428
|
+
#
|
429
|
+
# Returns a new rio representing the path to _other_ from the perspective of this Rio.
|
430
|
+
# URI#route_to requires that absolute URIs be used. IF::Path#route_to does not.
|
431
|
+
#
|
432
|
+
def route_to(other) target.route_to(other) end
|
433
|
+
|
434
|
+
# Calls Pathname#cleanpath
|
435
|
+
#
|
436
|
+
# Returns a new Rio whose path is the clean pathname of +self+ with
|
437
|
+
# consecutive slashes and useless dots
|
438
|
+
# removed. The filesystem is not accessed.
|
439
|
+
#
|
440
|
+
# If +consider_symlink+ is +true+, then a more conservative algorithm is used
|
441
|
+
# to avoid breaking symbolic linkages. This may retain more <tt>..</tt>
|
442
|
+
# entries than absolutely necessary, but without accessing the filesystem,
|
443
|
+
# this can't be avoided. See #realpath.
|
444
|
+
#
|
445
|
+
def cleanpath(consider_symlink=false) target.cleanpath(consider_symlink) end
|
446
|
+
|
447
|
+
# Calls Pathname#realpath
|
448
|
+
#
|
449
|
+
# Returns a new Rio whose path is the real (absolute) pathname
|
450
|
+
# of +self+ in the actual filesystem.
|
451
|
+
# The real pathname doesn't contain symlinks or useless dots.
|
452
|
+
#
|
453
|
+
def realpath() target.realpath() end
|
454
|
+
|
371
455
|
end
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
##def root(*args,&block) target.root(*args,&block) end
|
378
|
-
|
379
|
-
|
380
|
-
# Rio#cwd
|
381
|
-
#
|
382
|
-
#
|
383
|
-
##def cwd(*args,&block) target.cwd(*args,&block) end
|
384
|
-
|
385
|
-
|
386
|
-
# Rio#getwd
|
387
|
-
#
|
388
|
-
#
|
389
|
-
##def getwd(*args,&block) target.getwd(*args,&block) end
|
390
|
-
|
391
|
-
|
392
|
-
# Returns the scheme for the Rio's URI-like URI#scheme where the Rio is represented
|
393
|
-
# by a standard URI. For Rios that are not represented by standard URIs one of
|
394
|
-
# Rio's non-standard schemes is returned.
|
395
|
-
#
|
396
|
-
# rio('http://ruby-doc.org/').scheme #=> 'http'
|
397
|
-
#
|
398
|
-
def scheme(*args) target.scheme(*args) end
|
399
|
-
|
400
|
-
# Calls URI#host for Rios which have a URI. Otherwise raises NoMethodError.
|
401
|
-
#
|
402
|
-
# rio('http://ruby-doc.org/').host #=> 'ruby-doc'
|
403
|
-
#
|
404
|
-
def host(*args) target.host(*args) end
|
405
|
-
|
406
|
-
# Calls URI#opaque for Rios which have URI representations. The opaque portion
|
407
|
-
# of a URI is the portion after the colon and before the question-mark beginning
|
408
|
-
# the query.
|
409
|
-
#
|
410
|
-
# rio('http://example.org/do.cgi?n=1').opaque #=> '//example.org/do.cgi'
|
411
|
-
#
|
412
|
-
# For Rios that do not have URL representations, returns the same part of
|
413
|
-
# Rio's internal psuedo-URL
|
414
|
-
def opaque(*args) target.opaque(*args) end
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
# Calls URI#merge
|
419
|
-
#
|
420
|
-
# Merges two Rios. URI#merge does not document exactly what merging two URIs means.
|
421
|
-
# This appears to join the paths like <tt>other + path</tt>.
|
422
|
-
# See URI#merge for less information.
|
423
|
-
#
|
424
|
-
def merge(other) target.merge(other) end
|
425
|
-
|
426
|
-
|
427
|
-
# Calls URI#route_from
|
428
|
-
#
|
429
|
-
# Returns a new rio representing the path to this Rio from the perspective of _other_.
|
430
|
-
# URI#route_from requires that absolute URIs be used. Rio#route_from does not.
|
431
|
-
#
|
432
|
-
def route_from(other) target.route_from(other) end
|
433
|
-
|
434
|
-
# Calls URI#route_to
|
435
|
-
#
|
436
|
-
# Returns a new rio representing the path to _other_ from the perspective of this Rio.
|
437
|
-
# URI#route_to requires that absolute URIs be used. Rio#route_to does not.
|
438
|
-
#
|
439
|
-
def route_to(other) target.route_to(other) end
|
440
|
-
|
441
|
-
# Calls Pathname#cleanpath
|
442
|
-
#
|
443
|
-
# Returns a new Rio whose path is the clean pathname of +self+ with
|
444
|
-
# consecutive slashes and useless dots
|
445
|
-
# removed. The filesystem is not accessed.
|
446
|
-
#
|
447
|
-
# If +consider_symlink+ is +true+, then a more conservative algorithm is used
|
448
|
-
# to avoid breaking symbolic linkages. This may retain more <tt>..</tt>
|
449
|
-
# entries than absolutely necessary, but without accessing the filesystem,
|
450
|
-
# this can't be avoided. See #realpath.
|
451
|
-
#
|
452
|
-
def cleanpath(consider_symlink=false) target.cleanpath(consider_symlink) end
|
453
|
-
|
454
|
-
# Calls Pathname#realpath
|
455
|
-
#
|
456
|
-
# Returns a new Rio whose path is the real (absolute) pathname
|
457
|
-
# of +self+ in the actual filesystem.
|
458
|
-
# The real pathname doesn't contain symlinks or useless dots.
|
459
|
-
#
|
460
|
-
def realpath() target.realpath() end
|
461
|
-
|
456
|
+
end
|
457
|
+
end
|
458
|
+
module RIO
|
459
|
+
class Rio
|
460
|
+
include RIO::IF::Path
|
462
461
|
end
|
463
462
|
end
|