doc/DevDNSd/Application.html in devdnsd-1.5.0 vs doc/DevDNSd/Application.html in devdnsd-1.5.1

- old
+ new

@@ -127,11 +127,12 @@ <div class="tags"> </div> </dt> - <dd><pre class="code"><span class='const'>Resolv</span><span class='op'>::</span><span class='const'>DNS</span><span class='op'>::</span><span class='const'>Resource</span><span class='op'>::</span><span class='const'>IN</span><span class='op'>::</span><span class='const'>ANY</span></pre></dd> + <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> +</pre></dd> <dt id="ANY_CLASSES-constant" class="">ANY_CLASSES = <div class="docstring"> <div class="discussion"> <p>List of classes handled in case of DNS request with resource class ANY.</p> @@ -142,11 +143,12 @@ <div class="tags"> </div> </dt> - <dd><pre class="code"><span class='lbracket'>[</span><span class='const'>Resolv</span><span class='op'>::</span><span class='const'>DNS</span><span class='op'>::</span><span class='const'>Resource</span><span class='op'>::</span><span class='const'>IN</span><span class='op'>::</span><span class='const'>A</span><span class='comma'>,</span> <span class='const'>Resolv</span><span class='op'>::</span><span class='const'>DNS</span><span class='op'>::</span><span class='const'>Resource</span><span class='op'>::</span><span class='const'>IN</span><span class='op'>::</span><span class='const'>AAAA</span><span class='comma'>,</span> <span class='const'>Resolv</span><span class='op'>::</span><span class='const'>DNS</span><span class='op'>::</span><span class='const'>Resource</span><span class='op'>::</span><span class='const'>IN</span><span class='op'>::</span><span class='const'>ANY</span><span class='comma'>,</span> <span class='const'>Resolv</span><span class='op'>::</span><span class='const'>DNS</span><span class='op'>::</span><span class='const'>Resource</span><span class='op'>::</span><span class='const'>IN</span><span class='op'>::</span><span class='const'>CNAME</span><span class='comma'>,</span> <span class='const'>Resolv</span><span class='op'>::</span><span class='const'>DNS</span><span class='op'>::</span><span class='const'>Resource</span><span class='op'>::</span><span class='const'>IN</span><span class='op'>::</span><span class='const'>HINFO</span><span class='comma'>,</span> <span class='const'>Resolv</span><span class='op'>::</span><span class='const'>DNS</span><span class='op'>::</span><span class='const'>Resource</span><span class='op'>::</span><span class='const'>IN</span><span class='op'>::</span><span class='const'>MINFO</span><span class='comma'>,</span> <span class='const'>Resolv</span><span class='op'>::</span><span class='const'>DNS</span><span class='op'>::</span><span class='const'>Resource</span><span class='op'>::</span><span class='const'>IN</span><span class='op'>::</span><span class='const'>MX</span><span class='comma'>,</span> <span class='const'>Resolv</span><span class='op'>::</span><span class='const'>DNS</span><span class='op'>::</span><span class='const'>Resource</span><span class='op'>::</span><span class='const'>IN</span><span class='op'>::</span><span class='const'>NS</span><span class='comma'>,</span> <span class='const'>Resolv</span><span class='op'>::</span><span class='const'>DNS</span><span class='op'>::</span><span class='const'>Resource</span><span class='op'>::</span><span class='const'>IN</span><span class='op'>::</span><span class='const'>PTR</span><span class='comma'>,</span> <span class='const'>Resolv</span><span class='op'>::</span><span class='const'>DNS</span><span class='op'>::</span><span class='const'>Resource</span><span class='op'>::</span><span class='const'>IN</span><span class='op'>::</span><span class='const'>SOA</span><span class='comma'>,</span> <span class='const'>Resolv</span><span class='op'>::</span><span class='const'>DNS</span><span class='op'>::</span><span class='const'>Resource</span><span class='op'>::</span><span class='const'>IN</span><span class='op'>::</span><span class='const'>TXT</span><span class='rbracket'>]</span></pre></dd> + <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> +</pre></dd> </dl> @@ -757,39 +759,40 @@ 57</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 29</span> -<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_command'>command</span><span class='rparen'>)</span> - <span class='ivar'>@command</span> <span class='op'>=</span> <span class='id identifier rubyid_command'>command</span> - <span class='id identifier rubyid_application'>application</span> <span class='op'>=</span> <span class='ivar'>@command</span><span class='period'>.</span><span class='id identifier rubyid_application'>application</span> +<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> + <span class='rubyid_@command ivar id'>@command</span> <span class='assign token'>=</span> <span class='rubyid_command identifier id'>command</span> + <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> - <span class='comment'># Setup logger -</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>Logger</span><span class='period'>.</span><span class='id identifier rubyid_start_time'>start_time</span> <span class='op'>=</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span> - <span class='ivar'>@logger</span> <span class='op'>=</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>Logger</span><span class='period'>.</span><span class='id identifier rubyid_create'>create</span><span class='lparen'>(</span><span class='const'>Bovem</span><span class='op'>::</span><span class='const'>Logger</span><span class='period'>.</span><span class='id identifier rubyid_get_real_file'>get_real_file</span><span class='lparen'>(</span><span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>log-file</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>Logger</span><span class='period'>.</span><span class='id identifier rubyid_default_file'>default_file</span><span class='comma'>,</span> <span class='const'>Logger</span><span class='op'>::</span><span class='const'>INFO</span><span class='rparen'>)</span> + <span class='comment val'># Setup logger</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_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> + <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'>&quot;log-file&quot;</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> - <span class='comment'># Open configuration -</span> <span class='kw'>begin</span> - <span class='id identifier rubyid_overrides'>overrides</span> <span class='op'>=</span> <span class='lbrace'>{</span> - <span class='symbol'>:foreground</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_command'>command</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>start</span><span class='tstring_end'>&quot;</span></span> <span class='op'>?</span> <span class='id identifier rubyid_command'>command</span><span class='period'>.</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>foreground</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_value'>value</span> <span class='op'>:</span> <span class='kw'>false</span><span class='comma'>,</span> - <span class='symbol'>:log_file</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>log-file</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> - <span class='symbol'>:log_level</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>log-level</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> - <span class='symbol'>:tld</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>tld</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> - <span class='symbol'>:port</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>port</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_value'>value</span> - <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_reject'>reject</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='id identifier rubyid_v'>v</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='rbrace'>}</span> + <span class='comment val'># Open configuration</span> + <span class='rubyid_begin begin kw'>begin</span> + <span class='rubyid_overrides identifier id'>overrides</span> <span class='assign token'>=</span> <span class='lbrace token'>{</span> + <span class='symbol val'>:foreground</span> <span class='assign token'>=</span><span class='gt op'>&gt;</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'>&quot;start&quot;</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'>&quot;foreground&quot;</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> + <span class='symbol val'>:log_file</span> <span class='assign token'>=</span><span class='gt op'>&gt;</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'>&quot;log-file&quot;</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='symbol val'>:log_level</span> <span class='assign token'>=</span><span class='gt op'>&gt;</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'>&quot;log-level&quot;</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='symbol val'>:tld</span> <span class='assign token'>=</span><span class='gt op'>&gt;</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'>&quot;tld&quot;</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='symbol val'>:port</span> <span class='assign token'>=</span><span class='gt op'>&gt;</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'>&quot;port&quot;</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='rubyid_value identifier id'>value</span> + <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> - <span class='ivar'>@config</span> <span class='op'>=</span> <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>Configuration</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>configuration</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='id identifier rubyid_overrides'>overrides</span><span class='comma'>,</span> <span class='ivar'>@logger</span><span class='rparen'>)</span> + <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'>&quot;configuration&quot;</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> - <span class='ivar'>@logger</span> <span class='op'>=</span> <span class='kw'>nil</span> - <span class='ivar'>@logger</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_get_logger'>get_logger</span> - <span class='kw'>rescue</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>Errors</span><span class='op'>::</span><span class='const'>InvalidConfiguration</span><span class='comma'>,</span> <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>Errors</span><span class='op'>::</span><span class='const'>InvalidRule</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_e'>e</span> - <span class='ivar'>@logger</span> <span class='op'>?</span> <span class='ivar'>@logger</span><span class='period'>.</span><span class='id identifier rubyid_fatal'>fatal</span><span class='lparen'>(</span><span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>Logger</span><span class='period'>.</span><span class='id identifier rubyid_create'>create</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>STDERR</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_fatal'>fatal</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Cannot log to </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_config'>config</span><span class='period'>.</span><span class='id identifier rubyid_log_file'>log_file</span><span class='rbrace'>}</span><span class='tstring_content'>. Exiting...</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> - <span class='id identifier rubyid_raise'>raise</span> <span class='op'>::</span><span class='const'>SystemExit</span> - <span class='kw'>end</span> + <span class='rubyid_@logger ivar id'>@logger</span> <span class='assign token'>=</span> <span class='rubyid_nil nil kw'>nil</span> + <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> + <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'>&gt;</span> <span class='rubyid_e identifier id'>e</span> + <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'>&quot;STDERR&quot;</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'>&quot;Cannot log to #{config.log_file}. Exiting...&quot;</span><span class='rparen token'>)</span> + <span class='rubyid_raise identifier id'>raise</span> <span class='colon3 op'>::</span><span class='rubyid_SystemExit constant id'>SystemExit</span> + <span class='rubyid_end end kw'>end</span> - <span class='kw'>self</span> -<span class='kw'>end</span></pre> + <span class='rubyid_self self kw'>self</span> +<span class='rubyid_end end kw'>end</span> +</pre> </td> </tr> </table> </div> @@ -830,13 +833,14 @@ 23</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 21</span> -<span class='kw'>def</span> <span class='id identifier rubyid_command'>command</span> - <span class='ivar'>@command</span> -<span class='kw'>end</span></pre> +<span class='rubyid_def def kw'>def</span> <span class='rubyid_command identifier id'>command</span> + <span class='rubyid_@command ivar id'>@command</span> +<span class='rubyid_end end kw'>end</span> +</pre> </td> </tr> </table> </div> @@ -872,13 +876,14 @@ 20</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 18</span> -<span class='kw'>def</span> <span class='id identifier rubyid_config'>config</span> - <span class='ivar'>@config</span> -<span class='kw'>end</span></pre> +<span class='rubyid_def def kw'>def</span> <span class='rubyid_config identifier id'>config</span> + <span class='rubyid_@config ivar id'>@config</span> +<span class='rubyid_end end kw'>end</span> +</pre> </td> </tr> </table> </div> @@ -914,13 +919,14 @@ 26</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 24</span> -<span class='kw'>def</span> <span class='id identifier rubyid_logger'>logger</span> - <span class='ivar'>@logger</span> -<span class='kw'>end</span></pre> +<span class='rubyid_def def kw'>def</span> <span class='rubyid_logger identifier id'>logger</span> + <span class='rubyid_@logger ivar id'>@logger</span> +<span class='rubyid_end end kw'>end</span> +</pre> </td> </tr> </table> </div> @@ -1018,15 +1024,16 @@ 351</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 347</span> -<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span><span class='lparen'>(</span><span class='id identifier rubyid_command'>command</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_force'>force</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span> - <span class='ivar'>@instance</span> <span class='op'>=</span> <span class='kw'>nil</span> <span class='kw'>if</span> <span class='id identifier rubyid_force'>force</span> - <span class='ivar'>@instance</span> <span class='op'>||=</span> <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>Application</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_command'>command</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_command'>command</span> - <span class='ivar'>@instance</span> -<span class='kw'>end</span></pre> +<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> + <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> + <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> + <span class='rubyid_@instance ivar id'>@instance</span> +<span class='rubyid_end end kw'>end</span> +</pre> </td> </tr> </table> </div> @@ -1060,13 +1067,14 @@ 363</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 361</span> -<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_quit'>quit</span> - <span class='op'>::</span><span class='const'>EventMachine</span><span class='period'>.</span><span class='id identifier rubyid_stop'>stop</span> -<span class='kw'>end</span></pre> +<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> + <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> +<span class='rubyid_end end kw'>end</span> +</pre> </td> </tr> </table> </div> @@ -1107,13 +1115,14 @@ 358</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 356</span> -<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_run'>run</span> - <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span><span class='period'>.</span><span class='id identifier rubyid_perform_server'>perform_server</span> -<span class='kw'>end</span></pre> +<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> + <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> +<span class='rubyid_end end kw'>end</span> +</pre> </td> </tr> </table> </div> @@ -1220,63 +1229,64 @@ 284</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 232</span> -<span class='kw'>def</span> <span class='id identifier rubyid_action_install'>action_install</span> - <span class='id identifier rubyid_logger'>logger</span> <span class='op'>=</span> <span class='id identifier rubyid_get_logger'>get_logger</span> +<span class='rubyid_def def kw'>def</span> <span class='rubyid_action_install identifier id'>action_install</span> + <span class='rubyid_logger identifier id'>logger</span> <span class='assign token'>=</span> <span class='rubyid_get_logger identifier id'>get_logger</span> - <span class='kw'>if</span> <span class='op'>!</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_is_osx?'>is_osx?</span> <span class='kw'>then</span> - <span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_fatal'>fatal</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Install DevDNSd as a local resolver is only available on MacOSX.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> - <span class='kw'>return</span> <span class='kw'>false</span> - <span class='kw'>end</span> + <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> + <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'>&quot;Install DevDNSd as a local resolver is only available on MacOSX.&quot;</span><span class='rparen token'>)</span> + <span class='rubyid_return return kw'>return</span> <span class='rubyid_false false kw'>false</span> + <span class='rubyid_end end kw'>end</span> - <span class='id identifier rubyid_resolver_file'>resolver_file</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_resolver_path'>resolver_path</span> - <span class='id identifier rubyid_launch_agent'>launch_agent</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_launch_agent_path'>launch_agent_path</span> + <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> + <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> - <span class='comment'># Installs the resolver -</span> <span class='kw'>begin</span> - <span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Installing the resolver in </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_resolver_file'>resolver_file</span><span class='rbrace'>}</span><span class='tstring_content'> ...</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> + <span class='comment val'># Installs the resolver</span> + <span class='rubyid_begin begin kw'>begin</span> + <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'>&quot;Installing the resolver in #{resolver_file} ...&quot;</span><span class='rparen token'>)</span> - <span class='id identifier rubyid_open'>open</span><span class='lparen'>(</span><span class='id identifier rubyid_resolver_file'>resolver_file</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>w</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_f'>f</span><span class='op'>|</span> - <span class='id identifier rubyid_f'>f</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>nameserver 127.0.0.1\n</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> - <span class='id identifier rubyid_f'>f</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>port </span><span class='embexpr_beg'>#{</span><span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_port'>port</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> - <span class='id identifier rubyid_f'>f</span><span class='period'>.</span><span class='id identifier rubyid_flush'>flush</span> - <span class='rbrace'>}</span> - <span class='kw'>rescue</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_e'>e</span> - <span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_error'>error</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Cannot create the resolver file.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> - <span class='kw'>return</span> <span class='kw'>false</span> - <span class='kw'>end</span> + <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'>&quot;w&quot;</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> + <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'>&quot;nameserver 127.0.0.1\n&quot;</span><span class='rparen token'>)</span> + <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'>&quot;port #{@config.port}&quot;</span><span class='rparen token'>)</span> + <span class='rubyid_f identifier id'>f</span><span class='dot token'>.</span><span class='rubyid_flush identifier id'>flush</span> + <span class='rbrace token'>}</span> + <span class='rubyid_rescue rescue kw'>rescue</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='rubyid_e identifier id'>e</span> + <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'>&quot;Cannot create the resolver file.&quot;</span><span class='rparen token'>)</span> + <span class='rubyid_return return kw'>return</span> <span class='rubyid_false false kw'>false</span> + <span class='rubyid_end end kw'>end</span> - <span class='kw'>begin</span> - <span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Creating the launch agent in </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_launch_agent'>launch_agent</span><span class='rbrace'>}</span><span class='tstring_content'> ...</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> + <span class='rubyid_begin begin kw'>begin</span> + <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'>&quot;Creating the launch agent in #{launch_agent} ...&quot;</span><span class='rparen token'>)</span> - <span class='id identifier rubyid_args'>args</span> <span class='op'>=</span> <span class='gvar'>$ARGV</span> <span class='op'>?</span> <span class='gvar'>$ARGV</span><span class='lbracket'>[</span><span class='int'>0</span><span class='comma'>,</span> <span class='gvar'>$ARGV</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>-</span> <span class='int'>1</span><span class='rbracket'>]</span> <span class='op'>:</span> <span class='lbracket'>[</span><span class='rbracket'>]</span> + <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> - <span class='id identifier rubyid_plist'>plist</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>KeepAlive</span><span class='tstring_end'>&quot;</span></span> <span class='op'>=&gt;</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Label</span><span class='tstring_end'>&quot;</span></span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>it.cowtech.devdnsd</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Program</span><span class='tstring_end'>&quot;</span></span> <span class='op'>=&gt;</span> <span class='lparen'>(</span><span class='op'>::</span><span class='const'>Pathname</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='const'>Dir</span><span class='period'>.</span><span class='id identifier rubyid_pwd'>pwd</span><span class='rparen'>)</span> <span class='op'>+</span> <span class='gvar'>$0</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>ProgramArguments</span><span class='tstring_end'>&quot;</span></span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>RunAtLoad</span><span class='tstring_end'>&quot;</span></span> <span class='op'>=&gt;</span> <span class='kw'>true</span><span class='rbrace'>}</span> - <span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_open'>open</span><span class='lparen'>(</span><span class='id identifier rubyid_launch_agent'>launch_agent</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>w</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_f'>f</span><span class='op'>|</span> - <span class='id identifier rubyid_f'>f</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='id identifier rubyid_plist'>plist</span><span class='period'>.</span><span class='id identifier rubyid_to_json'>to_json</span><span class='rparen'>)</span> - <span class='id identifier rubyid_f'>f</span><span class='period'>.</span><span class='id identifier rubyid_flush'>flush</span> - <span class='rbrace'>}</span> - <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_execute_command'>execute_command</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>plutil -convert binary1 \&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_launch_agent'>launch_agent</span><span class='rbrace'>}</span><span class='tstring_content'>\&quot;</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> - <span class='kw'>rescue</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_e'>e</span> - <span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_error'>error</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Cannot create the launch agent.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> - <span class='kw'>return</span> <span class='kw'>false</span> - <span class='kw'>end</span> + <span class='rubyid_plist identifier id'>plist</span> <span class='assign token'>=</span> <span class='lbrace token'>{</span><span class='string val'>&quot;KeepAlive&quot;</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='rubyid_true true kw'>true</span><span class='comma token'>,</span> <span class='string val'>&quot;Label&quot;</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='string val'>&quot;it.cowtech.devdnsd&quot;</span><span class='comma token'>,</span> <span class='string val'>&quot;Program&quot;</span> <span class='assign token'>=</span><span class='gt op'>&gt;</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'>&quot;ProgramArguments&quot;</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='rubyid_args identifier id'>args</span><span class='comma token'>,</span> <span class='string val'>&quot;RunAtLoad&quot;</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='rubyid_true true kw'>true</span><span class='rbrace token'>}</span> + <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'>&quot;w&quot;</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> + <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> + <span class='rubyid_f identifier id'>f</span><span class='dot token'>.</span><span class='rubyid_flush identifier id'>flush</span> + <span class='rbrace 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='dstring node'>&quot;plutil -convert binary1 \&quot;#{launch_agent}\&quot;&quot;</span><span class='rparen token'>)</span> + <span class='rubyid_rescue rescue kw'>rescue</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='rubyid_e identifier id'>e</span> + <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'>&quot;Cannot create the launch agent.&quot;</span><span class='rparen token'>)</span> + <span class='rubyid_return return kw'>return</span> <span class='rubyid_false false kw'>false</span> + <span class='rubyid_end end kw'>end</span> - <span class='kw'>begin</span> - <span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Loading the launch agent ...</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> - <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_execute_command'>execute_command</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>launchctl load -w \&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_launch_agent'>launch_agent</span><span class='rbrace'>}</span><span class='tstring_content'>\&quot; &gt; /dev/null 2&gt;&amp;1</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> - <span class='kw'>rescue</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_e'>e</span> - <span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_error'>error</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Cannot load the launch agent.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> - <span class='kw'>return</span> <span class='kw'>false</span> - <span class='kw'>end</span> + <span class='rubyid_begin begin kw'>begin</span> + <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'>&quot;Loading the launch agent ...&quot;</span><span class='rparen 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='dstring node'>&quot;launchctl load -w \&quot;#{launch_agent}\&quot; &gt; /dev/null 2&gt;&amp;1&quot;</span><span class='rparen token'>)</span> + <span class='rubyid_rescue rescue kw'>rescue</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='rubyid_e identifier id'>e</span> + <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'>&quot;Cannot load the launch agent.&quot;</span><span class='rparen token'>)</span> + <span class='rubyid_return return kw'>return</span> <span class='rubyid_false false kw'>false</span> + <span class='rubyid_end end kw'>end</span> - <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_dns_update'>dns_update</span> + <span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_dns_update identifier id'>dns_update</span> - <span class='kw'>true</span> -<span class='kw'>end</span></pre> + <span class='rubyid_true true kw'>true</span> +<span class='rubyid_end end kw'>end</span> +</pre> </td> </tr> </table> </div> @@ -1337,23 +1347,24 @@ 218</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 206</span> -<span class='kw'>def</span> <span class='id identifier rubyid_action_start'>action_start</span> - <span class='id identifier rubyid_logger'>logger</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_get_logger'>get_logger</span> +<span class='rubyid_def def kw'>def</span> <span class='rubyid_action_start identifier id'>action_start</span> + <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> - <span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Starting DevDNSd ...</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> + <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'>&quot;Starting DevDNSd ...&quot;</span><span class='rparen token'>)</span> - <span class='kw'>if</span> <span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_foreground'>foreground</span> <span class='kw'>then</span> - <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_perform_server'>perform_server</span> - <span class='kw'>else</span> - <span class='const'>RExec</span><span class='op'>::</span><span class='const'>Daemon</span><span class='op'>::</span><span class='const'>Controller</span><span class='period'>.</span><span class='id identifier rubyid_start'>start</span><span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='rparen'>)</span> - <span class='kw'>end</span> + <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> + <span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_perform_server identifier id'>perform_server</span> + <span class='rubyid_else else kw'>else</span> + <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> + <span class='rubyid_end end kw'>end</span> - <span class='kw'>true</span> -<span class='kw'>end</span></pre> + <span class='rubyid_true true kw'>true</span> +<span class='rubyid_end end kw'>end</span> +</pre> </td> </tr> </table> </div> @@ -1406,15 +1417,16 @@ 227</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 223</span> -<span class='kw'>def</span> <span class='id identifier rubyid_action_stop'>action_stop</span> - <span class='const'>RExec</span><span class='op'>::</span><span class='const'>Daemon</span><span class='op'>::</span><span class='const'>Controller</span><span class='period'>.</span><span class='id identifier rubyid_stop'>stop</span><span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='rparen'>)</span> +<span class='rubyid_def def kw'>def</span> <span class='rubyid_action_stop identifier id'>action_stop</span> + <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> - <span class='kw'>true</span> -<span class='kw'>end</span></pre> + <span class='rubyid_true true kw'>true</span> +<span class='rubyid_end end kw'>end</span> +</pre> </td> </tr> </table> </div> @@ -1502,50 +1514,51 @@ 328</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 289</span> -<span class='kw'>def</span> <span class='id identifier rubyid_action_uninstall'>action_uninstall</span> - <span class='id identifier rubyid_logger'>logger</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_get_logger'>get_logger</span> +<span class='rubyid_def def kw'>def</span> <span class='rubyid_action_uninstall identifier id'>action_uninstall</span> + <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> - <span class='kw'>if</span> <span class='op'>!</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_is_osx?'>is_osx?</span> <span class='kw'>then</span> - <span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_fatal'>fatal</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Install DevDNSd as a local resolver is only available on MacOSX.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> - <span class='kw'>return</span> <span class='kw'>false</span> - <span class='kw'>end</span> + <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> + <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'>&quot;Install DevDNSd as a local resolver is only available on MacOSX.&quot;</span><span class='rparen token'>)</span> + <span class='rubyid_return return kw'>return</span> <span class='rubyid_false false kw'>false</span> + <span class='rubyid_end end kw'>end</span> - <span class='id identifier rubyid_resolver_file'>resolver_file</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_resolver_path'>resolver_path</span> - <span class='id identifier rubyid_launch_agent'>launch_agent</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_launch_agent_path'>launch_agent_path</span> + <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> + <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> - <span class='comment'># Remove the resolver -</span> <span class='kw'>begin</span> - <span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Deleting the resolver </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_resolver_file'>resolver_file</span><span class='rbrace'>}</span><span class='tstring_content'> ...</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> - <span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_resolver_file'>resolver_file</span><span class='rparen'>)</span> - <span class='kw'>rescue</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_e'>e</span> - <span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Cannot delete the resolver file.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> - <span class='kw'>return</span> <span class='kw'>false</span> - <span class='kw'>end</span> + <span class='comment val'># Remove the resolver</span> + <span class='rubyid_begin begin kw'>begin</span> + <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'>&quot;Deleting the resolver #{resolver_file} ...&quot;</span><span class='rparen token'>)</span> + <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> + <span class='rubyid_rescue rescue kw'>rescue</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='rubyid_e identifier id'>e</span> + <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'>&quot;Cannot delete the resolver file.&quot;</span><span class='rparen token'>)</span> + <span class='rubyid_return return kw'>return</span> <span class='rubyid_false false kw'>false</span> + <span class='rubyid_end end kw'>end</span> - <span class='comment'># Unload the launch agent. -</span> <span class='kw'>begin</span> - <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_execute_command'>execute_command</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>launchctl unload -w \&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_launch_agent'>launch_agent</span><span class='rbrace'>}</span><span class='tstring_content'>\&quot; &gt; /dev/null 2&gt;&amp;1</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> - <span class='kw'>rescue</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_e'>e</span> - <span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Cannot unload the launch agent.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> - <span class='kw'>end</span> + <span class='comment val'># Unload the launch agent.</span> + <span class='rubyid_begin begin kw'>begin</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='dstring node'>&quot;launchctl unload -w \&quot;#{launch_agent}\&quot; &gt; /dev/null 2&gt;&amp;1&quot;</span><span class='rparen token'>)</span> + <span class='rubyid_rescue rescue kw'>rescue</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='rubyid_e identifier id'>e</span> + <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'>&quot;Cannot unload the launch agent.&quot;</span><span class='rparen token'>)</span> + <span class='rubyid_end end kw'>end</span> - <span class='comment'># Delete the launch agent. -</span> <span class='kw'>begin</span> - <span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Deleting the launch agent </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_launch_agent'>launch_agent</span><span class='rbrace'>}</span><span class='tstring_content'> ...</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> - <span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_launch_agent'>launch_agent</span><span class='rparen'>)</span> - <span class='kw'>rescue</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_e'>e</span> - <span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Cannot delete the launch agent.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> - <span class='kw'>return</span> <span class='kw'>false</span> - <span class='kw'>end</span> + <span class='comment val'># Delete the launch agent.</span> + <span class='rubyid_begin begin kw'>begin</span> + <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'>&quot;Deleting the launch agent #{launch_agent} ...&quot;</span><span class='rparen token'>)</span> + <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> + <span class='rubyid_rescue rescue kw'>rescue</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='rubyid_e identifier id'>e</span> + <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'>&quot;Cannot delete the launch agent.&quot;</span><span class='rparen token'>)</span> + <span class='rubyid_return return kw'>return</span> <span class='rubyid_false false kw'>false</span> + <span class='rubyid_end end kw'>end</span> - <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_dns_update'>dns_update</span> + <span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_dns_update identifier id'>dns_update</span> - <span class='kw'>true</span> -<span class='kw'>end</span></pre> + <span class='rubyid_true true kw'>true</span> +<span class='rubyid_end end kw'>end</span> +</pre> </td> </tr> </table> </div> @@ -1597,14 +1610,15 @@ 105</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 102</span> -<span class='kw'>def</span> <span class='id identifier rubyid_dns_update'>dns_update</span> - <span class='ivar'>@logger</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Flushing DNS cache and resolvers ...</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> - <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_execute_command'>execute_command</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>dscacheutil -flushcache</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> -<span class='kw'>end</span></pre> +<span class='rubyid_def def kw'>def</span> <span class='rubyid_dns_update identifier id'>dns_update</span> + <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'>&quot;Flushing DNS cache and resolvers ...&quot;</span><span class='rparen 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='string val'>&quot;dscacheutil -flushcache&quot;</span><span class='rparen token'>)</span> +<span class='rubyid_end end kw'>end</span> +</pre> </td> </tr> </table> </div> @@ -1674,13 +1688,14 @@ 97</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 95</span> -<span class='kw'>def</span> <span class='id identifier rubyid_execute_command'>execute_command</span><span class='lparen'>(</span><span class='id identifier rubyid_command'>command</span><span class='rparen'>)</span> - <span class='id identifier rubyid_system'>system</span><span class='lparen'>(</span><span class='id identifier rubyid_command'>command</span><span class='rparen'>)</span> -<span class='kw'>end</span></pre> +<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> + <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> +<span class='rubyid_end end kw'>end</span> +</pre> </td> </tr> </table> </div> @@ -1731,13 +1746,14 @@ 72</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 70</span> -<span class='kw'>def</span> <span class='id identifier rubyid_get_logger'>get_logger</span> - <span class='ivar'>@logger</span> <span class='op'>||=</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>Logger</span><span class='period'>.</span><span class='id identifier rubyid_create'>create</span><span class='lparen'>(</span><span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_foreground'>foreground</span> <span class='op'>?</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>Logger</span><span class='period'>.</span><span class='id identifier rubyid_default_file'>default_file</span> <span class='op'>:</span> <span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_log_file'>log_file</span><span class='comma'>,</span> <span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_log_level'>log_level</span><span class='comma'>,</span> <span class='ivar'>@log_formatter</span><span class='rparen'>)</span> -<span class='kw'>end</span></pre> +<span class='rubyid_def def kw'>def</span> <span class='rubyid_get_logger identifier id'>get_logger</span> + <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> +<span class='rubyid_end end kw'>end</span> +</pre> </td> </tr> </table> </div> @@ -1789,13 +1805,14 @@ 65</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 63</span> -<span class='kw'>def</span> <span class='id identifier rubyid_is_osx?'>is_osx?</span> - <span class='op'>::</span><span class='const'>Config</span><span class='op'>::</span><span class='const'>CONFIG</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>host_os</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=~</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^darwin</span><span class='regexp_end'>/</span></span> -<span class='kw'>end</span></pre> +<span class='rubyid_def def kw'>def</span> <span class='rubyid_is_osx? fid id'>is_osx?</span> + <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> +<span class='rubyid_end end kw'>end</span> +</pre> </td> </tr> </table> </div> @@ -1867,13 +1884,14 @@ 89</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 87</span> -<span class='kw'>def</span> <span class='id identifier rubyid_launch_agent_path'>launch_agent_path</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>it.cowtech.devdnsd</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> - <span class='const'>ENV</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>HOME</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/Library/LaunchAgents/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_name'>name</span><span class='rbrace'>}</span><span class='tstring_content'>.plist</span><span class='tstring_end'>&quot;</span></span> -<span class='kw'>end</span></pre> +<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'>&quot;it.cowtech.devdnsd&quot;</span><span class='rparen token'>)</span> + <span class='rubyid_ENV constant id'>ENV</span><span class='lbrack token'>[</span><span class='string val'>&quot;HOME&quot;</span><span class='rbrack token'>]</span> <span class='plus op'>+</span> <span class='dstring node'>&quot;/Library/LaunchAgents/#{name}.plist&quot;</span> +<span class='rubyid_end end kw'>end</span> +</pre> </td> </tr> </table> </div> @@ -1923,12 +1941,13 @@ 334</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 333</span> -<span class='kw'>def</span> <span class='id identifier rubyid_on_start'>on_start</span> -<span class='kw'>end</span></pre> +<span class='rubyid_def def kw'>def</span> <span class='rubyid_on_start identifier id'>on_start</span> +<span class='rubyid_end end kw'>end</span> +</pre> </td> </tr> </table> </div> @@ -1978,12 +1997,13 @@ 340</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 339</span> -<span class='kw'>def</span> <span class='id identifier rubyid_on_stop'>on_stop</span> -<span class='kw'>end</span></pre> +<span class='rubyid_def def kw'>def</span> <span class='rubyid_on_stop identifier id'>on_stop</span> +<span class='rubyid_end end kw'>end</span> +</pre> </td> </tr> </table> </div> @@ -2071,50 +2091,51 @@ 149</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 110</span> -<span class='kw'>def</span> <span class='id identifier rubyid_perform_server'>perform_server</span> - <span class='const'>RubyDNS</span><span class='op'>::</span><span class='id identifier rubyid_run_server'>run_server</span><span class='lparen'>(</span><span class='symbol'>:listen</span> <span class='op'>=&gt;</span> <span class='lbracket'>[</span><span class='lbracket'>[</span><span class='symbol'>:udp</span><span class='comma'>,</span> <span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_address'>address</span><span class='comma'>,</span> <span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_port'>port</span><span class='period'>.</span><span class='id identifier rubyid_to_integer'>to_integer</span><span class='rbracket'>]</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='kw'>do</span> - <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_logger'>logger</span> <span class='op'>=</span> <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>Application</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span><span class='period'>.</span><span class='id identifier rubyid_logger'>logger</span> +<span class='rubyid_def def kw'>def</span> <span class='rubyid_perform_server identifier id'>perform_server</span> + <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'>&gt;</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> + <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> - <span class='id identifier rubyid_match'>match</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>.+</span><span class='regexp_end'>/</span></span><span class='comma'>,</span> <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>Application</span><span class='op'>::</span><span class='const'>ANY_CLASSES</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_match_data'>match_data</span><span class='comma'>,</span> <span class='id identifier rubyid_transaction'>transaction</span><span class='op'>|</span> - <span class='id identifier rubyid_transaction'>transaction</span><span class='period'>.</span><span class='id identifier rubyid_append_question!'>append_question!</span> + <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> + <span class='rubyid_transaction identifier id'>transaction</span><span class='dot token'>.</span><span class='rubyid_append_question! fid id'>append_question!</span> - <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>Application</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span><span class='period'>.</span><span class='id identifier rubyid_config'>config</span><span class='period'>.</span><span class='id identifier rubyid_rules'>rules</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_rule'>rule</span><span class='op'>|</span> - <span class='kw'>begin</span> - <span class='comment'># Get the subset of handled class that is valid for the rule -</span> <span class='id identifier rubyid_resource_classes'>resource_classes</span> <span class='op'>=</span> <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>Application</span><span class='op'>::</span><span class='const'>ANY_CLASSES</span> <span class='op'>&amp;</span> <span class='id identifier rubyid_rule'>rule</span><span class='period'>.</span><span class='id identifier rubyid_resource_class'>resource_class</span><span class='period'>.</span><span class='id identifier rubyid_ensure_array'>ensure_array</span> - <span class='id identifier rubyid_resource_classes'>resource_classes</span> <span class='op'>=</span> <span class='id identifier rubyid_resource_classes'>resource_classes</span> <span class='op'>&amp;</span> <span class='lbracket'>[</span><span class='id identifier rubyid_transaction'>transaction</span><span class='period'>.</span><span class='id identifier rubyid_resource_class'>resource_class</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_transaction'>transaction</span><span class='period'>.</span><span class='id identifier rubyid_resource_class'>resource_class</span> <span class='op'>!=</span> <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>Application</span><span class='op'>::</span><span class='const'>ANY_REQUEST</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_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> + <span class='rubyid_begin begin kw'>begin</span> + <span class='comment val'># Get the subset of handled class that is valid for the rule</span> + <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'>&amp;</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> + <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'>&amp;</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> - <span class='kw'>if</span> <span class='id identifier rubyid_resource_classes'>resource_classes</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='kw'>then</span> - <span class='id identifier rubyid_resource_classes'>resource_classes</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_resource_class'>resource_class</span><span class='op'>|</span> <span class='comment'># Now for every class -</span> <span class='id identifier rubyid_matches'>matches</span> <span class='op'>=</span> <span class='id identifier rubyid_rule'>rule</span><span class='period'>.</span><span class='id identifier rubyid_match_host'>match_host</span><span class='lparen'>(</span><span class='id identifier rubyid_match_data'>match_data</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='rparen'>)</span> - <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>Application</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span><span class='period'>.</span><span class='id identifier rubyid_process_rule'>process_rule</span><span class='lparen'>(</span><span class='id identifier rubyid_rule'>rule</span><span class='comma'>,</span> <span class='id identifier rubyid_resource_class'>resource_class</span><span class='comma'>,</span> <span class='id identifier rubyid_rule'>rule</span><span class='period'>.</span><span class='id identifier rubyid_is_regexp?'>is_regexp?</span> <span class='op'>?</span> <span class='id identifier rubyid_matches'>matches</span> <span class='op'>:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_transaction'>transaction</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_matches'>matches</span> - <span class='kw'>end</span> - <span class='kw'>end</span> - <span class='kw'>rescue</span> <span class='op'>::</span><span class='const'>Exception</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_e'>e</span> - <span class='id identifier rubyid_raise'>raise</span> <span class='id identifier rubyid_e'>e</span> - <span class='kw'>end</span> - <span class='kw'>end</span> - <span class='kw'>end</span> + <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> + <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> + <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> + <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> + <span class='rubyid_end end kw'>end</span> + <span class='rubyid_end end kw'>end</span> + <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'>&gt;</span> <span class='rubyid_e identifier id'>e</span> + <span class='rubyid_raise identifier id'>raise</span> <span class='rubyid_e identifier id'>e</span> + <span class='rubyid_end end kw'>end</span> + <span class='rubyid_end end kw'>end</span> + <span class='rubyid_end end kw'>end</span> - <span class='comment'># Default DNS handler -</span> <span class='id identifier rubyid_otherwise'>otherwise</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_transaction'>transaction</span><span class='op'>|</span> - <span class='id identifier rubyid_transaction'>transaction</span><span class='period'>.</span><span class='id identifier rubyid_failure!'>failure!</span><span class='lparen'>(</span><span class='symbol'>:NXDomain</span><span class='rparen'>)</span> - <span class='kw'>end</span> + <span class='comment val'># Default DNS handler</span> + <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> + <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> + <span class='rubyid_end end kw'>end</span> - <span class='comment'># Attach event handlers -</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_on'>on</span><span class='lparen'>(</span><span class='symbol'>:start</span><span class='rparen'>)</span> <span class='kw'>do</span> - <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>Application</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span><span class='period'>.</span><span class='id identifier rubyid_on_start'>on_start</span> - <span class='kw'>end</span> + <span class='comment val'># Attach event handlers</span> + <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> + <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> + <span class='rubyid_end end kw'>end</span> - <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_on'>on</span><span class='lparen'>(</span><span class='symbol'>:stop</span><span class='rparen'>)</span> <span class='kw'>do</span> - <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>Application</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span><span class='period'>.</span><span class='id identifier rubyid_on_stop'>on_stop</span> - <span class='kw'>end</span> - <span class='kw'>end</span> -<span class='kw'>end</span></pre> + <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> + <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> + <span class='rubyid_end end kw'>end</span> + <span class='rubyid_end end kw'>end</span> +<span class='rubyid_end end kw'>end</span> +</pre> </td> </tr> </table> </div> @@ -2270,54 +2291,55 @@ 201</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 158</span> -<span class='kw'>def</span> <span class='id identifier rubyid_process_rule'>process_rule</span><span class='lparen'>(</span><span class='id identifier rubyid_rule'>rule</span><span class='comma'>,</span> <span class='id identifier rubyid_type'>type</span><span class='comma'>,</span> <span class='id identifier rubyid_match_data'>match_data</span><span class='comma'>,</span> <span class='id identifier rubyid_transaction'>transaction</span><span class='rparen'>)</span> - <span class='id identifier rubyid_is_regex'>is_regex</span> <span class='op'>=</span> <span class='id identifier rubyid_rule'>rule</span><span class='period'>.</span><span class='id identifier rubyid_match'>match</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Regexp</span><span class='rparen'>)</span> - <span class='id identifier rubyid_type'>type</span> <span class='op'>=</span> <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>Rule</span><span class='period'>.</span><span class='id identifier rubyid_resource_class_to_symbol'>resource_class_to_symbol</span><span class='lparen'>(</span><span class='id identifier rubyid_type'>type</span><span class='rparen'>)</span> +<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> + <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> + <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> - <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>Application</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span><span class='period'>.</span><span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_debug'>debug</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Found match on </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_rule'>rule</span><span class='period'>.</span><span class='id identifier rubyid_match'>match</span><span class='rbrace'>}</span><span class='tstring_content'> with type </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type'>type</span><span class='rbrace'>}</span><span class='tstring_content'>.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</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><span class='dot token'>.</span><span class='rubyid_debug identifier id'>debug</span><span class='lparen token'>(</span><span class='dstring node'>&quot;Found match on #{rule.match} with type #{type}.&quot;</span><span class='rparen token'>)</span> - <span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_rule'>rule</span><span class='period'>.</span><span class='id identifier rubyid_block'>block</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='kw'>then</span> - <span class='id identifier rubyid_reply'>reply</span> <span class='op'>=</span> <span class='id identifier rubyid_rule'>rule</span><span class='period'>.</span><span class='id identifier rubyid_block'>block</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_match_data'>match_data</span><span class='comma'>,</span> <span class='id identifier rubyid_type'>type</span><span class='comma'>,</span> <span class='id identifier rubyid_transaction'>transaction</span><span class='rparen'>)</span> - <span class='kw'>else</span> - <span class='id identifier rubyid_reply'>reply</span> <span class='op'>=</span> <span class='id identifier rubyid_rule'>rule</span><span class='period'>.</span><span class='id identifier rubyid_reply'>reply</span> - <span class='kw'>end</span> + <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> + <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> + <span class='rubyid_else else kw'>else</span> + <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> + <span class='rubyid_end end kw'>end</span> - <span class='kw'>if</span> <span class='id identifier rubyid_is_regex'>is_regex</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_reply'>reply</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_match_data'>match_data</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span> <span class='kw'>then</span> - <span class='id identifier rubyid_reply'>reply</span> <span class='op'>=</span> <span class='id identifier rubyid_match_data'>match_data</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='id identifier rubyid_rule'>rule</span><span class='period'>.</span><span class='id identifier rubyid_match'>match</span><span class='comma'>,</span> <span class='id identifier rubyid_reply'>reply</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>$</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\\</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='rparen'>)</span> - <span class='kw'>end</span> + <span class='rubyid_if if kw'>if</span> <span class='rubyid_is_regex identifier id'>is_regex</span> <span class='andop op'>&amp;&amp;</span> <span class='rubyid_reply identifier id'>reply</span> <span class='andop op'>&amp;&amp;</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> + <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'>&quot;$&quot;</span><span class='comma token'>,</span> <span class='string val'>&quot;\\&quot;</span><span class='rparen token'>)</span><span class='rparen token'>)</span> + <span class='rubyid_end end kw'>end</span> - <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>Application</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span><span class='period'>.</span><span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_debug'>debug</span><span class='lparen'>(</span><span class='id identifier rubyid_reply'>reply</span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Reply is </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_reply'>reply</span><span class='rbrace'>}</span><span class='tstring_content'> with type </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type'>type</span><span class='rbrace'>}</span><span class='tstring_content'>.</span><span class='tstring_end'>&quot;</span></span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>No reply found.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</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><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'>&quot;Reply is #{reply} with type #{type}.&quot;</span> <span class='colon op'>:</span> <span class='string val'>&quot;No reply found.&quot;</span><span class='rparen token'>)</span> - <span class='kw'>if</span> <span class='id identifier rubyid_reply'>reply</span> <span class='kw'>then</span> - <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='id identifier rubyid_rule'>rule</span><span class='period'>.</span><span class='id identifier rubyid_options'>options</span> + <span class='rubyid_if if kw'>if</span> <span class='rubyid_reply identifier id'>reply</span> <span class='rubyid_then then kw'>then</span> + <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> - <span class='id identifier rubyid_final_reply'>final_reply</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span> + <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> - <span class='kw'>case</span> <span class='id identifier rubyid_type'>type</span> - <span class='kw'>when</span> <span class='symbol'>:MX</span> - <span class='id identifier rubyid_preference'>preference</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:preference</span><span class='rparen'>)</span> - <span class='id identifier rubyid_preference'>preference</span> <span class='op'>=</span> <span class='id identifier rubyid_preference'>preference</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>?</span> <span class='int'>10</span> <span class='op'>:</span> <span class='id identifier rubyid_preference'>preference</span><span class='period'>.</span><span class='id identifier rubyid_to_integer'>to_integer</span><span class='lparen'>(</span><span class='int'>10</span><span class='rparen'>)</span> - <span class='id identifier rubyid_final_reply'>final_reply</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_preference'>preference</span> - <span class='kw'>end</span> + <span class='rubyid_case case kw'>case</span> <span class='rubyid_type identifier id'>type</span> + <span class='rubyid_when when kw'>when</span> <span class='symbol val'>:MX</span> + <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> + <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> + <span class='rubyid_final_reply identifier id'>final_reply</span> <span class='lshft op'>&lt;&lt;</span> <span class='rubyid_preference identifier id'>preference</span> + <span class='rubyid_end end kw'>end</span> - <span class='kw'>if</span> <span class='lbracket'>[</span><span class='symbol'>:A</span><span class='comma'>,</span> <span class='symbol'>:AAAA</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_type'>type</span><span class='rparen'>)</span> <span class='kw'>then</span> - <span class='id identifier rubyid_final_reply'>final_reply</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_reply'>reply</span> - <span class='kw'>else</span> - <span class='id identifier rubyid_final_reply'>final_reply</span> <span class='op'>&lt;&lt;</span> <span class='const'>Resolv</span><span class='op'>::</span><span class='const'>DNS</span><span class='op'>::</span><span class='const'>Name</span><span class='period'>.</span><span class='id identifier rubyid_create'>create</span><span class='lparen'>(</span><span class='id identifier rubyid_reply'>reply</span><span class='rparen'>)</span> - <span class='kw'>end</span> + <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> + <span class='rubyid_final_reply identifier id'>final_reply</span> <span class='lshft op'>&lt;&lt;</span> <span class='rubyid_reply identifier id'>reply</span> + <span class='rubyid_else else kw'>else</span> + <span class='rubyid_final_reply identifier id'>final_reply</span> <span class='lshft op'>&lt;&lt;</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> + <span class='rubyid_end end kw'>end</span> - <span class='id identifier rubyid_final_reply'>final_reply</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='lbrace'>{</span><span class='symbol'>:resource_class</span> <span class='op'>=&gt;</span> <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>Rule</span><span class='period'>.</span><span class='id identifier rubyid_symbol_to_resource_class'>symbol_to_resource_class</span><span class='lparen'>(</span><span class='id identifier rubyid_type'>type</span><span class='rparen'>)</span><span class='rbrace'>}</span><span class='rparen'>)</span> - <span class='id identifier rubyid_transaction'>transaction</span><span class='period'>.</span><span class='id identifier rubyid_respond!'>respond!</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_final_reply'>final_reply</span><span class='rparen'>)</span> - <span class='kw'>elsif</span> <span class='id identifier rubyid_reply'>reply</span> <span class='op'>==</span> <span class='kw'>false</span> <span class='kw'>then</span> - <span class='kw'>false</span> - <span class='kw'>else</span> - <span class='id identifier rubyid_reply'>reply</span> - <span class='kw'>end</span> -<span class='kw'>end</span></pre> + <span class='rubyid_final_reply identifier id'>final_reply</span> <span class='lshft op'>&lt;&lt;</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'>&gt;</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> + <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> + <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> + <span class='rubyid_false false kw'>false</span> + <span class='rubyid_else else kw'>else</span> + <span class='rubyid_reply identifier id'>reply</span> + <span class='rubyid_end end kw'>end</span> +<span class='rubyid_end end kw'>end</span> +</pre> </td> </tr> </table> </div> @@ -2390,26 +2412,27 @@ 81</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 78</span> -<span class='kw'>def</span> <span class='id identifier rubyid_resolver_path'>resolver_path</span><span class='lparen'>(</span><span class='id identifier rubyid_tld'>tld</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span> - <span class='id identifier rubyid_tld'>tld</span> <span class='op'>||=</span> <span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_tld'>tld</span> - <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/etc/resolver/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_tld'>tld</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span> -<span class='kw'>end</span></pre> +<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> + <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> + <span class='dstring node'>&quot;/etc/resolver/#{tld}&quot;</span> +<span class='rubyid_end end kw'>end</span> +</pre> </td> </tr> </table> </div> </div> </div> <div id="footer"> - Generated on Wed Aug 22 13:48:32 2012 by + Generated on Sat Oct 6 08:58:34 2012 by <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a> - 0.8.2.1 (ruby-1.9.2). + 0.8.2.1 (ruby-1.8.7). </div> </body> </html> \ No newline at end of file