yax 0.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/yax-0.1/docs/classes/IO.html +251 -0
- data/yax-0.1/docs/classes/IO.src/M000003.html +46 -0
- data/yax-0.1/docs/classes/IO.src/M000004.html +27 -0
- data/yax-0.1/docs/classes/Module.html +156 -0
- data/yax-0.1/docs/classes/Module.src/M000002.html +23 -0
- data/yax-0.1/docs/classes/MultiIO.html +217 -0
- data/yax-0.1/docs/classes/MultiIO.src/M000006.html +18 -0
- data/yax-0.1/docs/classes/MultiIO.src/M000007.html +19 -0
- data/yax-0.1/docs/classes/MultiIO.src/M000008.html +20 -0
- data/yax-0.1/docs/classes/Numeric.html +155 -0
- data/yax-0.1/docs/classes/Numeric.src/M000005.html +16 -0
- data/yax-0.1/docs/classes/Regexp.html +153 -0
- data/yax-0.1/docs/classes/Regexp.src/M000001.html +16 -0
- data/yax-0.1/docs/classes/String.html +270 -0
- data/yax-0.1/docs/classes/String.src/M000009.html +18 -0
- data/yax-0.1/docs/classes/String.src/M000010.html +16 -0
- data/yax-0.1/docs/classes/String.src/M000011.html +22 -0
- data/yax-0.1/docs/classes/String.src/M000012.html +27 -0
- data/yax-0.1/docs/classes/String.src/M000013.html +21 -0
- data/yax-0.1/docs/classes/String.src/M000014.html +20 -0
- data/yax-0.1/docs/classes/Yax.html +256 -0
- data/yax-0.1/docs/classes/Yax.src/M000015.html +20 -0
- data/yax-0.1/docs/classes/Yax/Session.html +1661 -0
- data/yax-0.1/docs/classes/Yax/Session.src/M000016.html +20 -0
- data/yax-0.1/docs/classes/Yax/Session.src/M000017.html +18 -0
- data/yax-0.1/docs/classes/Yax/Session.src/M000018.html +19 -0
- data/yax-0.1/docs/classes/Yax/Session.src/M000019.html +19 -0
- data/yax-0.1/docs/classes/Yax/Session.src/M000020.html +19 -0
- data/yax-0.1/docs/classes/Yax/Session.src/M000021.html +46 -0
- data/yax-0.1/docs/classes/Yax/Session.src/M000022.html +19 -0
- data/yax-0.1/docs/classes/Yax/Session.src/M000023.html +18 -0
- data/yax-0.1/docs/classes/Yax/Session.src/M000024.html +20 -0
- data/yax-0.1/docs/classes/Yax/Session.src/M000025.html +18 -0
- data/yax-0.1/docs/classes/Yax/Session.src/M000026.html +19 -0
- data/yax-0.1/docs/classes/Yax/Session.src/M000027.html +20 -0
- data/yax-0.1/docs/classes/Yax/Session.src/M000028.html +18 -0
- data/yax-0.1/docs/classes/Yax/Session.src/M000029.html +18 -0
- data/yax-0.1/docs/classes/Yax/Session.src/M000030.html +19 -0
- data/yax-0.1/docs/classes/Yax/Session.src/M000031.html +25 -0
- data/yax-0.1/docs/classes/Yax/Session.src/M000032.html +18 -0
- data/yax-0.1/docs/classes/Yax/Session.src/M000033.html +36 -0
- data/yax-0.1/docs/classes/Yax/Session.src/M000034.html +34 -0
- data/yax-0.1/docs/classes/Yax/Session.src/M000035.html +23 -0
- data/yax-0.1/docs/classes/Yax/Session.src/M000036.html +20 -0
- data/yax-0.1/docs/classes/Yax/Session.src/M000037.html +32 -0
- data/yax-0.1/docs/classes/Yax/Session.src/M000038.html +20 -0
- data/yax-0.1/docs/classes/Yax/Session.src/M000042.html +18 -0
- data/yax-0.1/docs/classes/Yax/Session.src/M000043.html +18 -0
- data/yax-0.1/docs/classes/Yax/Session.src/M000044.html +20 -0
- data/yax-0.1/docs/classes/Yax/Session.src/M000046.html +37 -0
- data/yax-0.1/docs/classes/Yax/Session.src/M000047.html +29 -0
- data/yax-0.1/docs/classes/Yax/Session.src/M000048.html +29 -0
- data/yax-0.1/docs/classes/Yax/Session.src/M000049.html +30 -0
- data/yax-0.1/docs/classes/Yax/Session.src/M000050.html +22 -0
- data/yax-0.1/docs/classes/Yax/Session.src/M000051.html +20 -0
- data/yax-0.1/docs/classes/Yax/Session.src/M000052.html +20 -0
- data/yax-0.1/docs/classes/Yax/Session.src/M000053.html +19 -0
- data/yax-0.1/docs/classes/Yax/Session.src/M000054.html +28 -0
- data/yax-0.1/docs/classes/Yax/Session.src/M000055.html +21 -0
- data/yax-0.1/docs/classes/Yax/Session.src/M000056.html +27 -0
- data/yax-0.1/docs/classes/Yax/Session.src/M000057.html +20 -0
- data/yax-0.1/docs/classes/Yax/Session.src/M000058.html +22 -0
- data/yax-0.1/docs/classes/Yax/Session.src/M000059.html +21 -0
- data/yax-0.1/docs/classes/Yax/Session.src/M000060.html +21 -0
- data/yax-0.1/docs/classes/Yax/Session.src/M000061.html +20 -0
- data/yax-0.1/docs/classes/Yax/Session.src/M000062.html +21 -0
- data/yax-0.1/docs/classes/Yax/Session.src/M000063.html +20 -0
- data/yax-0.1/docs/classes/Yax/Session.src/M000064.html +21 -0
- data/yax-0.1/docs/classes/Yax/Session.src/M000065.html +26 -0
- data/yax-0.1/docs/classes/Yax/Session.src/M000066.html +25 -0
- data/yax-0.1/docs/classes/Yax/Session.src/M000067.html +29 -0
- data/yax-0.1/docs/classes/Yax/Session.src/M000068.html +26 -0
- data/yax-0.1/docs/classes/Yax/Session.src/M000069.html +19 -0
- data/yax-0.1/docs/classes/Yax/Session.src/M000070.html +31 -0
- data/yax-0.1/docs/classes/Yax/Session.src/M000071.html +25 -0
- data/yax-0.1/docs/created.rid +1 -0
- data/yax-0.1/docs/dot/f_0.dot +14 -0
- data/yax-0.1/docs/dot/f_0.png +0 -0
- data/yax-0.1/docs/dot/f_1.dot +14 -0
- data/yax-0.1/docs/dot/f_1.png +0 -0
- data/yax-0.1/docs/dot/f_2.dot +14 -0
- data/yax-0.1/docs/dot/f_2.png +0 -0
- data/yax-0.1/docs/dot/f_3.dot +93 -0
- data/yax-0.1/docs/dot/f_3.png +0 -0
- data/yax-0.1/docs/dot/m_3_0.dot +39 -0
- data/yax-0.1/docs/dot/m_3_0.png +0 -0
- data/yax-0.1/docs/files/License_txt.html +124 -0
- data/yax-0.1/docs/files/ReadMe_Amber_txt.html +489 -0
- data/yax-0.1/docs/files/ReadMe_txt.html +444 -0
- data/yax-0.1/docs/files/nist/yax_rb.html +138 -0
- data/yax-0.1/docs/fr_class_index.html +34 -0
- data/yax-0.1/docs/fr_file_index.html +30 -0
- data/yax-0.1/docs/fr_method_index.html +97 -0
- data/yax-0.1/docs/index.html +24 -0
- data/yax-0.1/docs/rdoc-style.css +208 -0
- data/yax-0.1/lib/nist/yax.rb +1367 -0
- data/yax-0.1/tests/test_yax.rb +190 -0
- metadata +195 -0
|
@@ -0,0 +1,444 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
2
|
+
<!DOCTYPE html
|
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
5
|
+
|
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
7
|
+
<head>
|
|
8
|
+
<title>File: ReadMe.txt</title>
|
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
|
11
|
+
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
|
12
|
+
<script type="text/javascript">
|
|
13
|
+
// <![CDATA[
|
|
14
|
+
|
|
15
|
+
function popupCode( url ) {
|
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function toggleCode( id ) {
|
|
20
|
+
if ( document.getElementById )
|
|
21
|
+
elem = document.getElementById( id );
|
|
22
|
+
else if ( document.all )
|
|
23
|
+
elem = eval( "document.all." + id );
|
|
24
|
+
else
|
|
25
|
+
return false;
|
|
26
|
+
|
|
27
|
+
elemStyle = elem.style;
|
|
28
|
+
|
|
29
|
+
if ( elemStyle.display != "block" ) {
|
|
30
|
+
elemStyle.display = "block"
|
|
31
|
+
} else {
|
|
32
|
+
elemStyle.display = "none"
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Make codeblocks hidden by default
|
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
|
40
|
+
|
|
41
|
+
// ]]>
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
</head>
|
|
45
|
+
<body>
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
<div id="fileHeader">
|
|
50
|
+
<h1>ReadMe.txt</h1>
|
|
51
|
+
<table class="header-table">
|
|
52
|
+
<tr class="top-aligned-row">
|
|
53
|
+
<td><strong>Path:</strong></td>
|
|
54
|
+
<td>ReadMe.txt
|
|
55
|
+
</td>
|
|
56
|
+
</tr>
|
|
57
|
+
<tr class="top-aligned-row">
|
|
58
|
+
<td><strong>Last Update:</strong></td>
|
|
59
|
+
<td>Sat Jan 14 21:45:26 EST 2006</td>
|
|
60
|
+
</tr>
|
|
61
|
+
</table>
|
|
62
|
+
</div>
|
|
63
|
+
<!-- banner header -->
|
|
64
|
+
|
|
65
|
+
<div id="bodyContent">
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
<div id="contextContent">
|
|
70
|
+
<div id="diagram">
|
|
71
|
+
<map id="map" name="map">
|
|
72
|
+
</map>
|
|
73
|
+
<img src="../dot/f_1.png" usemap="#map" border=0 alt="TopLevel">
|
|
74
|
+
</div>
|
|
75
|
+
|
|
76
|
+
<div id="description">
|
|
77
|
+
<h1><a href="../classes/Yax.html">Yax</a></h1>
|
|
78
|
+
<p>
|
|
79
|
+
<a href="../classes/Yax.html">Yax</a> stands for Yet Another eXpect. The
|
|
80
|
+
intention is to let you script interations with other programs: the name
|
|
81
|
+
could just as easily refer to the conversations between your script and
|
|
82
|
+
other programs. <a href="../classes/Yax.html">Yax</a> integrates well with
|
|
83
|
+
Ruby and Rake or Rant. <a href="../classes/Yax.html">Yax</a> was born out
|
|
84
|
+
of frustration with other solutions in this space. <a
|
|
85
|
+
href="../classes/Yax.html">Yax</a> has only been tested under OS X.
|
|
86
|
+
</p>
|
|
87
|
+
<h2>Status</h2>
|
|
88
|
+
<p>
|
|
89
|
+
<a href="../classes/Yax.html">Yax</a> is currently pre-release software,
|
|
90
|
+
which has not yet undergone internal reviews. Several developers use <a
|
|
91
|
+
href="../classes/Yax.html">Yax</a> to build the following software
|
|
92
|
+
components under OS X:
|
|
93
|
+
</p>
|
|
94
|
+
<ul>
|
|
95
|
+
<li>SoQt
|
|
96
|
+
|
|
97
|
+
</li>
|
|
98
|
+
<li>Fox 1.2
|
|
99
|
+
|
|
100
|
+
</li>
|
|
101
|
+
<li>FXScintilla
|
|
102
|
+
|
|
103
|
+
</li>
|
|
104
|
+
<li>wxWindows
|
|
105
|
+
|
|
106
|
+
</li>
|
|
107
|
+
<li>GLUI
|
|
108
|
+
|
|
109
|
+
</li>
|
|
110
|
+
<li>ARToolkit
|
|
111
|
+
|
|
112
|
+
</li>
|
|
113
|
+
<li>Coin
|
|
114
|
+
|
|
115
|
+
</li>
|
|
116
|
+
<li>libpng (with zlib)
|
|
117
|
+
|
|
118
|
+
</li>
|
|
119
|
+
<li>jpeg
|
|
120
|
+
|
|
121
|
+
</li>
|
|
122
|
+
<li>libtiff
|
|
123
|
+
|
|
124
|
+
</li>
|
|
125
|
+
<li>libwmf
|
|
126
|
+
|
|
127
|
+
</li>
|
|
128
|
+
<li>GD
|
|
129
|
+
|
|
130
|
+
</li>
|
|
131
|
+
<li>GraphicsMagic
|
|
132
|
+
|
|
133
|
+
</li>
|
|
134
|
+
<li>Swig
|
|
135
|
+
|
|
136
|
+
</li>
|
|
137
|
+
<li>Ruby OpenGL (James Adam’s tweak of Yoshiyuki Kusano’s code)
|
|
138
|
+
|
|
139
|
+
</li>
|
|
140
|
+
<li>rubyARToolkit
|
|
141
|
+
|
|
142
|
+
</li>
|
|
143
|
+
<li>rubyCoin
|
|
144
|
+
|
|
145
|
+
</li>
|
|
146
|
+
<li>qtRuby
|
|
147
|
+
|
|
148
|
+
</li>
|
|
149
|
+
<li>FXRuby
|
|
150
|
+
|
|
151
|
+
</li>
|
|
152
|
+
<li>rMagick
|
|
153
|
+
|
|
154
|
+
</li>
|
|
155
|
+
</ul>
|
|
156
|
+
<h2>Installation</h2>
|
|
157
|
+
<p>
|
|
158
|
+
<a href="../classes/Yax.html">Yax</a> can be downloaded in several forms:
|
|
159
|
+
</p>
|
|
160
|
+
<ul>
|
|
161
|
+
<li>A RubyGem, containing only <a href="../classes/Yax.html">Yax</a>. Due to
|
|
162
|
+
lack of resources, the RubyGem is untested.
|
|
163
|
+
|
|
164
|
+
</li>
|
|
165
|
+
<li>A development snapshot containing <a href="../classes/Yax.html">Yax</a> and
|
|
166
|
+
nearly everything it depends on, in a .tgz or .zip archive. The shapshot
|
|
167
|
+
contains a complete Amber development environment. Before using the
|
|
168
|
+
development snapshot, you need to:
|
|
169
|
+
|
|
170
|
+
<ol>
|
|
171
|
+
<li>Setup Amber (included in the snapshot): see <a
|
|
172
|
+
href="ReadMe_Amber_txt.html">ReadMe_Amber.txt</a>
|
|
173
|
+
|
|
174
|
+
</li>
|
|
175
|
+
<li>Install libraries required by <a href="../classes/Yax.html">Yax</a>:
|
|
176
|
+
|
|
177
|
+
<pre>
|
|
178
|
+
cd $DevRoot/Projects/yax
|
|
179
|
+
rake install_lib
|
|
180
|
+
</pre>
|
|
181
|
+
</li>
|
|
182
|
+
</ol>
|
|
183
|
+
</li>
|
|
184
|
+
</ul>
|
|
185
|
+
<h2>Use</h2>
|
|
186
|
+
<p>
|
|
187
|
+
Start out by creating a new Session, either by <a
|
|
188
|
+
href="../classes/Yax/Session.html#M000016">Yax::Session.spawn</a> (if the
|
|
189
|
+
default attributes are satisfactory) or by <a
|
|
190
|
+
href="../classes/Yax/Session.html#M000021">Yax::Session.new</a>, followed
|
|
191
|
+
by attribute adjustments, and then spawn sent to the Session instance. In
|
|
192
|
+
either case, you then send a series of <a
|
|
193
|
+
href="../classes/Yax/Session.html#M000044">Yax::Session#command</a>
|
|
194
|
+
messages. If these commands include a time limit, they will block until
|
|
195
|
+
completion. If a command does not include a time limit, you can follow it
|
|
196
|
+
up with one or more expect / respond pairs. After the last expect /
|
|
197
|
+
respond, you can either finish the command, or just issue another command
|
|
198
|
+
(the previous one will finish automatically). Once you are done with the
|
|
199
|
+
session, you can wait for it to finish, or explicity ask it to die.
|
|
200
|
+
</p>
|
|
201
|
+
<p>
|
|
202
|
+
An example interaction is shown below.
|
|
203
|
+
</p>
|
|
204
|
+
<h2>Extra Features</h2>
|
|
205
|
+
<p>
|
|
206
|
+
Time limits can be applied to operations that involve a response from the
|
|
207
|
+
spawned process. These limits can be expressed as numbers of seconds, or as
|
|
208
|
+
Strings in the form dd:hh:mm:ss. In either case the script should contain
|
|
209
|
+
actual measurements (which can come from an execution time log if
|
|
210
|
+
@time_log_path is specified). Adjustments for alternate operating
|
|
211
|
+
conditions can be made through the @timeout_multiplier and @timeout_offset
|
|
212
|
+
attributes.
|
|
213
|
+
</p>
|
|
214
|
+
<p>
|
|
215
|
+
<a href="../classes/Yax/Session.html">Yax::Session</a> attempts to
|
|
216
|
+
intelligently handle sudo. If @password_prompt is set and @password is not,
|
|
217
|
+
the first command will result in a request for the user’s password
|
|
218
|
+
for the password. Then every expect will include @password_prompt This
|
|
219
|
+
feature accomodates systems that authenticate only if some predetermined
|
|
220
|
+
time has elapsed since the last successful authentication. If you use this
|
|
221
|
+
feature, you should be careful with the transcripts, which are likely to
|
|
222
|
+
contain passwords.
|
|
223
|
+
</p>
|
|
224
|
+
<p>
|
|
225
|
+
<a href="../classes/Yax/Session.html">Yax::Session</a> includes convenience
|
|
226
|
+
methods for:
|
|
227
|
+
</p>
|
|
228
|
+
<ul>
|
|
229
|
+
<li>File operations (cd, rm, cp, mv, ln, mkdir, chmod and cmp)
|
|
230
|
+
|
|
231
|
+
</li>
|
|
232
|
+
<li>Downloading archives
|
|
233
|
+
|
|
234
|
+
</li>
|
|
235
|
+
<li>Unpacking archives
|
|
236
|
+
|
|
237
|
+
</li>
|
|
238
|
+
<li>Creating archives
|
|
239
|
+
|
|
240
|
+
</li>
|
|
241
|
+
<li>Using concise Symbols to represent long cumbersome urls and directory paths
|
|
242
|
+
|
|
243
|
+
</li>
|
|
244
|
+
<li>File content modification (useful for on-the-fly makefile or sourcecode
|
|
245
|
+
modifications)
|
|
246
|
+
|
|
247
|
+
</li>
|
|
248
|
+
<li>For environmental variable specification
|
|
249
|
+
|
|
250
|
+
</li>
|
|
251
|
+
</ul>
|
|
252
|
+
<p>
|
|
253
|
+
The <a href="../classes/Yax.html">Yax</a> module also provides conveninet
|
|
254
|
+
access to most features of a default instance of <a
|
|
255
|
+
href="../classes/Yax/Session.html">Yax::Session</a>.
|
|
256
|
+
</p>
|
|
257
|
+
<p>
|
|
258
|
+
You can log the session to a transcript (which can be anything that
|
|
259
|
+
responds to <<). Each line is prefixed by a character that explains
|
|
260
|
+
what the line means: see the @prefixes hash. The default prefixes are:
|
|
261
|
+
</p>
|
|
262
|
+
<pre>
|
|
263
|
+
[s>] Spawn a new shell
|
|
264
|
+
[c>] A command
|
|
265
|
+
[x>] One or more expected patterns or Strings
|
|
266
|
+
[i>] A response to an expected pattern or String
|
|
267
|
+
[o>] Output
|
|
268
|
+
[m>] Output that matches an expected pattern or String
|
|
269
|
+
[e>] Error output (some programs output innocuous information here
|
|
270
|
+
[n>] A note
|
|
271
|
+
[d>] Entering a directory
|
|
272
|
+
[f>] A file operation
|
|
273
|
+
</pre>
|
|
274
|
+
<h2>Example</h2>
|
|
275
|
+
<pre>
|
|
276
|
+
require 'nist/yax'
|
|
277
|
+
include Yax
|
|
278
|
+
|
|
279
|
+
# Prepare the default Yax::Session
|
|
280
|
+
def setup
|
|
281
|
+
$YAX=Yax::Session.new
|
|
282
|
+
yax.url_hash = {
|
|
283
|
+
:fox => 'http://www.fox-toolkit.org/ftp/fox-1.2.18.tar.gz',
|
|
284
|
+
:swig => 'http://easynews.dl.sourceforge.net/sourceforge/swig/swig-1.3.25.tar.gz',
|
|
285
|
+
:fxRuby => 'http://rubyforge.org/frs/download.php/4003/FXRuby-1.2.6.tar.gz',
|
|
286
|
+
:arToolKit => 'http://easynews.dl.sourceforge.net/sourceforge/artoolkit/ARToolKit-2.70.1.tgz'
|
|
287
|
+
}
|
|
288
|
+
yax.dir_overide = {
|
|
289
|
+
'ARToolKit-2.70.1' => 'ARToolKit'
|
|
290
|
+
}
|
|
291
|
+
yax.spawn
|
|
292
|
+
end
|
|
293
|
+
|
|
294
|
+
# Build the ARToolkit. This uses the alternative (non-XCode)
|
|
295
|
+
# instructions from README.txt, because they are better suited
|
|
296
|
+
# to automation.Defaults should be satisfactory for most
|
|
297
|
+
# relatively recent macs.
|
|
298
|
+
# GL_NV_texture_rectangle is supported on most NVidia graphics cards
|
|
299
|
+
# and on ATi Radeon and better graphics cards
|
|
300
|
+
def build_arToolKit(fastTextureMapping=true, textureRectangle=true)
|
|
301
|
+
banner 'Build ARToolKit'
|
|
302
|
+
untgz :arToolKit
|
|
303
|
+
cd :arToolKit
|
|
304
|
+
cmd './Configure'
|
|
305
|
+
# "Dose your Mac have fast texture mapping hardware? (y or n)"
|
|
306
|
+
expect "Enter :", '0:0:0:1'
|
|
307
|
+
snd( fastTextureMapping ? 'y' : 'n' )
|
|
308
|
+
# "Build gsub libraries with texture rectangle support? (y or n)"
|
|
309
|
+
expect "Enter :", '0:0:0:1'
|
|
310
|
+
snd( textureRectangle ? 'y' : 'n' )
|
|
311
|
+
finish '0:0:15:0'
|
|
312
|
+
cmd make, '0:1:0:0'
|
|
313
|
+
end
|
|
314
|
+
|
|
315
|
+
setup
|
|
316
|
+
build_arToolKit
|
|
317
|
+
</pre>
|
|
318
|
+
<h2>Caveats</h2>
|
|
319
|
+
<p>
|
|
320
|
+
If @password_prompt is non-nil (which lets you script commands that require
|
|
321
|
+
an administrative password) you will be prompted for a password. Curently
|
|
322
|
+
the password is echoed to the screen. If you save the transcript of the
|
|
323
|
+
session you should remove your password.
|
|
324
|
+
</p>
|
|
325
|
+
<p>
|
|
326
|
+
<a href="../classes/Yax.html">Yax</a> has only been tested spawning bash on
|
|
327
|
+
OS X (that’s why it was developed). I would like to hear from anyone
|
|
328
|
+
who has used it on another platform, or to script some other process.
|
|
329
|
+
</p>
|
|
330
|
+
<p>
|
|
331
|
+
To use <a href="../classes/Yax/Session.html#M000069">Yax::Session#curl</a>,
|
|
332
|
+
you must have curl installed. Get it from <a
|
|
333
|
+
href="http://curl.haxx.se">curl.haxx.se</a>
|
|
334
|
+
</p>
|
|
335
|
+
<h2>Implementation Notes</h2>
|
|
336
|
+
<p>
|
|
337
|
+
The stdout returned by PTY.spawn seems to behave oddly, at least under OS
|
|
338
|
+
X. The output from a given command may be delayed, and show up in a
|
|
339
|
+
subsequent command. To eliminate this problem I attempted to use popen3
|
|
340
|
+
instead. The popen3 stdout has its own problems:
|
|
341
|
+
</p>
|
|
342
|
+
<ul>
|
|
343
|
+
<li>IO.select raises an exception when fed this stdout This prevents the
|
|
344
|
+
standard Ruby implementation of expect (in expect.rb) from working.
|
|
345
|
+
|
|
346
|
+
</li>
|
|
347
|
+
<li>When I redefine expect without IO.select,
|
|
348
|
+
|
|
349
|
+
<ul>
|
|
350
|
+
<li>getc misses some characters.
|
|
351
|
+
|
|
352
|
+
</li>
|
|
353
|
+
<li>gets sometimes hangs.
|
|
354
|
+
|
|
355
|
+
</li>
|
|
356
|
+
</ul>
|
|
357
|
+
</li>
|
|
358
|
+
</ul>
|
|
359
|
+
<p>
|
|
360
|
+
To work around the problem with the PTY.spawn stdout, _flush() was added,
|
|
361
|
+
along with a few other tweaks controlled by pty_workaround. On platforms
|
|
362
|
+
other than OS X you might want to set pty_workaround to false.
|
|
363
|
+
</p>
|
|
364
|
+
<p>
|
|
365
|
+
The idea for redirecting error output to a file came from Ara T.
|
|
366
|
+
Howard’s Session (<a
|
|
367
|
+
href="http://www.codeforpeople.com/lib/ruby/session">www.codeforpeople.com/lib/ruby/session</a>/).
|
|
368
|
+
</p>
|
|
369
|
+
<h2>Potential improvements</h2>
|
|
370
|
+
<ul>
|
|
371
|
+
<li>Machine processable history in addition to transcript (for example, being
|
|
372
|
+
able to use result of ‘ls’ later in script) transcript is
|
|
373
|
+
useful for debugging interactions, but not for capturing results. (but see
|
|
374
|
+
next item).
|
|
375
|
+
|
|
376
|
+
</li>
|
|
377
|
+
<li>Expect can currently take multiple patterns, with different responses (and
|
|
378
|
+
subsequent expections) for each one. This allows for rather complicated
|
|
379
|
+
scripting, since the script is not be limited to linear interactions. It
|
|
380
|
+
would be good to have some simple way of structuring these interactions.
|
|
381
|
+
One way might be with SimpleMachine. Command output (and errors) would be
|
|
382
|
+
events. Expectations would be guards. The history would continue to be
|
|
383
|
+
linear, but it should additionally be mapped onto the machine structure so
|
|
384
|
+
that we can ask "What was the output from state Z" without
|
|
385
|
+
interpreting the linear history all over again.
|
|
386
|
+
|
|
387
|
+
</li>
|
|
388
|
+
<li>Could show error output in realtime (instead of after the expect). I think
|
|
389
|
+
I prefer to have all the errors at the end though.
|
|
390
|
+
|
|
391
|
+
</li>
|
|
392
|
+
<li>Allow operations without time limits? Currently passing a nil maxSeconds to
|
|
393
|
+
:command means "don’t block, we are going to
|
|
394
|
+
expect/respond". Need to pass in some thing else (zero? a Symbol?) to
|
|
395
|
+
tell it "block until finished". This would allow us to get rid of
|
|
396
|
+
cd_max_seconds, which would be more consistent with the other file
|
|
397
|
+
operations. On the other hand, in practice everything has a time limit.
|
|
398
|
+
|
|
399
|
+
</li>
|
|
400
|
+
<li>Password should not be echoed
|
|
401
|
+
|
|
402
|
+
</li>
|
|
403
|
+
<li>Replace dump with something that escapes non-printables, but does not put
|
|
404
|
+
quotes around strings (in irb ‘foo’.dump returns
|
|
405
|
+
\"foo\"
|
|
406
|
+
|
|
407
|
+
</li>
|
|
408
|
+
</ul>
|
|
409
|
+
<p>
|
|
410
|
+
Author: A. Griesser
|
|
411
|
+
</p>
|
|
412
|
+
|
|
413
|
+
</div>
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+
</div>
|
|
417
|
+
|
|
418
|
+
|
|
419
|
+
</div>
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
<!-- if includes -->
|
|
423
|
+
|
|
424
|
+
<div id="section">
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
|
|
428
|
+
|
|
429
|
+
|
|
430
|
+
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
<!-- if method_list -->
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
</div>
|
|
437
|
+
|
|
438
|
+
|
|
439
|
+
<div id="validator-badges">
|
|
440
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
|
441
|
+
</div>
|
|
442
|
+
|
|
443
|
+
</body>
|
|
444
|
+
</html>
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
2
|
+
<!DOCTYPE html
|
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
5
|
+
|
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
7
|
+
<head>
|
|
8
|
+
<title>File: yax.rb</title>
|
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
|
11
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
|
12
|
+
<script type="text/javascript">
|
|
13
|
+
// <![CDATA[
|
|
14
|
+
|
|
15
|
+
function popupCode( url ) {
|
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function toggleCode( id ) {
|
|
20
|
+
if ( document.getElementById )
|
|
21
|
+
elem = document.getElementById( id );
|
|
22
|
+
else if ( document.all )
|
|
23
|
+
elem = eval( "document.all." + id );
|
|
24
|
+
else
|
|
25
|
+
return false;
|
|
26
|
+
|
|
27
|
+
elemStyle = elem.style;
|
|
28
|
+
|
|
29
|
+
if ( elemStyle.display != "block" ) {
|
|
30
|
+
elemStyle.display = "block"
|
|
31
|
+
} else {
|
|
32
|
+
elemStyle.display = "none"
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Make codeblocks hidden by default
|
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
|
40
|
+
|
|
41
|
+
// ]]>
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
</head>
|
|
45
|
+
<body>
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
<div id="fileHeader">
|
|
50
|
+
<h1>yax.rb</h1>
|
|
51
|
+
<table class="header-table">
|
|
52
|
+
<tr class="top-aligned-row">
|
|
53
|
+
<td><strong>Path:</strong></td>
|
|
54
|
+
<td>nist/yax.rb
|
|
55
|
+
</td>
|
|
56
|
+
</tr>
|
|
57
|
+
<tr class="top-aligned-row">
|
|
58
|
+
<td><strong>Last Update:</strong></td>
|
|
59
|
+
<td>Sat Jan 14 21:45:26 EST 2006</td>
|
|
60
|
+
</tr>
|
|
61
|
+
</table>
|
|
62
|
+
</div>
|
|
63
|
+
<!-- banner header -->
|
|
64
|
+
|
|
65
|
+
<div id="bodyContent">
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
<div id="contextContent">
|
|
70
|
+
<div id="diagram">
|
|
71
|
+
<map id="map" name="map">
|
|
72
|
+
<area shape="RECT" coords="29,52,101,100" href="../../classes/Yax/Session.html" alt="Session">
|
|
73
|
+
<area shape="RECT" coords="152,52,224,100" href="../../classes/Regexp.html" alt="Regexp">
|
|
74
|
+
<area shape="RECT" coords="248,52,320,100" href="../../classes/Module.html" alt="Module">
|
|
75
|
+
<area shape="RECT" coords="344,52,416,100" href="../../classes/IO.html" alt="IO">
|
|
76
|
+
<area shape="RECT" coords="440,52,512,100" href="../../classes/Numeric.html" alt="Numeric">
|
|
77
|
+
<area shape="RECT" coords="536,52,608,100" href="../../classes/MultiIO.html" alt="MultiIO">
|
|
78
|
+
<area shape="RECT" coords="632,52,704,100" href="../../classes/String.html" alt="String">
|
|
79
|
+
<area shape="RECT" coords="18,18,138,110" href="../../classes/Yax.html" alt="Yax">
|
|
80
|
+
</map>
|
|
81
|
+
<img src="../../dot/f_3.png" usemap="#map" border=0 alt="TopLevel">
|
|
82
|
+
</div>
|
|
83
|
+
|
|
84
|
+
<div id="description">
|
|
85
|
+
<p>
|
|
86
|
+
For an overview of use, features, and an example, see <a
|
|
87
|
+
href="../ReadMe_txt.html">ReadMe.txt</a>.
|
|
88
|
+
</p>
|
|
89
|
+
<p>
|
|
90
|
+
Author: A. Griesser
|
|
91
|
+
</p>
|
|
92
|
+
|
|
93
|
+
</div>
|
|
94
|
+
|
|
95
|
+
<div id="requires-list">
|
|
96
|
+
<h3 class="section-bar">Required files</h3>
|
|
97
|
+
|
|
98
|
+
<div class="name-list">
|
|
99
|
+
pty
|
|
100
|
+
open3
|
|
101
|
+
stringio
|
|
102
|
+
timeout
|
|
103
|
+
fileutils
|
|
104
|
+
nist/common/sequentialHash
|
|
105
|
+
nist/common/singletonReflection
|
|
106
|
+
nist/common/rubyToolsDay
|
|
107
|
+
</div>
|
|
108
|
+
</div>
|
|
109
|
+
|
|
110
|
+
</div>
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
</div>
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
<!-- if includes -->
|
|
117
|
+
|
|
118
|
+
<div id="section">
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
<!-- if method_list -->
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
</div>
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
<div id="validator-badges">
|
|
134
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
|
135
|
+
</div>
|
|
136
|
+
|
|
137
|
+
</body>
|
|
138
|
+
</html>
|