akaer 1.5.2 → 1.5.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -0
- data/akaer.gemspec +1 -1
- data/doc/Akaer.html +2 -2
- data/doc/Akaer/Application.html +243 -225
- data/doc/Akaer/Configuration.html +13 -12
- data/doc/Akaer/Version.html +10 -6
- data/doc/_index.html +2 -2
- data/doc/file.README.html +5 -4
- data/doc/index.html +5 -4
- data/doc/top-level-namespace.html +2 -2
- data/lib/akaer/version.rb +1 -1
- metadata +7 -7
data/README.md
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
[![Build Status](https://secure.travis-ci.org/ShogunPanda/akaer.png?branch=master)](http://travis-ci.org/ShogunPanda/akaer)
|
4
4
|
[![Dependency Status](https://gemnasium.com/ShogunPanda/akaer.png?travis)](https://gemnasium.com/ShogunPanda/akaer)
|
5
|
+
[![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/ShogunPanda/akaer)
|
5
6
|
|
6
7
|
A small utility to add aliases to network interfaces.
|
7
8
|
|
data/akaer.gemspec
CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |gem|
|
|
21
21
|
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
22
22
|
gem.require_paths = ["lib"]
|
23
23
|
|
24
|
-
gem.add_dependency("mamertes", ">= 1.1.
|
24
|
+
gem.add_dependency("mamertes", ">= 1.1.7")
|
25
25
|
|
26
26
|
gem.add_development_dependency("rspec", "~> 2.11.0")
|
27
27
|
gem.add_development_dependency("rake", "~> 0.9.0")
|
data/doc/Akaer.html
CHANGED
@@ -121,9 +121,9 @@ Licensed under the MIT license, which can be found at <a href="http://www.openso
|
|
121
121
|
</div>
|
122
122
|
|
123
123
|
<div id="footer">
|
124
|
-
Generated on
|
124
|
+
Generated on Sat Oct 6 08:55:19 2012 by
|
125
125
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
126
|
-
0.8.2.1 (ruby-1.
|
126
|
+
0.8.2.1 (ruby-1.8.7).
|
127
127
|
</div>
|
128
128
|
|
129
129
|
</body>
|
data/doc/Akaer/Application.html
CHANGED
@@ -655,40 +655,41 @@
|
|
655
655
|
<td>
|
656
656
|
<pre class="code"><span class="info file"># File 'lib/akaer/application.rb', line 23</span>
|
657
657
|
|
658
|
-
<span class='kw'>def</span> <span class='
|
659
|
-
<span class='ivar'>@command</span> <span class='
|
660
|
-
<span class='
|
661
|
-
|
662
|
-
<span class='comment'># Setup logger
|
663
|
-
|
664
|
-
<span class='ivar'>@logger</span> <span class='
|
665
|
-
|
666
|
-
<span class='comment'># Open configuration
|
667
|
-
|
668
|
-
<span class='
|
669
|
-
<span class='symbol'>:interface</span> <span class='op'
|
670
|
-
<span class='symbol'>:addresses</span> <span class='op'
|
671
|
-
<span class='symbol'>:start_address</span> <span class='op'
|
672
|
-
<span class='symbol'>:aliases</span> <span class='op'
|
673
|
-
<span class='symbol'>:add_command</span> <span class='op'
|
674
|
-
<span class='symbol'>:remove_command</span> <span class='op'
|
675
|
-
<span class='symbol'>:log_file</span> <span class='op'
|
676
|
-
<span class='symbol'>:log_level</span> <span class='op'
|
677
|
-
<span class='symbol'>:dry_run</span> <span class='op'
|
678
|
-
<span class='symbol'>:quiet</span> <span class='op'
|
679
|
-
<span class='rbrace'>}</span><span class='
|
680
|
-
|
681
|
-
<span class='ivar'>@config</span> <span class='
|
682
|
-
|
683
|
-
<span class='ivar'>@logger</span> <span class='
|
684
|
-
<span class='ivar'>@logger</span> <span class='
|
685
|
-
<span class='kw'>rescue</span> <span class='
|
686
|
-
<span class='ivar'>@logger</span> <span class='op'>?</span> <span class='ivar'>@logger</span><span class='
|
687
|
-
<span class='
|
688
|
-
<span class='kw'>end</span>
|
689
|
-
|
690
|
-
<span class='kw'>self</span>
|
691
|
-
<span class='kw'>end</span
|
658
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_initialize identifier id'>initialize</span><span class='lparen token'>(</span><span class='rubyid_command identifier id'>command</span><span class='rparen token'>)</span>
|
659
|
+
<span class='rubyid_@command ivar id'>@command</span> <span class='assign token'>=</span> <span class='rubyid_command identifier id'>command</span>
|
660
|
+
<span class='rubyid_application identifier id'>application</span> <span class='assign token'>=</span> <span class='rubyid_@command ivar id'>@command</span><span class='dot token'>.</span><span class='rubyid_application identifier id'>application</span>
|
661
|
+
|
662
|
+
<span class='comment val'># Setup logger</span>
|
663
|
+
<span class='rubyid_Bovem constant id'>Bovem</span><span class='colon2 op'>::</span><span class='rubyid_Logger constant id'>Logger</span><span class='dot token'>.</span><span class='rubyid_start_time identifier id'>start_time</span> <span class='assign token'>=</span> <span class='rubyid_Time constant id'>Time</span><span class='dot token'>.</span><span class='rubyid_now identifier id'>now</span>
|
664
|
+
<span class='rubyid_@logger ivar id'>@logger</span> <span class='assign token'>=</span> <span class='rubyid_Bovem constant id'>Bovem</span><span class='colon2 op'>::</span><span class='rubyid_Logger constant id'>Logger</span><span class='dot token'>.</span><span class='rubyid_create identifier id'>create</span><span class='lparen token'>(</span><span class='rubyid_Bovem constant id'>Bovem</span><span class='colon2 op'>::</span><span class='rubyid_Logger constant id'>Logger</span><span class='dot token'>.</span><span class='rubyid_get_real_file identifier id'>get_real_file</span><span class='lparen token'>(</span><span class='rubyid_application identifier id'>application</span><span class='dot token'>.</span><span class='rubyid_options identifier id'>options</span><span class='lbrack token'>[</span><span class='string val'>"log-file"</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='rubyid_value identifier id'>value</span><span class='rparen token'>)</span> <span class='orop op'>||</span> <span class='rubyid_Bovem constant id'>Bovem</span><span class='colon2 op'>::</span><span class='rubyid_Logger constant id'>Logger</span><span class='dot token'>.</span><span class='rubyid_default_file identifier id'>default_file</span><span class='comma token'>,</span> <span class='rubyid_Logger constant id'>Logger</span><span class='colon2 op'>::</span><span class='rubyid_INFO constant id'>INFO</span><span class='rparen token'>)</span>
|
665
|
+
|
666
|
+
<span class='comment val'># Open configuration</span>
|
667
|
+
<span class='rubyid_begin begin kw'>begin</span>
|
668
|
+
<span class='rubyid_overrides identifier id'>overrides</span> <span class='assign token'>=</span> <span class='lbrace token'>{</span>
|
669
|
+
<span class='symbol val'>:interface</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='rubyid_application identifier id'>application</span><span class='dot token'>.</span><span class='rubyid_options identifier id'>options</span><span class='lbrack token'>[</span><span class='string val'>"interface"</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='rubyid_value identifier id'>value</span><span class='comma token'>,</span>
|
670
|
+
<span class='symbol val'>:addresses</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='rubyid_application identifier id'>application</span><span class='dot token'>.</span><span class='rubyid_options identifier id'>options</span><span class='lbrack token'>[</span><span class='string val'>"addresses"</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='rubyid_value identifier id'>value</span><span class='comma token'>,</span>
|
671
|
+
<span class='symbol val'>:start_address</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='rubyid_application identifier id'>application</span><span class='dot token'>.</span><span class='rubyid_options identifier id'>options</span><span class='lbrack token'>[</span><span class='string val'>"start-address"</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='rubyid_value identifier id'>value</span><span class='comma token'>,</span>
|
672
|
+
<span class='symbol val'>:aliases</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='rubyid_application identifier id'>application</span><span class='dot token'>.</span><span class='rubyid_options identifier id'>options</span><span class='lbrack token'>[</span><span class='string val'>"aliases"</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='rubyid_value identifier id'>value</span><span class='comma token'>,</span>
|
673
|
+
<span class='symbol val'>:add_command</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='rubyid_application identifier id'>application</span><span class='dot token'>.</span><span class='rubyid_options identifier id'>options</span><span class='lbrack token'>[</span><span class='string val'>"add-command"</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='rubyid_value identifier id'>value</span><span class='comma token'>,</span>
|
674
|
+
<span class='symbol val'>:remove_command</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='rubyid_application identifier id'>application</span><span class='dot token'>.</span><span class='rubyid_options identifier id'>options</span><span class='lbrack token'>[</span><span class='string val'>"remove-command"</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='rubyid_value identifier id'>value</span><span class='comma token'>,</span>
|
675
|
+
<span class='symbol val'>:log_file</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='rubyid_application identifier id'>application</span><span class='dot token'>.</span><span class='rubyid_options identifier id'>options</span><span class='lbrack token'>[</span><span class='string val'>"log-file"</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='rubyid_value identifier id'>value</span><span class='comma token'>,</span>
|
676
|
+
<span class='symbol val'>:log_level</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='rubyid_application identifier id'>application</span><span class='dot token'>.</span><span class='rubyid_options identifier id'>options</span><span class='lbrack token'>[</span><span class='string val'>"log-level"</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='rubyid_value identifier id'>value</span><span class='comma token'>,</span>
|
677
|
+
<span class='symbol val'>:dry_run</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='rubyid_application identifier id'>application</span><span class='dot token'>.</span><span class='rubyid_options identifier id'>options</span><span class='lbrack token'>[</span><span class='string val'>"dry-run"</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='rubyid_value identifier id'>value</span><span class='comma token'>,</span>
|
678
|
+
<span class='symbol val'>:quiet</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='rubyid_application identifier id'>application</span><span class='dot token'>.</span><span class='rubyid_options identifier id'>options</span><span class='lbrack token'>[</span><span class='string val'>"quiet"</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='rubyid_value identifier id'>value</span>
|
679
|
+
<span class='rbrace token'>}</span><span class='dot token'>.</span><span class='rubyid_reject identifier id'>reject</span> <span class='lbrace token'>{</span><span class='bitor op'>|</span><span class='rubyid_k identifier id'>k</span><span class='comma token'>,</span><span class='rubyid_v identifier id'>v</span><span class='bitor op'>|</span> <span class='rubyid_v identifier id'>v</span><span class='dot token'>.</span><span class='rubyid_nil? fid id'>nil?</span> <span class='rbrace token'>}</span>
|
680
|
+
|
681
|
+
<span class='rubyid_@config ivar id'>@config</span> <span class='assign token'>=</span> <span class='rubyid_Akaer constant id'>Akaer</span><span class='colon2 op'>::</span><span class='rubyid_Configuration constant id'>Configuration</span><span class='dot token'>.</span><span class='rubyid_new identifier id'>new</span><span class='lparen token'>(</span><span class='rubyid_application identifier id'>application</span><span class='dot token'>.</span><span class='rubyid_options identifier id'>options</span><span class='lbrack token'>[</span><span class='string val'>"configuration"</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='rubyid_value identifier id'>value</span><span class='comma token'>,</span> <span class='rubyid_overrides identifier id'>overrides</span><span class='comma token'>,</span> <span class='rubyid_@logger ivar id'>@logger</span><span class='rparen token'>)</span>
|
682
|
+
|
683
|
+
<span class='rubyid_@logger ivar id'>@logger</span> <span class='assign token'>=</span> <span class='rubyid_nil nil kw'>nil</span>
|
684
|
+
<span class='rubyid_@logger ivar id'>@logger</span> <span class='assign token'>=</span> <span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_get_logger identifier id'>get_logger</span>
|
685
|
+
<span class='rubyid_rescue rescue kw'>rescue</span> <span class='rubyid_Bovem constant id'>Bovem</span><span class='colon2 op'>::</span><span class='rubyid_Errors constant id'>Errors</span><span class='colon2 op'>::</span><span class='rubyid_InvalidConfiguration constant id'>InvalidConfiguration</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='rubyid_e identifier id'>e</span>
|
686
|
+
<span class='rubyid_@logger ivar id'>@logger</span> <span class='question op'>?</span> <span class='rubyid_@logger ivar id'>@logger</span><span class='dot token'>.</span><span class='rubyid_fatal identifier id'>fatal</span><span class='lparen token'>(</span><span class='rubyid_e identifier id'>e</span><span class='dot token'>.</span><span class='rubyid_message identifier id'>message</span><span class='rparen token'>)</span> <span class='colon op'>:</span> <span class='rubyid_Bovem constant id'>Bovem</span><span class='colon2 op'>::</span><span class='rubyid_Logger constant id'>Logger</span><span class='dot token'>.</span><span class='rubyid_create identifier id'>create</span><span class='lparen token'>(</span><span class='string val'>"STDERR"</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='rubyid_fatal identifier id'>fatal</span><span class='lparen token'>(</span><span class='dstring node'>"Cannot log to {mark=bright}#{config.log_file}{/mark}. Exiting..."</span><span class='rparen token'>)</span>
|
687
|
+
<span class='rubyid_raise identifier id'>raise</span> <span class='colon3 op'>::</span><span class='rubyid_SystemExit constant id'>SystemExit</span>
|
688
|
+
<span class='rubyid_end end kw'>end</span>
|
689
|
+
|
690
|
+
<span class='rubyid_self self kw'>self</span>
|
691
|
+
<span class='rubyid_end end kw'>end</span>
|
692
|
+
</pre>
|
692
693
|
</td>
|
693
694
|
</tr>
|
694
695
|
</table>
|
@@ -733,9 +734,10 @@
|
|
733
734
|
<td>
|
734
735
|
<pre class="code"><span class="info file"># File 'lib/akaer/application.rb', line 15</span>
|
735
736
|
|
736
|
-
<span class='kw'>def</span> <span class='
|
737
|
-
<span class='ivar'>@command</span>
|
738
|
-
<span class='kw'>end</span
|
737
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_command identifier id'>command</span>
|
738
|
+
<span class='rubyid_@command ivar id'>@command</span>
|
739
|
+
<span class='rubyid_end end kw'>end</span>
|
740
|
+
</pre>
|
739
741
|
</td>
|
740
742
|
</tr>
|
741
743
|
</table>
|
@@ -775,9 +777,10 @@
|
|
775
777
|
<td>
|
776
778
|
<pre class="code"><span class="info file"># File 'lib/akaer/application.rb', line 12</span>
|
777
779
|
|
778
|
-
<span class='kw'>def</span> <span class='
|
779
|
-
<span class='ivar'>@config</span>
|
780
|
-
<span class='kw'>end</span
|
780
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_config identifier id'>config</span>
|
781
|
+
<span class='rubyid_@config ivar id'>@config</span>
|
782
|
+
<span class='rubyid_end end kw'>end</span>
|
783
|
+
</pre>
|
781
784
|
</td>
|
782
785
|
</tr>
|
783
786
|
</table>
|
@@ -817,9 +820,10 @@
|
|
817
820
|
<td>
|
818
821
|
<pre class="code"><span class="info file"># File 'lib/akaer/application.rb', line 18</span>
|
819
822
|
|
820
|
-
<span class='kw'>def</span> <span class='
|
821
|
-
<span class='ivar'>@logger</span>
|
822
|
-
<span class='kw'>end</span
|
823
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_logger identifier id'>logger</span>
|
824
|
+
<span class='rubyid_@logger ivar id'>@logger</span>
|
825
|
+
<span class='rubyid_end end kw'>end</span>
|
826
|
+
</pre>
|
823
827
|
</td>
|
824
828
|
</tr>
|
825
829
|
</table>
|
@@ -918,10 +922,11 @@
|
|
918
922
|
<td>
|
919
923
|
<pre class="code"><span class="info file"># File 'lib/akaer/application.rb', line 304</span>
|
920
924
|
|
921
|
-
<span class='kw'>def</span> <span class='kw'>self</span><span class='
|
922
|
-
<span class='ivar'>@instance</span> <span class='
|
923
|
-
<span class='ivar'>@instance</span> <span class='op'>||=</span> <span class='
|
924
|
-
<span class='kw'>end</span
|
925
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_instance identifier id'>instance</span><span class='lparen token'>(</span><span class='rubyid_command identifier id'>command</span><span class='comma token'>,</span> <span class='rubyid_force identifier id'>force</span> <span class='assign token'>=</span> <span class='rubyid_false false kw'>false</span><span class='rparen token'>)</span>
|
926
|
+
<span class='rubyid_@instance ivar id'>@instance</span> <span class='assign token'>=</span> <span class='rubyid_nil nil kw'>nil</span> <span class='rubyid_if if_mod kw'>if</span> <span class='rubyid_force identifier id'>force</span>
|
927
|
+
<span class='rubyid_@instance ivar id'>@instance</span> <span class='opasgn op'>||=</span> <span class='rubyid_Akaer constant id'>Akaer</span><span class='colon2 op'>::</span><span class='rubyid_Application constant id'>Application</span><span class='dot token'>.</span><span class='rubyid_new identifier id'>new</span><span class='lparen token'>(</span><span class='rubyid_command identifier id'>command</span><span class='rparen token'>)</span>
|
928
|
+
<span class='rubyid_end end kw'>end</span>
|
929
|
+
</pre>
|
925
930
|
</td>
|
926
931
|
</tr>
|
927
932
|
</table>
|
@@ -991,18 +996,19 @@
|
|
991
996
|
<td>
|
992
997
|
<pre class="code"><span class="info file"># File 'lib/akaer/application.rb', line 198</span>
|
993
998
|
|
994
|
-
<span class='kw'>def</span> <span class='
|
995
|
-
<span class='
|
996
|
-
|
997
|
-
<span class='kw'>if</span> <span class='
|
998
|
-
<span class='comment'># Now, for every address, call the command
|
999
|
-
|
1000
|
-
<span class='kw'>self</span><span class='
|
1001
|
-
<span class='rbrace'>}</span>
|
1002
|
-
<span class='kw'>else</span>
|
1003
|
-
<span class='ivar'>@logger</span><span class='
|
1004
|
-
<span class='kw'>end</span>
|
1005
|
-
<span class='kw'>end</span
|
999
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_action_add identifier id'>action_add</span>
|
1000
|
+
<span class='rubyid_addresses identifier id'>addresses</span> <span class='assign token'>=</span> <span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_compute_addresses identifier id'>compute_addresses</span>
|
1001
|
+
|
1002
|
+
<span class='rubyid_if if kw'>if</span> <span class='rubyid_addresses identifier id'>addresses</span><span class='dot token'>.</span><span class='rubyid_present? fid id'>present?</span> <span class='rubyid_then then kw'>then</span>
|
1003
|
+
<span class='comment val'># Now, for every address, call the command</span>
|
1004
|
+
<span class='rubyid_addresses identifier id'>addresses</span><span class='dot token'>.</span><span class='rubyid_all? fid id'>all?</span> <span class='lbrace token'>{</span><span class='bitor op'>|</span><span class='rubyid_address identifier id'>address</span><span class='bitor op'>|</span>
|
1005
|
+
<span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_manage identifier id'>manage</span><span class='lparen token'>(</span><span class='symbol val'>:add</span><span class='comma token'>,</span> <span class='rubyid_address identifier id'>address</span><span class='rparen token'>)</span>
|
1006
|
+
<span class='rbrace token'>}</span>
|
1007
|
+
<span class='rubyid_else else kw'>else</span>
|
1008
|
+
<span class='rubyid_@logger ivar id'>@logger</span><span class='dot token'>.</span><span class='rubyid_error identifier id'>error</span><span class='lparen token'>(</span><span class='string val'>"No valid addresses to add to the interface found."</span><span class='rparen token'>)</span> <span class='rubyid_if if_mod kw'>if</span> <span class='notop op'>!</span><span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_config identifier id'>config</span><span class='dot token'>.</span><span class='rubyid_quiet identifier id'>quiet</span>
|
1009
|
+
<span class='rubyid_end end kw'>end</span>
|
1010
|
+
<span class='rubyid_end end kw'>end</span>
|
1011
|
+
</pre>
|
1006
1012
|
</td>
|
1007
1013
|
</tr>
|
1008
1014
|
</table>
|
@@ -1090,42 +1096,43 @@
|
|
1090
1096
|
<td>
|
1091
1097
|
<pre class="code"><span class="info file"># File 'lib/akaer/application.rb', line 230</span>
|
1092
1098
|
|
1093
|
-
<span class='kw'>def</span> <span class='
|
1094
|
-
<span class='
|
1095
|
-
|
1096
|
-
<span class='kw'>if</span> <span class='op'>!</span><span class='kw'>self</span><span class='
|
1097
|
-
<span class='
|
1098
|
-
<span class='kw'>return</span> <span class='kw'>false</span>
|
1099
|
-
<span class='kw'>end</span>
|
1100
|
-
|
1101
|
-
<span class='
|
1102
|
-
|
1103
|
-
<span class='kw'>begin</span>
|
1104
|
-
<span class='
|
1105
|
-
|
1106
|
-
<span class='
|
1107
|
-
|
1108
|
-
<span class='
|
1109
|
-
<span class='op'>::</span><span class='
|
1110
|
-
<span class='
|
1111
|
-
<span class='
|
1112
|
-
<span class='rbrace'>}</span>
|
1113
|
-
<span class='kw'>self</span><span class='
|
1114
|
-
<span class='kw'>rescue</span> <span class='op'
|
1115
|
-
<span class='
|
1116
|
-
<span class='kw'>return</span> <span class='kw'>false</span>
|
1117
|
-
<span class='kw'>end</span>
|
1118
|
-
|
1119
|
-
<span class='kw'>begin</span>
|
1120
|
-
<span class='
|
1121
|
-
<span class='kw'>self</span><span class='
|
1122
|
-
<span class='kw'>rescue</span> <span class='op'
|
1123
|
-
<span class='
|
1124
|
-
<span class='kw'>return</span> <span class='kw'>false</span>
|
1125
|
-
<span class='kw'>end</span>
|
1126
|
-
|
1127
|
-
<span class='kw'>true</span>
|
1128
|
-
<span class='kw'>end</span
|
1099
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_action_install identifier id'>action_install</span>
|
1100
|
+
<span class='rubyid_logger identifier id'>logger</span> <span class='assign token'>=</span> <span class='rubyid_get_logger identifier id'>get_logger</span>
|
1101
|
+
|
1102
|
+
<span class='rubyid_if if kw'>if</span> <span class='notop op'>!</span><span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_is_osx? fid id'>is_osx?</span> <span class='rubyid_then then kw'>then</span>
|
1103
|
+
<span class='rubyid_logger identifier id'>logger</span><span class='dot token'>.</span><span class='rubyid_fatal identifier id'>fatal</span><span class='lparen token'>(</span><span class='string val'>"Install akaer on autolaunch is only available on MacOSX."</span><span class='rparen token'>)</span> <span class='rubyid_if if_mod kw'>if</span> <span class='notop op'>!</span><span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_config identifier id'>config</span><span class='dot token'>.</span><span class='rubyid_quiet identifier id'>quiet</span>
|
1104
|
+
<span class='rubyid_return return kw'>return</span> <span class='rubyid_false false kw'>false</span>
|
1105
|
+
<span class='rubyid_end end kw'>end</span>
|
1106
|
+
|
1107
|
+
<span class='rubyid_launch_agent identifier id'>launch_agent</span> <span class='assign token'>=</span> <span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_launch_agent_path identifier id'>launch_agent_path</span>
|
1108
|
+
|
1109
|
+
<span class='rubyid_begin begin kw'>begin</span>
|
1110
|
+
<span class='rubyid_logger identifier id'>logger</span><span class='dot token'>.</span><span class='rubyid_info identifier id'>info</span><span class='lparen token'>(</span><span class='dstring node'>"Creating the launch agent in {mark=bright}#{launch_agent}{/mark} ..."</span><span class='rparen token'>)</span> <span class='rubyid_if if_mod kw'>if</span> <span class='notop op'>!</span><span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_config identifier id'>config</span><span class='dot token'>.</span><span class='rubyid_quiet identifier id'>quiet</span>
|
1111
|
+
|
1112
|
+
<span class='rubyid_args identifier id'>args</span> <span class='assign token'>=</span> <span class='rubyid_$ARGV gvar id'>$ARGV</span> <span class='question op'>?</span> <span class='rubyid_$ARGV gvar id'>$ARGV</span><span class='lbrack token'>[</span><span class='integer val'>0</span><span class='comma token'>,</span> <span class='rubyid_$ARGV gvar id'>$ARGV</span><span class='dot token'>.</span><span class='rubyid_length identifier id'>length</span> <span class='minus op'>-</span> <span class='integer val'>1</span><span class='rbrack token'>]</span> <span class='colon op'>:</span> <span class='lbrack token'>[</span><span class='rbrack token'>]</span>
|
1113
|
+
|
1114
|
+
<span class='rubyid_plist identifier id'>plist</span> <span class='assign token'>=</span> <span class='lbrace token'>{</span><span class='string val'>"KeepAlive"</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='rubyid_false false kw'>false</span><span class='comma token'>,</span> <span class='string val'>"Label"</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='string val'>"it.cowtech.akaer"</span><span class='comma token'>,</span> <span class='string val'>"Program"</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='lparen token'>(</span><span class='colon3 op'>::</span><span class='rubyid_Pathname constant id'>Pathname</span><span class='dot token'>.</span><span class='rubyid_new identifier id'>new</span><span class='lparen token'>(</span><span class='rubyid_Dir constant id'>Dir</span><span class='dot token'>.</span><span class='rubyid_pwd identifier id'>pwd</span><span class='rparen token'>)</span> <span class='plus op'>+</span> <span class='rubyid_$0 gvar id'>$0</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='rubyid_to_s identifier id'>to_s</span><span class='comma token'>,</span> <span class='string val'>"ProgramArguments"</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='rubyid_args identifier id'>args</span><span class='comma token'>,</span> <span class='string val'>"RunAtLoad"</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='rubyid_true true kw'>true</span><span class='rbrace token'>}</span>
|
1115
|
+
<span class='colon3 op'>::</span><span class='rubyid_File constant id'>File</span><span class='dot token'>.</span><span class='rubyid_open identifier id'>open</span><span class='lparen token'>(</span><span class='rubyid_launch_agent identifier id'>launch_agent</span><span class='comma token'>,</span> <span class='string val'>"w"</span><span class='rparen token'>)</span> <span class='lbrace token'>{</span><span class='bitor op'>|</span><span class='rubyid_f identifier id'>f</span><span class='bitor op'>|</span>
|
1116
|
+
<span class='rubyid_f identifier id'>f</span><span class='dot token'>.</span><span class='rubyid_write identifier id'>write</span><span class='lparen token'>(</span><span class='rubyid_plist identifier id'>plist</span><span class='dot token'>.</span><span class='rubyid_to_json identifier id'>to_json</span><span class='rparen token'>)</span>
|
1117
|
+
<span class='rubyid_f identifier id'>f</span><span class='dot token'>.</span><span class='rubyid_flush identifier id'>flush</span>
|
1118
|
+
<span class='rbrace token'>}</span>
|
1119
|
+
<span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_execute_command identifier id'>execute_command</span><span class='lparen token'>(</span><span class='dstring node'>"plutil -convert binary1 \"#{launch_agent}\""</span><span class='rparen token'>)</span>
|
1120
|
+
<span class='rubyid_rescue rescue kw'>rescue</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='rubyid_e identifier id'>e</span>
|
1121
|
+
<span class='rubyid_logger identifier id'>logger</span><span class='dot token'>.</span><span class='rubyid_error identifier id'>error</span><span class='lparen token'>(</span><span class='string val'>"Cannot create the launch agent."</span><span class='rparen token'>)</span> <span class='rubyid_if if_mod kw'>if</span> <span class='notop op'>!</span><span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_config identifier id'>config</span><span class='dot token'>.</span><span class='rubyid_quiet identifier id'>quiet</span>
|
1122
|
+
<span class='rubyid_return return kw'>return</span> <span class='rubyid_false false kw'>false</span>
|
1123
|
+
<span class='rubyid_end end kw'>end</span>
|
1124
|
+
|
1125
|
+
<span class='rubyid_begin begin kw'>begin</span>
|
1126
|
+
<span class='rubyid_logger identifier id'>logger</span><span class='dot token'>.</span><span class='rubyid_info identifier id'>info</span><span class='lparen token'>(</span><span class='string val'>"Loading the launch agent ..."</span><span class='rparen token'>)</span> <span class='rubyid_if if_mod kw'>if</span> <span class='notop op'>!</span><span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_config identifier id'>config</span><span class='dot token'>.</span><span class='rubyid_quiet identifier id'>quiet</span>
|
1127
|
+
<span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_execute_command identifier id'>execute_command</span><span class='lparen token'>(</span><span class='dstring node'>"launchctl load -w \"#{launch_agent}\" > /dev/null 2>&1"</span><span class='rparen token'>)</span>
|
1128
|
+
<span class='rubyid_rescue rescue kw'>rescue</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='rubyid_e identifier id'>e</span>
|
1129
|
+
<span class='rubyid_logger identifier id'>logger</span><span class='dot token'>.</span><span class='rubyid_error identifier id'>error</span><span class='lparen token'>(</span><span class='string val'>"Cannot load the launch agent."</span><span class='rparen token'>)</span> <span class='rubyid_if if_mod kw'>if</span> <span class='notop op'>!</span><span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_config identifier id'>config</span><span class='dot token'>.</span><span class='rubyid_quiet identifier id'>quiet</span>
|
1130
|
+
<span class='rubyid_return return kw'>return</span> <span class='rubyid_false false kw'>false</span>
|
1131
|
+
<span class='rubyid_end end kw'>end</span>
|
1132
|
+
|
1133
|
+
<span class='rubyid_true true kw'>true</span>
|
1134
|
+
<span class='rubyid_end end kw'>end</span>
|
1135
|
+
</pre>
|
1129
1136
|
</td>
|
1130
1137
|
</tr>
|
1131
1138
|
</table>
|
@@ -1189,18 +1196,19 @@
|
|
1189
1196
|
<td>
|
1190
1197
|
<pre class="code"><span class="info file"># File 'lib/akaer/application.rb', line 214</span>
|
1191
1198
|
|
1192
|
-
<span class='kw'>def</span> <span class='
|
1193
|
-
<span class='
|
1194
|
-
|
1195
|
-
<span class='kw'>if</span> <span class='
|
1196
|
-
<span class='comment'># Now, for every address, call the command
|
1197
|
-
|
1198
|
-
<span class='kw'>self</span><span class='
|
1199
|
-
<span class='rbrace'>}</span>
|
1200
|
-
<span class='kw'>else</span>
|
1201
|
-
<span class='ivar'>@logger</span><span class='
|
1202
|
-
<span class='kw'>end</span>
|
1203
|
-
<span class='kw'>end</span
|
1199
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_action_remove identifier id'>action_remove</span>
|
1200
|
+
<span class='rubyid_addresses identifier id'>addresses</span> <span class='assign token'>=</span> <span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_compute_addresses identifier id'>compute_addresses</span>
|
1201
|
+
|
1202
|
+
<span class='rubyid_if if kw'>if</span> <span class='rubyid_addresses identifier id'>addresses</span><span class='dot token'>.</span><span class='rubyid_present? fid id'>present?</span> <span class='rubyid_then then kw'>then</span>
|
1203
|
+
<span class='comment val'># Now, for every address, call the command</span>
|
1204
|
+
<span class='rubyid_addresses identifier id'>addresses</span><span class='dot token'>.</span><span class='rubyid_all? fid id'>all?</span> <span class='lbrace token'>{</span><span class='bitor op'>|</span><span class='rubyid_address identifier id'>address</span><span class='bitor op'>|</span>
|
1205
|
+
<span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_manage identifier id'>manage</span><span class='lparen token'>(</span><span class='symbol val'>:remove</span><span class='comma token'>,</span> <span class='rubyid_address identifier id'>address</span><span class='rparen token'>)</span>
|
1206
|
+
<span class='rbrace token'>}</span>
|
1207
|
+
<span class='rubyid_else else kw'>else</span>
|
1208
|
+
<span class='rubyid_@logger ivar id'>@logger</span><span class='dot token'>.</span><span class='rubyid_error identifier id'>error</span><span class='lparen token'>(</span><span class='string val'>"No valid addresses to remove from the interface found."</span><span class='rparen token'>)</span> <span class='rubyid_if if_mod kw'>if</span> <span class='notop op'>!</span><span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_config identifier id'>config</span><span class='dot token'>.</span><span class='rubyid_quiet identifier id'>quiet</span>
|
1209
|
+
<span class='rubyid_end end kw'>end</span>
|
1210
|
+
<span class='rubyid_end end kw'>end</span>
|
1211
|
+
</pre>
|
1204
1212
|
</td>
|
1205
1213
|
</tr>
|
1206
1214
|
</table>
|
@@ -1280,34 +1288,35 @@
|
|
1280
1288
|
<td>
|
1281
1289
|
<pre class="code"><span class="info file"># File 'lib/akaer/application.rb', line 270</span>
|
1282
1290
|
|
1283
|
-
<span class='kw'>def</span> <span class='
|
1284
|
-
<span class='
|
1285
|
-
|
1286
|
-
<span class='kw'>if</span> <span class='op'>!</span><span class='kw'>self</span><span class='
|
1287
|
-
<span class='
|
1288
|
-
<span class='kw'>return</span> <span class='kw'>false</span>
|
1289
|
-
<span class='kw'>end</span>
|
1290
|
-
|
1291
|
-
<span class='
|
1292
|
-
|
1293
|
-
<span class='comment'># Unload the launch agent
|
1294
|
-
|
1295
|
-
<span class='kw'>self</span><span class='
|
1296
|
-
<span class='kw'>rescue</span> <span class='op'
|
1297
|
-
<span class='
|
1298
|
-
<span class='kw'>end</span>
|
1299
|
-
|
1300
|
-
<span class='comment'># Delete the launch agent
|
1301
|
-
|
1302
|
-
<span class='
|
1303
|
-
<span class='op'>::</span><span class='
|
1304
|
-
<span class='kw'>rescue</span> <span class='op'
|
1305
|
-
<span class='
|
1306
|
-
<span class='kw'>return</span> <span class='kw'>false</span>
|
1307
|
-
<span class='kw'>end</span>
|
1308
|
-
|
1309
|
-
<span class='kw'>true</span>
|
1310
|
-
<span class='kw'>end</span
|
1291
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_action_uninstall identifier id'>action_uninstall</span>
|
1292
|
+
<span class='rubyid_logger identifier id'>logger</span> <span class='assign token'>=</span> <span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_get_logger identifier id'>get_logger</span>
|
1293
|
+
|
1294
|
+
<span class='rubyid_if if kw'>if</span> <span class='notop op'>!</span><span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_is_osx? fid id'>is_osx?</span> <span class='rubyid_then then kw'>then</span>
|
1295
|
+
<span class='rubyid_logger identifier id'>logger</span><span class='dot token'>.</span><span class='rubyid_fatal identifier id'>fatal</span><span class='lparen token'>(</span><span class='string val'>"Install akaer on autolaunch is only available on MacOSX."</span><span class='rparen token'>)</span> <span class='rubyid_if if_mod kw'>if</span> <span class='notop op'>!</span><span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_config identifier id'>config</span><span class='dot token'>.</span><span class='rubyid_quiet identifier id'>quiet</span>
|
1296
|
+
<span class='rubyid_return return kw'>return</span> <span class='rubyid_false false kw'>false</span>
|
1297
|
+
<span class='rubyid_end end kw'>end</span>
|
1298
|
+
|
1299
|
+
<span class='rubyid_launch_agent identifier id'>launch_agent</span> <span class='assign token'>=</span> <span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_launch_agent_path identifier id'>launch_agent_path</span>
|
1300
|
+
|
1301
|
+
<span class='comment val'># Unload the launch agent.</span>
|
1302
|
+
<span class='rubyid_begin begin kw'>begin</span>
|
1303
|
+
<span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_execute_command identifier id'>execute_command</span><span class='lparen token'>(</span><span class='dstring node'>"launchctl unload -w \"#{launch_agent}\" > /dev/null 2>&1"</span><span class='rparen token'>)</span>
|
1304
|
+
<span class='rubyid_rescue rescue kw'>rescue</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='rubyid_e identifier id'>e</span>
|
1305
|
+
<span class='rubyid_logger identifier id'>logger</span><span class='dot token'>.</span><span class='rubyid_warn identifier id'>warn</span><span class='lparen token'>(</span><span class='string val'>"Cannot unload the launch agent."</span><span class='rparen token'>)</span> <span class='rubyid_if if_mod kw'>if</span> <span class='notop op'>!</span><span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_config identifier id'>config</span><span class='dot token'>.</span><span class='rubyid_quiet identifier id'>quiet</span>
|
1306
|
+
<span class='rubyid_end end kw'>end</span>
|
1307
|
+
|
1308
|
+
<span class='comment val'># Delete the launch agent.</span>
|
1309
|
+
<span class='rubyid_begin begin kw'>begin</span>
|
1310
|
+
<span class='rubyid_logger identifier id'>logger</span><span class='dot token'>.</span><span class='rubyid_info identifier id'>info</span><span class='lparen token'>(</span><span class='dstring node'>"Deleting the launch agent #{launch_agent} ..."</span><span class='rparen token'>)</span>
|
1311
|
+
<span class='colon3 op'>::</span><span class='rubyid_File constant id'>File</span><span class='dot token'>.</span><span class='rubyid_delete identifier id'>delete</span><span class='lparen token'>(</span><span class='rubyid_launch_agent identifier id'>launch_agent</span><span class='rparen token'>)</span>
|
1312
|
+
<span class='rubyid_rescue rescue kw'>rescue</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='rubyid_e identifier id'>e</span>
|
1313
|
+
<span class='rubyid_logger identifier id'>logger</span><span class='dot token'>.</span><span class='rubyid_warn identifier id'>warn</span><span class='lparen token'>(</span><span class='string val'>"Cannot delete the launch agent."</span><span class='rparen token'>)</span> <span class='rubyid_if if_mod kw'>if</span> <span class='notop op'>!</span><span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_config identifier id'>config</span><span class='dot token'>.</span><span class='rubyid_quiet identifier id'>quiet</span>
|
1314
|
+
<span class='rubyid_return return kw'>return</span> <span class='rubyid_false false kw'>false</span>
|
1315
|
+
<span class='rubyid_end end kw'>end</span>
|
1316
|
+
|
1317
|
+
<span class='rubyid_true true kw'>true</span>
|
1318
|
+
<span class='rubyid_end end kw'>end</span>
|
1319
|
+
</pre>
|
1311
1320
|
</td>
|
1312
1321
|
</tr>
|
1313
1322
|
</table>
|
@@ -1406,32 +1415,33 @@
|
|
1406
1415
|
<td>
|
1407
1416
|
<pre class="code"><span class="info file"># File 'lib/akaer/application.rb', line 136</span>
|
1408
1417
|
|
1409
|
-
<span class='kw'>def</span> <span class='
|
1410
|
-
<span class='
|
1411
|
-
|
1412
|
-
<span class='kw'>if</span> <span class='kw'>self</span><span class='
|
1413
|
-
|
1414
|
-
|
1415
|
-
<span class='comment'># Now filter the addresses
|
1416
|
-
|
1417
|
-
<span class='
|
1418
|
-
<span class='
|
1419
|
-
<span class='rbrace'>}</span><span class='
|
1420
|
-
<span class='kw'>else</span>
|
1421
|
-
<span class='kw'>begin</span>
|
1422
|
-
<span class='
|
1423
|
-
<span class='
|
1424
|
-
|
1425
|
-
<span class='lparen'>(</span><span class='kw'>self</span><span class='
|
1426
|
-
<span class='
|
1427
|
-
<span class='
|
1428
|
-
<span class='kw'>end</span>
|
1429
|
-
<span class='kw'>rescue</span> <span class='
|
1430
|
-
<span class='kw'>end</span>
|
1431
|
-
<span class='kw'>end</span>
|
1432
|
-
|
1433
|
-
<span class='
|
1434
|
-
<span class='kw'>end</span
|
1418
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_compute_addresses identifier id'>compute_addresses</span><span class='lparen token'>(</span><span class='rubyid_type identifier id'>type</span> <span class='assign token'>=</span> <span class='symbol val'>:all</span><span class='rparen token'>)</span>
|
1419
|
+
<span class='rubyid_rv identifier id'>rv</span> <span class='assign token'>=</span> <span class='lbrack token'>[</span><span class='rbrack token'>]</span>
|
1420
|
+
|
1421
|
+
<span class='rubyid_if if kw'>if</span> <span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_config identifier id'>config</span><span class='dot token'>.</span><span class='rubyid_addresses identifier id'>addresses</span><span class='dot token'>.</span><span class='rubyid_present? fid id'>present?</span> <span class='comment val'># We have an explicit list</span>
|
1422
|
+
<span class='rubyid_rv identifier id'>rv</span> <span class='assign token'>=</span> <span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_config identifier id'>config</span><span class='dot token'>.</span><span class='rubyid_addresses identifier id'>addresses</span>
|
1423
|
+
|
1424
|
+
<span class='comment val'># Now filter the addresses</span>
|
1425
|
+
<span class='rubyid_filters identifier id'>filters</span> <span class='assign token'>=</span> <span class='lbrack token'>[</span><span class='rubyid_type identifier id'>type</span> <span class='neq op'>!=</span> <span class='symbol val'>:ipv6</span> <span class='question op'>?</span> <span class='symbol val'>:ipv4</span> <span class='colon op'>:</span> <span class='rubyid_nil nil kw'>nil</span><span class='comma token'>,</span> <span class='rubyid_type identifier id'>type</span> <span class='neq op'>!=</span> <span class='symbol val'>:ipv4</span> <span class='question op'>?</span> <span class='symbol val'>:ipv6</span> <span class='colon op'>:</span> <span class='rubyid_nil nil kw'>nil</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='rubyid_compact identifier id'>compact</span>
|
1426
|
+
<span class='rubyid_rv identifier id'>rv</span> <span class='assign token'>=</span> <span class='rubyid_rv identifier id'>rv</span><span class='dot token'>.</span><span class='rubyid_select identifier id'>select</span> <span class='lbrace token'>{</span><span class='bitor op'>|</span><span class='rubyid_address identifier id'>address</span><span class='bitor op'>|</span>
|
1427
|
+
<span class='rubyid_filters identifier id'>filters</span><span class='dot token'>.</span><span class='rubyid_any? fid id'>any?</span> <span class='lbrace token'>{</span><span class='bitor op'>|</span><span class='rubyid_filter identifier id'>filter</span><span class='bitor op'>|</span> <span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_send identifier id'>send</span><span class='lparen token'>(</span><span class='dstring node'>"is_#{filter}?"</span><span class='comma token'>,</span> <span class='rubyid_address identifier id'>address</span><span class='rparen token'>)</span> <span class='rbrace token'>}</span>
|
1428
|
+
<span class='rbrace token'>}</span><span class='dot token'>.</span><span class='rubyid_compact identifier id'>compact</span><span class='dot token'>.</span><span class='rubyid_uniq identifier id'>uniq</span>
|
1429
|
+
<span class='rubyid_else else kw'>else</span>
|
1430
|
+
<span class='rubyid_begin begin kw'>begin</span>
|
1431
|
+
<span class='rubyid_ip identifier id'>ip</span> <span class='assign token'>=</span> <span class='rubyid_IPAddr constant id'>IPAddr</span><span class='dot token'>.</span><span class='rubyid_new identifier id'>new</span><span class='lparen token'>(</span><span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_config identifier id'>config</span><span class='dot token'>.</span><span class='rubyid_start_address identifier id'>start_address</span><span class='dot token'>.</span><span class='rubyid_ensure_string identifier id'>ensure_string</span><span class='rparen token'>)</span>
|
1432
|
+
<span class='rubyid_raise identifier id'>raise</span> <span class='rubyid_ArgumentError constant id'>ArgumentError</span> <span class='rubyid_if if_mod kw'>if</span> <span class='lparen token'>(</span><span class='rubyid_type identifier id'>type</span> <span class='eq op'>==</span> <span class='symbol val'>:ipv4</span> <span class='andop op'>&&</span> <span class='notop op'>!</span><span class='rubyid_ip identifier id'>ip</span><span class='dot token'>.</span><span class='rubyid_ipv4? fid id'>ipv4?</span><span class='rparen token'>)</span> <span class='orop op'>||</span> <span class='lparen token'>(</span><span class='rubyid_type identifier id'>type</span> <span class='eq op'>==</span> <span class='symbol val'>:ipv6</span> <span class='andop op'>&&</span> <span class='notop op'>!</span><span class='rubyid_ip identifier id'>ip</span><span class='dot token'>.</span><span class='rubyid_ipv6? fid id'>ipv6?</span><span class='rparen token'>)</span>
|
1433
|
+
|
1434
|
+
<span class='lparen token'>(</span><span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_config identifier id'>config</span><span class='dot token'>.</span><span class='rubyid_aliases identifier id'>aliases</span> <span class='gt op'>></span> <span class='integer val'>0</span> <span class='question op'>?</span> <span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_config identifier id'>config</span><span class='dot token'>.</span><span class='rubyid_aliases identifier id'>aliases</span> <span class='colon op'>:</span> <span class='integer val'>5</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='rubyid_times identifier id'>times</span> <span class='rubyid_do do kw'>do</span>
|
1435
|
+
<span class='rubyid_rv identifier id'>rv</span> <span class='lshft op'><<</span> <span class='rubyid_ip identifier id'>ip</span><span class='dot token'>.</span><span class='rubyid_to_s identifier id'>to_s</span>
|
1436
|
+
<span class='rubyid_ip identifier id'>ip</span> <span class='assign token'>=</span> <span class='rubyid_ip identifier id'>ip</span><span class='dot token'>.</span><span class='rubyid_succ identifier id'>succ</span>
|
1437
|
+
<span class='rubyid_end end kw'>end</span>
|
1438
|
+
<span class='rubyid_rescue rescue kw'>rescue</span> <span class='rubyid_ArgumentError constant id'>ArgumentError</span>
|
1439
|
+
<span class='rubyid_end end kw'>end</span>
|
1440
|
+
<span class='rubyid_end end kw'>end</span>
|
1441
|
+
|
1442
|
+
<span class='rubyid_rv identifier id'>rv</span>
|
1443
|
+
<span class='rubyid_end end kw'>end</span>
|
1444
|
+
</pre>
|
1435
1445
|
</td>
|
1436
1446
|
</tr>
|
1437
1447
|
</table>
|
@@ -1505,9 +1515,10 @@
|
|
1505
1515
|
<td>
|
1506
1516
|
<pre class="code"><span class="info file"># File 'lib/akaer/application.rb', line 128</span>
|
1507
1517
|
|
1508
|
-
<span class='kw'>def</span> <span class='
|
1509
|
-
<span class='
|
1510
|
-
<span class='kw'>end</span
|
1518
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_execute_command identifier id'>execute_command</span><span class='lparen token'>(</span><span class='rubyid_command identifier id'>command</span><span class='rparen token'>)</span>
|
1519
|
+
<span class='rubyid_Kernel constant id'>Kernel</span><span class='dot token'>.</span><span class='rubyid_system identifier id'>system</span><span class='lparen token'>(</span><span class='rubyid_command identifier id'>command</span><span class='rparen token'>)</span>
|
1520
|
+
<span class='rubyid_end end kw'>end</span>
|
1521
|
+
</pre>
|
1511
1522
|
</td>
|
1512
1523
|
</tr>
|
1513
1524
|
</table>
|
@@ -1562,9 +1573,10 @@
|
|
1562
1573
|
<td>
|
1563
1574
|
<pre class="code"><span class="info file"># File 'lib/akaer/application.rb', line 112</span>
|
1564
1575
|
|
1565
|
-
<span class='kw'>def</span> <span class='
|
1566
|
-
<span class='ivar'>@logger</span> <span class='op'>||=</span> <span class='
|
1567
|
-
<span class='kw'>end</span
|
1576
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_get_logger identifier id'>get_logger</span>
|
1577
|
+
<span class='rubyid_@logger ivar id'>@logger</span> <span class='opasgn op'>||=</span> <span class='rubyid_Bovem constant id'>Bovem</span><span class='colon2 op'>::</span><span class='rubyid_Logger constant id'>Logger</span><span class='dot token'>.</span><span class='rubyid_create identifier id'>create</span><span class='lparen token'>(</span><span class='rubyid_Bovem constant id'>Bovem</span><span class='colon2 op'>::</span><span class='rubyid_Logger constant id'>Logger</span><span class='dot token'>.</span><span class='rubyid_default_file identifier id'>default_file</span><span class='comma token'>,</span> <span class='rubyid_@config ivar id'>@config</span><span class='dot token'>.</span><span class='rubyid_log_level identifier id'>log_level</span><span class='comma token'>,</span> <span class='rubyid_@log_formatter ivar id'>@log_formatter</span><span class='rparen token'>)</span>
|
1578
|
+
<span class='rubyid_end end kw'>end</span>
|
1579
|
+
</pre>
|
1568
1580
|
</td>
|
1569
1581
|
</tr>
|
1570
1582
|
</table>
|
@@ -1641,12 +1653,13 @@
|
|
1641
1653
|
<td>
|
1642
1654
|
<pre class="code"><span class="info file"># File 'lib/akaer/application.rb', line 71</span>
|
1643
1655
|
|
1644
|
-
<span class='kw'>def</span> <span class='
|
1645
|
-
<span class='
|
1656
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_is_ipv4? fid id'>is_ipv4?</span><span class='lparen token'>(</span><span class='rubyid_address identifier id'>address</span><span class='rparen token'>)</span>
|
1657
|
+
<span class='rubyid_address identifier id'>address</span> <span class='assign token'>=</span> <span class='rubyid_address identifier id'>address</span><span class='dot token'>.</span><span class='rubyid_ensure_string identifier id'>ensure_string</span>
|
1646
1658
|
|
1647
|
-
<span class='
|
1648
|
-
<span class='
|
1649
|
-
<span class='kw'>end</span
|
1659
|
+
<span class='rubyid_mo identifier id'>mo</span> <span class='assign token'>=</span> <span class='regexp val'>/\A(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\Z/</span><span class='dot token'>.</span><span class='rubyid_match identifier id'>match</span><span class='lparen token'>(</span><span class='rubyid_address identifier id'>address</span><span class='rparen token'>)</span>
|
1660
|
+
<span class='rubyid_rv identifier id'>rv</span> <span class='assign token'>=</span> <span class='lparen token'>(</span><span class='rubyid_mo identifier id'>mo</span> <span class='andop op'>&&</span> <span class='rubyid_mo identifier id'>mo</span><span class='dot token'>.</span><span class='rubyid_captures identifier id'>captures</span><span class='dot token'>.</span><span class='rubyid_all? fid id'>all?</span> <span class='lbrace token'>{</span><span class='bitor op'>|</span><span class='rubyid_i identifier id'>i</span><span class='bitor op'>|</span> <span class='rubyid_i identifier id'>i</span><span class='dot token'>.</span><span class='rubyid_to_i identifier id'>to_i</span> <span class='lt op'><</span> <span class='integer val'>256</span><span class='rbrace token'>}</span><span class='rparen token'>)</span> <span class='question op'>?</span> <span class='rubyid_true true kw'>true</span> <span class='colon op'>:</span> <span class='rubyid_false false kw'>false</span>
|
1661
|
+
<span class='rubyid_end end kw'>end</span>
|
1662
|
+
</pre>
|
1650
1663
|
</td>
|
1651
1664
|
</tr>
|
1652
1665
|
</table>
|
@@ -1733,22 +1746,23 @@
|
|
1733
1746
|
<td>
|
1734
1747
|
<pre class="code"><span class="info file"># File 'lib/akaer/application.rb', line 82</span>
|
1735
1748
|
|
1736
|
-
<span class='kw'>def</span> <span class='
|
1737
|
-
<span class='
|
1738
|
-
|
1739
|
-
<span class='
|
1740
|
-
<span class='comment'># IPv6 (normal)
|
1741
|
-
|
1742
|
-
<span class='
|
1743
|
-
<span class='
|
1744
|
-
<span class='comment'># IPv6 (IPv4 compat)
|
1745
|
-
|
1746
|
-
<span class='
|
1747
|
-
<span class='
|
1748
|
-
|
1749
|
-
<span class='kw'>false</span>
|
1750
|
-
<span class='kw'>end</span>
|
1751
|
-
<span class='kw'>end</span
|
1749
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_is_ipv6? fid id'>is_ipv6?</span><span class='lparen token'>(</span><span class='rubyid_address identifier id'>address</span><span class='rparen token'>)</span>
|
1750
|
+
<span class='rubyid_address identifier id'>address</span> <span class='assign token'>=</span> <span class='rubyid_address identifier id'>address</span><span class='dot token'>.</span><span class='rubyid_ensure_string identifier id'>ensure_string</span>
|
1751
|
+
|
1752
|
+
<span class='rubyid_rv identifier id'>rv</span> <span class='assign token'>=</span> <span class='rubyid_catch identifier id'>catch</span><span class='lparen token'>(</span><span class='symbol val'>:valid</span><span class='rparen token'>)</span> <span class='rubyid_do do kw'>do</span>
|
1753
|
+
<span class='comment val'># IPv6 (normal)</span>
|
1754
|
+
<span class='rubyid_throw identifier id'>throw</span><span class='lparen token'>(</span><span class='symbol val'>:valid</span><span class='comma token'>,</span> <span class='rubyid_true true kw'>true</span><span class='rparen token'>)</span> <span class='rubyid_if if_mod kw'>if</span> <span class='regexp val'>/\A[\dA-Fa-f]{1,4}(:[\dA-Fa-f]{1,4})*\Z/</span> <span class='match op'>=~</span> <span class='rubyid_address identifier id'>address</span>
|
1755
|
+
<span class='rubyid_throw identifier id'>throw</span><span class='lparen token'>(</span><span class='symbol val'>:valid</span><span class='comma token'>,</span> <span class='rubyid_true true kw'>true</span><span class='rparen token'>)</span> <span class='rubyid_if if_mod kw'>if</span> <span class='regexp val'>/\A[\dA-Fa-f]{1,4}(:[\dA-Fa-f]{1,4})*::([\dA-Fa-f]{1,4}(:[\dA-Fa-f]{1,4})*)?\Z/</span> <span class='match op'>=~</span> <span class='rubyid_address identifier id'>address</span>
|
1756
|
+
<span class='rubyid_throw identifier id'>throw</span><span class='lparen token'>(</span><span class='symbol val'>:valid</span><span class='comma token'>,</span> <span class='rubyid_true true kw'>true</span><span class='rparen token'>)</span> <span class='rubyid_if if_mod kw'>if</span> <span class='regexp val'>/\A::([\dA-Fa-f]{1,4}(:[\dA-Fa-f]{1,4})*)?\Z/</span> <span class='match op'>=~</span> <span class='rubyid_address identifier id'>address</span>
|
1757
|
+
<span class='comment val'># IPv6 (IPv4 compat)</span>
|
1758
|
+
<span class='rubyid_throw identifier id'>throw</span><span class='lparen token'>(</span><span class='symbol val'>:valid</span><span class='comma token'>,</span> <span class='rubyid_true true kw'>true</span><span class='rparen token'>)</span> <span class='rubyid_if if_mod kw'>if</span> <span class='regexp val'>/\A[\dA-Fa-f]{1,4}(:[\dA-Fa-f]{1,4})*:/</span> <span class='match op'>=~</span> <span class='rubyid_address identifier id'>address</span> <span class='andop op'>&&</span> <span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_is_ipv4? fid id'>is_ipv4?</span><span class='lparen token'>(</span><span class='rubyid_$' back_ref id'>$'</span><span class='rparen token'>)</span>
|
1759
|
+
<span class='rubyid_throw identifier id'>throw</span><span class='lparen token'>(</span><span class='symbol val'>:valid</span><span class='comma token'>,</span> <span class='rubyid_true true kw'>true</span><span class='rparen token'>)</span> <span class='rubyid_if if_mod kw'>if</span> <span class='regexp val'>/\A[\dA-Fa-f]{1,4}(:[\dA-Fa-f]{1,4})*::([\dA-Fa-f]{1,4}(:[\dA-Fa-f]{1,4})*:)?/</span> <span class='match op'>=~</span> <span class='rubyid_address identifier id'>address</span> <span class='andop op'>&&</span> <span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_is_ipv4? fid id'>is_ipv4?</span><span class='lparen token'>(</span><span class='rubyid_$' back_ref id'>$'</span><span class='rparen token'>)</span>
|
1760
|
+
<span class='rubyid_throw identifier id'>throw</span><span class='lparen token'>(</span><span class='symbol val'>:valid</span><span class='comma token'>,</span> <span class='rubyid_true true kw'>true</span><span class='rparen token'>)</span> <span class='rubyid_if if_mod kw'>if</span> <span class='regexp val'>/\A::([\dA-Fa-f]{1,4}(:[\dA-Fa-f]{1,4})*:)?/</span> <span class='match op'>=~</span> <span class='rubyid_address identifier id'>address</span> <span class='andop op'>&&</span> <span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_is_ipv4? fid id'>is_ipv4?</span><span class='lparen token'>(</span><span class='rubyid_$' back_ref id'>$'</span><span class='rparen token'>)</span>
|
1761
|
+
|
1762
|
+
<span class='rubyid_false false kw'>false</span>
|
1763
|
+
<span class='rubyid_end end kw'>end</span>
|
1764
|
+
<span class='rubyid_end end kw'>end</span>
|
1765
|
+
</pre>
|
1752
1766
|
</td>
|
1753
1767
|
</tr>
|
1754
1768
|
</table>
|
@@ -1805,9 +1819,10 @@
|
|
1805
1819
|
<td>
|
1806
1820
|
<pre class="code"><span class="info file"># File 'lib/akaer/application.rb', line 63</span>
|
1807
1821
|
|
1808
|
-
<span class='kw'>def</span> <span class='
|
1809
|
-
<span class='op'>::</span><span class='
|
1810
|
-
<span class='kw'>end</span
|
1822
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_is_osx? fid id'>is_osx?</span>
|
1823
|
+
<span class='colon3 op'>::</span><span class='rubyid_Config constant id'>Config</span><span class='colon2 op'>::</span><span class='rubyid_CONFIG constant id'>CONFIG</span><span class='lbrack token'>[</span><span class='string val'>'host_os'</span><span class='rbrack token'>]</span> <span class='match op'>=~</span> <span class='regexp val'>/^darwin/</span>
|
1824
|
+
<span class='rubyid_end end kw'>end</span>
|
1825
|
+
</pre>
|
1811
1826
|
</td>
|
1812
1827
|
</tr>
|
1813
1828
|
</table>
|
@@ -1883,9 +1898,10 @@
|
|
1883
1898
|
<td>
|
1884
1899
|
<pre class="code"><span class="info file"># File 'lib/akaer/application.rb', line 120</span>
|
1885
1900
|
|
1886
|
-
<span class='kw'>def</span> <span class='
|
1887
|
-
<span class='
|
1888
|
-
<span class='kw'>end</span
|
1901
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_launch_agent_path identifier id'>launch_agent_path</span><span class='lparen token'>(</span><span class='rubyid_name identifier id'>name</span> <span class='assign token'>=</span> <span class='string val'>"it.cowtech.akaer"</span><span class='rparen token'>)</span>
|
1902
|
+
<span class='rubyid_ENV constant id'>ENV</span><span class='lbrack token'>[</span><span class='string val'>"HOME"</span><span class='rbrack token'>]</span> <span class='plus op'>+</span> <span class='dstring node'>"/Library/LaunchAgents/#{name}.plist"</span>
|
1903
|
+
<span class='rubyid_end end kw'>end</span>
|
1904
|
+
</pre>
|
1889
1905
|
</td>
|
1890
1906
|
</tr>
|
1891
1907
|
</table>
|
@@ -1997,32 +2013,33 @@
|
|
1997
2013
|
<td>
|
1998
2014
|
<pre class="code"><span class="info file"># File 'lib/akaer/application.rb', line 168</span>
|
1999
2015
|
|
2000
|
-
<span class='kw'>def</span> <span class='
|
2001
|
-
<span class='
|
2002
|
-
|
2003
|
-
<span class='comment'># Compute the command
|
2004
|
-
|
2005
|
-
|
2006
|
-
<span class='comment'># Interpolate
|
2007
|
-
|
2008
|
-
|
2009
|
-
<span class='comment'># Compute the prefix
|
2010
|
-
|
2011
|
-
<span class='
|
2012
|
-
<span class='
|
2013
|
-
<span class='
|
2014
|
-
|
2015
|
-
<span class='comment'># Now execute
|
2016
|
-
|
2017
|
-
<span class='ivar'>@logger</span><span class='
|
2018
|
-
<span class='
|
2019
|
-
<span class='ivar'>@logger</span><span class='
|
2020
|
-
<span class='kw'>else</span>
|
2021
|
-
<span class='ivar'>@logger</span><span class='
|
2022
|
-
<span class='kw'>end</span>
|
2023
|
-
|
2024
|
-
<span class='
|
2025
|
-
<span class='kw'>end</span
|
2016
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_manage identifier id'>manage</span><span class='lparen token'>(</span><span class='rubyid_type identifier id'>type</span><span class='comma token'>,</span> <span class='rubyid_address identifier id'>address</span><span class='rparen token'>)</span>
|
2017
|
+
<span class='rubyid_rv identifier id'>rv</span> <span class='assign token'>=</span> <span class='rubyid_true true kw'>true</span>
|
2018
|
+
|
2019
|
+
<span class='comment val'># Compute the command</span>
|
2020
|
+
<span class='rubyid_command identifier id'>command</span> <span class='assign token'>=</span> <span class='lparen token'>(</span><span class='rubyid_type identifier id'>type</span> <span class='eq op'>==</span> <span class='symbol val'>:remove</span><span class='rparen token'>)</span> <span class='question op'>?</span> <span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_config identifier id'>config</span><span class='dot token'>.</span><span class='rubyid_remove_command identifier id'>remove_command</span> <span class='colon op'>:</span> <span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_config identifier id'>config</span><span class='dot token'>.</span><span class='rubyid_add_command identifier id'>add_command</span>
|
2021
|
+
|
2022
|
+
<span class='comment val'># Interpolate</span>
|
2023
|
+
<span class='rubyid_command identifier id'>command</span> <span class='assign token'>=</span> <span class='rubyid_command identifier id'>command</span><span class='dot token'>.</span><span class='rubyid_gsub identifier id'>gsub</span><span class='lparen token'>(</span><span class='string val'>"@INTERFACE@"</span><span class='comma token'>,</span> <span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_config identifier id'>config</span><span class='dot token'>.</span><span class='rubyid_interface identifier id'>interface</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='rubyid_gsub identifier id'>gsub</span><span class='lparen token'>(</span><span class='string val'>"@ALIAS@"</span><span class='comma token'>,</span> <span class='rubyid_address identifier id'>address</span><span class='rparen token'>)</span> <span class='plus op'>+</span> <span class='string val'>" > /dev/null 2>&1"</span>
|
2024
|
+
|
2025
|
+
<span class='comment val'># Compute the prefix</span>
|
2026
|
+
<span class='rubyid_@addresses ivar id'>@addresses</span> <span class='opasgn op'>||=</span> <span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_compute_addresses identifier id'>compute_addresses</span>
|
2027
|
+
<span class='rubyid_length identifier id'>length</span> <span class='assign token'>=</span> <span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_pad_number identifier id'>pad_number</span><span class='lparen token'>(</span><span class='rubyid_@addresses ivar id'>@addresses</span><span class='dot token'>.</span><span class='rubyid_length identifier id'>length</span><span class='rparen token'>)</span>
|
2028
|
+
<span class='rubyid_index identifier id'>index</span> <span class='assign token'>=</span> <span class='lparen token'>(</span><span class='rubyid_@addresses ivar id'>@addresses</span><span class='dot token'>.</span><span class='rubyid_index identifier id'>index</span><span class='lparen token'>(</span><span class='rubyid_address identifier id'>address</span><span class='rparen token'>)</span> <span class='orop op'>||</span> <span class='integer val'>0</span><span class='rparen token'>)</span> <span class='plus op'>+</span> <span class='integer val'>1</span>
|
2029
|
+
<span class='rubyid_prefix identifier id'>prefix</span> <span class='assign token'>=</span> <span class='dstring node'>"{mark=blue}[{mark=bright white}#{self.pad_number(index, length.length)}{mark=reset blue}/{/mark}#{length}{/mark}]{/mark}"</span>
|
2030
|
+
|
2031
|
+
<span class='comment val'># Now execute</span>
|
2032
|
+
<span class='rubyid_if if kw'>if</span> <span class='notop op'>!</span><span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_config identifier id'>config</span><span class='dot token'>.</span><span class='rubyid_dry_run identifier id'>dry_run</span> <span class='rubyid_then then kw'>then</span>
|
2033
|
+
<span class='rubyid_@logger ivar id'>@logger</span><span class='dot token'>.</span><span class='rubyid_info identifier id'>info</span><span class='lparen token'>(</span><span class='rubyid_@command ivar id'>@command</span><span class='dot token'>.</span><span class='rubyid_application identifier id'>application</span><span class='dot token'>.</span><span class='rubyid_console identifier id'>console</span><span class='dot token'>.</span><span class='rubyid_replace_markers identifier id'>replace_markers</span><span class='lparen token'>(</span><span class='dstring node'>"#{prefix} {mark=bright}#{(type == :remove ? "Removing" : "Adding")}{/mark} address {mark=bright}#{address}{/mark} #{type != :remove ? "to" : "from"} interface {mark=bright}#{self.config.interface}{/mark}..."</span><span class='rparen token'>)</span><span class='rparen token'>)</span> <span class='rubyid_if if_mod kw'>if</span> <span class='notop op'>!</span><span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_config identifier id'>config</span><span class='dot token'>.</span><span class='rubyid_quiet identifier id'>quiet</span>
|
2034
|
+
<span class='rubyid_rv identifier id'>rv</span> <span class='assign token'>=</span> <span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_execute_command identifier id'>execute_command</span><span class='lparen token'>(</span><span class='rubyid_command identifier id'>command</span><span class='rparen token'>)</span>
|
2035
|
+
<span class='rubyid_@logger ivar id'>@logger</span><span class='dot token'>.</span><span class='rubyid_error identifier id'>error</span><span class='lparen token'>(</span><span class='rubyid_@command ivar id'>@command</span><span class='dot token'>.</span><span class='rubyid_application identifier id'>application</span><span class='dot token'>.</span><span class='rubyid_console identifier id'>console</span><span class='dot token'>.</span><span class='rubyid_replace_markers identifier id'>replace_markers</span><span class='lparen token'>(</span><span class='dstring node'>"Cannot {mark=bright}#{(type == :remove ? "remove" : "add")}{/mark} address {mark=bright}#{address}{/mark} #{type != :remove ? "to" : "from"} interface {mark=bright}#{self.config.interface}{/mark}."</span><span class='rparen token'>)</span><span class='rparen token'>)</span> <span class='rubyid_if if_mod kw'>if</span> <span class='notop op'>!</span><span class='rubyid_rv identifier id'>rv</span>
|
2036
|
+
<span class='rubyid_else else kw'>else</span>
|
2037
|
+
<span class='rubyid_@logger ivar id'>@logger</span><span class='dot token'>.</span><span class='rubyid_info identifier id'>info</span><span class='lparen token'>(</span><span class='rubyid_@command ivar id'>@command</span><span class='dot token'>.</span><span class='rubyid_application identifier id'>application</span><span class='dot token'>.</span><span class='rubyid_console identifier id'>console</span><span class='dot token'>.</span><span class='rubyid_replace_markers identifier id'>replace_markers</span><span class='lparen token'>(</span><span class='dstring node'>"#{prefix} I will {mark=bright}#{(type == :remove ? "remove" : "add")}{/mark} address {mark=bright}#{address}{/mark} #{type != :remove ? "to" : "from"} interface {mark=bright}#{self.config.interface}{/mark}."</span><span class='rparen token'>)</span><span class='rparen token'>)</span> <span class='rubyid_if if_mod kw'>if</span> <span class='notop op'>!</span><span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_config identifier id'>config</span><span class='dot token'>.</span><span class='rubyid_quiet identifier id'>quiet</span>
|
2038
|
+
<span class='rubyid_end end kw'>end</span>
|
2039
|
+
|
2040
|
+
<span class='rubyid_rv identifier id'>rv</span>
|
2041
|
+
<span class='rubyid_end end kw'>end</span>
|
2042
|
+
</pre>
|
2026
2043
|
</td>
|
2027
2044
|
</tr>
|
2028
2045
|
</table>
|
@@ -2113,9 +2130,10 @@
|
|
2113
2130
|
<td>
|
2114
2131
|
<pre class="code"><span class="info file"># File 'lib/akaer/application.rb', line 105</span>
|
2115
2132
|
|
2116
|
-
<span class='kw'>def</span> <span class='
|
2117
|
-
<span class='
|
2118
|
-
<span class='kw'>end</span
|
2133
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_pad_number identifier id'>pad_number</span><span class='lparen token'>(</span><span class='rubyid_num identifier id'>num</span><span class='comma token'>,</span> <span class='rubyid_len identifier id'>len</span> <span class='assign token'>=</span> <span class='rubyid_nil nil kw'>nil</span><span class='rparen token'>)</span>
|
2134
|
+
<span class='rubyid_num identifier id'>num</span><span class='dot token'>.</span><span class='rubyid_to_integer identifier id'>to_integer</span><span class='dot token'>.</span><span class='rubyid_to_s identifier id'>to_s</span><span class='dot token'>.</span><span class='rubyid_rjust identifier id'>rjust</span><span class='lparen token'>(</span><span class='lbrack token'>[</span><span class='rubyid_len identifier id'>len</span><span class='dot token'>.</span><span class='rubyid_to_integer identifier id'>to_integer</span><span class='comma token'>,</span> <span class='integer val'>2</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='rubyid_max identifier id'>max</span><span class='comma token'>,</span> <span class='string val'>"0"</span><span class='rparen token'>)</span>
|
2135
|
+
<span class='rubyid_end end kw'>end</span>
|
2136
|
+
</pre>
|
2119
2137
|
</td>
|
2120
2138
|
</tr>
|
2121
2139
|
</table>
|
@@ -2126,9 +2144,9 @@
|
|
2126
2144
|
</div>
|
2127
2145
|
|
2128
2146
|
<div id="footer">
|
2129
|
-
Generated on
|
2147
|
+
Generated on Sat Oct 6 08:55:20 2012 by
|
2130
2148
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
2131
|
-
0.8.2.1 (ruby-1.
|
2149
|
+
0.8.2.1 (ruby-1.8.7).
|
2132
2150
|
</div>
|
2133
2151
|
|
2134
2152
|
</body>
|