devdnsd 1.5.0 → 1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +15 -15
- data/README.md +1 -0
- data/devdnsd.gemspec +1 -1
- data/doc/DevDNSd/Application.html +291 -268
- data/doc/DevDNSd/Configuration.html +19 -17
- data/doc/DevDNSd/Errors/InvalidRule.html +2 -2
- data/doc/DevDNSd/Errors.html +2 -2
- data/doc/DevDNSd/Rule.html +84 -71
- data/doc/DevDNSd/Version.html +10 -6
- data/doc/DevDNSd.html +2 -2
- 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/devdnsd/version.rb +1 -1
- metadata +169 -160
@@ -129,7 +129,8 @@
|
|
129
129
|
|
130
130
|
</div>
|
131
131
|
</dt>
|
132
|
-
<dd><pre class="code"><span class='
|
132
|
+
<dd><pre class="code"><span class='rubyid_Resolv constant id'>Resolv</span><span class='colon2 op'>::</span><span class='rubyid_DNS constant id'>DNS</span><span class='colon2 op'>::</span><span class='rubyid_Resource constant id'>Resource</span><span class='colon2 op'>::</span><span class='rubyid_IN constant id'>IN</span><span class='colon2 op'>::</span><span class='rubyid_ANY constant id'>ANY</span>
|
133
|
+
</pre></dd>
|
133
134
|
|
134
135
|
<dt id="ANY_CLASSES-constant" class="">ANY_CLASSES =
|
135
136
|
<div class="docstring">
|
@@ -144,7 +145,8 @@
|
|
144
145
|
|
145
146
|
</div>
|
146
147
|
</dt>
|
147
|
-
<dd><pre class="code"><span class='
|
148
|
+
<dd><pre class="code"><span class='lbrack token'>[</span><span class='rubyid_Resolv constant id'>Resolv</span><span class='colon2 op'>::</span><span class='rubyid_DNS constant id'>DNS</span><span class='colon2 op'>::</span><span class='rubyid_Resource constant id'>Resource</span><span class='colon2 op'>::</span><span class='rubyid_IN constant id'>IN</span><span class='colon2 op'>::</span><span class='rubyid_A constant id'>A</span><span class='comma token'>,</span> <span class='rubyid_Resolv constant id'>Resolv</span><span class='colon2 op'>::</span><span class='rubyid_DNS constant id'>DNS</span><span class='colon2 op'>::</span><span class='rubyid_Resource constant id'>Resource</span><span class='colon2 op'>::</span><span class='rubyid_IN constant id'>IN</span><span class='colon2 op'>::</span><span class='rubyid_AAAA constant id'>AAAA</span><span class='comma token'>,</span> <span class='rubyid_Resolv constant id'>Resolv</span><span class='colon2 op'>::</span><span class='rubyid_DNS constant id'>DNS</span><span class='colon2 op'>::</span><span class='rubyid_Resource constant id'>Resource</span><span class='colon2 op'>::</span><span class='rubyid_IN constant id'>IN</span><span class='colon2 op'>::</span><span class='rubyid_ANY constant id'>ANY</span><span class='comma token'>,</span> <span class='rubyid_Resolv constant id'>Resolv</span><span class='colon2 op'>::</span><span class='rubyid_DNS constant id'>DNS</span><span class='colon2 op'>::</span><span class='rubyid_Resource constant id'>Resource</span><span class='colon2 op'>::</span><span class='rubyid_IN constant id'>IN</span><span class='colon2 op'>::</span><span class='rubyid_CNAME constant id'>CNAME</span><span class='comma token'>,</span> <span class='rubyid_Resolv constant id'>Resolv</span><span class='colon2 op'>::</span><span class='rubyid_DNS constant id'>DNS</span><span class='colon2 op'>::</span><span class='rubyid_Resource constant id'>Resource</span><span class='colon2 op'>::</span><span class='rubyid_IN constant id'>IN</span><span class='colon2 op'>::</span><span class='rubyid_HINFO constant id'>HINFO</span><span class='comma token'>,</span> <span class='rubyid_Resolv constant id'>Resolv</span><span class='colon2 op'>::</span><span class='rubyid_DNS constant id'>DNS</span><span class='colon2 op'>::</span><span class='rubyid_Resource constant id'>Resource</span><span class='colon2 op'>::</span><span class='rubyid_IN constant id'>IN</span><span class='colon2 op'>::</span><span class='rubyid_MINFO constant id'>MINFO</span><span class='comma token'>,</span> <span class='rubyid_Resolv constant id'>Resolv</span><span class='colon2 op'>::</span><span class='rubyid_DNS constant id'>DNS</span><span class='colon2 op'>::</span><span class='rubyid_Resource constant id'>Resource</span><span class='colon2 op'>::</span><span class='rubyid_IN constant id'>IN</span><span class='colon2 op'>::</span><span class='rubyid_MX constant id'>MX</span><span class='comma token'>,</span> <span class='rubyid_Resolv constant id'>Resolv</span><span class='colon2 op'>::</span><span class='rubyid_DNS constant id'>DNS</span><span class='colon2 op'>::</span><span class='rubyid_Resource constant id'>Resource</span><span class='colon2 op'>::</span><span class='rubyid_IN constant id'>IN</span><span class='colon2 op'>::</span><span class='rubyid_NS constant id'>NS</span><span class='comma token'>,</span> <span class='rubyid_Resolv constant id'>Resolv</span><span class='colon2 op'>::</span><span class='rubyid_DNS constant id'>DNS</span><span class='colon2 op'>::</span><span class='rubyid_Resource constant id'>Resource</span><span class='colon2 op'>::</span><span class='rubyid_IN constant id'>IN</span><span class='colon2 op'>::</span><span class='rubyid_PTR constant id'>PTR</span><span class='comma token'>,</span> <span class='rubyid_Resolv constant id'>Resolv</span><span class='colon2 op'>::</span><span class='rubyid_DNS constant id'>DNS</span><span class='colon2 op'>::</span><span class='rubyid_Resource constant id'>Resource</span><span class='colon2 op'>::</span><span class='rubyid_IN constant id'>IN</span><span class='colon2 op'>::</span><span class='rubyid_SOA constant id'>SOA</span><span class='comma token'>,</span> <span class='rubyid_Resolv constant id'>Resolv</span><span class='colon2 op'>::</span><span class='rubyid_DNS constant id'>DNS</span><span class='colon2 op'>::</span><span class='rubyid_Resource constant id'>Resource</span><span class='colon2 op'>::</span><span class='rubyid_IN constant id'>IN</span><span class='colon2 op'>::</span><span class='rubyid_TXT constant id'>TXT</span><span class='rbrack token'>]</span>
|
149
|
+
</pre></dd>
|
148
150
|
|
149
151
|
</dl>
|
150
152
|
|
@@ -759,35 +761,36 @@
|
|
759
761
|
<td>
|
760
762
|
<pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 29</span>
|
761
763
|
|
762
|
-
<span class='kw'>def</span> <span class='
|
763
|
-
<span class='ivar'>@command</span> <span class='
|
764
|
-
<span class='
|
765
|
-
|
766
|
-
<span class='comment'># Setup logger
|
767
|
-
|
768
|
-
<span class='ivar'>@logger</span> <span class='
|
769
|
-
|
770
|
-
<span class='comment'># Open configuration
|
771
|
-
|
772
|
-
<span class='
|
773
|
-
<span class='symbol'>:foreground</span> <span class='op'
|
774
|
-
<span class='symbol'>:log_file</span> <span class='op'
|
775
|
-
<span class='symbol'>:log_level</span> <span class='op'
|
776
|
-
<span class='symbol'>:tld</span> <span class='op'
|
777
|
-
<span class='symbol'>:port</span> <span class='op'
|
778
|
-
<span class='rbrace'>}</span><span class='
|
779
|
-
|
780
|
-
<span class='ivar'>@config</span> <span class='
|
781
|
-
|
782
|
-
<span class='ivar'>@logger</span> <span class='
|
783
|
-
<span class='ivar'>@logger</span> <span class='
|
784
|
-
<span class='kw'>rescue</span> <span class='
|
785
|
-
<span class='ivar'>@logger</span> <span class='op'>?</span> <span class='ivar'>@logger</span><span class='
|
786
|
-
<span class='
|
787
|
-
<span class='kw'>end</span>
|
788
|
-
|
789
|
-
<span class='kw'>self</span>
|
790
|
-
<span class='kw'>end</span
|
764
|
+
<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>
|
765
|
+
<span class='rubyid_@command ivar id'>@command</span> <span class='assign token'>=</span> <span class='rubyid_command identifier id'>command</span>
|
766
|
+
<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>
|
767
|
+
|
768
|
+
<span class='comment val'># Setup logger</span>
|
769
|
+
<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>
|
770
|
+
<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>
|
771
|
+
|
772
|
+
<span class='comment val'># Open configuration</span>
|
773
|
+
<span class='rubyid_begin begin kw'>begin</span>
|
774
|
+
<span class='rubyid_overrides identifier id'>overrides</span> <span class='assign token'>=</span> <span class='lbrace token'>{</span>
|
775
|
+
<span class='symbol val'>:foreground</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='rubyid_command identifier id'>command</span><span class='dot token'>.</span><span class='rubyid_name identifier id'>name</span> <span class='eq op'>==</span> <span class='string val'>"start"</span> <span class='question op'>?</span> <span class='rubyid_command identifier id'>command</span><span class='dot token'>.</span><span class='rubyid_options identifier id'>options</span><span class='lbrack token'>[</span><span class='string val'>"foreground"</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='rubyid_value identifier id'>value</span> <span class='colon op'>:</span> <span class='rubyid_false false kw'>false</span><span class='comma token'>,</span>
|
776
|
+
<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>
|
777
|
+
<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>
|
778
|
+
<span class='symbol val'>:tld</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'>"tld"</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='rubyid_value identifier id'>value</span><span class='comma token'>,</span>
|
779
|
+
<span class='symbol val'>:port</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'>"port"</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='rubyid_value identifier id'>value</span>
|
780
|
+
<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>
|
781
|
+
|
782
|
+
<span class='rubyid_@config ivar id'>@config</span> <span class='assign token'>=</span> <span class='rubyid_DevDNSd constant id'>DevDNSd</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>
|
783
|
+
|
784
|
+
<span class='rubyid_@logger ivar id'>@logger</span> <span class='assign token'>=</span> <span class='rubyid_nil nil kw'>nil</span>
|
785
|
+
<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>
|
786
|
+
<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='comma token'>,</span> <span class='rubyid_DevDNSd constant id'>DevDNSd</span><span class='colon2 op'>::</span><span class='rubyid_Errors constant id'>Errors</span><span class='colon2 op'>::</span><span class='rubyid_InvalidRule constant id'>InvalidRule</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='rubyid_e identifier id'>e</span>
|
787
|
+
<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 #{config.log_file}. Exiting..."</span><span class='rparen token'>)</span>
|
788
|
+
<span class='rubyid_raise identifier id'>raise</span> <span class='colon3 op'>::</span><span class='rubyid_SystemExit constant id'>SystemExit</span>
|
789
|
+
<span class='rubyid_end end kw'>end</span>
|
790
|
+
|
791
|
+
<span class='rubyid_self self kw'>self</span>
|
792
|
+
<span class='rubyid_end end kw'>end</span>
|
793
|
+
</pre>
|
791
794
|
</td>
|
792
795
|
</tr>
|
793
796
|
</table>
|
@@ -832,9 +835,10 @@
|
|
832
835
|
<td>
|
833
836
|
<pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 21</span>
|
834
837
|
|
835
|
-
<span class='kw'>def</span> <span class='
|
836
|
-
<span class='ivar'>@command</span>
|
837
|
-
<span class='kw'>end</span
|
838
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_command identifier id'>command</span>
|
839
|
+
<span class='rubyid_@command ivar id'>@command</span>
|
840
|
+
<span class='rubyid_end end kw'>end</span>
|
841
|
+
</pre>
|
838
842
|
</td>
|
839
843
|
</tr>
|
840
844
|
</table>
|
@@ -874,9 +878,10 @@
|
|
874
878
|
<td>
|
875
879
|
<pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 18</span>
|
876
880
|
|
877
|
-
<span class='kw'>def</span> <span class='
|
878
|
-
<span class='ivar'>@config</span>
|
879
|
-
<span class='kw'>end</span
|
881
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_config identifier id'>config</span>
|
882
|
+
<span class='rubyid_@config ivar id'>@config</span>
|
883
|
+
<span class='rubyid_end end kw'>end</span>
|
884
|
+
</pre>
|
880
885
|
</td>
|
881
886
|
</tr>
|
882
887
|
</table>
|
@@ -916,9 +921,10 @@
|
|
916
921
|
<td>
|
917
922
|
<pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 24</span>
|
918
923
|
|
919
|
-
<span class='kw'>def</span> <span class='
|
920
|
-
<span class='ivar'>@logger</span>
|
921
|
-
<span class='kw'>end</span
|
924
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_logger identifier id'>logger</span>
|
925
|
+
<span class='rubyid_@logger ivar id'>@logger</span>
|
926
|
+
<span class='rubyid_end end kw'>end</span>
|
927
|
+
</pre>
|
922
928
|
</td>
|
923
929
|
</tr>
|
924
930
|
</table>
|
@@ -1020,11 +1026,12 @@
|
|
1020
1026
|
<td>
|
1021
1027
|
<pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 347</span>
|
1022
1028
|
|
1023
|
-
<span class='kw'>def</span> <span class='kw'>self</span><span class='
|
1024
|
-
<span class='ivar'>@instance</span> <span class='
|
1025
|
-
<span class='ivar'>@instance</span> <span class='op'>||=</span> <span class='
|
1026
|
-
<span class='ivar'>@instance</span>
|
1027
|
-
<span class='kw'>end</span
|
1029
|
+
<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='assign token'>=</span> <span class='rubyid_nil nil kw'>nil</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>
|
1030
|
+
<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>
|
1031
|
+
<span class='rubyid_@instance ivar id'>@instance</span> <span class='opasgn op'>||=</span> <span class='rubyid_DevDNSd constant id'>DevDNSd</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> <span class='rubyid_if if_mod kw'>if</span> <span class='rubyid_command identifier id'>command</span>
|
1032
|
+
<span class='rubyid_@instance ivar id'>@instance</span>
|
1033
|
+
<span class='rubyid_end end kw'>end</span>
|
1034
|
+
</pre>
|
1028
1035
|
</td>
|
1029
1036
|
</tr>
|
1030
1037
|
</table>
|
@@ -1062,9 +1069,10 @@
|
|
1062
1069
|
<td>
|
1063
1070
|
<pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 361</span>
|
1064
1071
|
|
1065
|
-
<span class='kw'>def</span> <span class='kw'>self</span><span class='
|
1066
|
-
<span class='op'>::</span><span class='
|
1067
|
-
<span class='kw'>end</span
|
1072
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_quit identifier id'>quit</span>
|
1073
|
+
<span class='colon3 op'>::</span><span class='rubyid_EventMachine constant id'>EventMachine</span><span class='dot token'>.</span><span class='rubyid_stop identifier id'>stop</span>
|
1074
|
+
<span class='rubyid_end end kw'>end</span>
|
1075
|
+
</pre>
|
1068
1076
|
</td>
|
1069
1077
|
</tr>
|
1070
1078
|
</table>
|
@@ -1109,9 +1117,10 @@
|
|
1109
1117
|
<td>
|
1110
1118
|
<pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 356</span>
|
1111
1119
|
|
1112
|
-
<span class='kw'>def</span> <span class='kw'>self</span><span class='
|
1113
|
-
<span class='kw'>self</span><span class='
|
1114
|
-
<span class='kw'>end</span
|
1120
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_run identifier id'>run</span>
|
1121
|
+
<span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_instance identifier id'>instance</span><span class='dot token'>.</span><span class='rubyid_perform_server identifier id'>perform_server</span>
|
1122
|
+
<span class='rubyid_end end kw'>end</span>
|
1123
|
+
</pre>
|
1115
1124
|
</td>
|
1116
1125
|
</tr>
|
1117
1126
|
</table>
|
@@ -1222,59 +1231,60 @@
|
|
1222
1231
|
<td>
|
1223
1232
|
<pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 232</span>
|
1224
1233
|
|
1225
|
-
<span class='kw'>def</span> <span class='
|
1226
|
-
<span class='
|
1227
|
-
|
1228
|
-
<span class='kw'>if</span> <span class='op'>!</span><span class='kw'>self</span><span class='
|
1229
|
-
<span class='
|
1230
|
-
<span class='kw'>return</span> <span class='kw'>false</span>
|
1231
|
-
<span class='kw'>end</span>
|
1232
|
-
|
1233
|
-
<span class='
|
1234
|
-
<span class='
|
1235
|
-
|
1236
|
-
<span class='comment'># Installs the resolver
|
1237
|
-
|
1238
|
-
<span class='
|
1239
|
-
|
1240
|
-
<span class='
|
1241
|
-
<span class='
|
1242
|
-
<span class='
|
1243
|
-
<span class='
|
1244
|
-
<span class='rbrace'>}</span>
|
1245
|
-
<span class='kw'>rescue</span> <span class='op'
|
1246
|
-
<span class='
|
1247
|
-
<span class='kw'>return</span> <span class='kw'>false</span>
|
1248
|
-
<span class='kw'>end</span>
|
1249
|
-
|
1250
|
-
<span class='kw'>begin</span>
|
1251
|
-
<span class='
|
1252
|
-
|
1253
|
-
<span class='
|
1254
|
-
|
1255
|
-
<span class='
|
1256
|
-
<span class='op'>::</span><span class='
|
1257
|
-
<span class='
|
1258
|
-
<span class='
|
1259
|
-
<span class='rbrace'>}</span>
|
1260
|
-
<span class='kw'>self</span><span class='
|
1261
|
-
<span class='kw'>rescue</span> <span class='op'
|
1262
|
-
<span class='
|
1263
|
-
<span class='kw'>return</span> <span class='kw'>false</span>
|
1264
|
-
<span class='kw'>end</span>
|
1265
|
-
|
1266
|
-
<span class='kw'>begin</span>
|
1267
|
-
<span class='
|
1268
|
-
<span class='kw'>self</span><span class='
|
1269
|
-
<span class='kw'>rescue</span> <span class='op'
|
1270
|
-
<span class='
|
1271
|
-
<span class='kw'>return</span> <span class='kw'>false</span>
|
1272
|
-
<span class='kw'>end</span>
|
1273
|
-
|
1274
|
-
<span class='kw'>self</span><span class='
|
1275
|
-
|
1276
|
-
<span class='kw'>true</span>
|
1277
|
-
<span class='kw'>end</span
|
1234
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_action_install identifier id'>action_install</span>
|
1235
|
+
<span class='rubyid_logger identifier id'>logger</span> <span class='assign token'>=</span> <span class='rubyid_get_logger identifier id'>get_logger</span>
|
1236
|
+
|
1237
|
+
<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>
|
1238
|
+
<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 DevDNSd as a local resolver is only available on MacOSX."</span><span class='rparen token'>)</span>
|
1239
|
+
<span class='rubyid_return return kw'>return</span> <span class='rubyid_false false kw'>false</span>
|
1240
|
+
<span class='rubyid_end end kw'>end</span>
|
1241
|
+
|
1242
|
+
<span class='rubyid_resolver_file identifier id'>resolver_file</span> <span class='assign token'>=</span> <span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_resolver_path identifier id'>resolver_path</span>
|
1243
|
+
<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>
|
1244
|
+
|
1245
|
+
<span class='comment val'># Installs the resolver</span>
|
1246
|
+
<span class='rubyid_begin begin kw'>begin</span>
|
1247
|
+
<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'>"Installing the resolver in #{resolver_file} ..."</span><span class='rparen token'>)</span>
|
1248
|
+
|
1249
|
+
<span class='rubyid_open identifier id'>open</span><span class='lparen token'>(</span><span class='rubyid_resolver_file identifier id'>resolver_file</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>
|
1250
|
+
<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='string val'>"nameserver 127.0.0.1\n"</span><span class='rparen token'>)</span>
|
1251
|
+
<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='dstring node'>"port #{@config.port}"</span><span class='rparen token'>)</span>
|
1252
|
+
<span class='rubyid_f identifier id'>f</span><span class='dot token'>.</span><span class='rubyid_flush identifier id'>flush</span>
|
1253
|
+
<span class='rbrace token'>}</span>
|
1254
|
+
<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>
|
1255
|
+
<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 resolver file."</span><span class='rparen token'>)</span>
|
1256
|
+
<span class='rubyid_return return kw'>return</span> <span class='rubyid_false false kw'>false</span>
|
1257
|
+
<span class='rubyid_end end kw'>end</span>
|
1258
|
+
|
1259
|
+
<span class='rubyid_begin begin kw'>begin</span>
|
1260
|
+
<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 #{launch_agent} ..."</span><span class='rparen token'>)</span>
|
1261
|
+
|
1262
|
+
<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>
|
1263
|
+
|
1264
|
+
<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_true true kw'>true</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.devdnsd"</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>
|
1265
|
+
<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>
|
1266
|
+
<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>
|
1267
|
+
<span class='rubyid_f identifier id'>f</span><span class='dot token'>.</span><span class='rubyid_flush identifier id'>flush</span>
|
1268
|
+
<span class='rbrace token'>}</span>
|
1269
|
+
<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>
|
1270
|
+
<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>
|
1271
|
+
<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>
|
1272
|
+
<span class='rubyid_return return kw'>return</span> <span class='rubyid_false false kw'>false</span>
|
1273
|
+
<span class='rubyid_end end kw'>end</span>
|
1274
|
+
|
1275
|
+
<span class='rubyid_begin begin kw'>begin</span>
|
1276
|
+
<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>
|
1277
|
+
<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>
|
1278
|
+
<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>
|
1279
|
+
<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>
|
1280
|
+
<span class='rubyid_return return kw'>return</span> <span class='rubyid_false false kw'>false</span>
|
1281
|
+
<span class='rubyid_end end kw'>end</span>
|
1282
|
+
|
1283
|
+
<span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_dns_update identifier id'>dns_update</span>
|
1284
|
+
|
1285
|
+
<span class='rubyid_true true kw'>true</span>
|
1286
|
+
<span class='rubyid_end end kw'>end</span>
|
1287
|
+
</pre>
|
1278
1288
|
</td>
|
1279
1289
|
</tr>
|
1280
1290
|
</table>
|
@@ -1339,19 +1349,20 @@
|
|
1339
1349
|
<td>
|
1340
1350
|
<pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 206</span>
|
1341
1351
|
|
1342
|
-
<span class='kw'>def</span> <span class='
|
1343
|
-
<span class='
|
1352
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_action_start identifier id'>action_start</span>
|
1353
|
+
<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>
|
1344
1354
|
|
1345
|
-
<span class='
|
1355
|
+
<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'>"Starting DevDNSd ..."</span><span class='rparen token'>)</span>
|
1346
1356
|
|
1347
|
-
<span class='kw'>if</span> <span class='ivar'>@config</span><span class='
|
1348
|
-
<span class='kw'>self</span><span class='
|
1349
|
-
<span class='kw'>else</span>
|
1350
|
-
<span class='
|
1351
|
-
<span class='kw'>end</span>
|
1357
|
+
<span class='rubyid_if if kw'>if</span> <span class='rubyid_@config ivar id'>@config</span><span class='dot token'>.</span><span class='rubyid_foreground identifier id'>foreground</span> <span class='rubyid_then then kw'>then</span>
|
1358
|
+
<span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_perform_server identifier id'>perform_server</span>
|
1359
|
+
<span class='rubyid_else else kw'>else</span>
|
1360
|
+
<span class='rubyid_RExec constant id'>RExec</span><span class='colon2 op'>::</span><span class='rubyid_Daemon constant id'>Daemon</span><span class='colon2 op'>::</span><span class='rubyid_Controller constant id'>Controller</span><span class='dot token'>.</span><span class='rubyid_start identifier id'>start</span><span class='lparen token'>(</span><span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_class identifier id'>class</span><span class='rparen token'>)</span>
|
1361
|
+
<span class='rubyid_end end kw'>end</span>
|
1352
1362
|
|
1353
|
-
<span class='kw'>true</span>
|
1354
|
-
<span class='kw'>end</span
|
1363
|
+
<span class='rubyid_true true kw'>true</span>
|
1364
|
+
<span class='rubyid_end end kw'>end</span>
|
1365
|
+
</pre>
|
1355
1366
|
</td>
|
1356
1367
|
</tr>
|
1357
1368
|
</table>
|
@@ -1408,11 +1419,12 @@
|
|
1408
1419
|
<td>
|
1409
1420
|
<pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 223</span>
|
1410
1421
|
|
1411
|
-
<span class='kw'>def</span> <span class='
|
1412
|
-
<span class='
|
1422
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_action_stop identifier id'>action_stop</span>
|
1423
|
+
<span class='rubyid_RExec constant id'>RExec</span><span class='colon2 op'>::</span><span class='rubyid_Daemon constant id'>Daemon</span><span class='colon2 op'>::</span><span class='rubyid_Controller constant id'>Controller</span><span class='dot token'>.</span><span class='rubyid_stop identifier id'>stop</span><span class='lparen token'>(</span><span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_class identifier id'>class</span><span class='rparen token'>)</span>
|
1413
1424
|
|
1414
|
-
<span class='kw'>true</span>
|
1415
|
-
<span class='kw'>end</span
|
1425
|
+
<span class='rubyid_true true kw'>true</span>
|
1426
|
+
<span class='rubyid_end end kw'>end</span>
|
1427
|
+
</pre>
|
1416
1428
|
</td>
|
1417
1429
|
</tr>
|
1418
1430
|
</table>
|
@@ -1504,46 +1516,47 @@
|
|
1504
1516
|
<td>
|
1505
1517
|
<pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 289</span>
|
1506
1518
|
|
1507
|
-
<span class='kw'>def</span> <span class='
|
1508
|
-
<span class='
|
1509
|
-
|
1510
|
-
<span class='kw'>if</span> <span class='op'>!</span><span class='kw'>self</span><span class='
|
1511
|
-
<span class='
|
1512
|
-
<span class='kw'>return</span> <span class='kw'>false</span>
|
1513
|
-
<span class='kw'>end</span>
|
1514
|
-
|
1515
|
-
<span class='
|
1516
|
-
<span class='
|
1517
|
-
|
1518
|
-
<span class='comment'># Remove the resolver
|
1519
|
-
|
1520
|
-
<span class='
|
1521
|
-
<span class='op'>::</span><span class='
|
1522
|
-
<span class='kw'>rescue</span> <span class='op'
|
1523
|
-
<span class='
|
1524
|
-
<span class='kw'>return</span> <span class='kw'>false</span>
|
1525
|
-
<span class='kw'>end</span>
|
1526
|
-
|
1527
|
-
<span class='comment'># Unload the launch agent
|
1528
|
-
|
1529
|
-
<span class='kw'>self</span><span class='
|
1530
|
-
<span class='kw'>rescue</span> <span class='op'
|
1531
|
-
<span class='
|
1532
|
-
<span class='kw'>end</span>
|
1533
|
-
|
1534
|
-
<span class='comment'># Delete the launch agent
|
1535
|
-
|
1536
|
-
<span class='
|
1537
|
-
<span class='op'>::</span><span class='
|
1538
|
-
<span class='kw'>rescue</span> <span class='op'
|
1539
|
-
<span class='
|
1540
|
-
<span class='kw'>return</span> <span class='kw'>false</span>
|
1541
|
-
<span class='kw'>end</span>
|
1542
|
-
|
1543
|
-
<span class='kw'>self</span><span class='
|
1544
|
-
|
1545
|
-
<span class='kw'>true</span>
|
1546
|
-
<span class='kw'>end</span
|
1519
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_action_uninstall identifier id'>action_uninstall</span>
|
1520
|
+
<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>
|
1521
|
+
|
1522
|
+
<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>
|
1523
|
+
<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 DevDNSd as a local resolver is only available on MacOSX."</span><span class='rparen token'>)</span>
|
1524
|
+
<span class='rubyid_return return kw'>return</span> <span class='rubyid_false false kw'>false</span>
|
1525
|
+
<span class='rubyid_end end kw'>end</span>
|
1526
|
+
|
1527
|
+
<span class='rubyid_resolver_file identifier id'>resolver_file</span> <span class='assign token'>=</span> <span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_resolver_path identifier id'>resolver_path</span>
|
1528
|
+
<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>
|
1529
|
+
|
1530
|
+
<span class='comment val'># Remove the resolver</span>
|
1531
|
+
<span class='rubyid_begin begin kw'>begin</span>
|
1532
|
+
<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 resolver #{resolver_file} ..."</span><span class='rparen token'>)</span>
|
1533
|
+
<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_resolver_file identifier id'>resolver_file</span><span class='rparen token'>)</span>
|
1534
|
+
<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>
|
1535
|
+
<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 resolver file."</span><span class='rparen token'>)</span>
|
1536
|
+
<span class='rubyid_return return kw'>return</span> <span class='rubyid_false false kw'>false</span>
|
1537
|
+
<span class='rubyid_end end kw'>end</span>
|
1538
|
+
|
1539
|
+
<span class='comment val'># Unload the launch agent.</span>
|
1540
|
+
<span class='rubyid_begin begin kw'>begin</span>
|
1541
|
+
<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>
|
1542
|
+
<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>
|
1543
|
+
<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>
|
1544
|
+
<span class='rubyid_end end kw'>end</span>
|
1545
|
+
|
1546
|
+
<span class='comment val'># Delete the launch agent.</span>
|
1547
|
+
<span class='rubyid_begin begin kw'>begin</span>
|
1548
|
+
<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>
|
1549
|
+
<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>
|
1550
|
+
<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>
|
1551
|
+
<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>
|
1552
|
+
<span class='rubyid_return return kw'>return</span> <span class='rubyid_false false kw'>false</span>
|
1553
|
+
<span class='rubyid_end end kw'>end</span>
|
1554
|
+
|
1555
|
+
<span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_dns_update identifier id'>dns_update</span>
|
1556
|
+
|
1557
|
+
<span class='rubyid_true true kw'>true</span>
|
1558
|
+
<span class='rubyid_end end kw'>end</span>
|
1559
|
+
</pre>
|
1547
1560
|
</td>
|
1548
1561
|
</tr>
|
1549
1562
|
</table>
|
@@ -1599,10 +1612,11 @@
|
|
1599
1612
|
<td>
|
1600
1613
|
<pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 102</span>
|
1601
1614
|
|
1602
|
-
<span class='kw'>def</span> <span class='
|
1603
|
-
<span class='ivar'>@logger</span><span class='
|
1604
|
-
<span class='kw'>self</span><span class='
|
1605
|
-
<span class='kw'>end</span
|
1615
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_dns_update identifier id'>dns_update</span>
|
1616
|
+
<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='string val'>"Flushing DNS cache and resolvers ..."</span><span class='rparen token'>)</span>
|
1617
|
+
<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='string val'>"dscacheutil -flushcache"</span><span class='rparen token'>)</span>
|
1618
|
+
<span class='rubyid_end end kw'>end</span>
|
1619
|
+
</pre>
|
1606
1620
|
</td>
|
1607
1621
|
</tr>
|
1608
1622
|
</table>
|
@@ -1676,9 +1690,10 @@
|
|
1676
1690
|
<td>
|
1677
1691
|
<pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 95</span>
|
1678
1692
|
|
1679
|
-
<span class='kw'>def</span> <span class='
|
1680
|
-
<span class='
|
1681
|
-
<span class='kw'>end</span
|
1693
|
+
<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>
|
1694
|
+
<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>
|
1695
|
+
<span class='rubyid_end end kw'>end</span>
|
1696
|
+
</pre>
|
1682
1697
|
</td>
|
1683
1698
|
</tr>
|
1684
1699
|
</table>
|
@@ -1733,9 +1748,10 @@
|
|
1733
1748
|
<td>
|
1734
1749
|
<pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 70</span>
|
1735
1750
|
|
1736
|
-
<span class='kw'>def</span> <span class='
|
1737
|
-
<span class='ivar'>@logger</span> <span class='op'>||=</span> <span class='
|
1738
|
-
<span class='kw'>end</span
|
1751
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_get_logger identifier id'>get_logger</span>
|
1752
|
+
<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_@config ivar id'>@config</span><span class='dot token'>.</span><span class='rubyid_foreground identifier id'>foreground</span> <span class='integer val'>? </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='colon op'>:</span> <span class='rubyid_@config ivar id'>@config</span><span class='dot token'>.</span><span class='rubyid_log_file identifier id'>log_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>
|
1753
|
+
<span class='rubyid_end end kw'>end</span>
|
1754
|
+
</pre>
|
1739
1755
|
</td>
|
1740
1756
|
</tr>
|
1741
1757
|
</table>
|
@@ -1791,9 +1807,10 @@ System services are only available on that platform.</p>
|
|
1791
1807
|
<td>
|
1792
1808
|
<pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 63</span>
|
1793
1809
|
|
1794
|
-
<span class='kw'>def</span> <span class='
|
1795
|
-
<span class='op'>::</span><span class='
|
1796
|
-
<span class='kw'>end</span
|
1810
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_is_osx? fid id'>is_osx?</span>
|
1811
|
+
<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>
|
1812
|
+
<span class='rubyid_end end kw'>end</span>
|
1813
|
+
</pre>
|
1797
1814
|
</td>
|
1798
1815
|
</tr>
|
1799
1816
|
</table>
|
@@ -1869,9 +1886,10 @@ System services are only available on that platform.</p>
|
|
1869
1886
|
<td>
|
1870
1887
|
<pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 87</span>
|
1871
1888
|
|
1872
|
-
<span class='kw'>def</span> <span class='
|
1873
|
-
<span class='
|
1874
|
-
<span class='kw'>end</span
|
1889
|
+
<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.devdnsd"</span><span class='rparen token'>)</span>
|
1890
|
+
<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>
|
1891
|
+
<span class='rubyid_end end kw'>end</span>
|
1892
|
+
</pre>
|
1875
1893
|
</td>
|
1876
1894
|
</tr>
|
1877
1895
|
</table>
|
@@ -1925,8 +1943,9 @@ System services are only available on that platform.</p>
|
|
1925
1943
|
<td>
|
1926
1944
|
<pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 333</span>
|
1927
1945
|
|
1928
|
-
<span class='kw'>def</span> <span class='
|
1929
|
-
<span class='kw'>end</span
|
1946
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_on_start identifier id'>on_start</span>
|
1947
|
+
<span class='rubyid_end end kw'>end</span>
|
1948
|
+
</pre>
|
1930
1949
|
</td>
|
1931
1950
|
</tr>
|
1932
1951
|
</table>
|
@@ -1980,8 +1999,9 @@ System services are only available on that platform.</p>
|
|
1980
1999
|
<td>
|
1981
2000
|
<pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 339</span>
|
1982
2001
|
|
1983
|
-
<span class='kw'>def</span> <span class='
|
1984
|
-
<span class='kw'>end</span
|
2002
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_on_stop identifier id'>on_stop</span>
|
2003
|
+
<span class='rubyid_end end kw'>end</span>
|
2004
|
+
</pre>
|
1985
2005
|
</td>
|
1986
2006
|
</tr>
|
1987
2007
|
</table>
|
@@ -2073,46 +2093,47 @@ System services are only available on that platform.</p>
|
|
2073
2093
|
<td>
|
2074
2094
|
<pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 110</span>
|
2075
2095
|
|
2076
|
-
<span class='kw'>def</span> <span class='
|
2077
|
-
<span class='
|
2078
|
-
<span class='kw'>self</span><span class='
|
2079
|
-
|
2080
|
-
<span class='
|
2081
|
-
<span class='
|
2082
|
-
|
2083
|
-
<span class='
|
2084
|
-
<span class='kw'>begin</span>
|
2085
|
-
<span class='comment'># Get the subset of handled class that is valid for the rule
|
2086
|
-
|
2087
|
-
<span class='
|
2088
|
-
|
2089
|
-
<span class='kw'>if</span> <span class='
|
2090
|
-
<span class='
|
2091
|
-
|
2092
|
-
<span class='
|
2093
|
-
<span class='kw'>end</span>
|
2094
|
-
<span class='kw'>end</span>
|
2095
|
-
<span class='kw'>rescue</span> <span class='op'>::</span><span class='
|
2096
|
-
<span class='
|
2097
|
-
<span class='kw'>end</span>
|
2098
|
-
<span class='kw'>end</span>
|
2099
|
-
<span class='kw'>end</span>
|
2100
|
-
|
2101
|
-
<span class='comment'># Default DNS handler
|
2102
|
-
|
2103
|
-
<span class='
|
2104
|
-
<span class='kw'>end</span>
|
2105
|
-
|
2106
|
-
<span class='comment'># Attach event handlers
|
2107
|
-
|
2108
|
-
<span class='
|
2109
|
-
<span class='kw'>end</span>
|
2110
|
-
|
2111
|
-
<span class='kw'>self</span><span class='
|
2112
|
-
<span class='
|
2113
|
-
<span class='kw'>end</span>
|
2114
|
-
<span class='kw'>end</span>
|
2115
|
-
<span class='kw'>end</span
|
2096
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_perform_server identifier id'>perform_server</span>
|
2097
|
+
<span class='rubyid_RubyDNS constant id'>RubyDNS</span><span class='colon2 op'>::</span><span class='rubyid_run_server identifier id'>run_server</span><span class='lparen token'>(</span><span class='symbol val'>:listen</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='lbrack token'>[</span><span class='lbrack token'>[</span><span class='symbol val'>:udp</span><span class='comma token'>,</span> <span class='rubyid_@config ivar id'>@config</span><span class='dot token'>.</span><span class='rubyid_address identifier id'>address</span><span class='comma token'>,</span> <span class='rubyid_@config ivar id'>@config</span><span class='dot token'>.</span><span class='rubyid_port identifier id'>port</span><span class='dot token'>.</span><span class='rubyid_to_integer identifier id'>to_integer</span><span class='rbrack token'>]</span><span class='rbrack token'>]</span><span class='rparen token'>)</span> <span class='rubyid_do do kw'>do</span>
|
2098
|
+
<span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_logger identifier id'>logger</span> <span class='assign token'>=</span> <span class='rubyid_DevDNSd constant id'>DevDNSd</span><span class='colon2 op'>::</span><span class='rubyid_Application constant id'>Application</span><span class='dot token'>.</span><span class='rubyid_instance identifier id'>instance</span><span class='dot token'>.</span><span class='rubyid_logger identifier id'>logger</span>
|
2099
|
+
|
2100
|
+
<span class='rubyid_match identifier id'>match</span><span class='lparen token'>(</span><span class='regexp val'>/.+/</span><span class='comma token'>,</span> <span class='rubyid_DevDNSd constant id'>DevDNSd</span><span class='colon2 op'>::</span><span class='rubyid_Application constant id'>Application</span><span class='colon2 op'>::</span><span class='rubyid_ANY_CLASSES constant id'>ANY_CLASSES</span><span class='rparen token'>)</span> <span class='rubyid_do do kw'>do</span> <span class='bitor op'>|</span><span class='rubyid_match_data identifier id'>match_data</span><span class='comma token'>,</span> <span class='rubyid_transaction identifier id'>transaction</span><span class='bitor op'>|</span>
|
2101
|
+
<span class='rubyid_transaction identifier id'>transaction</span><span class='dot token'>.</span><span class='rubyid_append_question! fid id'>append_question!</span>
|
2102
|
+
|
2103
|
+
<span class='rubyid_DevDNSd constant id'>DevDNSd</span><span class='colon2 op'>::</span><span class='rubyid_Application constant id'>Application</span><span class='dot token'>.</span><span class='rubyid_instance identifier id'>instance</span><span class='dot token'>.</span><span class='rubyid_config identifier id'>config</span><span class='dot token'>.</span><span class='rubyid_rules identifier id'>rules</span><span class='dot token'>.</span><span class='rubyid_each identifier id'>each</span> <span class='rubyid_do do kw'>do</span> <span class='bitor op'>|</span><span class='rubyid_rule identifier id'>rule</span><span class='bitor op'>|</span>
|
2104
|
+
<span class='rubyid_begin begin kw'>begin</span>
|
2105
|
+
<span class='comment val'># Get the subset of handled class that is valid for the rule</span>
|
2106
|
+
<span class='rubyid_resource_classes identifier id'>resource_classes</span> <span class='assign token'>=</span> <span class='rubyid_DevDNSd constant id'>DevDNSd</span><span class='colon2 op'>::</span><span class='rubyid_Application constant id'>Application</span><span class='colon2 op'>::</span><span class='rubyid_ANY_CLASSES constant id'>ANY_CLASSES</span> <span class='bitand op'>&</span> <span class='rubyid_rule identifier id'>rule</span><span class='dot token'>.</span><span class='rubyid_resource_class identifier id'>resource_class</span><span class='dot token'>.</span><span class='rubyid_ensure_array identifier id'>ensure_array</span>
|
2107
|
+
<span class='rubyid_resource_classes identifier id'>resource_classes</span> <span class='assign token'>=</span> <span class='rubyid_resource_classes identifier id'>resource_classes</span> <span class='bitand op'>&</span> <span class='lbrack token'>[</span><span class='rubyid_transaction identifier id'>transaction</span><span class='dot token'>.</span><span class='rubyid_resource_class identifier id'>resource_class</span><span class='rbrack token'>]</span> <span class='rubyid_if if_mod kw'>if</span> <span class='rubyid_transaction identifier id'>transaction</span><span class='dot token'>.</span><span class='rubyid_resource_class identifier id'>resource_class</span> <span class='neq op'>!=</span> <span class='rubyid_DevDNSd constant id'>DevDNSd</span><span class='colon2 op'>::</span><span class='rubyid_Application constant id'>Application</span><span class='colon2 op'>::</span><span class='rubyid_ANY_REQUEST constant id'>ANY_REQUEST</span>
|
2108
|
+
|
2109
|
+
<span class='rubyid_if if kw'>if</span> <span class='rubyid_resource_classes identifier id'>resource_classes</span><span class='dot token'>.</span><span class='rubyid_present? fid id'>present?</span> <span class='rubyid_then then kw'>then</span>
|
2110
|
+
<span class='rubyid_resource_classes identifier id'>resource_classes</span><span class='dot token'>.</span><span class='rubyid_each identifier id'>each</span> <span class='rubyid_do do kw'>do</span> <span class='bitor op'>|</span><span class='rubyid_resource_class identifier id'>resource_class</span><span class='bitor op'>|</span> <span class='comment val'># Now for every class</span>
|
2111
|
+
<span class='rubyid_matches identifier id'>matches</span> <span class='assign token'>=</span> <span class='rubyid_rule identifier id'>rule</span><span class='dot token'>.</span><span class='rubyid_match_host identifier id'>match_host</span><span class='lparen token'>(</span><span class='rubyid_match_data identifier id'>match_data</span><span class='lbrack token'>[</span><span class='integer val'>0</span><span class='rbrack token'>]</span><span class='rparen token'>)</span>
|
2112
|
+
<span class='rubyid_DevDNSd constant id'>DevDNSd</span><span class='colon2 op'>::</span><span class='rubyid_Application constant id'>Application</span><span class='dot token'>.</span><span class='rubyid_instance identifier id'>instance</span><span class='dot token'>.</span><span class='rubyid_process_rule identifier id'>process_rule</span><span class='lparen token'>(</span><span class='rubyid_rule identifier id'>rule</span><span class='comma token'>,</span> <span class='rubyid_resource_class identifier id'>resource_class</span><span class='comma token'>,</span> <span class='rubyid_rule identifier id'>rule</span><span class='dot token'>.</span><span class='rubyid_is_regexp? fid id'>is_regexp?</span> <span class='integer val'>? </span><span class='rubyid_matches identifier id'>matches</span> <span class='colon op'>:</span> <span class='rubyid_nil nil kw'>nil</span><span class='comma token'>,</span> <span class='rubyid_transaction identifier id'>transaction</span><span class='rparen token'>)</span> <span class='rubyid_if if_mod kw'>if</span> <span class='rubyid_matches identifier id'>matches</span>
|
2113
|
+
<span class='rubyid_end end kw'>end</span>
|
2114
|
+
<span class='rubyid_end end kw'>end</span>
|
2115
|
+
<span class='rubyid_rescue rescue kw'>rescue</span> <span class='colon2 op'>::</span><span class='rubyid_Exception constant id'>Exception</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='rubyid_e identifier id'>e</span>
|
2116
|
+
<span class='rubyid_raise identifier id'>raise</span> <span class='rubyid_e identifier id'>e</span>
|
2117
|
+
<span class='rubyid_end end kw'>end</span>
|
2118
|
+
<span class='rubyid_end end kw'>end</span>
|
2119
|
+
<span class='rubyid_end end kw'>end</span>
|
2120
|
+
|
2121
|
+
<span class='comment val'># Default DNS handler</span>
|
2122
|
+
<span class='rubyid_otherwise identifier id'>otherwise</span> <span class='rubyid_do do kw'>do</span> <span class='bitor op'>|</span><span class='rubyid_transaction identifier id'>transaction</span><span class='bitor op'>|</span>
|
2123
|
+
<span class='rubyid_transaction identifier id'>transaction</span><span class='dot token'>.</span><span class='rubyid_failure! fid id'>failure!</span><span class='lparen token'>(</span><span class='symbol val'>:NXDomain</span><span class='rparen token'>)</span>
|
2124
|
+
<span class='rubyid_end end kw'>end</span>
|
2125
|
+
|
2126
|
+
<span class='comment val'># Attach event handlers</span>
|
2127
|
+
<span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_on identifier id'>on</span><span class='lparen token'>(</span><span class='symbol val'>:start</span><span class='rparen token'>)</span> <span class='rubyid_do do kw'>do</span>
|
2128
|
+
<span class='rubyid_DevDNSd constant id'>DevDNSd</span><span class='colon2 op'>::</span><span class='rubyid_Application constant id'>Application</span><span class='dot token'>.</span><span class='rubyid_instance identifier id'>instance</span><span class='dot token'>.</span><span class='rubyid_on_start identifier id'>on_start</span>
|
2129
|
+
<span class='rubyid_end end kw'>end</span>
|
2130
|
+
|
2131
|
+
<span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_on identifier id'>on</span><span class='lparen token'>(</span><span class='symbol val'>:stop</span><span class='rparen token'>)</span> <span class='rubyid_do do kw'>do</span>
|
2132
|
+
<span class='rubyid_DevDNSd constant id'>DevDNSd</span><span class='colon2 op'>::</span><span class='rubyid_Application constant id'>Application</span><span class='dot token'>.</span><span class='rubyid_instance identifier id'>instance</span><span class='dot token'>.</span><span class='rubyid_on_stop identifier id'>on_stop</span>
|
2133
|
+
<span class='rubyid_end end kw'>end</span>
|
2134
|
+
<span class='rubyid_end end kw'>end</span>
|
2135
|
+
<span class='rubyid_end end kw'>end</span>
|
2136
|
+
</pre>
|
2116
2137
|
</td>
|
2117
2138
|
</tr>
|
2118
2139
|
</table>
|
@@ -2272,50 +2293,51 @@ System services are only available on that platform.</p>
|
|
2272
2293
|
<td>
|
2273
2294
|
<pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 158</span>
|
2274
2295
|
|
2275
|
-
<span class='kw'>def</span> <span class='
|
2276
|
-
<span class='
|
2277
|
-
<span class='
|
2278
|
-
|
2279
|
-
<span class='
|
2280
|
-
|
2281
|
-
<span class='kw'>if</span> <span class='op'>!</span><span class='
|
2282
|
-
<span class='
|
2283
|
-
<span class='kw'>else</span>
|
2284
|
-
<span class='
|
2285
|
-
<span class='kw'>end</span>
|
2286
|
-
|
2287
|
-
<span class='kw'>if</span> <span class='
|
2288
|
-
<span class='
|
2289
|
-
<span class='kw'>end</span>
|
2290
|
-
|
2291
|
-
<span class='
|
2292
|
-
|
2293
|
-
<span class='kw'>if</span> <span class='
|
2294
|
-
<span class='
|
2295
|
-
|
2296
|
-
<span class='
|
2297
|
-
|
2298
|
-
<span class='kw'>case</span> <span class='
|
2299
|
-
<span class='kw'>when</span> <span class='symbol'>:MX</span>
|
2300
|
-
<span class='
|
2301
|
-
<span class='
|
2302
|
-
<span class='
|
2303
|
-
<span class='kw'>end</span>
|
2304
|
-
|
2305
|
-
<span class='kw'>if</span> <span class='
|
2306
|
-
<span class='
|
2307
|
-
<span class='kw'>else</span>
|
2308
|
-
<span class='
|
2309
|
-
<span class='kw'>end</span>
|
2310
|
-
|
2311
|
-
<span class='
|
2312
|
-
<span class='
|
2313
|
-
<span class='kw'>elsif</span> <span class='
|
2314
|
-
<span class='kw'>false</span>
|
2315
|
-
<span class='kw'>else</span>
|
2316
|
-
<span class='
|
2317
|
-
<span class='kw'>end</span>
|
2318
|
-
<span class='kw'>end</span
|
2296
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_process_rule identifier id'>process_rule</span><span class='lparen token'>(</span><span class='rubyid_rule identifier id'>rule</span><span class='comma token'>,</span> <span class='rubyid_type identifier id'>type</span><span class='comma token'>,</span> <span class='rubyid_match_data identifier id'>match_data</span><span class='comma token'>,</span> <span class='rubyid_transaction identifier id'>transaction</span><span class='rparen token'>)</span>
|
2297
|
+
<span class='rubyid_is_regex identifier id'>is_regex</span> <span class='assign token'>=</span> <span class='rubyid_rule identifier id'>rule</span><span class='dot token'>.</span><span class='rubyid_match identifier id'>match</span><span class='dot token'>.</span><span class='rubyid_is_a? fid id'>is_a?</span><span class='lparen token'>(</span><span class='colon3 op'>::</span><span class='rubyid_Regexp constant id'>Regexp</span><span class='rparen token'>)</span>
|
2298
|
+
<span class='rubyid_type identifier id'>type</span> <span class='assign token'>=</span> <span class='rubyid_DevDNSd constant id'>DevDNSd</span><span class='colon2 op'>::</span><span class='rubyid_Rule constant id'>Rule</span><span class='dot token'>.</span><span class='rubyid_resource_class_to_symbol identifier id'>resource_class_to_symbol</span><span class='lparen token'>(</span><span class='rubyid_type identifier id'>type</span><span class='rparen token'>)</span>
|
2299
|
+
|
2300
|
+
<span class='rubyid_DevDNSd constant id'>DevDNSd</span><span class='colon2 op'>::</span><span class='rubyid_Application constant id'>Application</span><span class='dot token'>.</span><span class='rubyid_instance identifier id'>instance</span><span class='dot token'>.</span><span class='rubyid_logger identifier id'>logger</span><span class='dot token'>.</span><span class='rubyid_debug identifier id'>debug</span><span class='lparen token'>(</span><span class='dstring node'>"Found match on #{rule.match} with type #{type}."</span><span class='rparen token'>)</span>
|
2301
|
+
|
2302
|
+
<span class='rubyid_if if kw'>if</span> <span class='notop op'>!</span><span class='rubyid_rule identifier id'>rule</span><span class='dot token'>.</span><span class='rubyid_block identifier id'>block</span><span class='dot token'>.</span><span class='rubyid_nil? fid id'>nil?</span> <span class='rubyid_then then kw'>then</span>
|
2303
|
+
<span class='rubyid_reply identifier id'>reply</span> <span class='assign token'>=</span> <span class='rubyid_rule identifier id'>rule</span><span class='dot token'>.</span><span class='rubyid_block identifier id'>block</span><span class='dot token'>.</span><span class='rubyid_call identifier id'>call</span><span class='lparen token'>(</span><span class='rubyid_match_data identifier id'>match_data</span><span class='comma token'>,</span> <span class='rubyid_type identifier id'>type</span><span class='comma token'>,</span> <span class='rubyid_transaction identifier id'>transaction</span><span class='rparen token'>)</span>
|
2304
|
+
<span class='rubyid_else else kw'>else</span>
|
2305
|
+
<span class='rubyid_reply identifier id'>reply</span> <span class='assign token'>=</span> <span class='rubyid_rule identifier id'>rule</span><span class='dot token'>.</span><span class='rubyid_reply identifier id'>reply</span>
|
2306
|
+
<span class='rubyid_end end kw'>end</span>
|
2307
|
+
|
2308
|
+
<span class='rubyid_if if kw'>if</span> <span class='rubyid_is_regex identifier id'>is_regex</span> <span class='andop op'>&&</span> <span class='rubyid_reply identifier id'>reply</span> <span class='andop op'>&&</span> <span class='rubyid_match_data identifier id'>match_data</span><span class='lbrack token'>[</span><span class='integer val'>0</span><span class='rbrack token'>]</span> <span class='rubyid_then then kw'>then</span>
|
2309
|
+
<span class='rubyid_reply identifier id'>reply</span> <span class='assign token'>=</span> <span class='rubyid_match_data identifier id'>match_data</span><span class='lbrack token'>[</span><span class='integer val'>0</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='rubyid_gsub identifier id'>gsub</span><span class='lparen token'>(</span><span class='rubyid_rule identifier id'>rule</span><span class='dot token'>.</span><span class='rubyid_match identifier id'>match</span><span class='comma token'>,</span> <span class='rubyid_reply identifier id'>reply</span><span class='dot token'>.</span><span class='rubyid_gsub identifier id'>gsub</span><span class='lparen token'>(</span><span class='string val'>"$"</span><span class='comma token'>,</span> <span class='string val'>"\\"</span><span class='rparen token'>)</span><span class='rparen token'>)</span>
|
2310
|
+
<span class='rubyid_end end kw'>end</span>
|
2311
|
+
|
2312
|
+
<span class='rubyid_DevDNSd constant id'>DevDNSd</span><span class='colon2 op'>::</span><span class='rubyid_Application constant id'>Application</span><span class='dot token'>.</span><span class='rubyid_instance identifier id'>instance</span><span class='dot token'>.</span><span class='rubyid_logger identifier id'>logger</span><span class='dot token'>.</span><span class='rubyid_debug identifier id'>debug</span><span class='lparen token'>(</span><span class='rubyid_reply identifier id'>reply</span> <span class='integer val'>? </span><span class='dstring node'>"Reply is #{reply} with type #{type}."</span> <span class='colon op'>:</span> <span class='string val'>"No reply found."</span><span class='rparen token'>)</span>
|
2313
|
+
|
2314
|
+
<span class='rubyid_if if kw'>if</span> <span class='rubyid_reply identifier id'>reply</span> <span class='rubyid_then then kw'>then</span>
|
2315
|
+
<span class='rubyid_options identifier id'>options</span> <span class='assign token'>=</span> <span class='rubyid_rule identifier id'>rule</span><span class='dot token'>.</span><span class='rubyid_options identifier id'>options</span>
|
2316
|
+
|
2317
|
+
<span class='rubyid_final_reply identifier id'>final_reply</span> <span class='assign token'>=</span> <span class='lbrack token'>[</span><span class='rbrack token'>]</span>
|
2318
|
+
|
2319
|
+
<span class='rubyid_case case kw'>case</span> <span class='rubyid_type identifier id'>type</span>
|
2320
|
+
<span class='rubyid_when when kw'>when</span> <span class='symbol val'>:MX</span>
|
2321
|
+
<span class='rubyid_preference identifier id'>preference</span> <span class='assign token'>=</span> <span class='rubyid_options identifier id'>options</span><span class='dot token'>.</span><span class='rubyid_delete identifier id'>delete</span><span class='lparen token'>(</span><span class='symbol val'>:preference</span><span class='rparen token'>)</span>
|
2322
|
+
<span class='rubyid_preference identifier id'>preference</span> <span class='assign token'>=</span> <span class='rubyid_preference identifier id'>preference</span><span class='dot token'>.</span><span class='rubyid_nil? fid id'>nil?</span> <span class='integer val'>? </span><span class='integer val'>10</span> <span class='colon op'>:</span> <span class='rubyid_preference identifier id'>preference</span><span class='dot token'>.</span><span class='rubyid_to_integer identifier id'>to_integer</span><span class='lparen token'>(</span><span class='integer val'>10</span><span class='rparen token'>)</span>
|
2323
|
+
<span class='rubyid_final_reply identifier id'>final_reply</span> <span class='lshft op'><<</span> <span class='rubyid_preference identifier id'>preference</span>
|
2324
|
+
<span class='rubyid_end end kw'>end</span>
|
2325
|
+
|
2326
|
+
<span class='rubyid_if if kw'>if</span> <span class='lbrack token'>[</span><span class='symbol val'>:A</span><span class='comma token'>,</span> <span class='symbol val'>:AAAA</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='rubyid_include? fid id'>include?</span><span class='lparen token'>(</span><span class='rubyid_type identifier id'>type</span><span class='rparen token'>)</span> <span class='rubyid_then then kw'>then</span>
|
2327
|
+
<span class='rubyid_final_reply identifier id'>final_reply</span> <span class='lshft op'><<</span> <span class='rubyid_reply identifier id'>reply</span>
|
2328
|
+
<span class='rubyid_else else kw'>else</span>
|
2329
|
+
<span class='rubyid_final_reply identifier id'>final_reply</span> <span class='lshft op'><<</span> <span class='rubyid_Resolv constant id'>Resolv</span><span class='colon2 op'>::</span><span class='rubyid_DNS constant id'>DNS</span><span class='colon2 op'>::</span><span class='rubyid_Name constant id'>Name</span><span class='dot token'>.</span><span class='rubyid_create identifier id'>create</span><span class='lparen token'>(</span><span class='rubyid_reply identifier id'>reply</span><span class='rparen token'>)</span>
|
2330
|
+
<span class='rubyid_end end kw'>end</span>
|
2331
|
+
|
2332
|
+
<span class='rubyid_final_reply identifier id'>final_reply</span> <span class='lshft op'><<</span> <span class='rubyid_options identifier id'>options</span><span class='dot token'>.</span><span class='rubyid_merge identifier id'>merge</span><span class='lparen token'>(</span><span class='lbrace token'>{</span><span class='symbol val'>:resource_class</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='rubyid_DevDNSd constant id'>DevDNSd</span><span class='colon2 op'>::</span><span class='rubyid_Rule constant id'>Rule</span><span class='dot token'>.</span><span class='rubyid_symbol_to_resource_class identifier id'>symbol_to_resource_class</span><span class='lparen token'>(</span><span class='rubyid_type identifier id'>type</span><span class='rparen token'>)</span><span class='rbrace token'>}</span><span class='rparen token'>)</span>
|
2333
|
+
<span class='rubyid_transaction identifier id'>transaction</span><span class='dot token'>.</span><span class='rubyid_respond! fid id'>respond!</span><span class='lparen token'>(</span><span class='mult op'>*</span><span class='rubyid_final_reply identifier id'>final_reply</span><span class='rparen token'>)</span>
|
2334
|
+
<span class='rubyid_elsif elsif kw'>elsif</span> <span class='rubyid_reply identifier id'>reply</span> <span class='eq op'>==</span> <span class='rubyid_false false kw'>false</span> <span class='rubyid_then then kw'>then</span>
|
2335
|
+
<span class='rubyid_false false kw'>false</span>
|
2336
|
+
<span class='rubyid_else else kw'>else</span>
|
2337
|
+
<span class='rubyid_reply identifier id'>reply</span>
|
2338
|
+
<span class='rubyid_end end kw'>end</span>
|
2339
|
+
<span class='rubyid_end end kw'>end</span>
|
2340
|
+
</pre>
|
2319
2341
|
</td>
|
2320
2342
|
</tr>
|
2321
2343
|
</table>
|
@@ -2392,10 +2414,11 @@ System services are only available on that platform.</p>
|
|
2392
2414
|
<td>
|
2393
2415
|
<pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 78</span>
|
2394
2416
|
|
2395
|
-
<span class='kw'>def</span> <span class='
|
2396
|
-
<span class='
|
2397
|
-
<span class='
|
2398
|
-
<span class='kw'>end</span
|
2417
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_resolver_path identifier id'>resolver_path</span><span class='lparen token'>(</span><span class='rubyid_tld identifier id'>tld</span> <span class='assign token'>=</span> <span class='rubyid_nil nil kw'>nil</span><span class='rparen token'>)</span>
|
2418
|
+
<span class='rubyid_tld identifier id'>tld</span> <span class='opasgn op'>||=</span> <span class='rubyid_@config ivar id'>@config</span><span class='dot token'>.</span><span class='rubyid_tld identifier id'>tld</span>
|
2419
|
+
<span class='dstring node'>"/etc/resolver/#{tld}"</span>
|
2420
|
+
<span class='rubyid_end end kw'>end</span>
|
2421
|
+
</pre>
|
2399
2422
|
</td>
|
2400
2423
|
</tr>
|
2401
2424
|
</table>
|
@@ -2406,9 +2429,9 @@ System services are only available on that platform.</p>
|
|
2406
2429
|
</div>
|
2407
2430
|
|
2408
2431
|
<div id="footer">
|
2409
|
-
Generated on
|
2432
|
+
Generated on Sat Oct 6 08:58:34 2012 by
|
2410
2433
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
2411
|
-
0.8.2.1 (ruby-1.
|
2434
|
+
0.8.2.1 (ruby-1.8.7).
|
2412
2435
|
</div>
|
2413
2436
|
|
2414
2437
|
</body>
|