sprout 1.1.11.pre → 1.1.13.pre
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of sprout might be problematic. Click here for more details.
- data/Gemfile.lock +3 -4
- data/VERSION +1 -1
- data/doc/Dir.html +288 -0
- data/doc/Rake/Task.html +184 -0
- data/doc/Sprout.html +740 -0
- data/doc/Sprout/ArchiveUnpacker.html +1246 -0
- data/doc/Sprout/CommandLine.html +520 -0
- data/doc/Sprout/Concern.html +351 -0
- data/doc/Sprout/Errors.html +101 -0
- data/doc/Sprout/Errors/ArchiveUnpackerError.html +125 -0
- data/doc/Sprout/Errors/DestinationExistsError.html +133 -0
- data/doc/Sprout/Errors/DuplicateMemberError.html +132 -0
- data/doc/Sprout/Errors/ExecutableError.html +125 -0
- data/doc/Sprout/Errors/ExecutableRegistrationError.html +132 -0
- data/doc/Sprout/Errors/ExecutionError.html +121 -0
- data/doc/Sprout/Errors/GeneratorError.html +125 -0
- data/doc/Sprout/Errors/InvalidArgumentError.html +132 -0
- data/doc/Sprout/Errors/LoadError.html +121 -0
- data/doc/Sprout/Errors/MissingArgumentError.html +132 -0
- data/doc/Sprout/Errors/MissingExecutableError.html +132 -0
- data/doc/Sprout/Errors/MissingGeneratorError.html +132 -0
- data/doc/Sprout/Errors/MissingTemplateError.html +132 -0
- data/doc/Sprout/Errors/ProcessRunnerError.html +121 -0
- data/doc/Sprout/Errors/RemoteFileLoaderError.html +110 -0
- data/doc/Sprout/Errors/SproutError.html +114 -0
- data/doc/Sprout/Errors/UnknownArchiveType.html +122 -0
- data/doc/Sprout/Errors/UsageError.html +121 -0
- data/doc/Sprout/Errors/ValidationError.html +121 -0
- data/doc/Sprout/Errors/VersionRequirementNotMetError.html +121 -0
- data/doc/Sprout/Executable.html +169 -0
- data/doc/Sprout/Executable/Base.html +2813 -0
- data/doc/Sprout/Executable/Boolean.html +534 -0
- data/doc/Sprout/Executable/CollectionParam.html +483 -0
- data/doc/Sprout/Executable/FileParam.html +484 -0
- data/doc/Sprout/Executable/Files.html +292 -0
- data/doc/Sprout/Executable/Number.html +141 -0
- data/doc/Sprout/Executable/Param.html +2874 -0
- data/doc/Sprout/Executable/ParameterFactory.html +232 -0
- data/doc/Sprout/Executable/Path.html +223 -0
- data/doc/Sprout/Executable/Paths.html +253 -0
- data/doc/Sprout/Executable/Session.html +1513 -0
- data/doc/Sprout/Executable/StringParam.html +213 -0
- data/doc/Sprout/Executable/Strings.html +167 -0
- data/doc/Sprout/Executable/Url.html +160 -0
- data/doc/Sprout/Executable/Urls.html +170 -0
- data/doc/Sprout/FileTarget.html +1109 -0
- data/doc/Sprout/Generator.html +750 -0
- data/doc/Sprout/Generator/Base.html +1902 -0
- data/doc/Sprout/Generator/Command.html +690 -0
- data/doc/Sprout/Generator/DirectoryManifest.html +476 -0
- data/doc/Sprout/Generator/FileManifest.html +643 -0
- data/doc/Sprout/Generator/Manifest.html +377 -0
- data/doc/Sprout/Generator/TemplateManifest.html +194 -0
- data/doc/Sprout/GeneratorGenerator.html +1115 -0
- data/doc/Sprout/Library.html +1146 -0
- data/doc/Sprout/LibraryGenerator.html +331 -0
- data/doc/Sprout/OutputBuffer.html +445 -0
- data/doc/Sprout/Platform.html +714 -0
- data/doc/Sprout/ProcessRunner.html +1707 -0
- data/doc/Sprout/ProgressBar.html +366 -0
- data/doc/Sprout/ProgressBarImpl.html +2109 -0
- data/doc/Sprout/ProgressBarManager.html +424 -0
- data/doc/Sprout/ProgressBarOutputStream.html +406 -0
- data/doc/Sprout/RDocParser.html +211 -0
- data/doc/Sprout/RemoteFileLoader.html +172 -0
- data/doc/Sprout/RemoteFileTarget.html +679 -0
- data/doc/Sprout/ReversedProgressBar.html +184 -0
- data/doc/Sprout/RubyFeature.html +155 -0
- data/doc/Sprout/RubyFeature/ClassMethods.html +1065 -0
- data/doc/Sprout/RubyGenerator.html +786 -0
- data/doc/Sprout/Specification.html +767 -0
- data/doc/Sprout/System.html +191 -0
- data/doc/Sprout/System/BaseSystem.html +1660 -0
- data/doc/Sprout/System/JavaSystem.html +122 -0
- data/doc/Sprout/System/OSXSystem.html +335 -0
- data/doc/Sprout/System/ThreadMock.html +183 -0
- data/doc/Sprout/System/UnixSystem.html +584 -0
- data/doc/Sprout/System/VistaSystem.html +251 -0
- data/doc/Sprout/System/WinNixSystem.html +325 -0
- data/doc/Sprout/System/WinSystem.html +571 -0
- data/doc/Sprout/TestHelper.html +2165 -0
- data/doc/Sprout/ToolGenerator.html +953 -0
- data/doc/Sprout/VERSION.html +118 -0
- data/doc/String.html +290 -0
- data/doc/_index.html +820 -0
- data/doc/class_list.html +36 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +53 -0
- data/doc/css/style.css +310 -0
- data/doc/file.README.html +96 -0
- data/doc/file_list.html +41 -0
- data/doc/frames.html +13 -0
- data/doc/index.html +96 -0
- data/doc/js/app.js +202 -0
- data/doc/js/full_list.js +149 -0
- data/doc/js/jquery.js +154 -0
- data/doc/method_list.html +3603 -0
- data/doc/top-level-namespace.html +192 -0
- data/lib/sprout.rb +1 -0
- data/lib/sprout/executable/base.rb +2 -5
- data/lib/sprout/executable/param.rb +15 -8
- data/lib/sprout/executable/session.rb +1 -1
- data/lib/sprout/library.rb +44 -2
- data/test/unit/executable_test.rb +3 -5
- metadata +99 -3
@@ -0,0 +1,253 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta name="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>Class: Sprout::Executable::Paths</title>
|
7
|
+
<link rel="stylesheet" href="../../css/style.css" type="text/css" media="screen" charset="utf-8" />
|
8
|
+
<link rel="stylesheet" href="../../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
9
|
+
|
10
|
+
<script type="text/javascript" charset="utf-8">
|
11
|
+
relpath = '../..';
|
12
|
+
if (relpath != '') relpath += '/';
|
13
|
+
</script>
|
14
|
+
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
|
15
|
+
<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
|
16
|
+
|
17
|
+
</head>
|
18
|
+
<body>
|
19
|
+
<script type="text/javascript" charset="utf-8">
|
20
|
+
if (window.top.frames.main) document.body.className = 'frames';
|
21
|
+
</script>
|
22
|
+
|
23
|
+
<div id="header">
|
24
|
+
<div id="menu">
|
25
|
+
|
26
|
+
<a href="../../_index.html">Index (P)</a> »
|
27
|
+
<span class='title'><span class='object_link'><a href="../../Sprout.html" title="Sprout (module)">Sprout</a></span></span> » <span class='title'><span class='object_link'><a href="../Executable.html" title="Sprout::Executable (module)">Executable</a></span></span>
|
28
|
+
»
|
29
|
+
<span class="title">Paths</span>
|
30
|
+
|
31
|
+
|
32
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="search">
|
36
|
+
<a id="class_list_link" href="#">Class List</a>
|
37
|
+
<a id="method_list_link" href="#">Method List</a>
|
38
|
+
<a id ="file_list_link" href="#">File List</a>
|
39
|
+
</div>
|
40
|
+
|
41
|
+
<div class="clear"></div>
|
42
|
+
</div>
|
43
|
+
|
44
|
+
<iframe id="search_frame"></iframe>
|
45
|
+
|
46
|
+
<div id="content"><h1>Class: Sprout::Executable::Paths
|
47
|
+
|
48
|
+
|
49
|
+
|
50
|
+
</h1>
|
51
|
+
|
52
|
+
<dl class="box">
|
53
|
+
|
54
|
+
<dt class="r1">Inherits:</dt>
|
55
|
+
<dd class="r1">
|
56
|
+
<span class="inheritName"><span class='object_link'><a href="Files.html" title="Sprout::Executable::Files (class)">Files</a></span></span>
|
57
|
+
|
58
|
+
<ul class="fullTree">
|
59
|
+
<li>Object</li>
|
60
|
+
|
61
|
+
<li class="next"><span class='object_link'><a href="Param.html" title="Sprout::Executable::Param (class)">Param</a></span></li>
|
62
|
+
|
63
|
+
<li class="next"><span class='object_link'><a href="Files.html" title="Sprout::Executable::Files (class)">Files</a></span></li>
|
64
|
+
|
65
|
+
<li class="next">Sprout::Executable::Paths</li>
|
66
|
+
|
67
|
+
</ul>
|
68
|
+
<a href="#" class="inheritanceTree">show all</a>
|
69
|
+
|
70
|
+
</dd>
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
<dt class="r2 last">Defined in:</dt>
|
81
|
+
<dd class="r2 last">lib/sprout/executable/paths.rb</dd>
|
82
|
+
|
83
|
+
</dl>
|
84
|
+
<div class="clear"></div>
|
85
|
+
|
86
|
+
<h2>Overview</h2><div class="docstring">
|
87
|
+
<div class="discussion">
|
88
|
+
|
89
|
+
<p>A collection of Paths.</p>
|
90
|
+
|
91
|
+
|
92
|
+
</div>
|
93
|
+
</div>
|
94
|
+
<div class="tags">
|
95
|
+
|
96
|
+
<h3>See Also:</h3>
|
97
|
+
<ul class="see">
|
98
|
+
|
99
|
+
<li><span class='object_link'><a href="Path.html" title="Sprout::Executable::Path (class)">Path</a></span></li>
|
100
|
+
|
101
|
+
<li><span class='object_link'><a href="Param.html" title="Sprout::Executable::Param (class)">Param</a></span></li>
|
102
|
+
|
103
|
+
<li><span class='object_link'><a href="CollectionParam.html" title="Sprout::Executable::CollectionParam (module)">CollectionParam</a></span></li>
|
104
|
+
|
105
|
+
</ul>
|
106
|
+
|
107
|
+
</div>
|
108
|
+
<h2>Constant Summary</h2>
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
<h3 class="inherited">Constants inherited from <span class='object_link'><a href="Param.html" title="Sprout::Executable::Param (class)">Param</a></span></h3>
|
125
|
+
<p class="inherited"><span class='object_link'><a href="Param.html#DEFAULT_DELIMITER-constant" title="Sprout::Executable::Param::DEFAULT_DELIMITER (constant)">DEFAULT_DELIMITER</a></span>, <span class='object_link'><a href="Param.html#DEFAULT_OPTION_PARSER_TYPE_NAME-constant" title="Sprout::Executable::Param::DEFAULT_OPTION_PARSER_TYPE_NAME (constant)">DEFAULT_OPTION_PARSER_TYPE_NAME</a></span>, <span class='object_link'><a href="Param.html#DEFAULT_PREFIX-constant" title="Sprout::Executable::Param::DEFAULT_PREFIX (constant)">DEFAULT_PREFIX</a></span>, <span class='object_link'><a href="Param.html#DEFAULT_SHORT_PREFIX-constant" title="Sprout::Executable::Param::DEFAULT_SHORT_PREFIX (constant)">DEFAULT_SHORT_PREFIX</a></span></p>
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
<h2>
|
130
|
+
Instance Method Summary
|
131
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
132
|
+
</h2>
|
133
|
+
|
134
|
+
<ul class="summary">
|
135
|
+
|
136
|
+
<li class="public ">
|
137
|
+
<span class="summary_signature">
|
138
|
+
|
139
|
+
<a href="#prepare_prerequisites-instance_method" title="#prepare_prerequisites (instance method)">- (Object) <strong>prepare_prerequisites</strong> </a>
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
</span>
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
153
|
+
|
154
|
+
</li>
|
155
|
+
|
156
|
+
|
157
|
+
</ul>
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
<h3 class="inherited">Methods inherited from <span class='object_link'><a href="Files.html" title="Sprout::Executable::Files (class)">Files</a></span></h3>
|
169
|
+
<p class="inherited"><span class='object_link'><a href="Files.html#to_shell_value-instance_method" title="Sprout::Executable::Files#to_shell_value (method)">#to_shell_value</a></span></p>
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
<h3 class="inherited">Methods included from <span class='object_link'><a href="CollectionParam.html" title="Sprout::Executable::CollectionParam (module)">CollectionParam</a></span></h3>
|
179
|
+
<p class="inherited"><span class='object_link'><a href="CollectionParam.html#initialize-instance_method" title="Sprout::Executable::CollectionParam#initialize (method)">#initialize</a></span>, <span class='object_link'><a href="CollectionParam.html#to_shell-instance_method" title="Sprout::Executable::CollectionParam#to_shell (method)">#to_shell</a></span>, <span class='object_link'><a href="CollectionParam.html#to_shell_value-instance_method" title="Sprout::Executable::CollectionParam#to_shell_value (method)">#to_shell_value</a></span>, <span class='object_link'><a href="CollectionParam.html#value%3D-instance_method" title="Sprout::Executable::CollectionParam#value= (method)">#value=</a></span>, <span class='object_link'><a href="CollectionParam.html#visible%3F-instance_method" title="Sprout::Executable::CollectionParam#visible? (method)">#visible?</a></span></p>
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
<h3 class="inherited">Methods inherited from <span class='object_link'><a href="Param.html" title="Sprout::Executable::Param (class)">Param</a></span></h3>
|
189
|
+
<p class="inherited"><span class='object_link'><a href="Param.html#clean_path-instance_method" title="Sprout::Executable::Param#clean_path (method)">#clean_path</a></span>, <span class='object_link'><a href="Param.html#default-instance_method" title="Sprout::Executable::Param#default (method)">#default</a></span>, <span class='object_link'><a href="Param.html#default%3D-instance_method" title="Sprout::Executable::Param#default= (method)">#default=</a></span>, <span class='object_link'><a href="Param.html#default_option_parser_declaration-instance_method" title="Sprout::Executable::Param#default_option_parser_declaration (method)">#default_option_parser_declaration</a></span>, <span class='object_link'><a href="Param.html#file_is_output%3F-instance_method" title="Sprout::Executable::Param#file_is_output? (method)">#file_is_output?</a></span>, <span class='object_link'><a href="Param.html#hidden_name%3F-instance_method" title="Sprout::Executable::Param#hidden_name? (method)">#hidden_name?</a></span>, <span class='object_link'><a href="Param.html#hidden_value%3F-instance_method" title="Sprout::Executable::Param#hidden_value? (method)">#hidden_value?</a></span>, <span class='object_link'><a href="Param.html#initialize-instance_method" title="Sprout::Executable::Param#initialize (method)">#initialize</a></span>, <span class='object_link'><a href="Param.html#option_parser_declaration-instance_method" title="Sprout::Executable::Param#option_parser_declaration (method)">#option_parser_declaration</a></span>, <span class='object_link'><a href="Param.html#option_parser_name-instance_method" title="Sprout::Executable::Param#option_parser_name (method)">#option_parser_name</a></span>, <span class='object_link'><a href="Param.html#option_parser_short_name-instance_method" title="Sprout::Executable::Param#option_parser_short_name (method)">#option_parser_short_name</a></span>, <span class='object_link'><a href="Param.html#option_parser_type_name-instance_method" title="Sprout::Executable::Param#option_parser_type_name (method)">#option_parser_type_name</a></span>, <span class='object_link'><a href="Param.html#option_parser_type_output-instance_method" title="Sprout::Executable::Param#option_parser_type_output (method)">#option_parser_type_output</a></span>, <span class='object_link'><a href="Param.html#prepare-instance_method" title="Sprout::Executable::Param#prepare (method)">#prepare</a></span>, <span class='object_link'><a href="Param.html#prepared%3F-instance_method" title="Sprout::Executable::Param#prepared? (method)">#prepared?</a></span>, <span class='object_link'><a href="Param.html#required%3F-instance_method" title="Sprout::Executable::Param#required? (method)">#required?</a></span>, <span class='object_link'><a href="Param.html#shell_value-instance_method" title="Sprout::Executable::Param#shell_value (method)">#shell_value</a></span>, <span class='object_link'><a href="Param.html#short_prefix-instance_method" title="Sprout::Executable::Param#short_prefix (method)">#short_prefix</a></span>, <span class='object_link'><a href="Param.html#to_rdoc-instance_method" title="Sprout::Executable::Param#to_rdoc (method)">#to_rdoc</a></span>, <span class='object_link'><a href="Param.html#to_shell-instance_method" title="Sprout::Executable::Param#to_shell (method)">#to_shell</a></span>, <span class='object_link'><a href="Param.html#validate-instance_method" title="Sprout::Executable::Param#validate (method)">#validate</a></span>, <span class='object_link'><a href="Param.html#visible%3F-instance_method" title="Sprout::Executable::Param#visible? (method)">#visible?</a></span></p>
|
190
|
+
<div id="constructor_details" class="method_details_list">
|
191
|
+
<h2>Constructor Details</h2>
|
192
|
+
|
193
|
+
<p class="notice">This class inherits a constructor from <span class='object_link'><a href="CollectionParam.html#initialize-instance_method" title="Sprout::Executable::CollectionParam#initialize (method)">Sprout::Executable::CollectionParam</a></span></p>
|
194
|
+
|
195
|
+
</div>
|
196
|
+
|
197
|
+
|
198
|
+
<div id="instance_method_details" class="method_details_list">
|
199
|
+
<h2>Instance Method Details</h2>
|
200
|
+
|
201
|
+
|
202
|
+
<div class="method_details first">
|
203
|
+
<p class="signature first" id="prepare_prerequisites-instance_method">
|
204
|
+
|
205
|
+
- (<tt>Object</tt>) <strong>prepare_prerequisites</strong>
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
</p><table class="source_code">
|
210
|
+
<tr>
|
211
|
+
<td>
|
212
|
+
<pre class="lines">
|
213
|
+
|
214
|
+
|
215
|
+
14
|
216
|
+
15
|
217
|
+
16
|
218
|
+
17
|
219
|
+
18
|
220
|
+
19
|
221
|
+
20
|
222
|
+
21
|
223
|
+
22</pre>
|
224
|
+
</td>
|
225
|
+
<td>
|
226
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/executable/paths.rb', line 14</span>
|
227
|
+
|
228
|
+
<span class='kw'>def</span> <span class='id prepare_prerequisites'>prepare_prerequisites</span>
|
229
|
+
<span class='id value'>value</span><span class='period'>.</span><span class='id each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id path'>path</span><span class='op'>|</span>
|
230
|
+
<span class='id files'>files</span> <span class='op'>=</span> <span class='const'>FileList</span><span class='lbracket'>[</span><span class='id path'>path</span> <span class='op'>+</span> <span class='id file_expression'>file_expression</span><span class='rbracket'>]</span>
|
231
|
+
<span class='id files'>files</span><span class='period'>.</span><span class='id each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id f'>f</span><span class='op'>|</span>
|
232
|
+
<span class='id file'>file</span> <span class='id f'>f</span>
|
233
|
+
<span class='id belongs_to'>belongs_to</span><span class='period'>.</span><span class='id prerequisites'>prerequisites</span> <span class='op'><<</span> <span class='id f'>f</span>
|
234
|
+
<span class='kw'>end</span>
|
235
|
+
<span class='kw'>end</span>
|
236
|
+
<span class='kw'>end</span></pre>
|
237
|
+
</td>
|
238
|
+
</tr>
|
239
|
+
</table>
|
240
|
+
</div>
|
241
|
+
|
242
|
+
</div>
|
243
|
+
|
244
|
+
</div>
|
245
|
+
|
246
|
+
<div id="footer">
|
247
|
+
Generated on Fri Apr 29 18:33:07 2011 by
|
248
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
249
|
+
0.6.3 (ruby-1.9.2).
|
250
|
+
</div>
|
251
|
+
|
252
|
+
</body>
|
253
|
+
</html>
|
@@ -0,0 +1,1513 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta name="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>Class: Sprout::Executable::Session</title>
|
7
|
+
<link rel="stylesheet" href="../../css/style.css" type="text/css" media="screen" charset="utf-8" />
|
8
|
+
<link rel="stylesheet" href="../../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
9
|
+
|
10
|
+
<script type="text/javascript" charset="utf-8">
|
11
|
+
relpath = '../..';
|
12
|
+
if (relpath != '') relpath += '/';
|
13
|
+
</script>
|
14
|
+
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
|
15
|
+
<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
|
16
|
+
|
17
|
+
</head>
|
18
|
+
<body>
|
19
|
+
<script type="text/javascript" charset="utf-8">
|
20
|
+
if (window.top.frames.main) document.body.className = 'frames';
|
21
|
+
</script>
|
22
|
+
|
23
|
+
<div id="header">
|
24
|
+
<div id="menu">
|
25
|
+
|
26
|
+
<a href="../../_index.html">Index (S)</a> »
|
27
|
+
<span class='title'><span class='object_link'><a href="../../Sprout.html" title="Sprout (module)">Sprout</a></span></span> » <span class='title'><span class='object_link'><a href="../Executable.html" title="Sprout::Executable (module)">Executable</a></span></span>
|
28
|
+
»
|
29
|
+
<span class="title">Session</span>
|
30
|
+
|
31
|
+
|
32
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="search">
|
36
|
+
<a id="class_list_link" href="#">Class List</a>
|
37
|
+
<a id="method_list_link" href="#">Method List</a>
|
38
|
+
<a id ="file_list_link" href="#">File List</a>
|
39
|
+
</div>
|
40
|
+
|
41
|
+
<div class="clear"></div>
|
42
|
+
</div>
|
43
|
+
|
44
|
+
<iframe id="search_frame"></iframe>
|
45
|
+
|
46
|
+
<div id="content"><h1>Class: Sprout::Executable::Session
|
47
|
+
|
48
|
+
|
49
|
+
|
50
|
+
</h1>
|
51
|
+
|
52
|
+
<dl class="box">
|
53
|
+
|
54
|
+
<dt class="r1">Inherits:</dt>
|
55
|
+
<dd class="r1">
|
56
|
+
<span class="inheritName"><span class='object_link'><a href="Base.html" title="Sprout::Executable::Base (class)">Base</a></span></span>
|
57
|
+
|
58
|
+
<ul class="fullTree">
|
59
|
+
<li>Object</li>
|
60
|
+
|
61
|
+
<li class="next"><span class='object_link'><a href="Base.html" title="Sprout::Executable::Base (class)">Base</a></span></li>
|
62
|
+
|
63
|
+
<li class="next">Sprout::Executable::Session</li>
|
64
|
+
|
65
|
+
</ul>
|
66
|
+
<a href="#" class="inheritanceTree">show all</a>
|
67
|
+
|
68
|
+
</dd>
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
<dt class="r2 last">Defined in:</dt>
|
79
|
+
<dd class="r2 last">lib/sprout/executable/session.rb</dd>
|
80
|
+
|
81
|
+
</dl>
|
82
|
+
<div class="clear"></div>
|
83
|
+
|
84
|
+
<h2>Overview</h2><div class="docstring">
|
85
|
+
<div class="discussion">
|
86
|
+
|
87
|
+
<p>The Sprout::Daemon class exposes the Domain Specific Language provided by
|
88
|
+
the Sprout::Executable, along with enhancements (and modifications) to
|
89
|
+
support long-lived processes (like FDB and FCSH).</p>
|
90
|
+
|
91
|
+
<pre class="code"><span class='comment'>##
|
92
|
+
</span><span class='comment'># The Foo class extends Sprout::Daemon
|
93
|
+
</span><span class='kw'>class</span> <span class='const'>Foo</span> <span class='op'><</span> <span class='const'>Sprout</span><span class='op'>::</span><span class='const'>Daemon</span>
|
94
|
+
|
95
|
+
<span class='comment'>##
|
96
|
+
</span> <span class='comment'># Keep in mind that we're still working
|
97
|
+
</span> <span class='comment'># with Executable, so add_param is available
|
98
|
+
</span> <span class='comment'># for the initialization of the process.
|
99
|
+
</span> <span class='id add_param'>add_param</span> <span class='symbol'>:input</span><span class='comma'>,</span> <span class='const'>File</span>
|
100
|
+
|
101
|
+
<span class='comment'>##
|
102
|
+
</span> <span class='comment'># Expose the do_something action after
|
103
|
+
</span> <span class='comment'># the process is started.
|
104
|
+
</span> <span class='id add_action'>add_action</span> <span class='symbol'>:do_something</span>
|
105
|
+
|
106
|
+
<span class='comment'>##
|
107
|
+
</span> <span class='comment'># Expose the do_something_else action after
|
108
|
+
</span> <span class='comment'># the process is started.
|
109
|
+
</span> <span class='id add_action'>add_action</span> <span class='symbol'>:do_something_else</span>
|
110
|
+
<span class='kw'>end</span></pre>
|
111
|
+
|
112
|
+
<p>You can also create a globally-accessible rake task to use your new Daemon
|
113
|
+
instance by creating a method like the following:</p>
|
114
|
+
|
115
|
+
<pre class="code"><span class='kw'>def</span> <span class='id foo'>foo</span> <span class='op'>*</span><span class='id args'>args</span><span class='comma'>,</span> <span class='op'>&</span><span class='id block'>block</span>
|
116
|
+
<span class='id foo_tool'>foo_tool</span> <span class='op'>=</span> <span class='const'>Foo</span><span class='period'>.</span><span class='id new'>new</span>
|
117
|
+
<span class='id foo_tool'>foo_tool</span><span class='period'>.</span><span class='id to_rake'>to_rake</span> <span class='op'>*</span><span class='id args'>args</span><span class='comma'>,</span> <span class='op'>&</span><span class='id block'>block</span>
|
118
|
+
<span class='kw'>end</span></pre>
|
119
|
+
|
120
|
+
<p>The previous Rake task could be used like:</p>
|
121
|
+
|
122
|
+
<pre class="code"><span class='id foo'>foo</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Bar.txt</span><span class='tstring_end'>'</span></span> <span class='kw'>do</span> <span class='op'>|</span><span class='id t'>t</span><span class='op'>|</span>
|
123
|
+
<span class='id t'>t</span><span class='period'>.</span><span class='id do_something'>do_something</span>
|
124
|
+
<span class='id t'>t</span><span class='period'>.</span><span class='id do_something_else'>do_something_else</span>
|
125
|
+
<span class='kw'>end</span></pre>
|
126
|
+
|
127
|
+
|
128
|
+
</div>
|
129
|
+
</div>
|
130
|
+
<div class="tags">
|
131
|
+
|
132
|
+
</div>
|
133
|
+
<h2>Constant Summary</h2>
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
<h3 class="inherited">Constants included from <span class='object_link'><a href="../Executable.html" title="Sprout::Executable (module)">Sprout::Executable</a></span></h3>
|
146
|
+
<p class="inherited"><span class='object_link'><a href="../Executable.html#DEFAULT_FILE_EXPRESSION-constant" title="Sprout::Executable::DEFAULT_FILE_EXPRESSION (constant)">DEFAULT_FILE_EXPRESSION</a></span>, <span class='object_link'><a href="../Executable.html#DEFAULT_PREFIX-constant" title="Sprout::Executable::DEFAULT_PREFIX (constant)">DEFAULT_PREFIX</a></span>, <span class='object_link'><a href="../Executable.html#DEFAULT_SHORT_PREFIX-constant" title="Sprout::Executable::DEFAULT_SHORT_PREFIX (constant)">DEFAULT_SHORT_PREFIX</a></span></p>
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
<h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
|
157
|
+
<ul class="summary">
|
158
|
+
|
159
|
+
<li class="public ">
|
160
|
+
<span class="summary_signature">
|
161
|
+
|
162
|
+
<a href="#process_runner-instance_method" title="#process_runner (instance method)">- (Object) <strong>process_runner</strong> </a>
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
</span>
|
167
|
+
|
168
|
+
|
169
|
+
<span class="note title readonly">readonly</span>
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
<span class="summary_desc"><div class='inline'>
|
179
|
+
<p>The Sprout::ProcessRunner that delegates to the long-running process, via
|
180
|
+
stdin, stdout and stderr.</p>
|
181
|
+
</div></span>
|
182
|
+
|
183
|
+
</li>
|
184
|
+
|
185
|
+
|
186
|
+
<li class="public ">
|
187
|
+
<span class="summary_signature">
|
188
|
+
|
189
|
+
<a href="#process_thread-instance_method" title="#process_thread (instance method)">- (Object) <strong>process_thread</strong> </a>
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
</span>
|
194
|
+
|
195
|
+
|
196
|
+
<span class="note title readonly">readonly</span>
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
<span class="summary_desc"><div class='inline'>
|
206
|
+
<p>The Thread that contains the forked running process.</p>
|
207
|
+
</div></span>
|
208
|
+
|
209
|
+
</li>
|
210
|
+
|
211
|
+
|
212
|
+
<li class="public ">
|
213
|
+
<span class="summary_signature">
|
214
|
+
|
215
|
+
<a href="#prompt-instance_method" title="#prompt (instance method)">- (Regexp) <strong>prompt</strong> </a>
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
</span>
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
<span class="summary_desc"><div class='inline'>
|
232
|
+
<p>The prompt expression for this daemon process.</p>
|
233
|
+
</div></span>
|
234
|
+
|
235
|
+
</li>
|
236
|
+
|
237
|
+
|
238
|
+
</ul>
|
239
|
+
|
240
|
+
|
241
|
+
|
242
|
+
<h2>
|
243
|
+
Class Method Summary
|
244
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
245
|
+
</h2>
|
246
|
+
|
247
|
+
<ul class="summary">
|
248
|
+
|
249
|
+
<li class="public ">
|
250
|
+
<span class="summary_signature">
|
251
|
+
|
252
|
+
<a href="#add_action-class_method" title="add_action (class method)">+ (nil) <strong>add_action</strong>(name, arguments = nil, options = nil) </a>
|
253
|
+
|
254
|
+
|
255
|
+
|
256
|
+
</span>
|
257
|
+
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
<span class="summary_desc"><div class='inline'>
|
266
|
+
<p>Add an action that can be called while the long-lived process is active.</p>
|
267
|
+
</div></span>
|
268
|
+
|
269
|
+
</li>
|
270
|
+
|
271
|
+
|
272
|
+
<li class="public ">
|
273
|
+
<span class="summary_signature">
|
274
|
+
|
275
|
+
<a href="#add_action_alias-class_method" title="add_action_alias (class method)">+ (nil) <strong>add_action_alias</strong>(alias_name, source_name) </a>
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
</span>
|
280
|
+
|
281
|
+
|
282
|
+
|
283
|
+
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
|
288
|
+
<span class="summary_desc"><div class='inline'>
|
289
|
+
<p>Create an (often shorter) alias to an existing action name.</p>
|
290
|
+
</div></span>
|
291
|
+
|
292
|
+
</li>
|
293
|
+
|
294
|
+
|
295
|
+
</ul>
|
296
|
+
|
297
|
+
<h2>
|
298
|
+
Instance Method Summary
|
299
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
300
|
+
</h2>
|
301
|
+
|
302
|
+
<ul class="summary">
|
303
|
+
|
304
|
+
<li class="public ">
|
305
|
+
<span class="summary_signature">
|
306
|
+
|
307
|
+
<a href="#action_stack-instance_method" title="#action_stack (instance method)">- (Array<Hash>) <strong>action_stack</strong> </a>
|
308
|
+
|
309
|
+
|
310
|
+
|
311
|
+
</span>
|
312
|
+
|
313
|
+
|
314
|
+
|
315
|
+
|
316
|
+
|
317
|
+
|
318
|
+
|
319
|
+
|
320
|
+
<span class="summary_desc"><div class='inline'>
|
321
|
+
<p>Return or create a new array.</p>
|
322
|
+
</div></span>
|
323
|
+
|
324
|
+
</li>
|
325
|
+
|
326
|
+
|
327
|
+
<li class="protected ">
|
328
|
+
<span class="summary_signature">
|
329
|
+
|
330
|
+
<a href="#create_outer_task-instance_method" title="#create_outer_task (instance method)">- (Rake::Task) <strong>create_outer_task</strong>(*args) </a>
|
331
|
+
|
332
|
+
|
333
|
+
|
334
|
+
</span>
|
335
|
+
|
336
|
+
|
337
|
+
<span class="note title protected">protected</span>
|
338
|
+
|
339
|
+
|
340
|
+
|
341
|
+
|
342
|
+
|
343
|
+
<span class="summary_desc"><div class='inline'>
|
344
|
+
<p>This is the override of the underlying Sprout::Executable template method
|
345
|
+
so that we create a 'task' instead of a 'file' task.</p>
|
346
|
+
</div></span>
|
347
|
+
|
348
|
+
</li>
|
349
|
+
|
350
|
+
|
351
|
+
<li class="public ">
|
352
|
+
<span class="summary_signature">
|
353
|
+
|
354
|
+
<a href="#execute-instance_method" title="#execute (instance method)">- (Object) <strong>execute</strong>(should_wait = true) </a>
|
355
|
+
|
356
|
+
|
357
|
+
|
358
|
+
</span>
|
359
|
+
|
360
|
+
|
361
|
+
|
362
|
+
|
363
|
+
|
364
|
+
|
365
|
+
|
366
|
+
|
367
|
+
<span class="summary_desc"><div class='inline'>
|
368
|
+
<p>Execute the Daemon executable, followed by the collection of stored actions
|
369
|
+
in the order they were called.</p>
|
370
|
+
</div></span>
|
371
|
+
|
372
|
+
</li>
|
373
|
+
|
374
|
+
|
375
|
+
<li class="public ">
|
376
|
+
<span class="summary_signature">
|
377
|
+
|
378
|
+
<a href="#handle_user_input-instance_method" title="#handle_user_input (instance method)">- (Object) <strong>handle_user_input</strong> </a>
|
379
|
+
|
380
|
+
|
381
|
+
|
382
|
+
</span>
|
383
|
+
|
384
|
+
|
385
|
+
|
386
|
+
|
387
|
+
|
388
|
+
|
389
|
+
|
390
|
+
|
391
|
+
<span class="summary_desc"><div class='inline'>
|
392
|
+
<p>Expose the running process to manual input on the terminal, and write
|
393
|
+
stdout back to the user.</p>
|
394
|
+
</div></span>
|
395
|
+
|
396
|
+
</li>
|
397
|
+
|
398
|
+
|
399
|
+
<li class="protected ">
|
400
|
+
<span class="summary_signature">
|
401
|
+
|
402
|
+
<a href="#process_launched%3F-instance_method" title="#process_launched? (instance method)">- (Boolean) <strong>process_launched?</strong> </a>
|
403
|
+
|
404
|
+
|
405
|
+
|
406
|
+
</span>
|
407
|
+
|
408
|
+
|
409
|
+
<span class="note title protected">protected</span>
|
410
|
+
|
411
|
+
|
412
|
+
|
413
|
+
|
414
|
+
|
415
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
416
|
+
|
417
|
+
</li>
|
418
|
+
|
419
|
+
|
420
|
+
<li class="public ">
|
421
|
+
<span class="summary_signature">
|
422
|
+
|
423
|
+
<a href="#prompted%3F-instance_method" title="#prompted? (instance method)">- (Boolean) <strong>prompted?</strong> </a>
|
424
|
+
|
425
|
+
|
426
|
+
|
427
|
+
</span>
|
428
|
+
|
429
|
+
|
430
|
+
|
431
|
+
|
432
|
+
|
433
|
+
|
434
|
+
|
435
|
+
|
436
|
+
<span class="summary_desc"><div class='inline'>
|
437
|
+
<p>If executable is awaiting input.</p>
|
438
|
+
</div></span>
|
439
|
+
|
440
|
+
</li>
|
441
|
+
|
442
|
+
|
443
|
+
<li class="protected ">
|
444
|
+
<span class="summary_signature">
|
445
|
+
|
446
|
+
<a href="#system_execute-instance_method" title="#system_execute (instance method)">- (Thread) <strong>system_execute</strong>(binary, params) </a>
|
447
|
+
|
448
|
+
|
449
|
+
|
450
|
+
</span>
|
451
|
+
|
452
|
+
|
453
|
+
<span class="note title protected">protected</span>
|
454
|
+
|
455
|
+
|
456
|
+
|
457
|
+
|
458
|
+
|
459
|
+
<span class="summary_desc"><div class='inline'>
|
460
|
+
<p>This is the override of the underlying Sprout::Executable template method
|
461
|
+
so that we create the process in a thread in order to read and write to
|
462
|
+
it.</p>
|
463
|
+
</div></span>
|
464
|
+
|
465
|
+
</li>
|
466
|
+
|
467
|
+
|
468
|
+
<li class="protected ">
|
469
|
+
<span class="summary_signature">
|
470
|
+
|
471
|
+
<a href="#update_rake_task_name_from_args-instance_method" title="#update_rake_task_name_from_args (instance method)">- (String) <strong>update_rake_task_name_from_args</strong>(*args) </a>
|
472
|
+
|
473
|
+
|
474
|
+
|
475
|
+
</span>
|
476
|
+
|
477
|
+
|
478
|
+
<span class="note title protected">protected</span>
|
479
|
+
|
480
|
+
|
481
|
+
|
482
|
+
|
483
|
+
|
484
|
+
<span class="summary_desc"><div class='inline'>
|
485
|
+
<p>This is the override of the underlying Sprout::Executable template method
|
486
|
+
so that we are NOT added to the CLEAN collection.</p>
|
487
|
+
</div></span>
|
488
|
+
|
489
|
+
</li>
|
490
|
+
|
491
|
+
|
492
|
+
<li class="public ">
|
493
|
+
<span class="summary_signature">
|
494
|
+
|
495
|
+
<a href="#wait-instance_method" title="#wait (instance method)">- (Object) <strong>wait</strong> </a>
|
496
|
+
|
497
|
+
|
498
|
+
|
499
|
+
</span>
|
500
|
+
|
501
|
+
|
502
|
+
|
503
|
+
|
504
|
+
|
505
|
+
|
506
|
+
|
507
|
+
|
508
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
509
|
+
|
510
|
+
</li>
|
511
|
+
|
512
|
+
|
513
|
+
<li class="public ">
|
514
|
+
<span class="summary_signature">
|
515
|
+
|
516
|
+
<a href="#wait_for_prompt-instance_method" title="#wait_for_prompt (instance method)">- (Object) <strong>wait_for_prompt</strong> </a>
|
517
|
+
|
518
|
+
|
519
|
+
|
520
|
+
</span>
|
521
|
+
|
522
|
+
|
523
|
+
|
524
|
+
|
525
|
+
|
526
|
+
|
527
|
+
|
528
|
+
|
529
|
+
<span class="summary_desc"><div class='inline'>
|
530
|
+
<p>Wait for the underlying process to present an input prompt, so that another
|
531
|
+
action can be submitted, or user input can be collected.</p>
|
532
|
+
</div></span>
|
533
|
+
|
534
|
+
</li>
|
535
|
+
|
536
|
+
|
537
|
+
</ul>
|
538
|
+
|
539
|
+
|
540
|
+
|
541
|
+
|
542
|
+
|
543
|
+
|
544
|
+
|
545
|
+
|
546
|
+
|
547
|
+
|
548
|
+
<h3 class="inherited">Methods inherited from <span class='object_link'><a href="Base.html" title="Sprout::Executable::Base (class)">Base</a></span></h3>
|
549
|
+
<p class="inherited"><span class='object_link'><a href="Base.html#add_param-class_method" title="Sprout::Executable::Base.add_param (method)">add_param</a></span>, <span class='object_link'><a href="Base.html#add_param_alias-class_method" title="Sprout::Executable::Base.add_param_alias (method)">add_param_alias</a></span>, <span class='object_link'><a href="Base.html#binary_path-instance_method" title="Sprout::Executable::Base#binary_path (method)">#binary_path</a></span>, <span class='object_link'><a href="Base.html#binary_path%3D-instance_method" title="Sprout::Executable::Base#binary_path= (method)">#binary_path=</a></span>, <span class='object_link'><a href="Base.html#default_file_expression-instance_method" title="Sprout::Executable::Base#default_file_expression (method)">#default_file_expression</a></span>, <span class='object_link'><a href="Base.html#execute_delegate-instance_method" title="Sprout::Executable::Base#execute_delegate (method)">#execute_delegate</a></span>, <span class='object_link'><a href="Base.html#from_hash-instance_method" title="Sprout::Executable::Base#from_hash (method)">#from_hash</a></span>, <span class='object_link'><a href="Base.html#initialize-instance_method" title="Sprout::Executable::Base#initialize (method)">#initialize</a></span>, <span class='object_link'><a href="Base.html#library_added-instance_method" title="Sprout::Executable::Base#library_added (method)">#library_added</a></span>, <span class='object_link'><a href="Base.html#parse%21-instance_method" title="Sprout::Executable::Base#parse! (method)">#parse!</a></span>, <span class='object_link'><a href="Base.html#parse_extra_options%21-instance_method" title="Sprout::Executable::Base#parse_extra_options! (method)">#parse_extra_options!</a></span>, <span class='object_link'><a href="Base.html#parse_rake_task_arg-instance_method" title="Sprout::Executable::Base#parse_rake_task_arg (method)">#parse_rake_task_arg</a></span>, <span class='object_link'><a href="Base.html#prepare-instance_method" title="Sprout::Executable::Base#prepare (method)">#prepare</a></span>, <span class='object_link'><a href="Base.html#set-class_method" title="Sprout::Executable::Base.set (method)">set</a></span>, <span class='object_link'><a href="Base.html#static_default_value_collection-class_method" title="Sprout::Executable::Base.static_default_value_collection (method)">static_default_value_collection</a></span>, <span class='object_link'><a href="Base.html#static_parameter_collection-class_method" title="Sprout::Executable::Base.static_parameter_collection (method)">static_parameter_collection</a></span>, <span class='object_link'><a href="Base.html#stderr-instance_method" title="Sprout::Executable::Base#stderr (method)">#stderr</a></span>, <span class='object_link'><a href="Base.html#stderr%3D-instance_method" title="Sprout::Executable::Base#stderr= (method)">#stderr=</a></span>, <span class='object_link'><a href="Base.html#stdout-instance_method" title="Sprout::Executable::Base#stdout (method)">#stdout</a></span>, <span class='object_link'><a href="Base.html#stdout%3D-instance_method" title="Sprout::Executable::Base#stdout= (method)">#stdout=</a></span>, <span class='object_link'><a href="Base.html#to_hash-instance_method" title="Sprout::Executable::Base#to_hash (method)">#to_hash</a></span>, <span class='object_link'><a href="Base.html#to_help-instance_method" title="Sprout::Executable::Base#to_help (method)">#to_help</a></span>, <span class='object_link'><a href="Base.html#to_rake-instance_method" title="Sprout::Executable::Base#to_rake (method)">#to_rake</a></span>, <span class='object_link'><a href="Base.html#to_shell-instance_method" title="Sprout::Executable::Base#to_shell (method)">#to_shell</a></span></p>
|
550
|
+
|
551
|
+
|
552
|
+
|
553
|
+
|
554
|
+
|
555
|
+
|
556
|
+
|
557
|
+
|
558
|
+
|
559
|
+
|
560
|
+
|
561
|
+
|
562
|
+
|
563
|
+
|
564
|
+
|
565
|
+
|
566
|
+
|
567
|
+
|
568
|
+
<h3 class="inherited">Methods included from <span class='object_link'><a href="../Concern.html" title="Sprout::Concern (module)">Concern</a></span></h3>
|
569
|
+
<p class="inherited"><span class='object_link'><a href="../Concern.html#append_features-instance_method" title="Sprout::Concern#append_features (method)">#append_features</a></span>, <span class='object_link'><a href="../Concern.html#extended-class_method" title="Sprout::Concern.extended (method)">extended</a></span>, <span class='object_link'><a href="../Concern.html#included-instance_method" title="Sprout::Concern#included (method)">#included</a></span></p>
|
570
|
+
<div id="constructor_details" class="method_details_list">
|
571
|
+
<h2>Constructor Details</h2>
|
572
|
+
|
573
|
+
<p class="notice">This class inherits a constructor from <span class='object_link'><a href="Base.html#initialize-instance_method" title="Sprout::Executable::Base#initialize (method)">Sprout::Executable::Base</a></span></p>
|
574
|
+
|
575
|
+
</div>
|
576
|
+
|
577
|
+
<div id="instance_attr_details" class="attr_details">
|
578
|
+
<h2>Instance Attribute Details</h2>
|
579
|
+
|
580
|
+
|
581
|
+
<span id=""></span>
|
582
|
+
<span id="process_runner-instance_method"></span>
|
583
|
+
<div class="method_details first">
|
584
|
+
<p class="signature first" id="process_runner-instance_method">
|
585
|
+
|
586
|
+
- (<tt>Object</tt>) <strong>process_runner</strong> <span class="extras">(readonly)</span>
|
587
|
+
|
588
|
+
|
589
|
+
|
590
|
+
</p><div class="docstring">
|
591
|
+
<div class="discussion">
|
592
|
+
|
593
|
+
<p>The Sprout::ProcessRunner that delegates to the long-running process, via
|
594
|
+
stdin, stdout and stderr.</p>
|
595
|
+
|
596
|
+
|
597
|
+
</div>
|
598
|
+
</div>
|
599
|
+
<div class="tags">
|
600
|
+
|
601
|
+
</div><table class="source_code">
|
602
|
+
<tr>
|
603
|
+
<td>
|
604
|
+
<pre class="lines">
|
605
|
+
|
606
|
+
|
607
|
+
148
|
608
|
+
149
|
609
|
+
150</pre>
|
610
|
+
</td>
|
611
|
+
<td>
|
612
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/executable/session.rb', line 148</span>
|
613
|
+
|
614
|
+
<span class='kw'>def</span> <span class='id process_runner'>process_runner</span>
|
615
|
+
<span class='ivar'>@process_runner</span>
|
616
|
+
<span class='kw'>end</span></pre>
|
617
|
+
</td>
|
618
|
+
</tr>
|
619
|
+
</table>
|
620
|
+
</div>
|
621
|
+
|
622
|
+
|
623
|
+
<span id=""></span>
|
624
|
+
<span id="process_thread-instance_method"></span>
|
625
|
+
<div class="method_details ">
|
626
|
+
<p class="signature " id="process_thread-instance_method">
|
627
|
+
|
628
|
+
- (<tt>Object</tt>) <strong>process_thread</strong> <span class="extras">(readonly)</span>
|
629
|
+
|
630
|
+
|
631
|
+
|
632
|
+
</p><div class="docstring">
|
633
|
+
<div class="discussion">
|
634
|
+
|
635
|
+
<p>The Thread that contains the forked running process.</p>
|
636
|
+
|
637
|
+
|
638
|
+
</div>
|
639
|
+
</div>
|
640
|
+
<div class="tags">
|
641
|
+
|
642
|
+
</div><table class="source_code">
|
643
|
+
<tr>
|
644
|
+
<td>
|
645
|
+
<pre class="lines">
|
646
|
+
|
647
|
+
|
648
|
+
152
|
649
|
+
153
|
650
|
+
154</pre>
|
651
|
+
</td>
|
652
|
+
<td>
|
653
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/executable/session.rb', line 152</span>
|
654
|
+
|
655
|
+
<span class='kw'>def</span> <span class='id process_thread'>process_thread</span>
|
656
|
+
<span class='ivar'>@process_thread</span>
|
657
|
+
<span class='kw'>end</span></pre>
|
658
|
+
</td>
|
659
|
+
</tr>
|
660
|
+
</table>
|
661
|
+
</div>
|
662
|
+
|
663
|
+
|
664
|
+
<span id="prompt=-instance_method"></span>
|
665
|
+
<span id="prompt-instance_method"></span>
|
666
|
+
<div class="method_details ">
|
667
|
+
<p class="signature " id="prompt-instance_method">
|
668
|
+
|
669
|
+
- (<tt>Regexp</tt>) <strong>prompt</strong>
|
670
|
+
|
671
|
+
|
672
|
+
|
673
|
+
</p><div class="docstring">
|
674
|
+
<div class="discussion">
|
675
|
+
|
676
|
+
<p>The prompt expression for this daemon process.</p>
|
677
|
+
|
678
|
+
<p>When executing a series of commands, the wrapper will wait until it matches
|
679
|
+
this expression on stdout before continuing the series.</p>
|
680
|
+
|
681
|
+
<p>For FDB, this value is set like:</p>
|
682
|
+
|
683
|
+
<pre class="code"><span class='id set'>set</span> <span class='symbol'>:prompt</span><span class='comma'>,</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^\(fdb\) </span><span class='regexp_end'>/</span></span></pre>
|
684
|
+
|
685
|
+
<p>Most processes can trigger a variety of different prompts, these can be
|
686
|
+
expressed here using the | (or) operator.</p>
|
687
|
+
|
688
|
+
<p>FDB actually uses the following:</p>
|
689
|
+
|
690
|
+
<pre class="code"><span class='id set'>set</span> <span class='symbol'>:prompt</span><span class='comma'>,</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^\(fdb\) |\(y or n\) </span><span class='regexp_end'>/</span></span></pre>
|
691
|
+
|
692
|
+
|
693
|
+
</div>
|
694
|
+
</div>
|
695
|
+
<div class="tags">
|
696
|
+
<h3>Returns:</h3>
|
697
|
+
<ul class="return">
|
698
|
+
|
699
|
+
<li>
|
700
|
+
|
701
|
+
<span class='type'>(<tt>Regexp</tt>)</span>
|
702
|
+
|
703
|
+
|
704
|
+
|
705
|
+
|
706
|
+
</li>
|
707
|
+
|
708
|
+
</ul>
|
709
|
+
|
710
|
+
</div><table class="source_code">
|
711
|
+
<tr>
|
712
|
+
<td>
|
713
|
+
<pre class="lines">
|
714
|
+
|
715
|
+
|
716
|
+
142
|
717
|
+
143
|
718
|
+
144</pre>
|
719
|
+
</td>
|
720
|
+
<td>
|
721
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/executable/session.rb', line 142</span>
|
722
|
+
|
723
|
+
<span class='kw'>def</span> <span class='id prompt'>prompt</span>
|
724
|
+
<span class='ivar'>@prompt</span>
|
725
|
+
<span class='kw'>end</span></pre>
|
726
|
+
</td>
|
727
|
+
</tr>
|
728
|
+
</table>
|
729
|
+
</div>
|
730
|
+
|
731
|
+
</div>
|
732
|
+
|
733
|
+
|
734
|
+
<div id="class_method_details" class="method_details_list">
|
735
|
+
<h2>Class Method Details</h2>
|
736
|
+
|
737
|
+
|
738
|
+
<div class="method_details first">
|
739
|
+
<p class="signature first" id="add_action-class_method">
|
740
|
+
|
741
|
+
+ (<tt>nil</tt>) <strong>add_action</strong>(name, arguments = nil, options = nil)
|
742
|
+
|
743
|
+
|
744
|
+
|
745
|
+
</p><div class="docstring">
|
746
|
+
<div class="discussion">
|
747
|
+
|
748
|
+
<p>Add an action that can be called while the long-lived process is active.</p>
|
749
|
+
|
750
|
+
<p>This method should raise a Sprout::Errors::UsageError if the provided
|
751
|
+
action name is already defined for the provided instance.</p>
|
752
|
+
|
753
|
+
|
754
|
+
</div>
|
755
|
+
</div>
|
756
|
+
<div class="tags">
|
757
|
+
<h3>Parameters:</h3>
|
758
|
+
<ul class="param">
|
759
|
+
|
760
|
+
<li>
|
761
|
+
|
762
|
+
<span class='type'>(<tt>Symbol</tt>, <tt><span class='object_link'><a href="../../String.html" title="String (class)">String</a></span></tt>)</span>
|
763
|
+
|
764
|
+
|
765
|
+
<span class='name'>name</span>
|
766
|
+
|
767
|
+
|
768
|
+
|
769
|
+
—
|
770
|
+
<div class='inline'>
|
771
|
+
<p>The name of the method.</p>
|
772
|
+
</div>
|
773
|
+
|
774
|
+
</li>
|
775
|
+
|
776
|
+
<li>
|
777
|
+
|
778
|
+
<span class='type'>(<tt>Array<Object></tt>)</span>
|
779
|
+
|
780
|
+
|
781
|
+
<span class='name'>arguments</span>
|
782
|
+
|
783
|
+
|
784
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
785
|
+
|
786
|
+
|
787
|
+
—
|
788
|
+
<div class='inline'>
|
789
|
+
<p>An array of arguments that the method accepts.</p>
|
790
|
+
</div>
|
791
|
+
|
792
|
+
</li>
|
793
|
+
|
794
|
+
<li>
|
795
|
+
|
796
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
797
|
+
|
798
|
+
|
799
|
+
<span class='name'>options</span>
|
800
|
+
|
801
|
+
|
802
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
803
|
+
|
804
|
+
|
805
|
+
—
|
806
|
+
<div class='inline'>
|
807
|
+
<p>The options hash is reserved for future use.</p>
|
808
|
+
|
809
|
+
<p>class Foo < Sprout::Daemon</p>
|
810
|
+
|
811
|
+
<pre class="code"><span class='id add_action'>add_action</span> <span class='symbol'>:continue</span>
|
812
|
+
|
813
|
+
<span class='id add_action'>add_action</span> <span class='symbol'>:quit</span></pre>
|
814
|
+
|
815
|
+
<p>end</p>
|
816
|
+
</div>
|
817
|
+
|
818
|
+
</li>
|
819
|
+
|
820
|
+
</ul>
|
821
|
+
<h3>Returns:</h3>
|
822
|
+
<ul class="return">
|
823
|
+
|
824
|
+
<li>
|
825
|
+
|
826
|
+
<span class='type'>(<tt>nil</tt>)</span>
|
827
|
+
|
828
|
+
|
829
|
+
|
830
|
+
|
831
|
+
</li>
|
832
|
+
|
833
|
+
</ul>
|
834
|
+
|
835
|
+
</div><table class="source_code">
|
836
|
+
<tr>
|
837
|
+
<td>
|
838
|
+
<pre class="lines">
|
839
|
+
|
840
|
+
|
841
|
+
70
|
842
|
+
71
|
843
|
+
72
|
844
|
+
73
|
845
|
+
74
|
846
|
+
75
|
847
|
+
76</pre>
|
848
|
+
</td>
|
849
|
+
<td>
|
850
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/executable/session.rb', line 70</span>
|
851
|
+
|
852
|
+
<span class='kw'>def</span> <span class='id add_action'>add_action</span> <span class='id name'>name</span><span class='comma'>,</span> <span class='id arguments'>arguments</span><span class='op'>=</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='id options'>options</span><span class='op'>=</span><span class='kw'>nil</span>
|
853
|
+
<span class='id options'>options</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
854
|
+
<span class='id options'>options</span><span class='lbracket'>[</span><span class='symbol'>:name</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id name'>name</span>
|
855
|
+
<span class='id options'>options</span><span class='lbracket'>[</span><span class='symbol'>:arguments</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id arguments'>arguments</span>
|
856
|
+
<span class='id create_action_method'>create_action_method</span> <span class='id options'>options</span>
|
857
|
+
<span class='kw'>nil</span>
|
858
|
+
<span class='kw'>end</span></pre>
|
859
|
+
</td>
|
860
|
+
</tr>
|
861
|
+
</table>
|
862
|
+
</div>
|
863
|
+
|
864
|
+
<div class="method_details ">
|
865
|
+
<p class="signature " id="add_action_alias-class_method">
|
866
|
+
|
867
|
+
+ (<tt>nil</tt>) <strong>add_action_alias</strong>(alias_name, source_name)
|
868
|
+
|
869
|
+
|
870
|
+
|
871
|
+
</p><div class="docstring">
|
872
|
+
<div class="discussion">
|
873
|
+
|
874
|
+
<p>Create an (often shorter) alias to an existing action name.</p>
|
875
|
+
|
876
|
+
|
877
|
+
</div>
|
878
|
+
</div>
|
879
|
+
<div class="tags">
|
880
|
+
<h3>Returns:</h3>
|
881
|
+
<ul class="return">
|
882
|
+
|
883
|
+
<li>
|
884
|
+
|
885
|
+
<span class='type'>(<tt>nil</tt>)</span>
|
886
|
+
|
887
|
+
|
888
|
+
|
889
|
+
|
890
|
+
</li>
|
891
|
+
|
892
|
+
</ul>
|
893
|
+
|
894
|
+
<h3>See Also:</h3>
|
895
|
+
<ul class="see">
|
896
|
+
|
897
|
+
<li><span class='object_link'><a href="#add_action-class_method" title="Sprout::Executable::Session.add_action (method)">add_action</a></span></li>
|
898
|
+
|
899
|
+
</ul>
|
900
|
+
|
901
|
+
</div><table class="source_code">
|
902
|
+
<tr>
|
903
|
+
<td>
|
904
|
+
<pre class="lines">
|
905
|
+
|
906
|
+
|
907
|
+
85
|
908
|
+
86
|
909
|
+
87
|
910
|
+
88
|
911
|
+
89
|
912
|
+
90</pre>
|
913
|
+
</td>
|
914
|
+
<td>
|
915
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/executable/session.rb', line 85</span>
|
916
|
+
|
917
|
+
<span class='kw'>def</span> <span class='id add_action_alias'>add_action_alias</span> <span class='id alias_name'>alias_name</span><span class='comma'>,</span> <span class='id source_name'>source_name</span>
|
918
|
+
<span class='id define_method'>define_method</span><span class='lparen'>(</span><span class='id alias_name'>alias_name</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='op'>*</span><span class='id params'>params</span><span class='op'>|</span>
|
919
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id send'>send</span><span class='lparen'>(</span><span class='id source_name'>source_name</span><span class='comma'>,</span> <span class='id params'>params</span><span class='rparen'>)</span>
|
920
|
+
<span class='kw'>end</span>
|
921
|
+
<span class='kw'>nil</span>
|
922
|
+
<span class='kw'>end</span></pre>
|
923
|
+
</td>
|
924
|
+
</tr>
|
925
|
+
</table>
|
926
|
+
</div>
|
927
|
+
|
928
|
+
</div>
|
929
|
+
|
930
|
+
<div id="instance_method_details" class="method_details_list">
|
931
|
+
<h2>Instance Method Details</h2>
|
932
|
+
|
933
|
+
|
934
|
+
<div class="method_details first">
|
935
|
+
<p class="signature first" id="action_stack-instance_method">
|
936
|
+
|
937
|
+
- (<tt>Array<Hash></tt>) <strong>action_stack</strong>
|
938
|
+
|
939
|
+
|
940
|
+
|
941
|
+
</p><div class="docstring">
|
942
|
+
<div class="discussion">
|
943
|
+
|
944
|
+
<p>Return or create a new array.</p>
|
945
|
+
|
946
|
+
|
947
|
+
</div>
|
948
|
+
</div>
|
949
|
+
<div class="tags">
|
950
|
+
<h3>Returns:</h3>
|
951
|
+
<ul class="return">
|
952
|
+
|
953
|
+
<li>
|
954
|
+
|
955
|
+
<span class='type'>(<tt>Array<Hash></tt>)</span>
|
956
|
+
|
957
|
+
|
958
|
+
|
959
|
+
|
960
|
+
—
|
961
|
+
<div class='inline'>
|
962
|
+
<p>Return or create a new array.</p>
|
963
|
+
</div>
|
964
|
+
|
965
|
+
</li>
|
966
|
+
|
967
|
+
</ul>
|
968
|
+
|
969
|
+
</div><table class="source_code">
|
970
|
+
<tr>
|
971
|
+
<td>
|
972
|
+
<pre class="lines">
|
973
|
+
|
974
|
+
|
975
|
+
156
|
976
|
+
157
|
977
|
+
158</pre>
|
978
|
+
</td>
|
979
|
+
<td>
|
980
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/executable/session.rb', line 156</span>
|
981
|
+
|
982
|
+
<span class='kw'>def</span> <span class='id action_stack'>action_stack</span>
|
983
|
+
<span class='ivar'>@action_stack</span> <span class='op'>||=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
984
|
+
<span class='kw'>end</span></pre>
|
985
|
+
</td>
|
986
|
+
</tr>
|
987
|
+
</table>
|
988
|
+
</div>
|
989
|
+
|
990
|
+
<div class="method_details ">
|
991
|
+
<p class="signature " id="create_outer_task-instance_method">
|
992
|
+
|
993
|
+
- (<tt><span class='object_link'><a href="../../Rake/Task.html" title="Rake::Task (class)">Rake::Task</a></span></tt>) <strong>create_outer_task</strong>(*args) <span class="extras">(protected)</span>
|
994
|
+
|
995
|
+
|
996
|
+
|
997
|
+
</p><div class="docstring">
|
998
|
+
<div class="discussion">
|
999
|
+
|
1000
|
+
<p>This is the override of the underlying Sprout::Executable template method
|
1001
|
+
so that we create a 'task' instead of a 'file' task.</p>
|
1002
|
+
|
1003
|
+
|
1004
|
+
</div>
|
1005
|
+
</div>
|
1006
|
+
<div class="tags">
|
1007
|
+
<h3>Returns:</h3>
|
1008
|
+
<ul class="return">
|
1009
|
+
|
1010
|
+
<li>
|
1011
|
+
|
1012
|
+
<span class='type'>(<tt><span class='object_link'><a href="../../Rake/Task.html" title="Rake::Task (class)">Rake::Task</a></span></tt>)</span>
|
1013
|
+
|
1014
|
+
|
1015
|
+
|
1016
|
+
|
1017
|
+
</li>
|
1018
|
+
|
1019
|
+
</ul>
|
1020
|
+
|
1021
|
+
</div><table class="source_code">
|
1022
|
+
<tr>
|
1023
|
+
<td>
|
1024
|
+
<pre class="lines">
|
1025
|
+
|
1026
|
+
|
1027
|
+
250
|
1028
|
+
251
|
1029
|
+
252
|
1030
|
+
253
|
1031
|
+
254</pre>
|
1032
|
+
</td>
|
1033
|
+
<td>
|
1034
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/executable/session.rb', line 250</span>
|
1035
|
+
|
1036
|
+
<span class='kw'>def</span> <span class='id create_outer_task'>create_outer_task</span> <span class='op'>*</span><span class='id args'>args</span>
|
1037
|
+
<span class='id task'>task</span> <span class='op'>*</span><span class='id args'>args</span> <span class='kw'>do</span>
|
1038
|
+
<span class='id execute'>execute</span>
|
1039
|
+
<span class='kw'>end</span>
|
1040
|
+
<span class='kw'>end</span></pre>
|
1041
|
+
</td>
|
1042
|
+
</tr>
|
1043
|
+
</table>
|
1044
|
+
</div>
|
1045
|
+
|
1046
|
+
<div class="method_details ">
|
1047
|
+
<p class="signature " id="execute-instance_method">
|
1048
|
+
|
1049
|
+
- (<tt>Object</tt>) <strong>execute</strong>(should_wait = true)
|
1050
|
+
|
1051
|
+
|
1052
|
+
|
1053
|
+
</p><div class="docstring">
|
1054
|
+
<div class="discussion">
|
1055
|
+
|
1056
|
+
<p>Execute the Daemon executable, followed by the collection of stored actions
|
1057
|
+
in the order they were called.</p>
|
1058
|
+
|
1059
|
+
<p>If none of the stored actions result in terminating the process, the
|
1060
|
+
underlying daemon will be connected to the terminal for user (manual)
|
1061
|
+
input.</p>
|
1062
|
+
|
1063
|
+
<p>You can also send wait=false to connect to a daemon process from Ruby and
|
1064
|
+
execute actions over time. This might look like:</p>
|
1065
|
+
|
1066
|
+
<pre class="code"><span class='id fdb'>fdb</span> <span class='op'>=</span> <span class='const'>FlashSDK</span><span class='op'>::</span><span class='const'>FDB</span><span class='period'>.</span><span class='id new'>new</span>
|
1067
|
+
<span class='id fdb'>fdb</span><span class='period'>.</span><span class='id execute'>execute</span> <span class='kw'>false</span>
|
1068
|
+
|
1069
|
+
<span class='comment'># Do something else while FDB
|
1070
|
+
</span><span class='comment'># is open, then:
|
1071
|
+
</span>
|
1072
|
+
<span class='id fdb'>fdb</span><span class='period'>.</span><span class='id run'>run</span>
|
1073
|
+
<span class='id fdb'>fdb</span><span class='period'>.</span><span class='id break'>break</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>AsUnitRunner:12</span><span class='tstring_end'>"</span></span>
|
1074
|
+
<span class='id fdb'>fdb</span><span class='period'>.</span><span class='id continue'>continue</span>
|
1075
|
+
<span class='id fdb'>fdb</span><span class='period'>.</span><span class='id kill'>kill</span>
|
1076
|
+
<span class='id fdb'>fdb</span><span class='period'>.</span><span class='id confirm'>confirm</span>
|
1077
|
+
<span class='id fdb'>fdb</span><span class='period'>.</span><span class='id quit'>quit</span></pre>
|
1078
|
+
|
1079
|
+
|
1080
|
+
</div>
|
1081
|
+
</div>
|
1082
|
+
<div class="tags">
|
1083
|
+
<h3>Parameters:</h3>
|
1084
|
+
<ul class="param">
|
1085
|
+
|
1086
|
+
<li>
|
1087
|
+
|
1088
|
+
<span class='type'>(<tt><span class='object_link'><a href="Boolean.html" title="Sprout::Executable::Boolean (class)">Boolean</a></span></tt>)</span>
|
1089
|
+
|
1090
|
+
|
1091
|
+
<span class='name'>wait</span>
|
1092
|
+
|
1093
|
+
|
1094
|
+
|
1095
|
+
—
|
1096
|
+
<div class='inline'>
|
1097
|
+
<p>default true. Send false to connect to a daemon from Ruby code.</p>
|
1098
|
+
</div>
|
1099
|
+
|
1100
|
+
</li>
|
1101
|
+
|
1102
|
+
</ul>
|
1103
|
+
|
1104
|
+
</div><table class="source_code">
|
1105
|
+
<tr>
|
1106
|
+
<td>
|
1107
|
+
<pre class="lines">
|
1108
|
+
|
1109
|
+
|
1110
|
+
196
|
1111
|
+
197
|
1112
|
+
198
|
1113
|
+
199
|
1114
|
+
200
|
1115
|
+
201
|
1116
|
+
202</pre>
|
1117
|
+
</td>
|
1118
|
+
<td>
|
1119
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/executable/session.rb', line 196</span>
|
1120
|
+
|
1121
|
+
<span class='kw'>def</span> <span class='id execute'>execute</span> <span class='id should_wait'>should_wait</span><span class='op'>=</span><span class='kw'>true</span>
|
1122
|
+
<span class='ivar'>@process_runner</span> <span class='op'>=</span> <span class='kw'>super</span><span class='lparen'>(</span><span class='rparen'>)</span>
|
1123
|
+
<span class='ivar'>@process_launched</span> <span class='op'>=</span> <span class='kw'>true</span>
|
1124
|
+
<span class='id wait_for_prompt'>wait_for_prompt</span>
|
1125
|
+
<span class='id execute_actions'>execute_actions</span>
|
1126
|
+
<span class='id handle_user_input'>handle_user_input</span> <span class='kw'>if</span> <span class='id should_wait'>should_wait</span>
|
1127
|
+
<span class='kw'>end</span></pre>
|
1128
|
+
</td>
|
1129
|
+
</tr>
|
1130
|
+
</table>
|
1131
|
+
</div>
|
1132
|
+
|
1133
|
+
<div class="method_details ">
|
1134
|
+
<p class="signature " id="handle_user_input-instance_method">
|
1135
|
+
|
1136
|
+
- (<tt>Object</tt>) <strong>handle_user_input</strong>
|
1137
|
+
|
1138
|
+
|
1139
|
+
|
1140
|
+
</p><div class="docstring">
|
1141
|
+
<div class="discussion">
|
1142
|
+
|
1143
|
+
<p>Expose the running process to manual input on the terminal, and write
|
1144
|
+
stdout back to the user.</p>
|
1145
|
+
|
1146
|
+
|
1147
|
+
</div>
|
1148
|
+
</div>
|
1149
|
+
<div class="tags">
|
1150
|
+
|
1151
|
+
</div><table class="source_code">
|
1152
|
+
<tr>
|
1153
|
+
<td>
|
1154
|
+
<pre class="lines">
|
1155
|
+
|
1156
|
+
|
1157
|
+
225
|
1158
|
+
226
|
1159
|
+
227
|
1160
|
+
228
|
1161
|
+
229
|
1162
|
+
230
|
1163
|
+
231
|
1164
|
+
232
|
1165
|
+
233
|
1166
|
+
234
|
1167
|
+
235
|
1168
|
+
236</pre>
|
1169
|
+
</td>
|
1170
|
+
<td>
|
1171
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/executable/session.rb', line 225</span>
|
1172
|
+
|
1173
|
+
<span class='kw'>def</span> <span class='id handle_user_input'>handle_user_input</span>
|
1174
|
+
<span class='kw'>while</span> <span class='kw'>true</span>
|
1175
|
+
<span class='kw'>begin</span>
|
1176
|
+
<span class='kw'>break</span> <span class='kw'>if</span> <span class='op'>!</span><span class='id wait_for_prompt'>wait_for_prompt</span>
|
1177
|
+
<span class='id input'>input</span> <span class='op'>=</span> <span class='gvar'>$stdin</span><span class='period'>.</span><span class='id gets'>gets</span><span class='period'>.</span><span class='id chomp!'>chomp!</span>
|
1178
|
+
<span class='id execute_action'>execute_action</span><span class='lparen'>(</span><span class='id input'>input</span><span class='comma'>,</span> <span class='kw'>true</span><span class='rparen'>)</span>
|
1179
|
+
<span class='kw'>rescue</span> <span class='const'>SignalException</span> <span class='op'>=></span> <span class='id e'>e</span>
|
1180
|
+
<span class='kw'>return</span> <span class='kw'>false</span>
|
1181
|
+
<span class='kw'>end</span>
|
1182
|
+
<span class='kw'>end</span>
|
1183
|
+
<span class='id wait'>wait</span>
|
1184
|
+
<span class='kw'>end</span></pre>
|
1185
|
+
</td>
|
1186
|
+
</tr>
|
1187
|
+
</table>
|
1188
|
+
</div>
|
1189
|
+
|
1190
|
+
<div class="method_details ">
|
1191
|
+
<p class="signature " id="process_launched?-instance_method">
|
1192
|
+
|
1193
|
+
- (<tt><span class='object_link'><a href="Boolean.html" title="Sprout::Executable::Boolean (class)">Boolean</a></span></tt>) <strong>process_launched?</strong> <span class="extras">(protected)</span>
|
1194
|
+
|
1195
|
+
|
1196
|
+
|
1197
|
+
</p><div class="docstring">
|
1198
|
+
<div class="discussion">
|
1199
|
+
|
1200
|
+
|
1201
|
+
</div>
|
1202
|
+
</div>
|
1203
|
+
<div class="tags">
|
1204
|
+
<h3>Returns:</h3>
|
1205
|
+
<ul class="return">
|
1206
|
+
|
1207
|
+
<li>
|
1208
|
+
|
1209
|
+
<span class='type'>(<tt><span class='object_link'><a href="Boolean.html" title="Sprout::Executable::Boolean (class)">Boolean</a></span></tt>)</span>
|
1210
|
+
|
1211
|
+
|
1212
|
+
|
1213
|
+
|
1214
|
+
</li>
|
1215
|
+
|
1216
|
+
</ul>
|
1217
|
+
|
1218
|
+
</div><table class="source_code">
|
1219
|
+
<tr>
|
1220
|
+
<td>
|
1221
|
+
<pre class="lines">
|
1222
|
+
|
1223
|
+
|
1224
|
+
240
|
1225
|
+
241
|
1226
|
+
242</pre>
|
1227
|
+
</td>
|
1228
|
+
<td>
|
1229
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/executable/session.rb', line 240</span>
|
1230
|
+
|
1231
|
+
<span class='kw'>def</span> <span class='id process_launched?'>process_launched?</span>
|
1232
|
+
<span class='ivar'>@process_launched</span>
|
1233
|
+
<span class='kw'>end</span></pre>
|
1234
|
+
</td>
|
1235
|
+
</tr>
|
1236
|
+
</table>
|
1237
|
+
</div>
|
1238
|
+
|
1239
|
+
<div class="method_details ">
|
1240
|
+
<p class="signature " id="prompted?-instance_method">
|
1241
|
+
|
1242
|
+
- (<tt><span class='object_link'><a href="Boolean.html" title="Sprout::Executable::Boolean (class)">Boolean</a></span></tt>) <strong>prompted?</strong>
|
1243
|
+
|
1244
|
+
|
1245
|
+
|
1246
|
+
</p><div class="docstring">
|
1247
|
+
<div class="discussion">
|
1248
|
+
|
1249
|
+
<p>If executable is awaiting input.</p>
|
1250
|
+
|
1251
|
+
|
1252
|
+
</div>
|
1253
|
+
</div>
|
1254
|
+
<div class="tags">
|
1255
|
+
<h3>Returns:</h3>
|
1256
|
+
<ul class="return">
|
1257
|
+
|
1258
|
+
<li>
|
1259
|
+
|
1260
|
+
<span class='type'>(<tt><span class='object_link'><a href="Boolean.html" title="Sprout::Executable::Boolean (class)">Boolean</a></span></tt>)</span>
|
1261
|
+
|
1262
|
+
|
1263
|
+
|
1264
|
+
|
1265
|
+
—
|
1266
|
+
<div class='inline'>
|
1267
|
+
<p>If executable is awaiting input.</p>
|
1268
|
+
</div>
|
1269
|
+
|
1270
|
+
</li>
|
1271
|
+
|
1272
|
+
</ul>
|
1273
|
+
|
1274
|
+
</div><table class="source_code">
|
1275
|
+
<tr>
|
1276
|
+
<td>
|
1277
|
+
<pre class="lines">
|
1278
|
+
|
1279
|
+
|
1280
|
+
162
|
1281
|
+
163
|
1282
|
+
164</pre>
|
1283
|
+
</td>
|
1284
|
+
<td>
|
1285
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/executable/session.rb', line 162</span>
|
1286
|
+
|
1287
|
+
<span class='kw'>def</span> <span class='id prompted?'>prompted?</span>
|
1288
|
+
<span class='ivar'>@prompted</span>
|
1289
|
+
<span class='kw'>end</span></pre>
|
1290
|
+
</td>
|
1291
|
+
</tr>
|
1292
|
+
</table>
|
1293
|
+
</div>
|
1294
|
+
|
1295
|
+
<div class="method_details ">
|
1296
|
+
<p class="signature " id="system_execute-instance_method">
|
1297
|
+
|
1298
|
+
- (<tt>Thread</tt>) <strong>system_execute</strong>(binary, params) <span class="extras">(protected)</span>
|
1299
|
+
|
1300
|
+
|
1301
|
+
|
1302
|
+
</p><div class="docstring">
|
1303
|
+
<div class="discussion">
|
1304
|
+
|
1305
|
+
<p>This is the override of the underlying Sprout::Executable template method
|
1306
|
+
so that we create the process in a thread in order to read and write to
|
1307
|
+
it.</p>
|
1308
|
+
|
1309
|
+
|
1310
|
+
</div>
|
1311
|
+
</div>
|
1312
|
+
<div class="tags">
|
1313
|
+
<h3>Returns:</h3>
|
1314
|
+
<ul class="return">
|
1315
|
+
|
1316
|
+
<li>
|
1317
|
+
|
1318
|
+
<span class='type'>(<tt>Thread</tt>)</span>
|
1319
|
+
|
1320
|
+
|
1321
|
+
|
1322
|
+
|
1323
|
+
</li>
|
1324
|
+
|
1325
|
+
</ul>
|
1326
|
+
|
1327
|
+
</div><table class="source_code">
|
1328
|
+
<tr>
|
1329
|
+
<td>
|
1330
|
+
<pre class="lines">
|
1331
|
+
|
1332
|
+
|
1333
|
+
274
|
1334
|
+
275
|
1335
|
+
276
|
1336
|
+
277
|
1337
|
+
278
|
1338
|
+
279
|
1339
|
+
280
|
1340
|
+
281
|
1341
|
+
282
|
1342
|
+
283
|
1343
|
+
284
|
1344
|
+
285
|
1345
|
+
286
|
1346
|
+
287
|
1347
|
+
288
|
1348
|
+
289</pre>
|
1349
|
+
</td>
|
1350
|
+
<td>
|
1351
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/executable/session.rb', line 274</span>
|
1352
|
+
|
1353
|
+
<span class='kw'>def</span> <span class='id system_execute'>system_execute</span> <span class='id binary'>binary</span><span class='comma'>,</span> <span class='id params'>params</span>
|
1354
|
+
<span class='comment'># Combine the stderr and stdout for long-lived
|
1355
|
+
</span> <span class='comment'># processes so that they are both written to
|
1356
|
+
</span> <span class='comment'># stdout, this allows us to collect these streams
|
1357
|
+
</span> <span class='comment'># without threads or blocking eternally.
|
1358
|
+
</span> <span class='comment'>#
|
1359
|
+
</span> <span class='comment'># Thanks to https://github.com/apinstein for this
|
1360
|
+
</span> <span class='comment'># solution.
|
1361
|
+
</span> <span class='comment'>#params = "#{params} " + '2>&1'
|
1362
|
+
</span> <span class='ivar'>@process_thread</span> <span class='op'>=</span> <span class='const'>Sprout</span><span class='period'>.</span><span class='id current_system'>current_system</span><span class='period'>.</span><span class='id execute_thread'>execute_thread</span> <span class='id binary'>binary</span><span class='comma'>,</span> <span class='id params'>params</span><span class='comma'>,</span> <span class='id prompt'>prompt</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id message'>message</span><span class='op'>|</span>
|
1363
|
+
<span class='kw'>yield</span> <span class='id message'>message</span> <span class='kw'>if</span> <span class='id block_given?'>block_given?</span>
|
1364
|
+
<span class='const'>Sprout</span><span class='period'>.</span><span class='id stdout'>stdout</span><span class='period'>.</span><span class='id printf'>printf</span> <span class='id message'>message</span>
|
1365
|
+
<span class='ivar'>@prompted</span> <span class='op'>=</span> <span class='kw'>true</span> <span class='kw'>if</span> <span class='id prompt'>prompt</span><span class='period'>.</span><span class='id match'>match</span> <span class='id message'>message</span>
|
1366
|
+
<span class='kw'>end</span>
|
1367
|
+
<span class='ivar'>@process_runner</span> <span class='op'>=</span> <span class='id process_thread'>process_thread</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>runner</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
1368
|
+
<span class='kw'>end</span></pre>
|
1369
|
+
</td>
|
1370
|
+
</tr>
|
1371
|
+
</table>
|
1372
|
+
</div>
|
1373
|
+
|
1374
|
+
<div class="method_details ">
|
1375
|
+
<p class="signature " id="update_rake_task_name_from_args-instance_method">
|
1376
|
+
|
1377
|
+
- (<tt><span class='object_link'><a href="../../String.html" title="String (class)">String</a></span></tt>) <strong>update_rake_task_name_from_args</strong>(*args) <span class="extras">(protected)</span>
|
1378
|
+
|
1379
|
+
|
1380
|
+
|
1381
|
+
</p><div class="docstring">
|
1382
|
+
<div class="discussion">
|
1383
|
+
|
1384
|
+
<p>This is the override of the underlying Sprout::Executable template method
|
1385
|
+
so that we are NOT added to the CLEAN collection. (Work performed in the
|
1386
|
+
Executable)</p>
|
1387
|
+
|
1388
|
+
|
1389
|
+
</div>
|
1390
|
+
</div>
|
1391
|
+
<div class="tags">
|
1392
|
+
<h3>Returns:</h3>
|
1393
|
+
<ul class="return">
|
1394
|
+
|
1395
|
+
<li>
|
1396
|
+
|
1397
|
+
<span class='type'>(<tt><span class='object_link'><a href="../../String.html" title="String (class)">String</a></span></tt>)</span>
|
1398
|
+
|
1399
|
+
|
1400
|
+
|
1401
|
+
|
1402
|
+
</li>
|
1403
|
+
|
1404
|
+
</ul>
|
1405
|
+
|
1406
|
+
</div><table class="source_code">
|
1407
|
+
<tr>
|
1408
|
+
<td>
|
1409
|
+
<pre class="lines">
|
1410
|
+
|
1411
|
+
|
1412
|
+
263
|
1413
|
+
264
|
1414
|
+
265</pre>
|
1415
|
+
</td>
|
1416
|
+
<td>
|
1417
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/executable/session.rb', line 263</span>
|
1418
|
+
|
1419
|
+
<span class='kw'>def</span> <span class='id update_rake_task_name_from_args'>update_rake_task_name_from_args</span> <span class='op'>*</span><span class='id args'>args</span>
|
1420
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id rake_task_name'>rake_task_name</span> <span class='op'>=</span> <span class='id parse_rake_task_arg'>parse_rake_task_arg</span> <span class='id args'>args</span><span class='period'>.</span><span class='id last'>last</span>
|
1421
|
+
<span class='kw'>end</span></pre>
|
1422
|
+
</td>
|
1423
|
+
</tr>
|
1424
|
+
</table>
|
1425
|
+
</div>
|
1426
|
+
|
1427
|
+
<div class="method_details ">
|
1428
|
+
<p class="signature " id="wait-instance_method">
|
1429
|
+
|
1430
|
+
- (<tt>Object</tt>) <strong>wait</strong>
|
1431
|
+
|
1432
|
+
|
1433
|
+
|
1434
|
+
</p><table class="source_code">
|
1435
|
+
<tr>
|
1436
|
+
<td>
|
1437
|
+
<pre class="lines">
|
1438
|
+
|
1439
|
+
|
1440
|
+
204
|
1441
|
+
205
|
1442
|
+
206
|
1443
|
+
207</pre>
|
1444
|
+
</td>
|
1445
|
+
<td>
|
1446
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/executable/session.rb', line 204</span>
|
1447
|
+
|
1448
|
+
<span class='kw'>def</span> <span class='id wait'>wait</span>
|
1449
|
+
<span class='const'>Process</span><span class='period'>.</span><span class='id wait'>wait</span> <span class='id process_runner'>process_runner</span><span class='period'>.</span><span class='id pid'>pid</span>
|
1450
|
+
<span class='kw'>rescue</span> <span class='const'>Errno</span><span class='op'>::</span><span class='const'>ECHILD</span>
|
1451
|
+
<span class='kw'>end</span></pre>
|
1452
|
+
</td>
|
1453
|
+
</tr>
|
1454
|
+
</table>
|
1455
|
+
</div>
|
1456
|
+
|
1457
|
+
<div class="method_details ">
|
1458
|
+
<p class="signature " id="wait_for_prompt-instance_method">
|
1459
|
+
|
1460
|
+
- (<tt>Object</tt>) <strong>wait_for_prompt</strong>
|
1461
|
+
|
1462
|
+
|
1463
|
+
|
1464
|
+
</p><div class="docstring">
|
1465
|
+
<div class="discussion">
|
1466
|
+
|
1467
|
+
<p>Wait for the underlying process to present an input prompt, so that another
|
1468
|
+
action can be submitted, or user input can be collected.</p>
|
1469
|
+
|
1470
|
+
|
1471
|
+
</div>
|
1472
|
+
</div>
|
1473
|
+
<div class="tags">
|
1474
|
+
|
1475
|
+
</div><table class="source_code">
|
1476
|
+
<tr>
|
1477
|
+
<td>
|
1478
|
+
<pre class="lines">
|
1479
|
+
|
1480
|
+
|
1481
|
+
214
|
1482
|
+
215
|
1483
|
+
216
|
1484
|
+
217
|
1485
|
+
218
|
1486
|
+
219</pre>
|
1487
|
+
</td>
|
1488
|
+
<td>
|
1489
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/executable/session.rb', line 214</span>
|
1490
|
+
|
1491
|
+
<span class='kw'>def</span> <span class='id wait_for_prompt'>wait_for_prompt</span>
|
1492
|
+
<span class='kw'>while</span> <span class='id process_thread'>process_thread</span><span class='period'>.</span><span class='id alive?'>alive?</span> <span class='op'>&&</span> <span class='op'>!</span><span class='id prompted?'>prompted?</span>
|
1493
|
+
<span class='id sleep'>sleep</span> <span class='float'>0.2</span>
|
1494
|
+
<span class='kw'>end</span>
|
1495
|
+
<span class='id process_thread'>process_thread</span><span class='period'>.</span><span class='id alive?'>alive?</span>
|
1496
|
+
<span class='kw'>end</span></pre>
|
1497
|
+
</td>
|
1498
|
+
</tr>
|
1499
|
+
</table>
|
1500
|
+
</div>
|
1501
|
+
|
1502
|
+
</div>
|
1503
|
+
|
1504
|
+
</div>
|
1505
|
+
|
1506
|
+
<div id="footer">
|
1507
|
+
Generated on Fri Apr 29 18:33:08 2011 by
|
1508
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1509
|
+
0.6.3 (ruby-1.9.2).
|
1510
|
+
</div>
|
1511
|
+
|
1512
|
+
</body>
|
1513
|
+
</html>
|