akaer 2.0.0 → 2.1.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/Gemfile +2 -2
- data/README.md +4 -3
- data/akaer.gemspec +1 -1
- data/bin/akaer +3 -3
- data/doc/Akaer/Application.html +103 -103
- data/doc/Akaer/ApplicationMethods/General.html +4 -4
- data/doc/Akaer/ApplicationMethods/System.html +23 -23
- data/doc/Akaer/ApplicationMethods.html +3 -3
- data/doc/Akaer/Configuration.html +4 -4
- data/doc/Akaer/Version.html +4 -4
- data/doc/Akaer.html +3 -3
- data/doc/_index.html +4 -4
- data/doc/css/style.css +10 -0
- data/doc/file.README.html +7 -6
- data/doc/frames.html +1 -1
- data/doc/index.html +7 -6
- data/doc/top-level-namespace.html +3 -3
- data/lib/akaer/application.rb +31 -24
- data/lib/akaer/configuration.rb +5 -5
- data/lib/akaer/version.rb +1 -1
- data/locales/en.yml +2 -2
- data/locales/it.yml +2 -2
- data/spec/akaer/application_spec.rb +2 -2
- data/spec/akaer/configuration_spec.rb +2 -2
- metadata +5 -5
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
Module: Akaer::ApplicationMethods::General
|
8
8
|
|
9
|
-
— Documentation by YARD 0.8.
|
9
|
+
— Documentation by YARD 0.8.5.2
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -295,7 +295,7 @@
|
|
295
295
|
|
296
296
|
|
297
297
|
—
|
298
|
-
<div class='inline'><p><code>true</code> if operation
|
298
|
+
<div class='inline'><p><code>true</code> if operation succeeded, <code>false</code> otherwise.</p>
|
299
299
|
</div>
|
300
300
|
|
301
301
|
</li>
|
@@ -356,9 +356,9 @@
|
|
356
356
|
</div>
|
357
357
|
|
358
358
|
<div id="footer">
|
359
|
-
Generated on
|
359
|
+
Generated on Thu Feb 28 17:32:36 2013 by
|
360
360
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
361
|
-
0.8.
|
361
|
+
0.8.5.2 (ruby-1.9.3).
|
362
362
|
</div>
|
363
363
|
|
364
364
|
</body>
|
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
Module: Akaer::ApplicationMethods::System
|
8
8
|
|
9
|
-
— Documentation by YARD 0.8.
|
9
|
+
— Documentation by YARD 0.8.5.2
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -243,7 +243,7 @@
|
|
243
243
|
|
244
244
|
|
245
245
|
—
|
246
|
-
<div class='inline'><p><code>true</code> if action
|
246
|
+
<div class='inline'><p><code>true</code> if action succeeded, <code>false</code> otherwise.</p>
|
247
247
|
</div>
|
248
248
|
|
249
249
|
</li>
|
@@ -256,12 +256,12 @@
|
|
256
256
|
<pre class="lines">
|
257
257
|
|
258
258
|
|
259
|
-
|
260
|
-
|
261
|
-
|
259
|
+
130
|
260
|
+
131
|
261
|
+
132</pre>
|
262
262
|
</td>
|
263
263
|
<td>
|
264
|
-
<pre class="code"><span class="info file"># File 'lib/akaer/application.rb', line
|
264
|
+
<pre class="code"><span class="info file"># File 'lib/akaer/application.rb', line 130</span>
|
265
265
|
|
266
266
|
<span class='kw'>def</span> <span class='id identifier rubyid_action_add'>action_add</span>
|
267
267
|
<span class='id identifier rubyid_manage_action'>manage_action</span><span class='lparen'>(</span><span class='symbol'>:add</span><span class='comma'>,</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_add_empty'>add_empty</span><span class='comma'>,</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_config'>config</span><span class='period'>.</span><span class='id identifier rubyid_quiet'>quiet</span><span class='rparen'>)</span>
|
@@ -300,7 +300,7 @@
|
|
300
300
|
|
301
301
|
|
302
302
|
—
|
303
|
-
<div class='inline'><p><code>true</code> if action
|
303
|
+
<div class='inline'><p><code>true</code> if action succeeded, <code>false</code> otherwise.</p>
|
304
304
|
</div>
|
305
305
|
|
306
306
|
</li>
|
@@ -313,12 +313,12 @@
|
|
313
313
|
<pre class="lines">
|
314
314
|
|
315
315
|
|
316
|
-
|
317
|
-
|
318
|
-
|
316
|
+
144
|
317
|
+
145
|
318
|
+
146</pre>
|
319
319
|
</td>
|
320
320
|
<td>
|
321
|
-
<pre class="code"><span class="info file"># File 'lib/akaer/application.rb', line
|
321
|
+
<pre class="code"><span class="info file"># File 'lib/akaer/application.rb', line 144</span>
|
322
322
|
|
323
323
|
<span class='kw'>def</span> <span class='id identifier rubyid_action_install'>action_install</span>
|
324
324
|
<span class='id identifier rubyid_manage_agent'>manage_agent</span><span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_launch_agent_path'>launch_agent_path</span><span class='comma'>,</span> <span class='symbol'>:create_agent</span><span class='comma'>,</span> <span class='symbol'>:load_agent</span><span class='comma'>,</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_config'>config</span><span class='period'>.</span><span class='id identifier rubyid_quiet'>quiet</span><span class='rparen'>)</span>
|
@@ -357,7 +357,7 @@
|
|
357
357
|
|
358
358
|
|
359
359
|
—
|
360
|
-
<div class='inline'><p><code>true</code> if action
|
360
|
+
<div class='inline'><p><code>true</code> if action succeeded, <code>false</code> otherwise.</p>
|
361
361
|
</div>
|
362
362
|
|
363
363
|
</li>
|
@@ -370,12 +370,12 @@
|
|
370
370
|
<pre class="lines">
|
371
371
|
|
372
372
|
|
373
|
-
|
374
|
-
|
375
|
-
|
373
|
+
137
|
374
|
+
138
|
375
|
+
139</pre>
|
376
376
|
</td>
|
377
377
|
<td>
|
378
|
-
<pre class="code"><span class="info file"># File 'lib/akaer/application.rb', line
|
378
|
+
<pre class="code"><span class="info file"># File 'lib/akaer/application.rb', line 137</span>
|
379
379
|
|
380
380
|
<span class='kw'>def</span> <span class='id identifier rubyid_action_remove'>action_remove</span>
|
381
381
|
<span class='id identifier rubyid_manage_action'>manage_action</span><span class='lparen'>(</span><span class='symbol'>:remove</span><span class='comma'>,</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_remove_empty'>remove_empty</span><span class='comma'>,</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_config'>config</span><span class='period'>.</span><span class='id identifier rubyid_quiet'>quiet</span><span class='rparen'>)</span>
|
@@ -414,7 +414,7 @@
|
|
414
414
|
|
415
415
|
|
416
416
|
—
|
417
|
-
<div class='inline'><p><code>true</code> if action
|
417
|
+
<div class='inline'><p><code>true</code> if action succeeded, <code>false</code> otherwise.</p>
|
418
418
|
</div>
|
419
419
|
|
420
420
|
</li>
|
@@ -427,12 +427,12 @@
|
|
427
427
|
<pre class="lines">
|
428
428
|
|
429
429
|
|
430
|
-
|
431
|
-
|
432
|
-
|
430
|
+
151
|
431
|
+
152
|
432
|
+
153</pre>
|
433
433
|
</td>
|
434
434
|
<td>
|
435
|
-
<pre class="code"><span class="info file"># File 'lib/akaer/application.rb', line
|
435
|
+
<pre class="code"><span class="info file"># File 'lib/akaer/application.rb', line 151</span>
|
436
436
|
|
437
437
|
<span class='kw'>def</span> <span class='id identifier rubyid_action_uninstall'>action_uninstall</span>
|
438
438
|
<span class='id identifier rubyid_manage_agent'>manage_agent</span><span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_launch_agent_path'>launch_agent_path</span><span class='comma'>,</span> <span class='symbol'>:unload_agent</span><span class='comma'>,</span> <span class='symbol'>:delete_agent</span><span class='comma'>,</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_config'>config</span><span class='period'>.</span><span class='id identifier rubyid_quiet'>quiet</span><span class='rparen'>)</span>
|
@@ -447,9 +447,9 @@
|
|
447
447
|
</div>
|
448
448
|
|
449
449
|
<div id="footer">
|
450
|
-
Generated on
|
450
|
+
Generated on Thu Feb 28 17:32:36 2013 by
|
451
451
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
452
|
-
0.8.
|
452
|
+
0.8.5.2 (ruby-1.9.3).
|
453
453
|
</div>
|
454
454
|
|
455
455
|
</body>
|
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
Module: Akaer::ApplicationMethods
|
8
8
|
|
9
|
-
— Documentation by YARD 0.8.
|
9
|
+
— Documentation by YARD 0.8.5.2
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -116,9 +116,9 @@
|
|
116
116
|
</div>
|
117
117
|
|
118
118
|
<div id="footer">
|
119
|
-
Generated on
|
119
|
+
Generated on Thu Feb 28 17:32:36 2013 by
|
120
120
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
121
|
-
0.8.
|
121
|
+
0.8.5.2 (ruby-1.9.3).
|
122
122
|
</div>
|
123
123
|
|
124
124
|
</body>
|
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
Class: Akaer::Configuration
|
8
8
|
|
9
|
-
— Documentation by YARD 0.8.
|
9
|
+
— Documentation by YARD 0.8.5.2
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -103,7 +103,7 @@
|
|
103
103
|
|
104
104
|
<h2>Overview</h2><div class="docstring">
|
105
105
|
<div class="discussion">
|
106
|
-
<p>This class holds the configuration of the
|
106
|
+
<p>This class holds the configuration of the application.</p>
|
107
107
|
|
108
108
|
|
109
109
|
</div>
|
@@ -273,9 +273,9 @@
|
|
273
273
|
</div>
|
274
274
|
|
275
275
|
<div id="footer">
|
276
|
-
Generated on
|
276
|
+
Generated on Thu Feb 28 17:32:37 2013 by
|
277
277
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
278
|
-
0.8.
|
278
|
+
0.8.5.2 (ruby-1.9.3).
|
279
279
|
</div>
|
280
280
|
|
281
281
|
</body>
|
data/doc/Akaer/Version.html
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
Module: Akaer::Version
|
8
8
|
|
9
|
-
— Documentation by YARD 0.8.
|
9
|
+
— Documentation by YARD 0.8.5.2
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -134,7 +134,7 @@
|
|
134
134
|
|
135
135
|
</div>
|
136
136
|
</dt>
|
137
|
-
<dd><pre class="code"><span class='int'>
|
137
|
+
<dd><pre class="code"><span class='int'>1</span></pre></dd>
|
138
138
|
|
139
139
|
<dt id="PATCH-constant" class="">PATCH =
|
140
140
|
<div class="docstring">
|
@@ -180,9 +180,9 @@
|
|
180
180
|
</div>
|
181
181
|
|
182
182
|
<div id="footer">
|
183
|
-
Generated on
|
183
|
+
Generated on Thu Feb 28 17:32:36 2013 by
|
184
184
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
185
|
-
0.8.
|
185
|
+
0.8.5.2 (ruby-1.9.3).
|
186
186
|
</div>
|
187
187
|
|
188
188
|
</body>
|
data/doc/Akaer.html
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
Module: Akaer
|
8
8
|
|
9
|
-
— Documentation by YARD 0.8.
|
9
|
+
— Documentation by YARD 0.8.5.2
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -121,9 +121,9 @@ Licensed under the MIT license, which can be found at http://www.opensource.org/
|
|
121
121
|
</div>
|
122
122
|
|
123
123
|
<div id="footer">
|
124
|
-
Generated on
|
124
|
+
Generated on Thu Feb 28 17:32:36 2013 by
|
125
125
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
126
|
-
0.8.
|
126
|
+
0.8.5.2 (ruby-1.9.3).
|
127
127
|
</div>
|
128
128
|
|
129
129
|
</body>
|
data/doc/_index.html
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
<head>
|
5
5
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
6
|
<title>
|
7
|
-
Documentation by YARD 0.8.
|
7
|
+
Documentation by YARD 0.8.5.2
|
8
8
|
|
9
9
|
</title>
|
10
10
|
|
@@ -56,7 +56,7 @@
|
|
56
56
|
|
57
57
|
<iframe id="search_frame"></iframe>
|
58
58
|
|
59
|
-
<div id="content"><h1 class="noborder title">Documentation by YARD 0.8.
|
59
|
+
<div id="content"><h1 class="noborder title">Documentation by YARD 0.8.5.2</h1>
|
60
60
|
<div id="listing">
|
61
61
|
<h1 class="alphaindex">Alphabetic Index</h1>
|
62
62
|
|
@@ -175,9 +175,9 @@
|
|
175
175
|
</div>
|
176
176
|
|
177
177
|
<div id="footer">
|
178
|
-
Generated on
|
178
|
+
Generated on Thu Feb 28 17:32:36 2013 by
|
179
179
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
180
|
-
0.8.
|
180
|
+
0.8.5.2 (ruby-1.9.3).
|
181
181
|
</div>
|
182
182
|
|
183
183
|
</body>
|
data/doc/css/style.css
CHANGED
@@ -27,6 +27,16 @@ h2 small { font-weight: normal; font-size: 0.7em; display: block; float: right;
|
|
27
27
|
.rdoc-term { padding-right: 25px; font-weight: bold; }
|
28
28
|
.rdoc-list p { margin: 0; padding: 0; margin-bottom: 4px; }
|
29
29
|
|
30
|
+
/* style for <table> */
|
31
|
+
#filecontents table, .docstring table { border-collapse: collapse; }
|
32
|
+
#filecontents table th, #filecontents table td,
|
33
|
+
.docstring table th, .docstring table td { border: 1px solid #ccc; padding: 8px; padding-right: 17px; }
|
34
|
+
#filecontents table tr:nth-child(odd),
|
35
|
+
.docstring table tr:nth-child(odd) { background: #eee; }
|
36
|
+
#filecontents table tr:nth-child(even),
|
37
|
+
.docstring table tr:nth-child(even) { background: #fff; }
|
38
|
+
#filecontents table th, .docstring table th { background: #fff; }
|
39
|
+
|
30
40
|
/* style for <ul> */
|
31
41
|
#filecontents li > p, .docstring li > p { margin: 0px; }
|
32
42
|
#filecontents ul, .docstring ul { padding-left: 20px; }
|
data/doc/file.README.html
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
File: README
|
8
8
|
|
9
|
-
— Documentation by YARD 0.8.
|
9
|
+
— Documentation by YARD 0.8.5.2
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -63,8 +63,9 @@
|
|
63
63
|
|
64
64
|
<div id="content"><div id='filecontents'><h1 id="akaer">akaer</h1>
|
65
65
|
|
66
|
-
<p><a href="http://
|
66
|
+
<p><a href="http://badge.fury.io/rb/akaer"><img src="https://badge.fury.io/rb/akaer.png" alt="Gem Version" /></a>
|
67
67
|
<a href="https://gemnasium.com/ShogunPanda/akaer"><img src="https://gemnasium.com/ShogunPanda/akaer.png?travis" alt="Dependency Status" /></a>
|
68
|
+
<a href="http://travis-ci.org/ShogunPanda/akaer"><img src="https://secure.travis-ci.org/ShogunPanda/akaer.png?branch=master" alt="Build Status" /></a>
|
68
69
|
<a href="https://codeclimate.com/github/ShogunPanda/akaer"><img src="https://codeclimate.com/github/ShogunPanda/akaer.png" alt="Code Climate" /></a></p>
|
69
70
|
|
70
71
|
<p>A small utility to add aliases to network interfaces.</p>
|
@@ -115,8 +116,8 @@
|
|
115
116
|
<li><code>addresses</code>: A specific list of aliases to manage.</li>
|
116
117
|
<li><code>start_address</code>: The address to start sequential address. <code>10.0.0.1</code> by default. Not used if <code>addresses</code> is specified.</li>
|
117
118
|
<li><code>aliases</code>: The number of sequential addresses to add. 5 by default.</li>
|
118
|
-
<li><code>add_command</code>: The command to run for adding an alias. <code>sudo ifconfig
|
119
|
-
<li><code>remove_command</code>: The command to run for removing an alias. <code>sudo ifconfig
|
119
|
+
<li><code>add_command</code>: The command to run for adding an alias. <code>sudo ifconfig {{interface}} alias {{address}}</code> by default.</li>
|
120
|
+
<li><code>remove_command</code>: The command to run for removing an alias. <code>sudo ifconfig {{interface}} -alias {{address}}</code> by default.</li>
|
120
121
|
<li><code>log_file</code>: The default log file. By default it logs to standard output.</li>
|
121
122
|
<li><code>log_level</code>: The default log level. Valid values are from 0 to 5 where 0 means “all messages”.</li>
|
122
123
|
<li><code>dry_run</code>: Only show which modifications will be done.</li>
|
@@ -143,9 +144,9 @@
|
|
143
144
|
</div></div>
|
144
145
|
|
145
146
|
<div id="footer">
|
146
|
-
Generated on
|
147
|
+
Generated on Thu Feb 28 17:32:36 2013 by
|
147
148
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
148
|
-
0.8.
|
149
|
+
0.8.5.2 (ruby-1.9.3).
|
149
150
|
</div>
|
150
151
|
|
151
152
|
</body>
|
data/doc/frames.html
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
5
|
<head>
|
6
6
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
7
|
-
<title>Documentation by YARD 0.8.
|
7
|
+
<title>Documentation by YARD 0.8.5.2</title>
|
8
8
|
</head>
|
9
9
|
<script type="text/javascript" charset="utf-8">
|
10
10
|
window.onload = function() {
|
data/doc/index.html
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
File: README
|
8
8
|
|
9
|
-
— Documentation by YARD 0.8.
|
9
|
+
— Documentation by YARD 0.8.5.2
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -63,8 +63,9 @@
|
|
63
63
|
|
64
64
|
<div id="content"><div id='filecontents'><h1 id="akaer">akaer</h1>
|
65
65
|
|
66
|
-
<p><a href="http://
|
66
|
+
<p><a href="http://badge.fury.io/rb/akaer"><img src="https://badge.fury.io/rb/akaer.png" alt="Gem Version" /></a>
|
67
67
|
<a href="https://gemnasium.com/ShogunPanda/akaer"><img src="https://gemnasium.com/ShogunPanda/akaer.png?travis" alt="Dependency Status" /></a>
|
68
|
+
<a href="http://travis-ci.org/ShogunPanda/akaer"><img src="https://secure.travis-ci.org/ShogunPanda/akaer.png?branch=master" alt="Build Status" /></a>
|
68
69
|
<a href="https://codeclimate.com/github/ShogunPanda/akaer"><img src="https://codeclimate.com/github/ShogunPanda/akaer.png" alt="Code Climate" /></a></p>
|
69
70
|
|
70
71
|
<p>A small utility to add aliases to network interfaces.</p>
|
@@ -115,8 +116,8 @@
|
|
115
116
|
<li><code>addresses</code>: A specific list of aliases to manage.</li>
|
116
117
|
<li><code>start_address</code>: The address to start sequential address. <code>10.0.0.1</code> by default. Not used if <code>addresses</code> is specified.</li>
|
117
118
|
<li><code>aliases</code>: The number of sequential addresses to add. 5 by default.</li>
|
118
|
-
<li><code>add_command</code>: The command to run for adding an alias. <code>sudo ifconfig
|
119
|
-
<li><code>remove_command</code>: The command to run for removing an alias. <code>sudo ifconfig
|
119
|
+
<li><code>add_command</code>: The command to run for adding an alias. <code>sudo ifconfig {{interface}} alias {{address}}</code> by default.</li>
|
120
|
+
<li><code>remove_command</code>: The command to run for removing an alias. <code>sudo ifconfig {{interface}} -alias {{address}}</code> by default.</li>
|
120
121
|
<li><code>log_file</code>: The default log file. By default it logs to standard output.</li>
|
121
122
|
<li><code>log_level</code>: The default log level. Valid values are from 0 to 5 where 0 means “all messages”.</li>
|
122
123
|
<li><code>dry_run</code>: Only show which modifications will be done.</li>
|
@@ -143,9 +144,9 @@
|
|
143
144
|
</div></div>
|
144
145
|
|
145
146
|
<div id="footer">
|
146
|
-
Generated on
|
147
|
+
Generated on Thu Feb 28 17:32:36 2013 by
|
147
148
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
148
|
-
0.8.
|
149
|
+
0.8.5.2 (ruby-1.9.3).
|
149
150
|
</div>
|
150
151
|
|
151
152
|
</body>
|
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
Top Level Namespace
|
8
8
|
|
9
|
-
— Documentation by YARD 0.8.
|
9
|
+
— Documentation by YARD 0.8.5.2
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -103,9 +103,9 @@
|
|
103
103
|
</div>
|
104
104
|
|
105
105
|
<div id="footer">
|
106
|
-
Generated on
|
106
|
+
Generated on Thu Feb 28 17:32:36 2013 by
|
107
107
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
108
|
-
0.8.
|
108
|
+
0.8.5.2 (ruby-1.9.3).
|
109
109
|
</div>
|
110
110
|
|
111
111
|
</body>
|
data/lib/akaer/application.rb
CHANGED
@@ -25,7 +25,7 @@ module Akaer
|
|
25
25
|
#
|
26
26
|
# @param type [Symbol] The operation to execute. Can be `:add` or `:remove`.
|
27
27
|
# @param address [String] The address to manage.
|
28
|
-
# @return [Boolean] `true` if operation
|
28
|
+
# @return [Boolean] `true` if operation succeeded, `false` otherwise.
|
29
29
|
def manage(type, address)
|
30
30
|
locale = self.i18n
|
31
31
|
config = self.config
|
@@ -54,12 +54,21 @@ module Akaer
|
|
54
54
|
begin
|
55
55
|
@addresses ||= self.compute_addresses
|
56
56
|
length = self.pad_number(@addresses.length)
|
57
|
-
[true,
|
57
|
+
[true, build_command(type, address), "{mark=blue}[{mark=bright white}#{self.pad_number((@addresses.index(address) || 0) + 1, length.length)}{mark=reset blue}/{/mark}#{length}{/mark}]{/mark}"]
|
58
58
|
rescue ArgumentError
|
59
59
|
[false]
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
|
+
# Builds the command to execute.
|
64
|
+
#
|
65
|
+
# @param type [Symbol] The type of operation. Can be `:add` or `:remove`.
|
66
|
+
# @param address [String] The address to manage.
|
67
|
+
# @return [String] The command to execute.
|
68
|
+
def build_command(type, address)
|
69
|
+
Mustache.render(config.send((type == :remove) ? :remove_command : :add_command), {interface: config.interface, address: address.to_s}) + " > /dev/null 2>&1"
|
70
|
+
end
|
71
|
+
|
63
72
|
# Executes management.
|
64
73
|
#
|
65
74
|
# @param command [String] The command to execute.
|
@@ -68,7 +77,7 @@ module Akaer
|
|
68
77
|
# @param address [String] The address that will be managed.
|
69
78
|
# @param config [Configuration] The current configuration.
|
70
79
|
# @param quiet [Boolean] Whether to show the message.
|
71
|
-
# @return [Boolean] `true` if operation
|
80
|
+
# @return [Boolean] `true` if operation succeeded, `false` otherwise.
|
72
81
|
def execute_manage(command, prefix, type, address, config, quiet)
|
73
82
|
locale = self.i18n
|
74
83
|
log_management(:run, prefix, type, locale.removing, locale.adding, address, config, quiet)
|
@@ -117,28 +126,28 @@ module Akaer
|
|
117
126
|
module System
|
118
127
|
# Adds aliases to the interface.
|
119
128
|
#
|
120
|
-
# @return [Boolean] `true` if action
|
129
|
+
# @return [Boolean] `true` if action succeeded, `false` otherwise.
|
121
130
|
def action_add
|
122
131
|
manage_action(:add, self.i18n.add_empty, self.config.quiet)
|
123
132
|
end
|
124
133
|
|
125
134
|
# Removes aliases from the interface.
|
126
135
|
#
|
127
|
-
# @return [Boolean] `true` if action
|
136
|
+
# @return [Boolean] `true` if action succeeded, `false` otherwise.
|
128
137
|
def action_remove
|
129
138
|
manage_action(:remove, self.i18n.remove_empty, self.config.quiet)
|
130
139
|
end
|
131
140
|
|
132
141
|
# Installs the application into the autolaunch.
|
133
142
|
#
|
134
|
-
# @return [Boolean] `true` if action
|
143
|
+
# @return [Boolean] `true` if action succeeded, `false` otherwise.
|
135
144
|
def action_install
|
136
145
|
manage_agent(self.launch_agent_path, :create_agent, :load_agent, self.config.quiet)
|
137
146
|
end
|
138
147
|
|
139
148
|
# Uninstalls the application from the autolaunch.
|
140
149
|
#
|
141
|
-
# @return [Boolean] `true` if action
|
150
|
+
# @return [Boolean] `true` if action succeeded, `false` otherwise.
|
142
151
|
def action_uninstall
|
143
152
|
manage_agent(self.launch_agent_path, :unload_agent, :delete_agent, self.config.quiet)
|
144
153
|
end
|
@@ -150,10 +159,8 @@ module Akaer
|
|
150
159
|
# @param first_operation [Symbol] The first operation to execute.
|
151
160
|
# @param second_operation [Symbol] The second operation to execute.
|
152
161
|
# @param quiet [Boolean] Whether to show messages.
|
153
|
-
# @return [Boolean] `true` if operation
|
162
|
+
# @return [Boolean] `true` if operation succeeded, `false` otherwise.
|
154
163
|
def manage_agent(launch_agent, first_operation, second_operation, quiet)
|
155
|
-
rv = true
|
156
|
-
|
157
164
|
rv = check_agent_available(quiet)
|
158
165
|
rv = send(first_operation, launch_agent, quiet) if rv
|
159
166
|
rv = send(second_operation, launch_agent, quiet) if rv
|
@@ -178,7 +185,7 @@ module Akaer
|
|
178
185
|
#
|
179
186
|
# @param launch_agent [String] The agent path.
|
180
187
|
# @param quiet [Boolean] Whether to show messages.
|
181
|
-
# @return [Boolean] `true` if operation
|
188
|
+
# @return [Boolean] `true` if operation succeeded, `false` otherwise.
|
182
189
|
def create_agent(launch_agent, quiet)
|
183
190
|
begin
|
184
191
|
self.logger.info(self.i18n.agent_creating(launch_agent)) if !quiet
|
@@ -196,7 +203,7 @@ module Akaer
|
|
196
203
|
# @param launch_agent [String] The agent path.
|
197
204
|
def write_agent(launch_agent)
|
198
205
|
::File.open(launch_agent, "w") {|f|
|
199
|
-
f.write({"KeepAlive" => false, "Label" => "it.cowtech.akaer", "Program" => (::Pathname.new(Dir.pwd) + $0).to_s, "ProgramArguments" => (
|
206
|
+
f.write({"KeepAlive" => false, "Label" => "it.cowtech.akaer", "Program" => (::Pathname.new(Dir.pwd) + $0).to_s, "ProgramArguments" => (ARGV ? ARGV[0, ARGV.length - 1] : []), "RunAtLoad" => true}.to_json)
|
200
207
|
f.flush
|
201
208
|
}
|
202
209
|
end
|
@@ -205,12 +212,12 @@ module Akaer
|
|
205
212
|
#
|
206
213
|
# @param launch_agent [String] The agent path.
|
207
214
|
# @param quiet [Boolean] Whether to show messages.
|
208
|
-
# @return [Boolean] `true` if operation
|
215
|
+
# @return [Boolean] `true` if operation succeeded, `false` otherwise.
|
209
216
|
def delete_agent(launch_agent, quiet)
|
210
217
|
begin
|
211
218
|
self.logger.info(self.i18n.agent_deleting(launch_agent)) if !quiet
|
212
219
|
::File.delete(launch_agent)
|
213
|
-
rescue =>
|
220
|
+
rescue => _
|
214
221
|
self.logger.warn(self.i18n.agent_deleting_error) if !quiet
|
215
222
|
return false
|
216
223
|
end
|
@@ -220,7 +227,7 @@ module Akaer
|
|
220
227
|
#
|
221
228
|
# @param launch_agent [String] The agent path.
|
222
229
|
# @param quiet [Boolean] Whether to show messages.
|
223
|
-
# @return [Boolean] `true` if operation
|
230
|
+
# @return [Boolean] `true` if operation succeeded, `false` otherwise.
|
224
231
|
def load_agent(launch_agent, quiet)
|
225
232
|
begin
|
226
233
|
perform_agent_loading(launch_agent, "load", :agent_loading, quiet)
|
@@ -234,23 +241,23 @@ module Akaer
|
|
234
241
|
#
|
235
242
|
# @param launch_agent [String] The agent path.
|
236
243
|
# @param quiet [Boolean] Whether to show messages.
|
237
|
-
# @return [Boolean] `true` if operation
|
244
|
+
# @return [Boolean] `true` if operation succeeded, `false` otherwise.
|
238
245
|
def unload_agent(launch_agent, quiet)
|
239
246
|
begin
|
240
247
|
perform_agent_loading(launch_agent, "unload", :agent_unloading, quiet)
|
241
|
-
rescue =>
|
248
|
+
rescue => _
|
242
249
|
self.logger.warn(self.i18n.agent_unloading_error) if !quiet
|
243
250
|
false
|
244
251
|
end
|
245
252
|
end
|
246
253
|
|
247
|
-
# Performs
|
254
|
+
# Performs operation on a OSX system agent.
|
248
255
|
#
|
249
256
|
# @param launch_agent [String] The agent path.
|
250
257
|
# @param command [String] The command to run.
|
251
258
|
# @param message [String] The message to show.
|
252
259
|
# @param quiet [Boolean] Whether to show messages.
|
253
|
-
# @return [Boolean] `true` if operation
|
260
|
+
# @return [Boolean] `true` if operation succeeded, `false` otherwise.
|
254
261
|
def perform_agent_loading(launch_agent, command, message, quiet)
|
255
262
|
self.logger.info(self.i18n.send(message, launch_agent)) if !quiet
|
256
263
|
self.execute_command("launchctl #{command} -w \"#{launch_agent}\" > /dev/null 2>&1")
|
@@ -285,7 +292,7 @@ module Akaer
|
|
285
292
|
self.i18n = locale
|
286
293
|
|
287
294
|
@command = command
|
288
|
-
options = @command.application.get_options.reject {|
|
295
|
+
options = @command.application.get_options.reject {|_, v| v.nil? }
|
289
296
|
|
290
297
|
# Setup logger
|
291
298
|
Bovem::Logger.start_time = Time.now
|
@@ -305,7 +312,7 @@ module Akaer
|
|
305
312
|
address = address.ensure_string
|
306
313
|
|
307
314
|
mo = /\A(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\Z/.match(address)
|
308
|
-
|
315
|
+
(mo && mo.captures.all? {|i| i.to_i < 256}) ? true : false
|
309
316
|
end
|
310
317
|
|
311
318
|
# Checks if and address is a valid IPv6 address.
|
@@ -315,7 +322,7 @@ module Akaer
|
|
315
322
|
def is_ipv6?(address)
|
316
323
|
address = address.ensure_string
|
317
324
|
|
318
|
-
|
325
|
+
catch(:valid) do
|
319
326
|
# IPv6 (normal)
|
320
327
|
throw(:valid, true) if /\A[\dA-Fa-f]{1,4}(:[\dA-Fa-f]{1,4})*\Z/ =~ address
|
321
328
|
throw(:valid, true) if /\A[\dA-Fa-f]{1,4}(:[\dA-Fa-f]{1,4})*::([\dA-Fa-f]{1,4}(:[\dA-Fa-f]{1,4})*)?\Z/ =~ address
|
@@ -405,7 +412,7 @@ module Akaer
|
|
405
412
|
def filter_addresses(config, type)
|
406
413
|
filters = [:ipv4, :ipv6].select {|i| type == i || type == :all }.compact
|
407
414
|
|
408
|
-
|
415
|
+
config.addresses.select { |address|
|
409
416
|
filters.any? {|filter| self.send("is_#{filter}?", address) }
|
410
417
|
}.compact.uniq
|
411
418
|
end
|
@@ -420,7 +427,7 @@ module Akaer
|
|
420
427
|
ip = IPAddr.new(config.start_address.ensure_string)
|
421
428
|
raise ArgumentError if type != :all && !ip.send("#{type}?")
|
422
429
|
|
423
|
-
(config.aliases > 0 ? config.aliases : 5).times.collect {|
|
430
|
+
(config.aliases > 0 ? config.aliases : 5).times.collect {|_|
|
424
431
|
current = ip
|
425
432
|
ip = ip.succ
|
426
433
|
current
|
data/lib/akaer/configuration.rb
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
#
|
6
6
|
|
7
7
|
module Akaer
|
8
|
-
# This class holds the configuration of the
|
8
|
+
# This class holds the configuration of the application.
|
9
9
|
class Configuration < Bovem::Configuration
|
10
10
|
# The default interface to manage. Default: `lo0`.
|
11
11
|
property :interface, default: "lo0"
|
@@ -19,11 +19,11 @@ module Akaer
|
|
19
19
|
# The number of aliases to add. Default: `5`.
|
20
20
|
property :aliases, default: 5
|
21
21
|
|
22
|
-
# The command to run for adding an alias. Default: `sudo ifconfig {{interface}} alias {{
|
23
|
-
property :add_command, default: "sudo ifconfig {{interface}} alias {{
|
22
|
+
# The command to run for adding an alias. Default: `sudo ifconfig {{interface}} alias {{address}}`.
|
23
|
+
property :add_command, default: "sudo ifconfig {{interface}} alias {{address}}"
|
24
24
|
|
25
|
-
# The command to run for removing an alias. Default: `sudo ifconfig {{interface}} alias {{
|
26
|
-
property :remove_command, default: "sudo ifconfig {{interface}} -alias {{
|
25
|
+
# The command to run for removing an alias. Default: `sudo ifconfig {{interface}} alias {{address}}`.
|
26
|
+
property :remove_command, default: "sudo ifconfig {{interface}} -alias {{address}}"
|
27
27
|
|
28
28
|
# The file to log to. Default is the standard output.
|
29
29
|
property :log_file, default: "STDOUT"
|