triglav-agent 1.0.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +2 -0
- data/.travis.yml +6 -0
- data/.yardopts +6 -0
- data/CHANGELOG.md +3 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/Gemfile +5 -0
- data/LICENSE.txt +21 -0
- data/README.md +59 -0
- data/Rakefile +11 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/docs/Triglav/Agent/ApiClient/AuthenticationError.html +150 -0
- data/docs/Triglav/Agent/ApiClient/ConnectionError.html +150 -0
- data/docs/Triglav/Agent/ApiClient/Error.html +296 -0
- data/docs/Triglav/Agent/ApiClient.html +545 -0
- data/docs/Triglav/Agent/Base/CLI.html +498 -0
- data/docs/Triglav/Agent/Base/Connection.html +258 -0
- data/docs/Triglav/Agent/Base/Monitor.html +370 -0
- data/docs/Triglav/Agent/Base/Processor.html +623 -0
- data/docs/Triglav/Agent/Base/Setting.html +1081 -0
- data/docs/Triglav/Agent/Base/Worker.html +635 -0
- data/docs/Triglav/Agent/Base.html +121 -0
- data/docs/Triglav/Agent/Configuration.html +967 -0
- data/docs/Triglav/Agent/Error.html +130 -0
- data/docs/Triglav/Agent/HashUtil.html +351 -0
- data/docs/Triglav/Agent/LogFormatter.html +271 -0
- data/docs/Triglav/Agent/Logger.html +287 -0
- data/docs/Triglav/Agent/StorageFile.html +1130 -0
- data/docs/Triglav/Agent/Timer.html +424 -0
- data/docs/Triglav/Agent/TooManyError.html +134 -0
- data/docs/Triglav/Agent.html +131 -0
- data/docs/Triglav.html +119 -0
- data/docs/_index.html +335 -0
- data/docs/class_list.html +51 -0
- data/docs/css/common.css +1 -0
- data/docs/css/full_list.css +58 -0
- data/docs/css/style.css +481 -0
- data/docs/file.LICENSE.html +72 -0
- data/docs/file.README.html +137 -0
- data/docs/file_list.html +61 -0
- data/docs/frames.html +17 -0
- data/docs/index.html +137 -0
- data/docs/js/app.js +243 -0
- data/docs/js/full_list.js +216 -0
- data/docs/js/jquery.js +4 -0
- data/docs/method_list.html +659 -0
- data/docs/top-level-namespace.html +112 -0
- data/example/config.yml +40 -0
- data/lib/triglav/agent/api_client.rb +199 -0
- data/lib/triglav/agent/base/cli.rb +98 -0
- data/lib/triglav/agent/base/connection.rb +30 -0
- data/lib/triglav/agent/base/monitor.rb +32 -0
- data/lib/triglav/agent/base/processor.rb +136 -0
- data/lib/triglav/agent/base/setting.rb +112 -0
- data/lib/triglav/agent/base/worker.rb +95 -0
- data/lib/triglav/agent/configuration.rb +79 -0
- data/lib/triglav/agent/error.rb +4 -0
- data/lib/triglav/agent/hash_util.rb +36 -0
- data/lib/triglav/agent/logger.rb +50 -0
- data/lib/triglav/agent/storage_file.rb +144 -0
- data/lib/triglav/agent/timer.rb +80 -0
- data/lib/triglav/agent/version.rb +5 -0
- data/lib/triglav/agent.rb +20 -0
- data/lib/triglav-agent.rb +1 -0
- data/triglav-agent.gemspec +33 -0
- metadata +250 -0
@@ -0,0 +1,498 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>
|
7
|
+
Class: Triglav::Agent::Base::CLI
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.5
|
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
|
+
pathId = "Triglav::Agent::Base::CLI";
|
19
|
+
relpath = '../../../';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
|
23
|
+
<script type="text/javascript" charset="utf-8" src="../../../js/jquery.js"></script>
|
24
|
+
|
25
|
+
<script type="text/javascript" charset="utf-8" src="../../../js/app.js"></script>
|
26
|
+
|
27
|
+
|
28
|
+
</head>
|
29
|
+
<body>
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="../../../class_list.html"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
38
|
+
|
39
|
+
<a href="../../../_index.html">Index (C)</a> »
|
40
|
+
<span class='title'><span class='object_link'><a href="../../../Triglav.html" title="Triglav (module)">Triglav</a></span></span> » <span class='title'><span class='object_link'><a href="../../Agent.html" title="Triglav::Agent (module)">Agent</a></span></span> » <span class='title'><span class='object_link'><a href="../Base.html" title="Triglav::Agent::Base (module)">Base</a></span></span>
|
41
|
+
»
|
42
|
+
<span class="title">CLI</span>
|
43
|
+
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<div id="search">
|
47
|
+
|
48
|
+
<a class="full_list_link" id="class_list_link"
|
49
|
+
href="../../../class_list.html">
|
50
|
+
|
51
|
+
<svg width="24" height="24">
|
52
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
54
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
55
|
+
</svg>
|
56
|
+
</a>
|
57
|
+
|
58
|
+
</div>
|
59
|
+
<div class="clear"></div>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<iframe id="search_frame" src="../../../class_list.html"></iframe>
|
63
|
+
|
64
|
+
<div id="content"><h1>Class: Triglav::Agent::Base::CLI
|
65
|
+
|
66
|
+
|
67
|
+
|
68
|
+
</h1>
|
69
|
+
<div class="box_info">
|
70
|
+
|
71
|
+
<dl>
|
72
|
+
<dt>Inherits:</dt>
|
73
|
+
<dd>
|
74
|
+
<span class="inheritName">Object</span>
|
75
|
+
|
76
|
+
<ul class="fullTree">
|
77
|
+
<li>Object</li>
|
78
|
+
|
79
|
+
<li class="next">Triglav::Agent::Base::CLI</li>
|
80
|
+
|
81
|
+
</ul>
|
82
|
+
<a href="#" class="inheritanceTree">show all</a>
|
83
|
+
|
84
|
+
</dd>
|
85
|
+
</dl>
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
<dl>
|
98
|
+
<dt>Defined in:</dt>
|
99
|
+
<dd>lib/triglav/agent/base/cli.rb</dd>
|
100
|
+
</dl>
|
101
|
+
|
102
|
+
</div>
|
103
|
+
|
104
|
+
<h2>Overview</h2><div class="docstring">
|
105
|
+
<div class="discussion">
|
106
|
+
|
107
|
+
<p>A base class for cli option parser</p>
|
108
|
+
|
109
|
+
<p>This base class usually should be enough for agent plugins, but you can
|
110
|
+
override this class and configure with Configuration#cli_classe=</p>
|
111
|
+
|
112
|
+
|
113
|
+
</div>
|
114
|
+
</div>
|
115
|
+
<div class="tags">
|
116
|
+
|
117
|
+
|
118
|
+
</div>
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
<h2>
|
127
|
+
Instance Method Summary
|
128
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
129
|
+
</h2>
|
130
|
+
|
131
|
+
<ul class="summary">
|
132
|
+
|
133
|
+
<li class="public ">
|
134
|
+
<span class="summary_signature">
|
135
|
+
|
136
|
+
<a href="#default_opts-instance_method" title="#default_opts (instance method)">#<strong>default_opts</strong> ⇒ Object </a>
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
</span>
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
151
|
+
|
152
|
+
</li>
|
153
|
+
|
154
|
+
|
155
|
+
<li class="public ">
|
156
|
+
<span class="summary_signature">
|
157
|
+
|
158
|
+
<a href="#option_parser-instance_method" title="#option_parser (instance method)">#<strong>option_parser</strong>(opts = {}) ⇒ Object </a>
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
</span>
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
<span class="summary_desc"><div class='inline'></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)">#<strong>parse_options</strong>(argv = ARGV) ⇒ Object </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)">#<strong>run</strong> ⇒ Object </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
|
+
|
225
|
+
|
226
|
+
<div id="instance_method_details" class="method_details_list">
|
227
|
+
<h2>Instance Method Details</h2>
|
228
|
+
|
229
|
+
|
230
|
+
<div class="method_details first">
|
231
|
+
<h3 class="signature first" id="default_opts-instance_method">
|
232
|
+
|
233
|
+
#<strong>default_opts</strong> ⇒ <tt>Object</tt>
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
</h3><table class="source_code">
|
240
|
+
<tr>
|
241
|
+
<td>
|
242
|
+
<pre class="lines">
|
243
|
+
|
244
|
+
|
245
|
+
23
|
246
|
+
24
|
247
|
+
25
|
248
|
+
26
|
249
|
+
27
|
250
|
+
28
|
251
|
+
29</pre>
|
252
|
+
</td>
|
253
|
+
<td>
|
254
|
+
<pre class="code"><span class="info file"># File 'lib/triglav/agent/base/cli.rb', line 23</span>
|
255
|
+
|
256
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_default_opts'>default_opts</span>
|
257
|
+
<span class='lbrace'>{</span>
|
258
|
+
<span class='label'>config:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>config.yml</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
|
259
|
+
<span class='label'>dotenv:</span> <span class='kw'>false</span><span class='comma'>,</span>
|
260
|
+
<span class='label'>debug:</span> <span class='kw'>false</span><span class='comma'>,</span>
|
261
|
+
<span class='rbrace'>}</span>
|
262
|
+
<span class='kw'>end</span></pre>
|
263
|
+
</td>
|
264
|
+
</tr>
|
265
|
+
</table>
|
266
|
+
</div>
|
267
|
+
|
268
|
+
<div class="method_details ">
|
269
|
+
<h3 class="signature " id="option_parser-instance_method">
|
270
|
+
|
271
|
+
#<strong>option_parser</strong>(opts = {}) ⇒ <tt>Object</tt>
|
272
|
+
|
273
|
+
|
274
|
+
|
275
|
+
|
276
|
+
|
277
|
+
</h3><table class="source_code">
|
278
|
+
<tr>
|
279
|
+
<td>
|
280
|
+
<pre class="lines">
|
281
|
+
|
282
|
+
|
283
|
+
31
|
284
|
+
32
|
285
|
+
33
|
286
|
+
34
|
287
|
+
35
|
288
|
+
36
|
289
|
+
37
|
290
|
+
38
|
291
|
+
39
|
292
|
+
40
|
293
|
+
41
|
294
|
+
42
|
295
|
+
43
|
296
|
+
44
|
297
|
+
45
|
298
|
+
46
|
299
|
+
47
|
300
|
+
48
|
301
|
+
49
|
302
|
+
50
|
303
|
+
51
|
304
|
+
52
|
305
|
+
53
|
306
|
+
54
|
307
|
+
55
|
308
|
+
56
|
309
|
+
57
|
310
|
+
58
|
311
|
+
59
|
312
|
+
60
|
313
|
+
61
|
314
|
+
62
|
315
|
+
63
|
316
|
+
64
|
317
|
+
65
|
318
|
+
66
|
319
|
+
67
|
320
|
+
68
|
321
|
+
69
|
322
|
+
70
|
323
|
+
71</pre>
|
324
|
+
</td>
|
325
|
+
<td>
|
326
|
+
<pre class="code"><span class="info file"># File 'lib/triglav/agent/base/cli.rb', line 31</span>
|
327
|
+
|
328
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_option_parser'>option_parser</span><span class='lparen'>(</span><span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
329
|
+
<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>
|
330
|
+
|
331
|
+
<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>
|
332
|
+
<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>
|
333
|
+
<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>
|
334
|
+
<span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>"</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'>"</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_msg'>msg</span>
|
335
|
+
<span class='id identifier rubyid_exit'>exit</span> <span class='int'>1</span>
|
336
|
+
<span class='kw'>end</span>
|
337
|
+
<span class='kw'>end</span>
|
338
|
+
|
339
|
+
<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'>'</span><span class='tstring_content'>-c</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>--config VALUE</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Config file (default: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:config</span><span class='rbracket'>]</span><span class='embexpr_end'>}</span><span class='tstring_content'>)</span><span class='tstring_end'>"</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>
|
340
|
+
<span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:config</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_v'>v</span>
|
341
|
+
<span class='rbrace'>}</span>
|
342
|
+
<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'>'</span><span class='tstring_content'>-s</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>--status VALUE</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Status stroage file (default: status.yml)</span><span class='tstring_end'>"</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>
|
343
|
+
<span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:status</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_v'>v</span>
|
344
|
+
<span class='rbrace'>}</span>
|
345
|
+
<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'>'</span><span class='tstring_content'>-t</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>--token VALUE</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Triglav access token storage file (default: token.yml)</span><span class='tstring_end'>"</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>
|
346
|
+
<span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:token</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_v'>v</span>
|
347
|
+
<span class='rbrace'>}</span>
|
348
|
+
<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'>'</span><span class='tstring_content'>--dotenv</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Load environment variables from .env file (default: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:dotenv</span><span class='rbracket'>]</span><span class='embexpr_end'>}</span><span class='tstring_content'>)</span><span class='tstring_end'>"</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>
|
349
|
+
<span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:dotenv</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_v'>v</span>
|
350
|
+
<span class='rbrace'>}</span>
|
351
|
+
<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'>'</span><span class='tstring_content'>--debug</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Debug mode (default: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:debug</span><span class='rbracket'>]</span><span class='embexpr_end'>}</span><span class='tstring_content'>)</span><span class='tstring_end'>"</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>
|
352
|
+
<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>
|
353
|
+
<span class='rbrace'>}</span>
|
354
|
+
<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'>'</span><span class='tstring_content'>-h</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>--help</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>help</span><span class='tstring_end'>"</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>
|
355
|
+
<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>
|
356
|
+
<span class='rbrace'>}</span>
|
357
|
+
<span class='comment'># serverengine options
|
358
|
+
</span> <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'>'</span><span class='tstring_content'>--log VALUE</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Log path (default: </span><span class='embexpr_beg'>#{</span><span class='const'>Setting</span><span class='op'>::</span><span class='const'>DEFAULT_LOG</span><span class='embexpr_end'>}</span><span class='tstring_content'>)</span><span class='tstring_end'>"</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>
|
359
|
+
<span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:log</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_v'>v</span>
|
360
|
+
<span class='rbrace'>}</span>
|
361
|
+
<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'>'</span><span class='tstring_content'>--log-level VALUE</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Log level (default: </span><span class='embexpr_beg'>#{</span><span class='const'>Setting</span><span class='op'>::</span><span class='const'>DEFAULT_LOG_LEVEL</span><span class='embexpr_end'>}</span><span class='tstring_content'>)</span><span class='tstring_end'>"</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>
|
362
|
+
<span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:log_level</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_v'>v</span>
|
363
|
+
<span class='rbrace'>}</span>
|
364
|
+
|
365
|
+
<span class='id identifier rubyid_op'>op</span><span class='period'>.</span><span class='id identifier rubyid_banner'>banner</span> <span class='op'>+=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span>
|
366
|
+
|
367
|
+
<span class='id identifier rubyid_op'>op</span>
|
368
|
+
<span class='kw'>end</span></pre>
|
369
|
+
</td>
|
370
|
+
</tr>
|
371
|
+
</table>
|
372
|
+
</div>
|
373
|
+
|
374
|
+
<div class="method_details ">
|
375
|
+
<h3 class="signature " id="parse_options-instance_method">
|
376
|
+
|
377
|
+
#<strong>parse_options</strong>(argv = ARGV) ⇒ <tt>Object</tt>
|
378
|
+
|
379
|
+
|
380
|
+
|
381
|
+
|
382
|
+
|
383
|
+
</h3><table class="source_code">
|
384
|
+
<tr>
|
385
|
+
<td>
|
386
|
+
<pre class="lines">
|
387
|
+
|
388
|
+
|
389
|
+
73
|
390
|
+
74
|
391
|
+
75
|
392
|
+
76
|
393
|
+
77
|
394
|
+
78
|
395
|
+
79
|
396
|
+
80
|
397
|
+
81
|
398
|
+
82
|
399
|
+
83
|
400
|
+
84
|
401
|
+
85
|
402
|
+
86
|
403
|
+
87
|
404
|
+
88
|
405
|
+
89
|
406
|
+
90
|
407
|
+
91
|
408
|
+
92
|
409
|
+
93
|
410
|
+
94
|
411
|
+
95</pre>
|
412
|
+
</td>
|
413
|
+
<td>
|
414
|
+
<pre class="code"><span class="info file"># File 'lib/triglav/agent/base/cli.rb', line 73</span>
|
415
|
+
|
416
|
+
<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>
|
417
|
+
<span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='id identifier rubyid_default_opts'>default_opts</span>
|
418
|
+
<span class='id identifier rubyid_op'>op</span> <span class='op'>=</span> <span class='id identifier rubyid_option_parser'>option_parser</span><span class='lparen'>(</span><span class='id identifier rubyid_opts'>opts</span><span class='rparen'>)</span>
|
419
|
+
|
420
|
+
<span class='kw'>begin</span>
|
421
|
+
<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>
|
422
|
+
<span class='kw'>rescue</span> <span class='const'>OptionParser</span><span class='op'>::</span><span class='const'>InvalidOption</span> <span class='op'>=></span> <span class='id identifier rubyid_e'>e</span>
|
423
|
+
<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>
|
424
|
+
<span class='kw'>end</span>
|
425
|
+
|
426
|
+
<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>
|
427
|
+
<span class='id identifier rubyid_usage'>usage</span>
|
428
|
+
<span class='kw'>end</span>
|
429
|
+
|
430
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:config</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
431
|
+
<span class='id identifier rubyid_usage'>usage</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>--config VALUE is required</span><span class='tstring_end'>"</span></span>
|
432
|
+
<span class='kw'>end</span>
|
433
|
+
<span class='kw'>if</span> <span class='op'>!</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_readable?'>readable?</span><span class='lparen'>(</span><span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:config</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
434
|
+
<span class='id identifier rubyid_usage'>usage</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Config file '</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:config</span><span class='rbracket'>]</span><span class='embexpr_end'>}</span><span class='tstring_content'>' does not exist or not readable</span><span class='tstring_end'>"</span></span>
|
435
|
+
<span class='kw'>end</span>
|
436
|
+
|
437
|
+
<span class='lbracket'>[</span><span class='id identifier rubyid_opts'>opts</span><span class='comma'>,</span> <span class='id identifier rubyid_args'>args</span><span class='rbracket'>]</span>
|
438
|
+
<span class='kw'>end</span></pre>
|
439
|
+
</td>
|
440
|
+
</tr>
|
441
|
+
</table>
|
442
|
+
</div>
|
443
|
+
|
444
|
+
<div class="method_details ">
|
445
|
+
<h3 class="signature " id="run-instance_method">
|
446
|
+
|
447
|
+
#<strong>run</strong> ⇒ <tt>Object</tt>
|
448
|
+
|
449
|
+
|
450
|
+
|
451
|
+
|
452
|
+
|
453
|
+
</h3><table class="source_code">
|
454
|
+
<tr>
|
455
|
+
<td>
|
456
|
+
<pre class="lines">
|
457
|
+
|
458
|
+
|
459
|
+
13
|
460
|
+
14
|
461
|
+
15
|
462
|
+
16
|
463
|
+
17
|
464
|
+
18
|
465
|
+
19
|
466
|
+
20
|
467
|
+
21</pre>
|
468
|
+
</td>
|
469
|
+
<td>
|
470
|
+
<pre class="code"><span class="info file"># File 'lib/triglav/agent/base/cli.rb', line 13</span>
|
471
|
+
|
472
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_run'>run</span>
|
473
|
+
<span class='id identifier rubyid_opts'>opts</span><span class='comma'>,</span> <span class='id identifier rubyid__'>_</span> <span class='op'>=</span> <span class='id identifier rubyid_parse_options'>parse_options</span><span class='lparen'>(</span><span class='const'>ARGV</span><span class='rparen'>)</span>
|
474
|
+
<span class='gvar'>$setting</span> <span class='op'>=</span> <span class='const'>Configuration</span><span class='period'>.</span><span class='id identifier rubyid_setting_class'>setting_class</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_opts'>opts</span><span class='rparen'>)</span>
|
475
|
+
<span class='gvar'>$logger</span> <span class='op'>=</span> <span class='gvar'>$setting</span><span class='period'>.</span><span class='id identifier rubyid_logger'>logger</span>
|
476
|
+
<span class='id identifier rubyid_se'>se</span> <span class='op'>=</span> <span class='const'>ServerEngine</span><span class='period'>.</span><span class='id identifier rubyid_create'>create</span><span class='lparen'>(</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='const'>Configuration</span><span class='period'>.</span><span class='id identifier rubyid_worker_module'>worker_module</span><span class='rparen'>)</span> <span class='kw'>do</span>
|
477
|
+
<span class='gvar'>$setting</span><span class='period'>.</span><span class='id identifier rubyid_serverengine_options'>serverengine_options</span>
|
478
|
+
<span class='kw'>end</span>
|
479
|
+
<span class='id identifier rubyid_se'>se</span><span class='period'>.</span><span class='id identifier rubyid_run'>run</span>
|
480
|
+
<span class='kw'>end</span></pre>
|
481
|
+
</td>
|
482
|
+
</tr>
|
483
|
+
</table>
|
484
|
+
</div>
|
485
|
+
|
486
|
+
</div>
|
487
|
+
|
488
|
+
</div>
|
489
|
+
|
490
|
+
<div id="footer">
|
491
|
+
Generated on Thu Feb 23 23:20:33 2017 by
|
492
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
493
|
+
0.9.5 (ruby-2.3.2).
|
494
|
+
</div>
|
495
|
+
|
496
|
+
</div>
|
497
|
+
</body>
|
498
|
+
</html>
|