wishdev-rio 0.4.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/COPYING +341 -0
- data/README +81 -0
- data/Rakefile +281 -0
- data/build_doc.rb +94 -0
- data/doc/ANNOUNCE +159 -0
- data/doc/RELEASE_NOTES +308 -0
- data/doc/RIOIS +215 -0
- data/doc/generators/template/html/rio.css +428 -0
- data/doc/generators/template/html/rio.rb +523 -0
- data/doc/generators/template/html/ugly.rb +132 -0
- data/doc/pkg_def.rb +60 -0
- data/doc/rfc1738.txt +1403 -0
- data/doc/rfc959.txt +3933 -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/abstract_method.rb +56 -0
- data/lib/rio/argv.rb +56 -0
- data/lib/rio/arycopy.rb +43 -0
- data/lib/rio/assert.rb +114 -0
- data/lib/rio/base.rb +56 -0
- data/lib/rio/callstr.rb +46 -0
- data/lib/rio/const.rb +51 -0
- data/lib/rio/construct.rb +50 -0
- data/lib/rio/constructor.rb +258 -0
- data/lib/rio/context/autoclose.rb +72 -0
- data/lib/rio/context/copying.rb +55 -0
- data/lib/rio/context/cxx.rb +66 -0
- data/lib/rio/context/dir.rb +120 -0
- data/lib/rio/context/gzip.rb +50 -0
- data/lib/rio/context/methods.rb +182 -0
- data/lib/rio/context/skip.rb +66 -0
- data/lib/rio/context/stream.rb +229 -0
- data/lib/rio/context.rb +117 -0
- data/lib/rio/cp.rb +370 -0
- data/lib/rio/def.rb +53 -0
- data/lib/rio/dir.rb +144 -0
- data/lib/rio/doc/EXAMPLES.rb +299 -0
- data/lib/rio/doc/HOWTO.rb +737 -0
- data/lib/rio/doc/INDEX.rb +311 -0
- data/lib/rio/doc/INTRO.rb +1068 -0
- data/lib/rio/doc/OPTIONAL.rb +130 -0
- data/lib/rio/doc/SYNOPSIS.rb +183 -0
- data/lib/rio/doc.rb +45 -0
- data/lib/rio/entrysel.rb +246 -0
- data/lib/rio/exception/copy.rb +97 -0
- data/lib/rio/exception/notimplemented.rb +57 -0
- data/lib/rio/exception/notsupported.rb +46 -0
- data/lib/rio/exception/open.rb +61 -0
- data/lib/rio/exception/state.rb +73 -0
- data/lib/rio/exception.rb +41 -0
- data/lib/rio/ext/csv.rb +351 -0
- 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/doc.rb +133 -0
- data/lib/rio/ext/yaml/tie.rb +149 -0
- data/lib/rio/ext/yaml.rb +164 -0
- 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/ext/zipfile.rb +110 -0
- data/lib/rio/ext.rb +138 -0
- data/lib/rio/factory.rb +436 -0
- data/lib/rio/file.rb +118 -0
- data/lib/rio/filter/closeoneof.rb +103 -0
- data/lib/rio/filter/gzip.rb +70 -0
- data/lib/rio/filter.rb +94 -0
- data/lib/rio/fs/base.rb +41 -0
- data/lib/rio/fs/impl.rb +122 -0
- data/lib/rio/fs/native.rb +75 -0
- data/lib/rio/fs/stream.rb +61 -0
- data/lib/rio/fs/url.rb +63 -0
- data/lib/rio/ftp/conncache.rb +101 -0
- data/lib/rio/ftp/dir.rb +94 -0
- data/lib/rio/ftp/fs.rb +180 -0
- data/lib/rio/ftp/ftpfile.rb +20 -0
- data/lib/rio/grande.rb +97 -0
- data/lib/rio/handle.rb +100 -0
- data/lib/rio/if/basic.rb +64 -0
- data/lib/rio/if/csv.rb +76 -0
- data/lib/rio/if/dir.rb +157 -0
- data/lib/rio/if/file.rb +89 -0
- data/lib/rio/if/fileordir.rb +268 -0
- data/lib/rio/if/grande.rb +729 -0
- data/lib/rio/if/grande_entry.rb +379 -0
- data/lib/rio/if/grande_stream.rb +693 -0
- data/lib/rio/if/internal.rb +125 -0
- data/lib/rio/if/path.rb +462 -0
- data/lib/rio/if/rubyio.rb +681 -0
- data/lib/rio/if/string.rb +83 -0
- data/lib/rio/if/temp.rb +45 -0
- data/lib/rio/if/test.rb +282 -0
- data/lib/rio/if/yaml.rb +206 -0
- data/lib/rio/if.rb +64 -0
- data/lib/rio/ioh.rb +162 -0
- data/lib/rio/iomode.rb +109 -0
- data/lib/rio/ios/fail.rb +106 -0
- data/lib/rio/ios/generic.rb +119 -0
- data/lib/rio/ios/mode.rb +60 -0
- data/lib/rio/ios/null.rb +119 -0
- data/lib/rio/iowrap.rb +128 -0
- data/lib/rio/kernel.rb +54 -0
- data/lib/rio/local.rb +62 -0
- data/lib/rio/match.rb +53 -0
- data/lib/rio/matchrecord.rb +283 -0
- data/lib/rio/no_warn.rb +49 -0
- data/lib/rio/nullio.rb +159 -0
- data/lib/rio/open3.rb +68 -0
- data/lib/rio/ops/construct.rb +61 -0
- data/lib/rio/ops/create.rb +77 -0
- data/lib/rio/ops/dir.rb +346 -0
- data/lib/rio/ops/either.rb +134 -0
- data/lib/rio/ops/file.rb +102 -0
- data/lib/rio/ops/path.rb +296 -0
- data/lib/rio/ops/stream/input.rb +267 -0
- data/lib/rio/ops/stream/output.rb +100 -0
- data/lib/rio/ops/stream/read.rb +86 -0
- data/lib/rio/ops/stream/write.rb +57 -0
- data/lib/rio/ops/stream.rb +87 -0
- data/lib/rio/ops/symlink.rb +80 -0
- data/lib/rio/path/reset.rb +69 -0
- data/lib/rio/path.rb +129 -0
- data/lib/rio/piper/cp.rb +80 -0
- data/lib/rio/piper.rb +122 -0
- data/lib/rio/prompt.rb +66 -0
- data/lib/rio/rectype.rb +88 -0
- data/lib/rio/rl/base.rb +118 -0
- data/lib/rio/rl/builder.rb +117 -0
- data/lib/rio/rl/chmap.rb +66 -0
- data/lib/rio/rl/fs2url.rb +82 -0
- data/lib/rio/rl/ioi.rb +78 -0
- data/lib/rio/rl/path.rb +110 -0
- data/lib/rio/rl/pathmethods.rb +116 -0
- data/lib/rio/rl/uri.rb +200 -0
- data/lib/rio/rl/withpath.rb +296 -0
- data/lib/rio/scheme/aryio.rb +88 -0
- data/lib/rio/scheme/cmdio.rb +80 -0
- data/lib/rio/scheme/cmdpipe.rb +118 -0
- data/lib/rio/scheme/fd.rb +65 -0
- data/lib/rio/scheme/ftp.rb +141 -0
- data/lib/rio/scheme/http.rb +78 -0
- data/lib/rio/scheme/null.rb +55 -0
- data/lib/rio/scheme/path.rb +98 -0
- data/lib/rio/scheme/stderr.rb +55 -0
- data/lib/rio/scheme/stdio.rb +71 -0
- data/lib/rio/scheme/strio.rb +87 -0
- data/lib/rio/scheme/sysio.rb +63 -0
- data/lib/rio/scheme/tcp.rb +75 -0
- data/lib/rio/scheme/temp.rb +200 -0
- data/lib/rio/state/error.rb +72 -0
- data/lib/rio/state.rb +242 -0
- data/lib/rio/stream/base.rb +54 -0
- data/lib/rio/stream/duplex.rb +79 -0
- data/lib/rio/stream/open.rb +202 -0
- data/lib/rio/stream.rb +181 -0
- data/lib/rio/symantics.rb +45 -0
- data/lib/rio/tempdir.rb +132 -0
- data/lib/rio/to_rio/all.rb +39 -0
- data/lib/rio/to_rio/array.rb +39 -0
- data/lib/rio/to_rio/io.rb +40 -0
- data/lib/rio/to_rio/object.rb +42 -0
- data/lib/rio/to_rio/string.rb +40 -0
- data/lib/rio/to_rio.rb +67 -0
- data/lib/rio/uri/file.rb +198 -0
- data/lib/rio/util.rb +48 -0
- data/lib/rio/version.rb +51 -0
- data/lib/rio.rb +162 -0
- data/setup.rb +1360 -0
- data/test/bin/count_lines.rb +11 -0
- data/test/bin/find_lines.rb +13 -0
- data/test/bin/list_dir.rb +14 -0
- data/test/ftp/all.rb +9 -0
- data/test/ftp/anon_copy_data.rb +36 -0
- data/test/ftp/anon_misc.rb +124 -0
- data/test/ftp/anon_read.rb +105 -0
- data/test/ftp/anon_special.rb +68 -0
- data/test/ftp/anon_write.rb +70 -0
- data/test/ftp/ftp2ftp.rb +51 -0
- data/test/ftp/initftpfiles.rb +14 -0
- data/test/ftp/testdef.rb +55 -0
- data/test/gem_runtests.rb +15 -0
- data/test/http/all.rb +4 -0
- data/test/http/copy-from-http.rb +141 -0
- data/test/http/uri-meta.rb +72 -0
- data/test/lib/temp_server.rb +46 -0
- data/test/runalltests.rb +17 -0
- data/test/runftptests.rb +14 -0
- data/test/runhttp.rb +11 -0
- data/test/runhttptests.rb +14 -0
- data/test/runtests.rb +52 -0
- data/test/tc/abs.rb +355 -0
- data/test/tc/all.rb +80 -0
- data/test/tc/base.rb +31 -0
- data/test/tc/base2.rb +87 -0
- data/test/tc/cd1.rb +113 -0
- data/test/tc/clearsel.rb +68 -0
- data/test/tc/clone.rb +208 -0
- data/test/tc/closeoncopy.rb +102 -0
- data/test/tc/closeoneof.rb +194 -0
- data/test/tc/cmdpipe.rb +149 -0
- data/test/tc/copy-dir-samevar.rb +91 -0
- data/test/tc/copy-from.rb +129 -0
- data/test/tc/copy-to.rb +91 -0
- data/test/tc/copy.rb +74 -0
- data/test/tc/copyarray.rb +188 -0
- data/test/tc/copydest.rb +50 -0
- data/test/tc/copydir.rb +166 -0
- data/test/tc/copydirlines.rb +121 -0
- data/test/tc/copylines.rb +46 -0
- data/test/tc/copynonex.rb +118 -0
- data/test/tc/copysymlink.rb +39 -0
- data/test/tc/create.rb +114 -0
- data/test/tc/csv.rb +226 -0
- data/test/tc/csv2.rb +138 -0
- data/test/tc/csv_columns.rb +37 -0
- data/test/tc/csvutil.rb +56 -0
- data/test/tc/dir.rb +76 -0
- data/test/tc/dir_iter.rb +383 -0
- data/test/tc/dirautoclose.rb +67 -0
- data/test/tc/dirent.rb +178 -0
- data/test/tc/dirss.rb +81 -0
- data/test/tc/each.rb +111 -0
- data/test/tc/each_break.rb +243 -0
- data/test/tc/edf.rb +81 -0
- data/test/tc/empty.rb +51 -0
- data/test/tc/emptyriodir.rb +129 -0
- data/test/tc/entary.rb +227 -0
- data/test/tc/entsel.rb +110 -0
- data/test/tc/eq.rb +101 -0
- data/test/tc/expand_path.rb +69 -0
- data/test/tc/ext.rb +136 -0
- data/test/tc/fileno.rb +94 -0
- data/test/tc/files_select.rb +92 -0
- data/test/tc/get.rb +152 -0
- data/test/tc/getrec.rb +137 -0
- data/test/tc/gzip.rb +109 -0
- data/test/tc/io_each_byte.rb +60 -0
- data/test/tc/io_read.rb +80 -0
- data/test/tc/iometh.rb +149 -0
- data/test/tc/likeio.rb +116 -0
- data/test/tc/line_record_row.rb +51 -0
- data/test/tc/lineno.rb +196 -0
- data/test/tc/lines.rb +66 -0
- data/test/tc/misc.rb +432 -0
- data/test/tc/nolines.rb +204 -0
- data/test/tc/noqae.rb +879 -0
- data/test/tc/null.rb +45 -0
- data/test/tc/once.rb +6 -0
- data/test/tc/overload.rb +140 -0
- data/test/tc/pa.rb +158 -0
- data/test/tc/path_parts.rb +175 -0
- data/test/tc/pathop.rb +60 -0
- data/test/tc/paths.rb +145 -0
- data/test/tc/pid.rb +31 -0
- data/test/tc/piper.rb +143 -0
- data/test/tc/programs_util.rb +24 -0
- data/test/tc/qae.rb +493 -0
- data/test/tc/qae_riovar.rb +499 -0
- data/test/tc/readline.rb +30 -0
- data/test/tc/records.rb +68 -0
- data/test/tc/rename.rb +233 -0
- data/test/tc/rename_assign.rb +45 -0
- data/test/tc/riorl.rb +181 -0
- data/test/tc/route.rb +51 -0
- data/test/tc/selnosel.rb +33 -0
- data/test/tc/skip.rb +89 -0
- data/test/tc/skiplines.rb +71 -0
- data/test/tc/split.rb +28 -0
- data/test/tc/splitlines.rb +65 -0
- data/test/tc/splitpath.rb +83 -0
- data/test/tc/sub.rb +46 -0
- data/test/tc/symlink.rb +176 -0
- data/test/tc/symlink0.rb +348 -0
- data/test/tc/symlink1.rb +114 -0
- data/test/tc/synopsis.rb +75 -0
- data/test/tc/temp.rb +152 -0
- data/test/tc/tempdir.rb +60 -0
- data/test/tc/tempfile.rb +66 -0
- data/test/tc/testcase.rb +170 -0
- data/test/tc/tonl.rb +37 -0
- data/test/tc/truncate.rb +39 -0
- data/test/tc/yaml.rb +275 -0
- metadata +387 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
#--
|
|
2
|
+
# ===============================================================================
|
|
3
|
+
# Copyright (c) 2005,2006,2007 Christopher Kleckner
|
|
4
|
+
# All rights reserved
|
|
5
|
+
#
|
|
6
|
+
# This file is part of the Rio library for ruby.
|
|
7
|
+
#
|
|
8
|
+
# Rio is free software; you can redistribute it and/or modify
|
|
9
|
+
# it under the terms of the GNU General Public License as published by
|
|
10
|
+
# the Free Software Foundation; either version 2 of the License, or
|
|
11
|
+
# (at your option) any later version.
|
|
12
|
+
#
|
|
13
|
+
# Rio is distributed in the hope that it will be useful,
|
|
14
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
# GNU General Public License for more details.
|
|
17
|
+
#
|
|
18
|
+
# You should have received a copy of the GNU General Public License
|
|
19
|
+
# along with Rio; if not, write to the Free Software
|
|
20
|
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
21
|
+
# ===============================================================================
|
|
22
|
+
#++
|
|
23
|
+
#
|
|
24
|
+
# To create the documentation for Rio run the command
|
|
25
|
+
# ruby build_doc.rb
|
|
26
|
+
# from the distribution directory.
|
|
27
|
+
#
|
|
28
|
+
# Suggested Reading
|
|
29
|
+
# * RIO::Doc::SYNOPSIS
|
|
30
|
+
# * RIO::Doc::INTRO
|
|
31
|
+
# * RIO::Doc::HOWTO
|
|
32
|
+
# * RIO::Doc::EXAMPLES
|
|
33
|
+
# * RIO::Rio
|
|
34
|
+
#
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
module RIO
|
|
38
|
+
class Rio
|
|
39
|
+
# This is an internal function and is not needed in client code.
|
|
40
|
+
# It returns the internal 'Context' object.
|
|
41
|
+
#def cx() target.cx() end
|
|
42
|
+
|
|
43
|
+
# This is an internal function and should not normally be needed in client code.
|
|
44
|
+
# It closes a Rio and returns it to its 'reset' state.
|
|
45
|
+
def reset() # :nodoc:
|
|
46
|
+
target.reset()
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# This is an internal function and is not needed in client code.
|
|
50
|
+
# It returns the internal 'Rio Resource Locator' object.
|
|
51
|
+
def rl() # :nodoc:
|
|
52
|
+
target.rl()
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# This is an internal function and is not needed in client code.
|
|
56
|
+
# It returns the internal 'Rio Resource Locator' object.
|
|
57
|
+
def to_rl() # :nodoc:
|
|
58
|
+
target.to_rl()
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# This is an internal function and is not needed in client code.
|
|
62
|
+
# It returns the internal 'Rio Context' object.
|
|
63
|
+
def cx() # :nodoc:
|
|
64
|
+
target.cx()
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# This is an internal function and is not needed in client code.
|
|
68
|
+
def cx=(arg) # :nodoc:
|
|
69
|
+
target.cx = arg
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# This is an internal function and is not needed in client code.
|
|
73
|
+
def copyclose() # :nodoc:
|
|
74
|
+
target.copyclose
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# This is an internal function and is not needed in client code.
|
|
78
|
+
def nostreamenum() # :nodoc:
|
|
79
|
+
target.nostreamenum
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# This is an internal function and is not needed in client code.
|
|
83
|
+
def cpclose(*args,&block) # :nodoc:
|
|
84
|
+
target.cpclose(*args,&block)
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# This is an internal function and is not needed in client code.
|
|
88
|
+
def each_record(*args,&block) # :nodoc:
|
|
89
|
+
target.each_record(*args,&block)
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# This is an internal function and is not needed in client code.
|
|
93
|
+
def each_row(*args,&block) # :nodoc:
|
|
94
|
+
target.each_row(*args,&block)
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# This is an internal function and is not needed in client code.
|
|
98
|
+
def outputmode?() # :nodoc:
|
|
99
|
+
target.outputmode?
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
# This is an internal function and is not needed in client code.
|
|
103
|
+
def inputmode?() # :nodoc:
|
|
104
|
+
target.inputmode?
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# This is an internal function and is not needed in client code.
|
|
108
|
+
def iostate(sym) # :nodoc:
|
|
109
|
+
target.iostate(sym)
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
# This is an internal function and is not needed in client code.
|
|
113
|
+
def getwd(*args) # :nodoc:
|
|
114
|
+
target.getwd(*args)
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
# This is an internal function and is not needed in client code.
|
|
118
|
+
def stream_iter?() # :nodoc:
|
|
119
|
+
target.stream_iter?
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
end
|
|
125
|
+
end
|
data/lib/rio/if/path.rb
ADDED
|
@@ -0,0 +1,462 @@
|
|
|
1
|
+
#--
|
|
2
|
+
# ===============================================================================
|
|
3
|
+
# Copyright (c) 2005,2006,2007 Christopher Kleckner
|
|
4
|
+
# All rights reserved
|
|
5
|
+
#
|
|
6
|
+
# This file is part of the Rio library for ruby.
|
|
7
|
+
#
|
|
8
|
+
# Rio is free software; you can redistribute it and/or modify
|
|
9
|
+
# it under the terms of the GNU General Public License as published by
|
|
10
|
+
# the Free Software Foundation; either version 2 of the License, or
|
|
11
|
+
# (at your option) any later version.
|
|
12
|
+
#
|
|
13
|
+
# Rio is distributed in the hope that it will be useful,
|
|
14
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
# GNU General Public License for more details.
|
|
17
|
+
#
|
|
18
|
+
# You should have received a copy of the GNU General Public License
|
|
19
|
+
# along with Rio; if not, write to the Free Software
|
|
20
|
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
21
|
+
# ===============================================================================
|
|
22
|
+
#++
|
|
23
|
+
#
|
|
24
|
+
# To create the documentation for Rio run the command
|
|
25
|
+
# ruby build_doc.rb
|
|
26
|
+
# from the distribution directory.
|
|
27
|
+
#
|
|
28
|
+
# Suggested Reading
|
|
29
|
+
# * RIO::Doc::SYNOPSIS
|
|
30
|
+
# * RIO::Doc::INTRO
|
|
31
|
+
# * RIO::Doc::HOWTO
|
|
32
|
+
# * RIO::Doc::EXAMPLES
|
|
33
|
+
# * RIO::Rio
|
|
34
|
+
#
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
module RIO
|
|
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? #=> '.gz'
|
|
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
|
+
|
|
455
|
+
end
|
|
456
|
+
end
|
|
457
|
+
end
|
|
458
|
+
module RIO
|
|
459
|
+
class Rio
|
|
460
|
+
include RIO::IF::Path
|
|
461
|
+
end
|
|
462
|
+
end
|