ec2-host 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,616 @@
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
+ Class: EC2::Host::CLI
8
+
9
+ &mdash; Documentation by YARD 0.8.7.6
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../../css/style.css" type="text/css" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="../../css/common.css" type="text/css" 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#!EC2/Host/CLI.html";
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 (C)</a> &raquo;
35
+ <span class='title'><span class='object_link'><a href="../../EC2.html" title="EC2 (class)">EC2</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Host.html" title="EC2::Host (class)">Host</a></span></span>
36
+ &raquo;
37
+ <span class="title">CLI</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>Class: EC2::Host::CLI
67
+
68
+
69
+
70
+ </h1>
71
+
72
+ <dl class="box">
73
+
74
+ <dt class="r1">Inherits:</dt>
75
+ <dd class="r1">
76
+ <span class="inheritName">Object</span>
77
+
78
+ <ul class="fullTree">
79
+ <li>Object</li>
80
+
81
+ <li class="next">EC2::Host::CLI</li>
82
+
83
+ </ul>
84
+ <a href="#" class="inheritanceTree">show all</a>
85
+
86
+ </dd>
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+ <dt class="r2 last">Defined in:</dt>
97
+ <dd class="r2 last">lib/ec2/host/cli.rb</dd>
98
+
99
+ </dl>
100
+ <div class="clear"></div>
101
+
102
+
103
+
104
+
105
+
106
+ <h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
107
+ <ul class="summary">
108
+
109
+ <li class="public ">
110
+ <span class="summary_signature">
111
+
112
+ <a href="#options-instance_method" title="#options (instance method)">- (Object) <strong>options</strong> </a>
113
+
114
+
115
+
116
+ </span>
117
+
118
+
119
+
120
+
121
+ <span class="note title readonly">readonly</span>
122
+
123
+
124
+
125
+
126
+
127
+
128
+
129
+
130
+
131
+ <span class="summary_desc"><div class='inline'>
132
+ <p>Returns the value of attribute options.</p>
133
+ </div></span>
134
+
135
+ </li>
136
+
137
+
138
+ </ul>
139
+
140
+
141
+
142
+
143
+
144
+ <h2>
145
+ Instance Method Summary
146
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
147
+ </h2>
148
+
149
+ <ul class="summary">
150
+
151
+ <li class="public ">
152
+ <span class="summary_signature">
153
+
154
+ <a href="#initialize-instance_method" title="#initialize (instance method)">- (CLI) <strong>initialize</strong>(argv = ARGV) </a>
155
+
156
+
157
+
158
+ </span>
159
+
160
+
161
+ <span class="note title constructor">constructor</span>
162
+
163
+
164
+
165
+
166
+
167
+
168
+
169
+
170
+ <span class="summary_desc"><div class='inline'>
171
+ <p>A new instance of CLI.</p>
172
+ </div></span>
173
+
174
+ </li>
175
+
176
+
177
+ <li class="public ">
178
+ <span class="summary_signature">
179
+
180
+ <a href="#parse_options-instance_method" title="#parse_options (instance method)">- (Object) <strong>parse_options</strong>(argv = ARGV) </a>
181
+
182
+
183
+
184
+ </span>
185
+
186
+
187
+
188
+
189
+
190
+
191
+
192
+
193
+
194
+ <span class="summary_desc"><div class='inline'></div></span>
195
+
196
+ </li>
197
+
198
+
199
+ <li class="public ">
200
+ <span class="summary_signature">
201
+
202
+ <a href="#run-instance_method" title="#run (instance method)">- (Object) <strong>run</strong> </a>
203
+
204
+
205
+
206
+ </span>
207
+
208
+
209
+
210
+
211
+
212
+
213
+
214
+
215
+
216
+ <span class="summary_desc"><div class='inline'></div></span>
217
+
218
+ </li>
219
+
220
+
221
+ </ul>
222
+
223
+
224
+ <div id="constructor_details" class="method_details_list">
225
+ <h2>Constructor Details</h2>
226
+
227
+ <div class="method_details first">
228
+ <h3 class="signature first" id="initialize-instance_method">
229
+
230
+ - (<tt><span class='object_link'><a href="" title="EC2::Host::CLI (class)">CLI</a></span></tt>) <strong>initialize</strong>(argv = ARGV)
231
+
232
+
233
+
234
+
235
+
236
+ </h3><div class="docstring">
237
+ <div class="discussion">
238
+
239
+ <p>Returns a new instance of CLI</p>
240
+
241
+
242
+ </div>
243
+ </div>
244
+ <div class="tags">
245
+
246
+
247
+ </div><table class="source_code">
248
+ <tr>
249
+ <td>
250
+ <pre class="lines">
251
+
252
+
253
+ 9
254
+ 10
255
+ 11</pre>
256
+ </td>
257
+ <td>
258
+ <pre class="code"><span class="info file"># File 'lib/ec2/host/cli.rb', line 9</span>
259
+
260
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_argv'>argv</span> <span class='op'>=</span> <span class='const'>ARGV</span><span class='rparen'>)</span>
261
+ <span class='ivar'>@options</span> <span class='op'>=</span> <span class='id identifier rubyid_parse_options'>parse_options</span><span class='lparen'>(</span><span class='id identifier rubyid_argv'>argv</span><span class='rparen'>)</span>
262
+ <span class='kw'>end</span></pre>
263
+ </td>
264
+ </tr>
265
+ </table>
266
+ </div>
267
+
268
+ </div>
269
+
270
+ <div id="instance_attr_details" class="attr_details">
271
+ <h2>Instance Attribute Details</h2>
272
+
273
+
274
+ <span id=""></span>
275
+ <div class="method_details first">
276
+ <h3 class="signature first" id="options-instance_method">
277
+
278
+ - (<tt>Object</tt>) <strong>options</strong> <span class="extras">(readonly)</span>
279
+
280
+
281
+
282
+
283
+
284
+ </h3><div class="docstring">
285
+ <div class="discussion">
286
+
287
+ <p>Returns the value of attribute options</p>
288
+
289
+
290
+ </div>
291
+ </div>
292
+ <div class="tags">
293
+
294
+
295
+ </div><table class="source_code">
296
+ <tr>
297
+ <td>
298
+ <pre class="lines">
299
+
300
+
301
+ 7
302
+ 8
303
+ 9</pre>
304
+ </td>
305
+ <td>
306
+ <pre class="code"><span class="info file"># File 'lib/ec2/host/cli.rb', line 7</span>
307
+
308
+ <span class='kw'>def</span> <span class='id identifier rubyid_options'>options</span>
309
+ <span class='ivar'>@options</span>
310
+ <span class='kw'>end</span></pre>
311
+ </td>
312
+ </tr>
313
+ </table>
314
+ </div>
315
+
316
+ </div>
317
+
318
+
319
+ <div id="instance_method_details" class="method_details_list">
320
+ <h2>Instance Method Details</h2>
321
+
322
+
323
+ <div class="method_details first">
324
+ <h3 class="signature first" id="parse_options-instance_method">
325
+
326
+ - (<tt>Object</tt>) <strong>parse_options</strong>(argv = ARGV)
327
+
328
+
329
+
330
+
331
+
332
+ </h3><table class="source_code">
333
+ <tr>
334
+ <td>
335
+ <pre class="lines">
336
+
337
+
338
+ 13
339
+ 14
340
+ 15
341
+ 16
342
+ 17
343
+ 18
344
+ 19
345
+ 20
346
+ 21
347
+ 22
348
+ 23
349
+ 24
350
+ 25
351
+ 26
352
+ 27
353
+ 28
354
+ 29
355
+ 30
356
+ 31
357
+ 32
358
+ 33
359
+ 34
360
+ 35
361
+ 36
362
+ 37
363
+ 38
364
+ 39
365
+ 40
366
+ 41
367
+ 42
368
+ 43
369
+ 44
370
+ 45
371
+ 46
372
+ 47
373
+ 48
374
+ 49
375
+ 50
376
+ 51
377
+ 52
378
+ 53
379
+ 54
380
+ 55
381
+ 56
382
+ 57
383
+ 58
384
+ 59
385
+ 60
386
+ 61
387
+ 62
388
+ 63
389
+ 64
390
+ 65
391
+ 66
392
+ 67
393
+ 68
394
+ 69
395
+ 70
396
+ 71
397
+ 72
398
+ 73
399
+ 74
400
+ 75
401
+ 76
402
+ 77
403
+ 78
404
+ 79
405
+ 80
406
+ 81
407
+ 82
408
+ 83
409
+ 84
410
+ 85
411
+ 86
412
+ 87
413
+ 88
414
+ 89
415
+ 90
416
+ 91
417
+ 92
418
+ 93
419
+ 94
420
+ 95
421
+ 96
422
+ 97
423
+ 98
424
+ 99
425
+ 100
426
+ 101</pre>
427
+ </td>
428
+ <td>
429
+ <pre class="code"><span class="info file"># File 'lib/ec2/host/cli.rb', line 13</span>
430
+
431
+ <span class='kw'>def</span> <span class='id identifier rubyid_parse_options'>parse_options</span><span class='lparen'>(</span><span class='id identifier rubyid_argv'>argv</span> <span class='op'>=</span> <span class='const'>ARGV</span><span class='rparen'>)</span>
432
+ <span class='id identifier rubyid_op'>op</span> <span class='op'>=</span> <span class='const'>OptionParser</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
433
+
434
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_module_eval'>module_eval</span> <span class='kw'>do</span>
435
+ <span class='id identifier rubyid_define_method'>define_method</span><span class='lparen'>(</span><span class='symbol'>:usage</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_msg'>msg</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='op'>|</span>
436
+ <span class='id identifier rubyid_puts'>puts</span> <span class='id identifier rubyid_op'>op</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
437
+ <span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>error: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_msg'>msg</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_msg'>msg</span>
438
+ <span class='id identifier rubyid_exit'>exit</span> <span class='int'>1</span>
439
+ <span class='kw'>end</span>
440
+ <span class='kw'>end</span>
441
+
442
+ <span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='lbrace'>{</span>
443
+ <span class='label'>state:</span> <span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>running</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span>
444
+ <span class='rbrace'>}</span>
445
+
446
+ <span class='id identifier rubyid_op'>op</span><span class='period'>.</span><span class='id identifier rubyid_on'>on</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>--hostname one,two,three</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='const'>Array</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>name or private_dns_name</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span>
447
+ <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:hostname</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_v'>v</span>
448
+ <span class='rbrace'>}</span>
449
+ <span class='id identifier rubyid_op'>op</span><span class='period'>.</span><span class='id identifier rubyid_on'>on</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>-r</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>--role one,two,three</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='const'>Array</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>role</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span>
450
+ <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:role</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_v'>v</span>
451
+ <span class='rbrace'>}</span>
452
+ <span class='id identifier rubyid_op'>op</span><span class='period'>.</span><span class='id identifier rubyid_on'>on</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>--r1</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>--role1 one,two,three</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='const'>Array</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>role1, the 1st part of role delimited by </span><span class='embexpr_beg'>#{</span><span class='const'>Config</span><span class='period'>.</span><span class='id identifier rubyid_role_tag_delimiter'>role_tag_delimiter</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span>
453
+ <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:role1</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_v'>v</span>
454
+ <span class='rbrace'>}</span>
455
+ <span class='id identifier rubyid_op'>op</span><span class='period'>.</span><span class='id identifier rubyid_on'>on</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>--r2</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>--role2 one,two,three</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='const'>Array</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>role2, the 2st part of role delimited by </span><span class='embexpr_beg'>#{</span><span class='const'>Config</span><span class='period'>.</span><span class='id identifier rubyid_role_tag_delimiter'>role_tag_delimiter</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span>
456
+ <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:role2</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_v'>v</span>
457
+ <span class='rbrace'>}</span>
458
+ <span class='id identifier rubyid_op'>op</span><span class='period'>.</span><span class='id identifier rubyid_on'>on</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>--r3</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>--role3 one,two,three</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='const'>Array</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>role3, the 3st part of role delimited by </span><span class='embexpr_beg'>#{</span><span class='const'>Config</span><span class='period'>.</span><span class='id identifier rubyid_role_tag_delimiter'>role_tag_delimiter</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span>
459
+ <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:role3</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_v'>v</span>
460
+ <span class='rbrace'>}</span>
461
+ <span class='id identifier rubyid_op'>op</span><span class='period'>.</span><span class='id identifier rubyid_on'>on</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>--instance-id one,two,three</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='const'>Array</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>instance_id</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span>
462
+ <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:instance_id</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_v'>v</span>
463
+ <span class='rbrace'>}</span>
464
+ <span class='id identifier rubyid_op'>op</span><span class='period'>.</span><span class='id identifier rubyid_on'>on</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>--state one,two,three</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='const'>Array</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>filter with instance state (default: running)</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span>
465
+ <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:state</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_v'>v</span>
466
+ <span class='rbrace'>}</span>
467
+ <span class='id identifier rubyid_op'>op</span><span class='period'>.</span><span class='id identifier rubyid_on'>on</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>--monitoring one,two,three</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='const'>Array</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>filter with instance monitoring</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span>
468
+ <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:monitoring</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_v'>v</span>
469
+ <span class='rbrace'>}</span>
470
+ <span class='const'>Config</span><span class='period'>.</span><span class='id identifier rubyid_optional_options'>optional_options</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_opt'>opt</span><span class='comma'>,</span> <span class='id identifier rubyid_tag'>tag</span><span class='op'>|</span>
471
+ <span class='id identifier rubyid_op'>op</span><span class='period'>.</span><span class='id identifier rubyid_on'>on</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>--</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_opt'>opt</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>_</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>-</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'> one,two,three</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='const'>Array</span><span class='comma'>,</span> <span class='id identifier rubyid_opt'>opt</span><span class='rparen'>)</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span>
472
+ <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='id identifier rubyid_opt'>opt</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_v'>v</span>
473
+ <span class='rbrace'>}</span>
474
+ <span class='kw'>end</span>
475
+ <span class='id identifier rubyid_op'>op</span><span class='period'>.</span><span class='id identifier rubyid_on'>on</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>-a</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>--all</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>list all hosts (remove default filter)</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span>
476
+ <span class='lbracket'>[</span><span class='symbol'>:hostname</span><span class='comma'>,</span> <span class='symbol'>:role</span><span class='comma'>,</span> <span class='symbol'>:role1</span><span class='comma'>,</span> <span class='symbol'>:role2</span><span class='comma'>,</span> <span class='symbol'>:role3</span><span class='comma'>,</span> <span class='symbol'>:instance_id</span><span class='comma'>,</span> <span class='symbol'>:state</span><span class='comma'>,</span> <span class='symbol'>:monitoring</span><span class='rbracket'>]</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_key'>key</span><span class='op'>|</span>
477
+ <span class='id identifier rubyid_opts'>opts</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
478
+ <span class='kw'>end</span>
479
+ <span class='const'>Config</span><span class='period'>.</span><span class='id identifier rubyid_optional_options'>optional_options</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_opt'>opt</span><span class='comma'>,</span> <span class='id identifier rubyid_tag'>tag</span><span class='op'>|</span>
480
+ <span class='id identifier rubyid_opts'>opts</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_opt'>opt</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rparen'>)</span>
481
+ <span class='kw'>end</span>
482
+ <span class='rbrace'>}</span>
483
+ <span class='id identifier rubyid_op'>op</span><span class='period'>.</span><span class='id identifier rubyid_on'>on</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>--private-ip</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>--ip</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>show private ip address instead of hostname</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span>
484
+ <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:private_ip</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_v'>v</span>
485
+ <span class='rbrace'>}</span>
486
+ <span class='id identifier rubyid_op'>op</span><span class='period'>.</span><span class='id identifier rubyid_on'>on</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>--public-ip</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>show public ip address instead of hostname</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span>
487
+ <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:public_ip</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_v'>v</span>
488
+ <span class='rbrace'>}</span>
489
+ <span class='id identifier rubyid_op'>op</span><span class='period'>.</span><span class='id identifier rubyid_on'>on</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>-i</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>--info</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>show host info</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span>
490
+ <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:info</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_v'>v</span>
491
+ <span class='rbrace'>}</span>
492
+ <span class='id identifier rubyid_op'>op</span><span class='period'>.</span><span class='id identifier rubyid_on'>on</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>-j</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>--jsonl</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>show host info in line delimited json</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span>
493
+ <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:jsonl</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_v'>v</span>
494
+ <span class='rbrace'>}</span>
495
+ <span class='id identifier rubyid_op'>op</span><span class='period'>.</span><span class='id identifier rubyid_on'>on</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>--json</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>show host info in json</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span>
496
+ <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:json</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_v'>v</span>
497
+ <span class='rbrace'>}</span>
498
+ <span class='id identifier rubyid_op'>op</span><span class='period'>.</span><span class='id identifier rubyid_on'>on</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>--pretty-json</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>show host info in pretty json</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span>
499
+ <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:pretty_json</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_v'>v</span>
500
+ <span class='rbrace'>}</span>
501
+ <span class='id identifier rubyid_op'>op</span><span class='period'>.</span><span class='id identifier rubyid_on'>on</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>--debug</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>debug mode</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span>
502
+ <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:debug</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_v'>v</span>
503
+ <span class='rbrace'>}</span>
504
+ <span class='id identifier rubyid_op'>op</span><span class='period'>.</span><span class='id identifier rubyid_on'>on</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>-h</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>--help</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>show help</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span>
505
+ <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:help</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_v'>v</span>
506
+ <span class='rbrace'>}</span>
507
+
508
+ <span class='kw'>begin</span>
509
+ <span class='id identifier rubyid_args'>args</span> <span class='op'>=</span> <span class='id identifier rubyid_op'>op</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_argv'>argv</span><span class='rparen'>)</span>
510
+ <span class='kw'>rescue</span> <span class='const'>OptionParser</span><span class='op'>::</span><span class='const'>InvalidOption</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_e'>e</span>
511
+ <span class='id identifier rubyid_usage'>usage</span> <span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span>
512
+ <span class='kw'>end</span>
513
+
514
+ <span class='kw'>if</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:help</span><span class='rbracket'>]</span>
515
+ <span class='id identifier rubyid_usage'>usage</span>
516
+ <span class='kw'>end</span>
517
+
518
+ <span class='id identifier rubyid_opts'>opts</span>
519
+ <span class='kw'>end</span></pre>
520
+ </td>
521
+ </tr>
522
+ </table>
523
+ </div>
524
+
525
+ <div class="method_details ">
526
+ <h3 class="signature " id="run-instance_method">
527
+
528
+ - (<tt>Object</tt>) <strong>run</strong>
529
+
530
+
531
+
532
+
533
+
534
+ </h3><table class="source_code">
535
+ <tr>
536
+ <td>
537
+ <pre class="lines">
538
+
539
+
540
+ 103
541
+ 104
542
+ 105
543
+ 106
544
+ 107
545
+ 108
546
+ 109
547
+ 110
548
+ 111
549
+ 112
550
+ 113
551
+ 114
552
+ 115
553
+ 116
554
+ 117
555
+ 118
556
+ 119
557
+ 120
558
+ 121
559
+ 122
560
+ 123
561
+ 124
562
+ 125
563
+ 126
564
+ 127
565
+ 128
566
+ 129
567
+ 130</pre>
568
+ </td>
569
+ <td>
570
+ <pre class="code"><span class="info file"># File 'lib/ec2/host/cli.rb', line 103</span>
571
+
572
+ <span class='kw'>def</span> <span class='id identifier rubyid_run'>run</span>
573
+ <span class='id identifier rubyid_hosts'>hosts</span> <span class='op'>=</span> <span class='const'>EC2</span><span class='op'>::</span><span class='const'>Host</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_condition'>condition</span><span class='rparen'>)</span>
574
+ <span class='kw'>if</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:info</span><span class='rbracket'>]</span>
575
+ <span class='id identifier rubyid_hosts'>hosts</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_host'>host</span><span class='op'>|</span>
576
+ <span class='gvar'>$stdout</span><span class='period'>.</span><span class='id identifier rubyid_puts'>puts</span> <span class='id identifier rubyid_host'>host</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span>
577
+ <span class='kw'>end</span>
578
+ <span class='kw'>elsif</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:jsonl</span><span class='rbracket'>]</span>
579
+ <span class='id identifier rubyid_hosts'>hosts</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_host'>host</span><span class='op'>|</span>
580
+ <span class='gvar'>$stdout</span><span class='period'>.</span><span class='id identifier rubyid_puts'>puts</span> <span class='id identifier rubyid_host'>host</span><span class='period'>.</span><span class='id identifier rubyid_to_hash'>to_hash</span><span class='period'>.</span><span class='id identifier rubyid_to_json'>to_json</span>
581
+ <span class='kw'>end</span>
582
+ <span class='kw'>elsif</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:json</span><span class='rbracket'>]</span>
583
+ <span class='gvar'>$stdout</span><span class='period'>.</span><span class='id identifier rubyid_puts'>puts</span> <span class='id identifier rubyid_hosts'>hosts</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='symbol'>:to_hash</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_json'>to_json</span>
584
+ <span class='kw'>elsif</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:pretty_json</span><span class='rbracket'>]</span>
585
+ <span class='gvar'>$stdout</span><span class='period'>.</span><span class='id identifier rubyid_puts'>puts</span> <span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_pretty_generate'>pretty_generate</span><span class='lparen'>(</span><span class='id identifier rubyid_hosts'>hosts</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='symbol'>:to_hash</span><span class='rparen'>)</span><span class='rparen'>)</span>
586
+ <span class='kw'>elsif</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:private_ip</span><span class='rbracket'>]</span>
587
+ <span class='id identifier rubyid_hosts'>hosts</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_host'>host</span><span class='op'>|</span>
588
+ <span class='gvar'>$stdout</span><span class='period'>.</span><span class='id identifier rubyid_puts'>puts</span> <span class='id identifier rubyid_host'>host</span><span class='period'>.</span><span class='id identifier rubyid_private_ip_address'>private_ip_address</span>
589
+ <span class='kw'>end</span>
590
+ <span class='kw'>elsif</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:public_ip</span><span class='rbracket'>]</span>
591
+ <span class='id identifier rubyid_hosts'>hosts</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_host'>host</span><span class='op'>|</span>
592
+ <span class='gvar'>$stdout</span><span class='period'>.</span><span class='id identifier rubyid_puts'>puts</span> <span class='id identifier rubyid_host'>host</span><span class='period'>.</span><span class='id identifier rubyid_public_ip_address'>public_ip_address</span>
593
+ <span class='kw'>end</span>
594
+ <span class='kw'>else</span>
595
+ <span class='id identifier rubyid_hosts'>hosts</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_host'>host</span><span class='op'>|</span>
596
+ <span class='gvar'>$stdout</span><span class='period'>.</span><span class='id identifier rubyid_puts'>puts</span> <span class='id identifier rubyid_host'>host</span><span class='period'>.</span><span class='id identifier rubyid_hostname'>hostname</span>
597
+ <span class='kw'>end</span>
598
+ <span class='kw'>end</span>
599
+ <span class='kw'>end</span></pre>
600
+ </td>
601
+ </tr>
602
+ </table>
603
+ </div>
604
+
605
+ </div>
606
+
607
+ </div>
608
+
609
+ <div id="footer">
610
+ Generated on Thu Nov 24 10:25:36 2016 by
611
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
612
+ 0.8.7.6 (ruby-2.3.2).
613
+ </div>
614
+
615
+ </body>
616
+ </html>