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/README
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright (c) 2005,
|
1
|
+
Copyright (c) 2005,2006,2007 Christopher Kleckner
|
2
2
|
All rights reserved
|
3
3
|
|
4
4
|
This file is part of the Rio library for ruby.
|
@@ -18,30 +18,35 @@ along with Rio; if not, write to the Free Software
|
|
18
18
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
19
19
|
|
20
20
|
|
21
|
-
<b>Rio is pre-alpha software.
|
22
|
-
The documented interface and behavior is subject to change without notice.</b>
|
23
|
-
|
24
21
|
=== Rio - Ruby I/O Comfort Class
|
25
22
|
|
26
|
-
Rio
|
27
|
-
|
23
|
+
Rio wraps much of the functionality of IO, File, Dir, Pathname, FileUtils,
|
24
|
+
Tempfile, StringIO, OpenURI, Zlib, and CSV.
|
25
|
+
|
26
|
+
==== Building the documentation
|
28
27
|
|
29
28
|
To create the documentation for Rio run the command
|
30
29
|
ruby build_doc.rb
|
31
|
-
from
|
30
|
+
from the distribution directory.
|
32
31
|
|
33
32
|
Then point your browser at the 'doc/rdoc' directory.
|
34
33
|
|
35
|
-
|
34
|
+
The RDoc template file included with the distribution contains some RDoc hacks
|
35
|
+
that overcomes some of RDoc's weaknesses and makes the documentation *much* more
|
36
|
+
usable. It is unadvisable to build the RDoc documentation without these.
|
37
|
+
|
38
|
+
|
39
|
+
===== Suggested Reading
|
36
40
|
* RIO::Doc::SYNOPSIS
|
37
41
|
* RIO::Doc::INTRO
|
38
42
|
* RIO::Doc::HOWTO
|
43
|
+
* RIO::Doc::EXAMPLES
|
39
44
|
* RIO::Rio
|
40
45
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
ruby setup.rb
|
46
|
+
==== Installation
|
47
|
+
|
48
|
+
To install Rio from the distribution directory type
|
49
|
+
ruby setup.rb
|
45
50
|
|
46
51
|
Rio is also available as a gem. If you have rubygems installed use:
|
47
52
|
gem install rio
|
@@ -56,6 +61,7 @@ To read the documentation without running rdoc, read the files:
|
|
56
61
|
* lib/rio/doc/HOWTO.rb
|
57
62
|
* lib/rio/if/*.rb
|
58
63
|
|
64
|
+
|
59
65
|
Project:: http://rubyforge.org/projects/rio/
|
60
66
|
Documentation:: http://rio.rubyforge.org/
|
61
67
|
Bugs:: http://rubyforge.org/tracker/?group_id=821
|
data/Rakefile
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.
|
@@ -41,32 +41,12 @@ require 'rake/testtask'
|
|
41
41
|
$:.push 'lib'
|
42
42
|
require 'rio/version'
|
43
43
|
require 'rio/doc'
|
44
|
+
require 'rio'
|
44
45
|
|
45
|
-
SVN_REPOSITORY_URL = ''
|
46
|
+
SVN_REPOSITORY_URL = 'svn+ssh://rio4ruby@rubyforge.org//var/svn/trunk/rio'
|
46
47
|
|
47
|
-
|
48
|
-
|
49
|
-
'lib/rio/if/*.rb','lib/rio/kernel.rb','lib/rio/constructor.rb']
|
50
|
-
XMP_FILES = FileList['ex/*']
|
51
|
-
|
52
|
-
module PKG
|
53
|
-
NAME = "rio"
|
54
|
-
TITLE = RIO::TITLE
|
55
|
-
VERSION = RIO::VERSION
|
56
|
-
FULLNAME = PKG::NAME + "-" + PKG::VERSION
|
57
|
-
SUMMARY = RIO::SUMMARY
|
58
|
-
DESCRIPTION = RIO::DESCRIPTION
|
59
|
-
FILES = FileList.new(['setup.rb', 'build_doc.rb', 'COPYING', 'Rakefile', 'ChangeLog', 'VERSION',
|
60
|
-
'test/**/*.rb','doc/**/*'] + SRC_FILES.to_a + DOC_FILES.to_a + XMP_FILES.to_a
|
61
|
-
) do |fl|
|
62
|
-
fl.exclude( /\bsvn\b/ )
|
63
|
-
fl.exclude( 'test/qp' )
|
64
|
-
fl.exclude( 'test/coverage' )
|
65
|
-
fl.exclude( 'doc/rdoc' )
|
66
|
-
end
|
67
|
-
OUT_DIR = 'pkg'
|
68
|
-
OUT_FILES = %w[.gem .tar.gz .zip].map { |ex| OUT_DIR + '/' + FULLNAME + ex }
|
69
|
-
end
|
48
|
+
require 'doc/pkg_def'
|
49
|
+
|
70
50
|
ZIP_DIR = "/zip/ruby/rio"
|
71
51
|
|
72
52
|
|
@@ -84,47 +64,44 @@ task :prepare do
|
|
84
64
|
ruby "setup.rb setup"
|
85
65
|
end
|
86
66
|
|
87
|
-
|
88
67
|
desc "Installs the package #{PKG::NAME}"
|
89
68
|
task :install => [:prepare] do
|
90
69
|
ruby "setup.rb install"
|
91
70
|
end
|
92
71
|
|
93
|
-
|
94
72
|
task :clean do
|
95
73
|
ruby "setup.rb clean"
|
96
74
|
end
|
97
75
|
|
98
|
-
|
99
76
|
CLOBBER << "doc/rdoc"
|
100
77
|
desc "Builds the documentation"
|
101
|
-
task :doc => [:
|
78
|
+
task :doc => [:rio_rdoc] do
|
102
79
|
puts "\nGenerating online documentation..."
|
103
80
|
# ruby %{-I../lib ../bin/webgen -V 2 }
|
104
81
|
end
|
105
82
|
|
106
|
-
RDOC_OPTIONS = ['--line-numbers']
|
107
83
|
rd = Rake::RDocTask.new do |rdoc|
|
108
84
|
rdoc.rdoc_dir = 'doc/rdoc'
|
109
85
|
rdoc.title = PKG::TITLE
|
110
|
-
rdoc.options = RDOC_OPTIONS
|
86
|
+
rdoc.options = PKG::RDOC_OPTIONS
|
111
87
|
rdoc.main = 'RIO::Doc::SYNOPSIS'
|
112
|
-
|
113
|
-
next if glb =~ /yaml.rb$/
|
88
|
+
PKG::FILES::DOC.to_a.each do |glb|
|
89
|
+
#next if glb =~ /yaml.rb$/
|
114
90
|
rdoc.rdoc_files.include( glb )
|
115
91
|
end
|
116
92
|
rdoc.template = 'doc/generators/template/html/rio.rb'
|
117
93
|
end
|
118
94
|
|
119
|
-
|
95
|
+
desc "Build custom RDoc"
|
96
|
+
task :rio_rdoc do
|
97
|
+
require 'rio/doc/SYNOPSIS'
|
98
|
+
ruby "-Idoc/patched_rdoc -Ilib doc/bin/rdoc --show-hash --op doc/rdoc --title #{PKG::TITLE} --line-numbers --template doc/generators/template/html/rio.rb #{PKG::FILES::DOC} --main #{RIO::Doc::SYNOPSIS}"
|
99
|
+
end
|
100
|
+
CLOBBER << "test/log" << "test/qp"
|
120
101
|
task :test do |t|
|
121
102
|
sh "cd test;ruby -I../lib -I. runtests.rb"
|
122
103
|
end
|
123
104
|
|
124
|
-
#task :package => [:gen_files] do |var|
|
125
|
-
# require 'rio/kernel'
|
126
|
-
# rio(ZIP_DIR) << rio('pkg').files['*.tgz','*.tar.gz','*.zip','*.gem']
|
127
|
-
#end
|
128
105
|
task :ziparc do |var|
|
129
106
|
require 'rio'
|
130
107
|
#$trace_states = true
|
@@ -145,6 +122,7 @@ end
|
|
145
122
|
#CLOBBER << "ChangeLog" << "VERSION" << "install.rb"
|
146
123
|
|
147
124
|
task :gen_files => [:gen_changelog, :gen_version]
|
125
|
+
#task :gen_files => [:gen_version]
|
148
126
|
CLOBBER << "ChangeLog" << "VERSION"
|
149
127
|
task :no_old_pkg do
|
150
128
|
# unless Dir["pkg/#{PKG::FULLNAME}*"].empty?
|
@@ -162,7 +140,36 @@ task :package => [:no_old_pkg, :gen_files]
|
|
162
140
|
Rake::PackageTask.new( PKG::NAME, PKG::VERSION ) do |p|
|
163
141
|
p.need_tar_gz = true
|
164
142
|
p.need_zip = true
|
165
|
-
p.package_files = PKG::FILES
|
143
|
+
p.package_files = PKG::FILES::DIST
|
144
|
+
end
|
145
|
+
|
146
|
+
Spec = Gem::Specification.new do |s|
|
147
|
+
s.name = PKG::NAME
|
148
|
+
s.version = PKG::VERSION
|
149
|
+
s.author = PKG::AUTHOR
|
150
|
+
s.email = PKG::EMAIL
|
151
|
+
s.homepage = "http://rio.rubyforge.org/"
|
152
|
+
s.rubyforge_project = "rio"
|
153
|
+
|
154
|
+
s.platform = Gem::Platform::RUBY
|
155
|
+
s.summary = PKG::SUMMARY
|
156
|
+
s.files = PKG::FILES::DIST.map { |rf| rf.to_s }
|
157
|
+
|
158
|
+
s.require_path = 'lib'
|
159
|
+
s.autorequire = 'rio'
|
160
|
+
|
161
|
+
s.has_rdoc = true
|
162
|
+
|
163
|
+
s.rdoc_options << PKG::RDOC_OPTIONS
|
164
|
+
end
|
165
|
+
|
166
|
+
Rake::GemPackageTask.new(Spec) do |p| end
|
167
|
+
|
168
|
+
desc "Build the Gem spec file for the rio package"
|
169
|
+
task :gemspec => "pkg/rio.gemspec"
|
170
|
+
file "pkg/rio.gemspec" => ["pkg", "Rakefile"] do |t|
|
171
|
+
puts PKG::FILES::DIST
|
172
|
+
open(t.name, "w") do |f| f.puts Spec.to_yaml end
|
166
173
|
end
|
167
174
|
|
168
175
|
desc "Make a new release (test,package,svn_version)"
|
@@ -194,55 +201,18 @@ task :svn_commit do
|
|
194
201
|
sh cmd
|
195
202
|
end
|
196
203
|
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
#### Basic information
|
203
|
-
|
204
|
-
s.name = PKG::NAME
|
205
|
-
s.version = PKG::VERSION
|
206
|
-
s.summary = PKG::SUMMARY
|
207
|
-
s.description = PKG::DESCRIPTION
|
208
|
-
|
209
|
-
#### Dependencies, requirements and files
|
210
|
-
|
211
|
-
s.files = PKG::FILES.to_a
|
212
|
-
# s.add_dependency( 'extensions', '>= 0.6.0' )
|
213
|
-
|
214
|
-
s.require_path = 'lib'
|
215
|
-
s.autorequire = 'rio'
|
216
|
-
|
217
|
-
#### Documentation
|
218
|
-
|
219
|
-
s.has_rdoc = true
|
220
|
-
#s.extra_rdoc_files = ['doc/generators/template/html/rio.rb']
|
221
|
-
s.rdoc_options << RDOC_OPTIONS
|
222
|
-
|
223
|
-
#### Author and project details
|
224
|
-
|
225
|
-
s.author = "Christopher Kleckner"
|
226
|
-
s.email = "rio4ruby@rubyforge.org"
|
227
|
-
s.homepage = "http://rio.rubyforge.org/"
|
228
|
-
s.rubyforge_project = "rio"
|
229
|
-
end
|
230
|
-
|
231
|
-
Rake::GemPackageTask.new( spec ) do |pkg|
|
232
|
-
pkg.need_zip = true
|
233
|
-
pkg.need_tar_gz = true
|
234
|
-
end
|
235
|
-
|
236
|
-
end
|
204
|
+
#desc "Build the gem from the gemspec"
|
205
|
+
#task :buildgem => ['rio.gemspec'] do
|
206
|
+
# cmd = "gem build 'rio.gemspec'"
|
207
|
+
# sh cmd
|
208
|
+
#end
|
237
209
|
|
238
|
-
=
|
239
|
-
desc "
|
240
|
-
task :
|
241
|
-
|
242
|
-
|
243
|
-
sh "svn cp -m 'Created version #{PKG::NAME}' #{repositoryPath}/trunk #{repositoryPath}/versions/#{PKG::NAME}"
|
210
|
+
GEM_FILENAME = "pkg/#{Spec.full_name}.gem"
|
211
|
+
desc "Install development gem"
|
212
|
+
task :installgem => [GEM_FILENAME] do
|
213
|
+
cmd = "gem install #{GEM_FILENAME}"
|
214
|
+
sh cmd
|
244
215
|
end
|
245
|
-
=end
|
246
216
|
|
247
217
|
desc "Upload documentation to homepage"
|
248
218
|
task :uploaddoc => [:rdoc] do
|
@@ -281,7 +251,7 @@ task :statistics do
|
|
281
251
|
total_lines = 0
|
282
252
|
total_code = 0
|
283
253
|
show_line( "File Name", "Lines", "LOC" )
|
284
|
-
|
254
|
+
PKG::FILES::SRC.each do |fn|
|
285
255
|
lines, codelines = count_lines fn
|
286
256
|
show_line( fn, lines, codelines )
|
287
257
|
total_lines += lines
|
data/build_doc.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
#--
|
3
3
|
# ===============================================================================
|
4
|
-
# Copyright (c) 2005,
|
4
|
+
# Copyright (c) 2005,2006,2007 Christopher Kleckner
|
5
5
|
# All rights reserved
|
6
6
|
#
|
7
7
|
# This file is part of the Rio library for ruby.
|
@@ -28,32 +28,32 @@
|
|
28
28
|
|
29
29
|
$:.unshift 'lib'
|
30
30
|
require 'rio'
|
31
|
+
require 'rio/prompt'
|
32
|
+
require 'doc/pkg_def'
|
31
33
|
|
32
34
|
module DFLT
|
33
35
|
RDOC_DIR = rio('doc/rdoc')
|
34
36
|
end
|
35
37
|
|
36
|
-
puts "Rio interactive RDoc installer."
|
38
|
+
#puts "Rio interactive RDoc installer."
|
37
39
|
|
38
|
-
rdoc_dir =
|
40
|
+
rdoc_dir = RIO.promptd('Where shall I build the rdoc documentation',DFLT::RDOC_DIR)
|
39
41
|
rdoc_dir = DFLT::RDOC_DIR if rdoc_dir.empty?
|
40
42
|
rdoc_dir = rio(rdoc_dir)
|
41
43
|
|
42
|
-
|
44
|
+
argv = []
|
45
|
+
argv << '--op' << rdoc_dir.to_s
|
46
|
+
argv += PKG::RDOC_OPTIONS
|
47
|
+
argv += PKG::FILES::DOC
|
43
48
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
]
|
53
|
-
|
54
|
-
cmd = sprintf("rdoc %s %s",RDOC_OPTIONS.join(' '),rdoc_files.join(' '))
|
55
|
-
|
56
|
-
rio(?-,cmd) > ?-
|
49
|
+
require 'rdoc/rdoc'
|
50
|
+
begin
|
51
|
+
r = RDoc::RDoc.new
|
52
|
+
r.document(argv)
|
53
|
+
rescue RDoc::RDocError => e
|
54
|
+
$stderr.puts e.message
|
55
|
+
exit(1)
|
56
|
+
end
|
57
57
|
|
58
58
|
docindex = (rdoc_dir/'index.html').abs.to_url
|
59
59
|
msg = "Please point your browser at '#{docindex}'"
|
@@ -63,5 +63,7 @@ puts
|
|
63
63
|
puts lin
|
64
64
|
puts "> " + msg + " >"
|
65
65
|
puts lin
|
66
|
+
__END__
|
67
|
+
|
66
68
|
|
67
69
|
|
data/doc/ANNOUNCE
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Rio 0.3.
|
1
|
+
Rio 0.3.9
|
2
2
|
|
3
3
|
== Overview
|
4
4
|
|
@@ -10,36 +10,7 @@ interfaces provided by IO, File, and Dir to an appropriate object, Rio
|
|
10
10
|
provides a "grande" interface that allows many common application
|
11
11
|
level I/O and file-system tasks to be expressed succinctly.
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
Enhanced support for FTP file-systems. All of Rio's most powerful
|
16
|
-
idioms are now supported seamlessly on FTP servers.
|
17
|
-
|
18
|
-
# copy a file from or to an FTP server
|
19
|
-
rio('ftp://ahost/adir/afile') > rio('localfile') # server -> local file
|
20
|
-
rio('ftp://ahost/adir/afile') < rio('localfile') # local file -> server
|
21
|
-
|
22
|
-
# copy an entire directory structure from or to an FTP server
|
23
|
-
rio('ftp://ahost/adir') > rio('localdir') # server -> local directory
|
24
|
-
rio('ftp://ahost/adir') < rio('localdir') # local directory -> server
|
25
|
-
|
26
|
-
All of Rio's grande selection and filtering options are available for
|
27
|
-
files and directories on FTP servers.
|
28
|
-
|
29
|
-
# create a gzipped copy of a web page on an ftp server
|
30
|
-
rio('ftp://ftphost/f.html.gz').gzip < rio('http://httphost/f.html')
|
31
|
-
|
32
|
-
# dump the first 10 lines of a gzipped log file on an FTP server to stdout
|
33
|
-
rio('ftp://ftphost/logfile.txt').lines(0...10) > ?-
|
34
|
-
|
35
|
-
# iterate through the entries of a directory on an FTP server
|
36
|
-
rio('ftp://ftphost/adir').entries { |entrio| ... }
|
37
|
-
|
38
|
-
# get an array of all .rb files on an ftp server
|
39
|
-
rb_files = rio('ftp://ftphost/').all.files['*.rb']
|
40
|
-
|
41
|
-
|
42
|
-
== SYNOPSIS
|
13
|
+
= SYNOPSIS
|
43
14
|
|
44
15
|
For the following assume:
|
45
16
|
astring = ""
|
@@ -156,7 +127,7 @@ Bugs:: http://rubyforge.org/tracker/?group_id=821
|
|
156
127
|
Email:: rio4ruby@rubyforge.org
|
157
128
|
|
158
129
|
== Copyright
|
159
|
-
Copyright (c) 2005,
|
130
|
+
Copyright (c) 2005,2006,2007 Christopher Kleckner. All rights reserved
|
160
131
|
|
161
132
|
== License
|
162
133
|
Rio is released under the GNU General Public License
|
data/doc/RELEASE_NOTES
CHANGED
@@ -1,8 +1,3 @@
|
|
1
|
-
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
2
|
-
Rio is pre-alpha software.
|
3
|
-
The documented interface and behaviour is subject to change without notice.
|
4
|
-
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
5
|
-
|
6
1
|
=== Rio - Ruby I/O Comfort Class
|
7
2
|
|
8
3
|
Rio is a convenience class wrapping much of the functionality of
|
@@ -20,6 +15,10 @@ Suggested Reading
|
|
20
15
|
* RIO::Doc::HOWTO
|
21
16
|
* RIO::Rio
|
22
17
|
|
18
|
+
== New for version 0.3.9
|
19
|
+
* Bug fixes, code cleanup,
|
20
|
+
|
21
|
+
|
23
22
|
== New for version 0.3.8
|
24
23
|
* Enhanced support for FTP file-systems. All of Rio's most powerful
|
25
24
|
idioms are now supported seamlessly on FTP servers.
|
data/doc/RIOIS
ADDED
@@ -0,0 +1,215 @@
|
|
1
|
+
Rio IS
|
2
|
+
|
3
|
+
=== EASY
|
4
|
+
|
5
|
+
Anything that does I/O is a Rio:
|
6
|
+
|
7
|
+
File:
|
8
|
+
rio('aflile')
|
9
|
+
Directory:
|
10
|
+
rio('adir')
|
11
|
+
Web Page:
|
12
|
+
rio('http://ahost/adir/afile')
|
13
|
+
Any IO:
|
14
|
+
rio(any_io)
|
15
|
+
|
16
|
+
... much more
|
17
|
+
|
18
|
+
Makes common tasks easy
|
19
|
+
|
20
|
+
rio('afile') > rio('copy of afile')
|
21
|
+
rio('adir') > rio('copy of adir')
|
22
|
+
rio('gzipped_file.gz').gzip > rio('ungzipped_file')
|
23
|
+
chomped_lines = rio('afile').chomp[]
|
24
|
+
|
25
|
+
... much more
|
26
|
+
|
27
|
+
=== Powerful
|
28
|
+
|
29
|
+
rb_files= rio('adir').files['*.rb']
|
30
|
+
rb_files_including_those_in_subdirectories = rio('adir').all.files['*.rb']
|
31
|
+
first_ten_lines_chomped = rio('afile').chomp[0..9]
|
32
|
+
first_ten_lines_chomped_from_gzipped_file = rio('afile.gz').gzip.chomp[0..9]
|
33
|
+
first_ten_lines_chomped_from_gzipped_file_on_ftp_server = rio('ftp://ahost/afile.gz').gzip.chomp[0..9]
|
34
|
+
|
35
|
+
... much more
|
36
|
+
|
37
|
+
=== Consistent
|
38
|
+
|
39
|
+
To iterate, add a block:
|
40
|
+
rio('afile').lines(/regular_expression/) { |line| ... }
|
41
|
+
rio('adir').files('
|
42
|
+
To return an array, use a subscript:
|
43
|
+
rio('afile').lines[/regular_expression/]
|
44
|
+
To copy use the copy-operator:
|
45
|
+
rio('afile').lines(/regular_expression/) > rio('destination_file')
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
== Overview
|
54
|
+
|
55
|
+
Rio is a Ruby I/O convenience class wrapping much of the functionality
|
56
|
+
of IO, File and Dir. Rio also uses FileUtils, Tempfile, StringIO,
|
57
|
+
OpenURI, Net::FTP, Zlib, and CSV to provide similar functionality
|
58
|
+
using a simple consistent interface. In addition to forwarding the
|
59
|
+
interfaces provided by IO, File, and Dir to an appropriate object, Rio
|
60
|
+
provides a "grande" interface that allows many common application
|
61
|
+
level I/O and file-system tasks to be expressed succinctly.
|
62
|
+
|
63
|
+
== New
|
64
|
+
|
65
|
+
Enhanced support for FTP file-systems. All of Rio's most powerful
|
66
|
+
idioms are now supported seamlessly on FTP servers.
|
67
|
+
|
68
|
+
# copy a file from or to an FTP server
|
69
|
+
rio('ftp://ahost/adir/afile') > rio('localfile') # server -> local file
|
70
|
+
rio('ftp://ahost/adir/afile') < rio('localfile') # local file -> server
|
71
|
+
|
72
|
+
# copy an entire directory structure from or to an FTP server
|
73
|
+
rio('ftp://ahost/adir') > rio('localdir') # server -> local directory
|
74
|
+
rio('ftp://ahost/adir') < rio('localdir') # local directory -> server
|
75
|
+
|
76
|
+
All of Rio's grande selection and filtering options are available for
|
77
|
+
files and directories on FTP servers.
|
78
|
+
|
79
|
+
# create a gzipped copy of a web page on an ftp server
|
80
|
+
rio('ftp://ftphost/f.html.gz').gzip < rio('http://httphost/f.html')
|
81
|
+
|
82
|
+
# dump the first 10 lines of a gzipped log file on an FTP server to stdout
|
83
|
+
rio('ftp://ftphost/logfile.txt').lines(0...10) > ?-
|
84
|
+
|
85
|
+
# iterate through the entries of a directory on an FTP server
|
86
|
+
rio('ftp://ftphost/adir').entries { |entrio| ... }
|
87
|
+
|
88
|
+
# get an array of all .rb files on an ftp server
|
89
|
+
rb_files = rio('ftp://ftphost/').all.files['*.rb']
|
90
|
+
|
91
|
+
|
92
|
+
== SYNOPSIS
|
93
|
+
|
94
|
+
For the following assume:
|
95
|
+
astring = ""
|
96
|
+
anarray = []
|
97
|
+
|
98
|
+
Copy or append a file to a string
|
99
|
+
rio('afile') > astring # copy
|
100
|
+
rio('afile') >> astring # append
|
101
|
+
|
102
|
+
Copy or append a string to a file
|
103
|
+
rio('afile') < astring # copy
|
104
|
+
rio('afile') << astring # append
|
105
|
+
|
106
|
+
Copy or append the lines of a file to an array
|
107
|
+
rio('afile') > anarray
|
108
|
+
rio('afile') >> anarray
|
109
|
+
|
110
|
+
Copy or append a file to another file
|
111
|
+
rio('afile') > rio('another_file')
|
112
|
+
rio('afile') >> rio('another_file')
|
113
|
+
|
114
|
+
Copy a file to a directory
|
115
|
+
rio('adir') << rio('afile')
|
116
|
+
|
117
|
+
Copy a directory structure to another directory
|
118
|
+
rio('adir') >> rio('another_directory')
|
119
|
+
|
120
|
+
Copy a web-page to a file
|
121
|
+
rio('http://rubydoc.org/') > rio('afile')
|
122
|
+
|
123
|
+
Ways to get the chomped lines of a file into an array
|
124
|
+
anarray = rio('afile').chomp[] # subscript operator
|
125
|
+
rio('afile').chomp > anarray # copy-to operator
|
126
|
+
anarray = rio('afile').chomp.to_a # to_a
|
127
|
+
anarray = rio('afile').chomp.readlines # IO#readlines
|
128
|
+
|
129
|
+
Copy a gzipped file un-gzipping it
|
130
|
+
rio('afile.gz').gzip > rio('afile')
|
131
|
+
|
132
|
+
Copy a plain file, gzipping it
|
133
|
+
rio('afile.gz').gzip < rio('afile')
|
134
|
+
|
135
|
+
Copy a file from a ftp server into a local file un-gzipping it
|
136
|
+
rio('ftp://host/afile.gz').gzip > rio('afile')
|
137
|
+
|
138
|
+
Iterate over the entries in a directory
|
139
|
+
rio('adir').entries { |entrio| ... }
|
140
|
+
|
141
|
+
Iterate over only the files in a directory
|
142
|
+
rio('adir').files { |entrio| ... }
|
143
|
+
|
144
|
+
Iterate over only the .rb files in a directory
|
145
|
+
rio('adir').files('*.rb') { |entrio| ... }
|
146
|
+
|
147
|
+
Iterate over .rb files but not symlinks to .rb files
|
148
|
+
rio('adir').files('*.rb').skip(:symlink?) { |entrio| ... }
|
149
|
+
|
150
|
+
Iterate over only the _dot_ files in a directory
|
151
|
+
rio('adir').files(/^\./) { |entrio| ... }
|
152
|
+
|
153
|
+
Iterate over the files in a directory and its subdirectories, skipping
|
154
|
+
'.svn' and 'CVS' directories
|
155
|
+
|
156
|
+
rio('adir').norecurse(/^\.svn$/,'CVS').files { |entrio| ... }
|
157
|
+
|
158
|
+
Create an array of the .rb entries in a directory
|
159
|
+
anarray = rio('adir')['*.rb']
|
160
|
+
|
161
|
+
Create an array of the .rb entries in a directory and its
|
162
|
+
subdirectories.
|
163
|
+
anarray = rio('adir').all['*.rb']
|
164
|
+
|
165
|
+
Iterate over the .rb files in a directory and its subdirectories
|
166
|
+
rio('adir').all.files('*.rb') { |entrio| ... }
|
167
|
+
|
168
|
+
Iterate over the non-empty, non-comment chomped lines of a file
|
169
|
+
rio('afile').chomp.skip.lines(:empty?,/^\s*#/) { |line| ... }
|
170
|
+
|
171
|
+
Copy the output of th ps command into an array, skipping the header
|
172
|
+
line and the ps command entry
|
173
|
+
rio(?-,'ps -a').skip.lines(0,/ps$/) > anarray
|
174
|
+
|
175
|
+
Prompt for input and return what was typed
|
176
|
+
ans = rio(?-).print("Type Something: ").chomp.gets
|
177
|
+
|
178
|
+
Change the extension of all .htm files in a directory and its
|
179
|
+
subdirectories to .html
|
180
|
+
rio('adir').rename.all.files('*.htm') do |htmfile|
|
181
|
+
htmfile.extname = '.html'
|
182
|
+
end
|
183
|
+
|
184
|
+
Create a symbolic link 'asymlink' in 'adir' which refers to
|
185
|
+
'adir/afile'
|
186
|
+
rio('adir/afile').symlink('adir/asymlink')
|
187
|
+
|
188
|
+
Copy a CSV file, changing the separator to a semicolon
|
189
|
+
rio('comma.csv').csv > rio('semicolon.csv').csv(';')
|
190
|
+
|
191
|
+
Iterate through a CSVfile with each line parsed into an array
|
192
|
+
rio('afile.csv').csv { |array_of_fields| ...}
|
193
|
+
|
194
|
+
Create a tab separated file of accounts in a UNIX passwd file,
|
195
|
+
listing only the username, uid, and realname fields
|
196
|
+
rio('/etc/passwd').csv(':').columns(0,2,4) > rio('rpt').csv("\t")
|
197
|
+
|
198
|
+
Pipe multiple commands
|
199
|
+
rio('afile') | rio(?-,'acmd') | 'another_cmd' | ?-
|
200
|
+
|
201
|
+
== Contact
|
202
|
+
|
203
|
+
Project:: http://rubyforge.org/projects/rio/
|
204
|
+
Documentation:: http://rio.rubyforge.org/
|
205
|
+
Bugs:: http://rubyforge.org/tracker/?group_id=821
|
206
|
+
Email:: rio4ruby@rubyforge.org
|
207
|
+
|
208
|
+
== Copyright
|
209
|
+
Copyright (c) 2005,2006,2007 Christopher Kleckner. All rights reserved
|
210
|
+
|
211
|
+
== License
|
212
|
+
Rio is released under the GNU General Public License
|
213
|
+
(http://www.gnu.org/licenses/gpl.html)
|
214
|
+
|
215
|
+
-Christopher Kleckner
|