bovem 1.2.6 → 2.0.0
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/.travis.yml +1 -1
- data/Gemfile +1 -1
- data/README.md +5 -2
- data/bovem.gemspec +11 -9
- data/doc/Bovem.html +7 -25
- data/doc/Bovem/Configuration.html +30 -43
- data/doc/Bovem/Console.html +225 -4360
- data/doc/Bovem/ConsoleMethods.html +125 -0
- data/doc/Bovem/ConsoleMethods/Interactions.html +575 -0
- data/doc/Bovem/ConsoleMethods/Interactions/ClassMethods.html +231 -0
- data/doc/Bovem/ConsoleMethods/Logging.html +2218 -0
- data/doc/Bovem/ConsoleMethods/Logging/ClassMethods.html +212 -0
- data/doc/Bovem/ConsoleMethods/Output.html +1213 -0
- data/doc/Bovem/ConsoleMethods/StyleHandling.html +274 -0
- data/doc/Bovem/ConsoleMethods/StyleHandling/ClassMethods.html +653 -0
- data/doc/Bovem/Errors.html +3 -3
- data/doc/Bovem/Errors/InvalidConfiguration.html +3 -3
- data/doc/Bovem/Errors/InvalidLogger.html +3 -3
- data/doc/Bovem/Logger.html +112 -12
- data/doc/Bovem/Shell.html +58 -1888
- data/doc/Bovem/ShellMethods.html +125 -0
- data/doc/Bovem/ShellMethods/Directories.html +484 -0
- data/doc/Bovem/ShellMethods/Execute.html +565 -0
- data/doc/Bovem/ShellMethods/General.html +450 -0
- data/doc/Bovem/ShellMethods/Read.html +451 -0
- data/doc/Bovem/ShellMethods/Write.html +676 -0
- data/doc/Bovem/Version.html +6 -6
- data/doc/_index.html +145 -4
- data/doc/class_list.html +1 -1
- data/doc/file.README.html +10 -7
- data/doc/frames.html +1 -1
- data/doc/index.html +10 -7
- data/doc/method_list.html +119 -79
- data/doc/top-level-namespace.html +3 -3
- data/lib/bovem.rb +1 -1
- data/lib/bovem/configuration.rb +24 -13
- data/lib/bovem/console.rb +566 -497
- data/lib/bovem/errors.rb +1 -1
- data/lib/bovem/logger.rb +4 -4
- data/lib/bovem/shell.rb +482 -305
- data/lib/bovem/version.rb +4 -4
- data/locales/en.yml +43 -0
- data/locales/it.yml +43 -0
- data/spec/bovem/configuration_spec.rb +3 -3
- data/spec/bovem/console_spec.rb +17 -10
- data/spec/bovem/logger_spec.rb +1 -1
- data/spec/bovem/shell_spec.rb +9 -5
- data/spec/coverage_helper.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- metadata +32 -22
@@ -0,0 +1,125 @@
|
|
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 http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Module: Bovem::ShellMethods
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.3
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '../';
|
20
|
+
framesUrl = "../frames.html#!" + escape(window.location.href);
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="../_index.html">Index (S)</a> »
|
35
|
+
<span class='title'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span>
|
36
|
+
»
|
37
|
+
<span class="title">ShellMethods</span>
|
38
|
+
|
39
|
+
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="search">
|
44
|
+
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="../class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
49
|
+
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="../method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
54
|
+
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="../file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
<div class="clear"></div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<iframe id="search_frame"></iframe>
|
65
|
+
|
66
|
+
<div id="content"><h1>Module: Bovem::ShellMethods
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
<dt class="r1 last">Defined in:</dt>
|
82
|
+
<dd class="r1 last">lib/bovem/shell.rb</dd>
|
83
|
+
|
84
|
+
</dl>
|
85
|
+
<div class="clear"></div>
|
86
|
+
|
87
|
+
<h2>Overview</h2><div class="docstring">
|
88
|
+
<div class="discussion">
|
89
|
+
<p>Methods of the <span class='object_link'><a href="Shell.html" title="Bovem::Shell (class)">Shell</a></span> class.</p>
|
90
|
+
|
91
|
+
|
92
|
+
</div>
|
93
|
+
</div>
|
94
|
+
<div class="tags">
|
95
|
+
|
96
|
+
|
97
|
+
</div><h2>Defined Under Namespace</h2>
|
98
|
+
<p class="children">
|
99
|
+
|
100
|
+
|
101
|
+
<strong class="modules">Modules:</strong> <span class='object_link'><a href="ShellMethods/Directories.html" title="Bovem::ShellMethods::Directories (module)">Directories</a></span>, <span class='object_link'><a href="ShellMethods/Execute.html" title="Bovem::ShellMethods::Execute (module)">Execute</a></span>, <span class='object_link'><a href="ShellMethods/General.html" title="Bovem::ShellMethods::General (module)">General</a></span>, <span class='object_link'><a href="ShellMethods/Read.html" title="Bovem::ShellMethods::Read (module)">Read</a></span>, <span class='object_link'><a href="ShellMethods/Write.html" title="Bovem::ShellMethods::Write (module)">Write</a></span>
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
</p>
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
</div>
|
117
|
+
|
118
|
+
<div id="footer">
|
119
|
+
Generated on Fri Feb 1 23:40:17 2013 by
|
120
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
121
|
+
0.8.3 (ruby-1.9.3).
|
122
|
+
</div>
|
123
|
+
|
124
|
+
</body>
|
125
|
+
</html>
|
@@ -0,0 +1,484 @@
|
|
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 http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Module: Bovem::ShellMethods::Directories
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.3
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../../css/style.css" type="text/css" media="screen" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '../../';
|
20
|
+
framesUrl = "../../frames.html#!" + escape(window.location.href);
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="../../_index.html">Index (D)</a> »
|
35
|
+
<span class='title'><span class='object_link'><a href="../../Bovem.html" title="Bovem (module)">Bovem</a></span></span> » <span class='title'><span class='object_link'><a href="../ShellMethods.html" title="Bovem::ShellMethods (module)">ShellMethods</a></span></span>
|
36
|
+
»
|
37
|
+
<span class="title">Directories</span>
|
38
|
+
|
39
|
+
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="search">
|
44
|
+
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="../../class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
49
|
+
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="../../method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
54
|
+
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="../../file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
<div class="clear"></div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<iframe id="search_frame"></iframe>
|
65
|
+
|
66
|
+
<div id="content"><h1>Module: Bovem::ShellMethods::Directories
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
<dt class="r1">Included in:</dt>
|
81
|
+
<dd class="r1"><span class='object_link'><a href="../Shell.html" title="Bovem::Shell (class)">Bovem::Shell</a></span></dd>
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
<dt class="r2 last">Defined in:</dt>
|
86
|
+
<dd class="r2 last">lib/bovem/shell.rb</dd>
|
87
|
+
|
88
|
+
</dl>
|
89
|
+
<div class="clear"></div>
|
90
|
+
|
91
|
+
<h2>Overview</h2><div class="docstring">
|
92
|
+
<div class="discussion">
|
93
|
+
<p>Methods to interact with directories.</p>
|
94
|
+
|
95
|
+
|
96
|
+
</div>
|
97
|
+
</div>
|
98
|
+
<div class="tags">
|
99
|
+
|
100
|
+
|
101
|
+
</div>
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
<h2>
|
110
|
+
Instance Method Summary
|
111
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
112
|
+
</h2>
|
113
|
+
|
114
|
+
<ul class="summary">
|
115
|
+
|
116
|
+
<li class="public ">
|
117
|
+
<span class="summary_signature">
|
118
|
+
|
119
|
+
<a href="#create_directories-instance_method" title="#create_directories (instance method)">- (Boolean) <strong>create_directories</strong>(directories, mode = 0755, run = true, show_errors = false, fatal = true) </a>
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
</span>
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
<span class="summary_desc"><div class='inline'><p>Creates a list of directories, included missing parent directories.</p>
|
134
|
+
</div></span>
|
135
|
+
|
136
|
+
</li>
|
137
|
+
|
138
|
+
|
139
|
+
<li class="public ">
|
140
|
+
<span class="summary_signature">
|
141
|
+
|
142
|
+
<a href="#within_directory-instance_method" title="#within_directory (instance method)">- (Boolean) <strong>within_directory</strong>(directory, restore = true, show_messages = false) </a>
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
</span>
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
<span class="summary_desc"><div class='inline'><p>Executes a block of code in another directory.</p>
|
157
|
+
</div></span>
|
158
|
+
|
159
|
+
</li>
|
160
|
+
|
161
|
+
|
162
|
+
</ul>
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
<div id="instance_method_details" class="method_details_list">
|
168
|
+
<h2>Instance Method Details</h2>
|
169
|
+
|
170
|
+
|
171
|
+
<div class="method_details first">
|
172
|
+
<h3 class="signature first" id="create_directories-instance_method">
|
173
|
+
|
174
|
+
- (<tt>Boolean</tt>) <strong>create_directories</strong>(directories, mode = 0755, run = true, show_errors = false, fatal = true)
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
|
180
|
+
</h3><div class="docstring">
|
181
|
+
<div class="discussion">
|
182
|
+
<p>Creates a list of directories, included missing parent directories.</p>
|
183
|
+
|
184
|
+
|
185
|
+
</div>
|
186
|
+
</div>
|
187
|
+
<div class="tags">
|
188
|
+
<p class="tag_title">Parameters:</p>
|
189
|
+
<ul class="param">
|
190
|
+
|
191
|
+
<li>
|
192
|
+
|
193
|
+
<span class='name'>directories</span>
|
194
|
+
|
195
|
+
|
196
|
+
<span class='type'>(<tt>Array</tt>)</span>
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
—
|
201
|
+
<div class='inline'><p>The list of directories to create.</p>
|
202
|
+
</div>
|
203
|
+
|
204
|
+
</li>
|
205
|
+
|
206
|
+
<li>
|
207
|
+
|
208
|
+
<span class='name'>mode</span>
|
209
|
+
|
210
|
+
|
211
|
+
<span class='type'>(<tt>Fixnum</tt>)</span>
|
212
|
+
|
213
|
+
|
214
|
+
<em class="default">(defaults to: <tt>0755</tt>)</em>
|
215
|
+
|
216
|
+
|
217
|
+
—
|
218
|
+
<div class='inline'><p>Initial permissions for the new directories.</p>
|
219
|
+
</div>
|
220
|
+
|
221
|
+
</li>
|
222
|
+
|
223
|
+
<li>
|
224
|
+
|
225
|
+
<span class='name'>run</span>
|
226
|
+
|
227
|
+
|
228
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
229
|
+
|
230
|
+
|
231
|
+
<em class="default">(defaults to: <tt>true</tt>)</em>
|
232
|
+
|
233
|
+
|
234
|
+
—
|
235
|
+
<div class='inline'><p>If <code>false</code>, it will just print a list of directories that would be created.</p>
|
236
|
+
</div>
|
237
|
+
|
238
|
+
</li>
|
239
|
+
|
240
|
+
<li>
|
241
|
+
|
242
|
+
<span class='name'>show_errors</span>
|
243
|
+
|
244
|
+
|
245
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
246
|
+
|
247
|
+
|
248
|
+
<em class="default">(defaults to: <tt>false</tt>)</em>
|
249
|
+
|
250
|
+
|
251
|
+
—
|
252
|
+
<div class='inline'><p>If show errors.</p>
|
253
|
+
</div>
|
254
|
+
|
255
|
+
</li>
|
256
|
+
|
257
|
+
<li>
|
258
|
+
|
259
|
+
<span class='name'>fatal</span>
|
260
|
+
|
261
|
+
|
262
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
263
|
+
|
264
|
+
|
265
|
+
<em class="default">(defaults to: <tt>true</tt>)</em>
|
266
|
+
|
267
|
+
|
268
|
+
—
|
269
|
+
<div class='inline'><p>If quit in case of fatal errors.</p>
|
270
|
+
</div>
|
271
|
+
|
272
|
+
</li>
|
273
|
+
|
274
|
+
</ul>
|
275
|
+
|
276
|
+
<p class="tag_title">Returns:</p>
|
277
|
+
<ul class="return">
|
278
|
+
|
279
|
+
<li>
|
280
|
+
|
281
|
+
|
282
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
283
|
+
|
284
|
+
|
285
|
+
|
286
|
+
—
|
287
|
+
<div class='inline'><p><code>true</code> if operation succeeded, <code>false</code> otherwise.</p>
|
288
|
+
</div>
|
289
|
+
|
290
|
+
</li>
|
291
|
+
|
292
|
+
</ul>
|
293
|
+
|
294
|
+
</div><table class="source_code">
|
295
|
+
<tr>
|
296
|
+
<td>
|
297
|
+
<pre class="lines">
|
298
|
+
|
299
|
+
|
300
|
+
446
|
301
|
+
447
|
302
|
+
448
|
303
|
+
449
|
304
|
+
450
|
305
|
+
451
|
306
|
+
452
|
307
|
+
453
|
308
|
+
454
|
309
|
+
455
|
310
|
+
456
|
311
|
+
457
|
312
|
+
458
|
313
|
+
459
|
314
|
+
460
|
315
|
+
461
|
316
|
+
462</pre>
|
317
|
+
</td>
|
318
|
+
<td>
|
319
|
+
<pre class="code"><span class="info file"># File 'lib/bovem/shell.rb', line 446</span>
|
320
|
+
|
321
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_create_directories'>create_directories</span><span class='lparen'>(</span><span class='id identifier rubyid_directories'>directories</span><span class='comma'>,</span> <span class='id identifier rubyid_mode'>mode</span> <span class='op'>=</span> <span class='int'>0755</span><span class='comma'>,</span> <span class='id identifier rubyid_run'>run</span> <span class='op'>=</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='id identifier rubyid_show_errors'>show_errors</span> <span class='op'>=</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='id identifier rubyid_fatal'>fatal</span> <span class='op'>=</span> <span class='kw'>true</span><span class='rparen'>)</span>
|
322
|
+
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='kw'>true</span>
|
323
|
+
|
324
|
+
<span class='comment'># Adjust directory
|
325
|
+
</span> <span class='id identifier rubyid_directories'>directories</span> <span class='op'>=</span> <span class='id identifier rubyid_directories'>directories</span><span class='period'>.</span><span class='id identifier rubyid_ensure_array'>ensure_array</span><span class='period'>.</span><span class='id identifier rubyid_compact'>compact</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_d'>d</span><span class='op'>|</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='id identifier rubyid_d'>d</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
326
|
+
|
327
|
+
<span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_run'>run</span> <span class='kw'>then</span> <span class='comment'># Just print
|
328
|
+
</span> <span class='id identifier rubyid_dry_run_directory_creation'>dry_run_directory_creation</span><span class='lparen'>(</span><span class='id identifier rubyid_directories'>directories</span><span class='rparen'>)</span>
|
329
|
+
<span class='kw'>else</span>
|
330
|
+
<span class='id identifier rubyid_directories'>directories</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_directory'>directory</span><span class='op'>|</span>
|
331
|
+
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='id identifier rubyid_rv'>rv</span> <span class='op'>&&</span> <span class='id identifier rubyid_try_create_directory'>try_create_directory</span><span class='lparen'>(</span><span class='id identifier rubyid_directory'>directory</span><span class='comma'>,</span> <span class='id identifier rubyid_mode'>mode</span><span class='comma'>,</span> <span class='id identifier rubyid_fatal'>fatal</span><span class='comma'>,</span> <span class='id identifier rubyid_directories'>directories</span><span class='comma'>,</span> <span class='id identifier rubyid_show_errors'>show_errors</span><span class='rparen'>)</span>
|
332
|
+
<span class='kw'>break</span> <span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_rv'>rv</span>
|
333
|
+
<span class='kw'>end</span>
|
334
|
+
<span class='kw'>end</span>
|
335
|
+
|
336
|
+
<span class='id identifier rubyid_rv'>rv</span>
|
337
|
+
<span class='kw'>end</span></pre>
|
338
|
+
</td>
|
339
|
+
</tr>
|
340
|
+
</table>
|
341
|
+
</div>
|
342
|
+
|
343
|
+
<div class="method_details ">
|
344
|
+
<h3 class="signature " id="within_directory-instance_method">
|
345
|
+
|
346
|
+
- (<tt>Boolean</tt>) <strong>within_directory</strong>(directory, restore = true, show_messages = false)
|
347
|
+
|
348
|
+
|
349
|
+
|
350
|
+
|
351
|
+
|
352
|
+
</h3><div class="docstring">
|
353
|
+
<div class="discussion">
|
354
|
+
<p>Executes a block of code in another directory.</p>
|
355
|
+
|
356
|
+
|
357
|
+
</div>
|
358
|
+
</div>
|
359
|
+
<div class="tags">
|
360
|
+
<p class="tag_title">Parameters:</p>
|
361
|
+
<ul class="param">
|
362
|
+
|
363
|
+
<li>
|
364
|
+
|
365
|
+
<span class='name'>directory</span>
|
366
|
+
|
367
|
+
|
368
|
+
<span class='type'>(<tt>String</tt>)</span>
|
369
|
+
|
370
|
+
|
371
|
+
|
372
|
+
—
|
373
|
+
<div class='inline'><p>The new working directory.</p>
|
374
|
+
</div>
|
375
|
+
|
376
|
+
</li>
|
377
|
+
|
378
|
+
<li>
|
379
|
+
|
380
|
+
<span class='name'>restore</span>
|
381
|
+
|
382
|
+
|
383
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
384
|
+
|
385
|
+
|
386
|
+
<em class="default">(defaults to: <tt>true</tt>)</em>
|
387
|
+
|
388
|
+
|
389
|
+
—
|
390
|
+
<div class='inline'><p>If to restore the original working directory.</p>
|
391
|
+
</div>
|
392
|
+
|
393
|
+
</li>
|
394
|
+
|
395
|
+
<li>
|
396
|
+
|
397
|
+
<span class='name'>show_messages</span>
|
398
|
+
|
399
|
+
|
400
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
401
|
+
|
402
|
+
|
403
|
+
<em class="default">(defaults to: <tt>false</tt>)</em>
|
404
|
+
|
405
|
+
|
406
|
+
—
|
407
|
+
<div class='inline'><p>Show informative messages about working directory changes.</p>
|
408
|
+
</div>
|
409
|
+
|
410
|
+
</li>
|
411
|
+
|
412
|
+
</ul>
|
413
|
+
|
414
|
+
<p class="tag_title">Returns:</p>
|
415
|
+
<ul class="return">
|
416
|
+
|
417
|
+
<li>
|
418
|
+
|
419
|
+
|
420
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
421
|
+
|
422
|
+
|
423
|
+
|
424
|
+
—
|
425
|
+
<div class='inline'><p><code>true</code> if the directory was valid and the code executed, <code>false</code> otherwise.</p>
|
426
|
+
</div>
|
427
|
+
|
428
|
+
</li>
|
429
|
+
|
430
|
+
</ul>
|
431
|
+
|
432
|
+
</div><table class="source_code">
|
433
|
+
<tr>
|
434
|
+
<td>
|
435
|
+
<pre class="lines">
|
436
|
+
|
437
|
+
|
438
|
+
424
|
439
|
+
425
|
440
|
+
426
|
441
|
+
427
|
442
|
+
428
|
443
|
+
429
|
444
|
+
430
|
445
|
+
431
|
446
|
+
432
|
447
|
+
433
|
448
|
+
434
|
449
|
+
435
|
450
|
+
436</pre>
|
451
|
+
</td>
|
452
|
+
<td>
|
453
|
+
<pre class="code"><span class="info file"># File 'lib/bovem/shell.rb', line 424</span>
|
454
|
+
|
455
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_within_directory'>within_directory</span><span class='lparen'>(</span><span class='id identifier rubyid_directory'>directory</span><span class='comma'>,</span> <span class='id identifier rubyid_restore'>restore</span> <span class='op'>=</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='id identifier rubyid_show_messages'>show_messages</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span>
|
456
|
+
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='kw'>false</span>
|
457
|
+
<span class='id identifier rubyid_locale'>locale</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_shell'>shell</span>
|
458
|
+
|
459
|
+
<span class='id identifier rubyid_directory'>directory</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='id identifier rubyid_directory'>directory</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span><span class='rparen'>)</span>
|
460
|
+
<span class='id identifier rubyid_original'>original</span> <span class='op'>=</span> <span class='const'>Dir</span><span class='period'>.</span><span class='id identifier rubyid_pwd'>pwd</span>
|
461
|
+
|
462
|
+
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='id identifier rubyid_enter_directory'>enter_directory</span><span class='lparen'>(</span><span class='id identifier rubyid_directory'>directory</span><span class='comma'>,</span> <span class='id identifier rubyid_show_messages'>show_messages</span><span class='comma'>,</span> <span class='id identifier rubyid_locale'>locale</span><span class='period'>.</span><span class='id identifier rubyid_move_in'>move_in</span><span class='lparen'>(</span><span class='id identifier rubyid_directory'>directory</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
463
|
+
<span class='kw'>yield</span> <span class='kw'>if</span> <span class='id identifier rubyid_rv'>rv</span> <span class='op'>&&</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
|
464
|
+
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='id identifier rubyid_enter_directory'>enter_directory</span><span class='lparen'>(</span><span class='id identifier rubyid_original'>original</span><span class='comma'>,</span> <span class='id identifier rubyid_show_messages'>show_messages</span><span class='comma'>,</span> <span class='id identifier rubyid_locale'>locale</span><span class='period'>.</span><span class='id identifier rubyid_move_out'>move_out</span><span class='lparen'>(</span><span class='id identifier rubyid_directory'>directory</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_rv'>rv</span> <span class='op'>&&</span> <span class='id identifier rubyid_restore'>restore</span>
|
465
|
+
|
466
|
+
<span class='id identifier rubyid_rv'>rv</span>
|
467
|
+
<span class='kw'>end</span></pre>
|
468
|
+
</td>
|
469
|
+
</tr>
|
470
|
+
</table>
|
471
|
+
</div>
|
472
|
+
|
473
|
+
</div>
|
474
|
+
|
475
|
+
</div>
|
476
|
+
|
477
|
+
<div id="footer">
|
478
|
+
Generated on Fri Feb 1 23:40:17 2013 by
|
479
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
480
|
+
0.8.3 (ruby-1.9.3).
|
481
|
+
</div>
|
482
|
+
|
483
|
+
</body>
|
484
|
+
</html>
|