doc/DevDNSd/Application.html in devdnsd-3.1.2 vs doc/DevDNSd/Application.html in devdnsd-4.0.0
- old
+ new
@@ -4,11 +4,11 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
Class: DevDNSd::Application
- — Documentation by YARD 0.8.7.4
+ — Documentation by YARD 0.8.7.6
</title>
<link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
@@ -71,16 +71,16 @@
<dl class="box">
<dt class="r1">Inherits:</dt>
<dd class="r1">
- <span class="inheritName">RExec::Daemon::Base</span>
+ <span class="inheritName">Process::Daemon</span>
<ul class="fullTree">
<li>Object</li>
- <li class="next">RExec::Daemon::Base</li>
+ <li class="next">Process::Daemon</li>
<li class="next">DevDNSd::Application</li>
</ul>
<a href="#" class="inheritanceTree">show all</a>
@@ -91,11 +91,11 @@
<dt class="r2">Includes:</dt>
- <dd class="r2"><span class='object_link'><a href="ApplicationMethods/Aliases.html" title="DevDNSd::ApplicationMethods::Aliases (module)">DevDNSd::ApplicationMethods::Aliases</a></span>, <span class='object_link'><a href="ApplicationMethods/Server.html" title="DevDNSd::ApplicationMethods::Server (module)">DevDNSd::ApplicationMethods::Server</a></span>, <span class='object_link'><a href="ApplicationMethods/System.html" title="DevDNSd::ApplicationMethods::System (module)">DevDNSd::ApplicationMethods::System</a></span>, Lazier::I18n</dd>
+ <dd class="r2"><span class='object_link'><a href="Aliases.html" title="DevDNSd::Aliases (module)">Aliases</a></span>, <span class='object_link'><a href="OSX.html" title="DevDNSd::OSX (module)">OSX</a></span>, <span class='object_link'><a href="Server.html" title="DevDNSd::Server (module)">Server</a></span>, <span class='object_link'><a href="System.html" title="DevDNSd::System (module)">System</a></span></dd>
@@ -146,11 +146,15 @@
<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='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><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span></pre></dd>
</dl>
@@ -160,10 +164,38 @@
<ul class="summary">
<li class="public ">
<span class="summary_signature">
+ <a href="#%3Ai18n-instance_method" title="#:i18n (instance method)">- (Bovem::I18n) <strong>:i18n</strong>(:i18n) </a>
+
+
+
+ </span>
+
+
+
+
+ <span class="note title readonly">readonly</span>
+
+
+
+
+
+
+
+
+
+ <span class="summary_desc"><div class='inline'><p>A localizer object.</p>
+</div></span>
+
+</li>
+
+
+ <li class="public ">
+ <span class="summary_signature">
+
<a href="#command-instance_method" title="#command (instance method)">- (Bovem::Command) <strong>command</strong> </a>
</span>
@@ -216,10 +248,38 @@
<li class="public ">
<span class="summary_signature">
+ <a href="#i18n-instance_method" title="#i18n (instance method)">- (Object) <strong>i18n</strong> </a>
+
+
+
+ </span>
+
+
+
+
+ <span class="note title readonly">readonly</span>
+
+
+
+
+
+
+
+
+
+ <span class="summary_desc"><div class='inline'><p>Returns the value of attribute i18n.</p>
+</div></span>
+
+</li>
+
+
+ <li class="public ">
+ <span class="summary_signature">
+
<a href="#locale-instance_method" title="#locale (instance method)">- (Symbol|nil) <strong>locale</strong> </a>
</span>
@@ -244,11 +304,11 @@
<li class="public ">
<span class="summary_signature">
- <a href="#logger-instance_method" title="#logger (instance method)">- (Bovem::Logger) <strong>logger</strong> </a>
+ <a href="#logger-instance_method" title="#logger (instance method)">- (Logger) <strong>logger</strong>(force = false) </a>
</span>
@@ -261,16 +321,44 @@
- <span class="summary_desc"><div class='inline'><p>The logger for this application.</p>
+ <span class="summary_desc"><div class='inline'><p>Gets the current logger of the application.</p>
</div></span>
</li>
+ <li class="public ">
+ <span class="summary_signature">
+
+ <a href="#server-instance_method" title="#server (instance method)">- (RubyDNS::RuleBasedServer) <strong>server</strong> </a>
+
+
+
+ </span>
+
+
+
+
+ <span class="note title readonly">readonly</span>
+
+
+
+
+
+
+
+
+
+ <span class="summary_desc"><div class='inline'><p>The server of this application.</p>
+</div></span>
+
+</li>
+
+
</ul>
@@ -384,59 +472,59 @@
<ul class="summary">
<li class="public ">
<span class="summary_signature">
- <a href="#get_logger-instance_method" title="#get_logger (instance method)">- (Logger) <strong>get_logger</strong> </a>
+ <a href="#initialize-instance_method" title="#initialize (instance method)">- (Application) <strong>initialize</strong>(command, locale) </a>
</span>
+ <span class="note title constructor">constructor</span>
+
- <span class="summary_desc"><div class='inline'><p>Gets the current logger of the application.</p>
+ <span class="summary_desc"><div class='inline'><p>Creates a new application.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
- <a href="#initialize-instance_method" title="#initialize (instance method)">- (Application) <strong>initialize</strong>(command, locale) </a>
+ <a href="#on_start-instance_method" title="#on_start (instance method)">- (NilClass) <strong>on_start</strong> </a>
</span>
- <span class="note title constructor">constructor</span>
-
- <span class="summary_desc"><div class='inline'><p>Creates a new application.</p>
+ <span class="summary_desc"><div class='inline'><p>This method is called when the server starts.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
- <a href="#on_start-instance_method" title="#on_start (instance method)">- (NilClass) <strong>on_start</strong> </a>
+ <a href="#on_stop-instance_method" title="#on_stop (instance method)">- (NilClass) <strong>on_stop</strong> </a>
</span>
@@ -446,20 +534,20 @@
- <span class="summary_desc"><div class='inline'><p>This method is called when the server starts.</p>
+ <span class="summary_desc"><div class='inline'><p>This method is called when the server stop.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
- <a href="#on_stop-instance_method" title="#on_stop (instance method)">- (NilClass) <strong>on_stop</strong> </a>
+ <a href="#shutdown-instance_method" title="#shutdown (instance method)">- (Object) <strong>shutdown</strong> </a>
</span>
@@ -469,11 +557,11 @@
- <span class="summary_desc"><div class='inline'><p>This method is called when the server stop.</p>
+ <span class="summary_desc"><div class='inline'><p>Stops the server.</p>
</div></span>
</li>
@@ -487,38 +575,48 @@
- <h3 class="inherited">Methods included from <span class='object_link'><a href="ApplicationMethods/Server.html" title="DevDNSd::ApplicationMethods::Server (module)">DevDNSd::ApplicationMethods::Server</a></span></h3>
- <p class="inherited"><span class='object_link'><a href="ApplicationMethods/Server.html#perform_server-instance_method" title="DevDNSd::ApplicationMethods::Server#perform_server (method)">#perform_server</a></span>, <span class='object_link'><a href="ApplicationMethods/Server.html#process_rule-instance_method" title="DevDNSd::ApplicationMethods::Server#process_rule (method)">#process_rule</a></span>, <span class='object_link'><a href="ApplicationMethods/Server.html#process_rule_in_classes-instance_method" title="DevDNSd::ApplicationMethods::Server#process_rule_in_classes (method)">#process_rule_in_classes</a></span></p>
+ <h3 class="inherited">Methods included from <span class='object_link'><a href="OSX.html" title="DevDNSd::OSX (module)">OSX</a></span></h3>
+ <p class="inherited"><span class='object_link'><a href="OSX.html#action_add-instance_method" title="DevDNSd::OSX#action_add (method)">#action_add</a></span>, <span class='object_link'><a href="OSX.html#action_install-instance_method" title="DevDNSd::OSX#action_install (method)">#action_install</a></span>, <span class='object_link'><a href="OSX.html#action_remove-instance_method" title="DevDNSd::OSX#action_remove (method)">#action_remove</a></span>, <span class='object_link'><a href="OSX.html#action_uninstall-instance_method" title="DevDNSd::OSX#action_uninstall (method)">#action_uninstall</a></span>, <span class='object_link'><a href="OSX.html#dns_update-instance_method" title="DevDNSd::OSX#dns_update (method)">#dns_update</a></span>, <span class='object_link'><a href="OSX.html#execute_command-instance_method" title="DevDNSd::OSX#execute_command (method)">#execute_command</a></span>, <span class='object_link'><a href="OSX.html#launch_agent_path-instance_method" title="DevDNSd::OSX#launch_agent_path (method)">#launch_agent_path</a></span>, <span class='object_link'><a href="OSX.html#osx%3F-instance_method" title="DevDNSd::OSX#osx? (method)">#osx?</a></span>, <span class='object_link'><a href="OSX.html#resolver_path-instance_method" title="DevDNSd::OSX#resolver_path (method)">#resolver_path</a></span></p>
- <h3 class="inherited">Methods included from <span class='object_link'><a href="ApplicationMethods/Aliases.html" title="DevDNSd::ApplicationMethods::Aliases (module)">DevDNSd::ApplicationMethods::Aliases</a></span></h3>
- <p class="inherited"><span class='object_link'><a href="ApplicationMethods/Aliases.html#compute_addresses-instance_method" title="DevDNSd::ApplicationMethods::Aliases#compute_addresses (method)">#compute_addresses</a></span>, <span class='object_link'><a href="ApplicationMethods/Aliases.html#is_ipv4%3F-instance_method" title="DevDNSd::ApplicationMethods::Aliases#is_ipv4? (method)">#is_ipv4?</a></span>, <span class='object_link'><a href="ApplicationMethods/Aliases.html#is_ipv6%3F-instance_method" title="DevDNSd::ApplicationMethods::Aliases#is_ipv6? (method)">#is_ipv6?</a></span>, <span class='object_link'><a href="ApplicationMethods/Aliases.html#manage_address-instance_method" title="DevDNSd::ApplicationMethods::Aliases#manage_address (method)">#manage_address</a></span>, <span class='object_link'><a href="ApplicationMethods/Aliases.html#manage_aliases-instance_method" title="DevDNSd::ApplicationMethods::Aliases#manage_aliases (method)">#manage_aliases</a></span></p>
+ <h3 class="inherited">Methods included from <span class='object_link'><a href="System.html" title="DevDNSd::System (module)">System</a></span></h3>
+ <p class="inherited"><span class='object_link'><a href="System.html#action_restart-instance_method" title="DevDNSd::System#action_restart (method)">#action_restart</a></span>, <span class='object_link'><a href="System.html#action_start-instance_method" title="DevDNSd::System#action_start (method)">#action_start</a></span>, <span class='object_link'><a href="System.html#action_status-instance_method" title="DevDNSd::System#action_status (method)">#action_status</a></span>, <span class='object_link'><a href="System.html#action_stop-instance_method" title="DevDNSd::System#action_stop (method)">#action_stop</a></span>, <span class='object_link'><a href="System.html#daemon_name-instance_method" title="DevDNSd::System#daemon_name (method)">#daemon_name</a></span>, <span class='object_link'><a href="System.html#log_directory-instance_method" title="DevDNSd::System#log_directory (method)">#log_directory</a></span>, <span class='object_link'><a href="System.html#log_file_path-instance_method" title="DevDNSd::System#log_file_path (method)">#log_file_path</a></span>, <span class='object_link'><a href="System.html#process_file_path-instance_method" title="DevDNSd::System#process_file_path (method)">#process_file_path</a></span>, <span class='object_link'><a href="System.html#working_directory-instance_method" title="DevDNSd::System#working_directory (method)">#working_directory</a></span></p>
- <h3 class="inherited">Methods included from <span class='object_link'><a href="ApplicationMethods/System.html" title="DevDNSd::ApplicationMethods::System (module)">DevDNSd::ApplicationMethods::System</a></span></h3>
- <p class="inherited"><span class='object_link'><a href="ApplicationMethods/System.html#action_add-instance_method" title="DevDNSd::ApplicationMethods::System#action_add (method)">#action_add</a></span>, <span class='object_link'><a href="ApplicationMethods/System.html#action_install-instance_method" title="DevDNSd::ApplicationMethods::System#action_install (method)">#action_install</a></span>, <span class='object_link'><a href="ApplicationMethods/System.html#action_remove-instance_method" title="DevDNSd::ApplicationMethods::System#action_remove (method)">#action_remove</a></span>, <span class='object_link'><a href="ApplicationMethods/System.html#action_restart-instance_method" title="DevDNSd::ApplicationMethods::System#action_restart (method)">#action_restart</a></span>, <span class='object_link'><a href="ApplicationMethods/System.html#action_start-instance_method" title="DevDNSd::ApplicationMethods::System#action_start (method)">#action_start</a></span>, <span class='object_link'><a href="ApplicationMethods/System.html#action_status-instance_method" title="DevDNSd::ApplicationMethods::System#action_status (method)">#action_status</a></span>, <span class='object_link'><a href="ApplicationMethods/System.html#action_stop-instance_method" title="DevDNSd::ApplicationMethods::System#action_stop (method)">#action_stop</a></span>, <span class='object_link'><a href="ApplicationMethods/System.html#action_uninstall-instance_method" title="DevDNSd::ApplicationMethods::System#action_uninstall (method)">#action_uninstall</a></span>, <span class='object_link'><a href="ApplicationMethods/System.html#dns_update-instance_method" title="DevDNSd::ApplicationMethods::System#dns_update (method)">#dns_update</a></span>, <span class='object_link'><a href="ApplicationMethods/System.html#execute_command-instance_method" title="DevDNSd::ApplicationMethods::System#execute_command (method)">#execute_command</a></span>, <span class='object_link'><a href="ApplicationMethods/System.html#is_osx%3F-instance_method" title="DevDNSd::ApplicationMethods::System#is_osx? (method)">#is_osx?</a></span>, <span class='object_link'><a href="ApplicationMethods/System.html#launch_agent_path-instance_method" title="DevDNSd::ApplicationMethods::System#launch_agent_path (method)">#launch_agent_path</a></span>, <span class='object_link'><a href="ApplicationMethods/System.html#resolver_path-instance_method" title="DevDNSd::ApplicationMethods::System#resolver_path (method)">#resolver_path</a></span></p>
+ <h3 class="inherited">Methods included from <span class='object_link'><a href="Server.html" title="DevDNSd::Server (module)">Server</a></span></h3>
+ <p class="inherited"><span class='object_link'><a href="Server.html#perform_server-instance_method" title="DevDNSd::Server#perform_server (method)">#perform_server</a></span>, <span class='object_link'><a href="Server.html#process_rule-instance_method" title="DevDNSd::Server#process_rule (method)">#process_rule</a></span>, <span class='object_link'><a href="Server.html#process_rule_in_classes-instance_method" title="DevDNSd::Server#process_rule_in_classes (method)">#process_rule_in_classes</a></span></p>
+
+
+
+
+
+
+ <h3 class="inherited">Methods included from <span class='object_link'><a href="Aliases.html" title="DevDNSd::Aliases (module)">Aliases</a></span></h3>
+ <p class="inherited"><span class='object_link'><a href="Aliases.html#compute_addresses-instance_method" title="DevDNSd::Aliases#compute_addresses (method)">#compute_addresses</a></span>, <span class='object_link'><a href="Aliases.html#ipv4%3F-instance_method" title="DevDNSd::Aliases#ipv4? (method)">#ipv4?</a></span>, <span class='object_link'><a href="Aliases.html#ipv6%3F-instance_method" title="DevDNSd::Aliases#ipv6? (method)">#ipv6?</a></span>, <span class='object_link'><a href="Aliases.html#manage_address-instance_method" title="DevDNSd::Aliases#manage_address (method)">#manage_address</a></span>, <span class='object_link'><a href="Aliases.html#manage_aliases-instance_method" title="DevDNSd::Aliases#manage_aliases (method)">#manage_aliases</a></span></p>
+
+
<div id="constructor_details" class="method_details_list">
<h2>Constructor Details</h2>
<div class="method_details first">
<h3 class="signature first" id="initialize-instance_method">
@@ -577,44 +675,42 @@
<tr>
<td>
<pre class="lines">
-672
-673
-674
-675
-676
-677
-678
-679
-680
-681
-682
-683
-684
-685
-686
-687</pre>
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 672</span>
+ <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 50</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='comma'>,</span> <span class='id identifier rubyid_locale'>locale</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_i18n_setup'>i18n_setup</span><span class='lparen'>(</span><span class='symbol'>:devdnsd</span><span class='comma'>,</span> <span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_absolute_path'>absolute_path</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='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='kw'>__FILE__</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/../../locales/</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
- <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span> <span class='op'>=</span> <span class='id identifier rubyid_locale'>locale</span>
-
+ <span class='ivar'>@i18n</span> <span class='op'>=</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_locale'>locale</span><span class='comma'>,</span> <span class='label'>root:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>devdnsd</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>path:</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='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='kw'>__FILE__</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/../../locales/</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
<span class='ivar'>@locale</span> <span class='op'>=</span> <span class='id identifier rubyid_locale'>locale</span>
<span class='ivar'>@command</span> <span class='op'>=</span> <span class='id identifier rubyid_command'>command</span>
- <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='ivar'>@command</span><span class='period'>.</span><span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_get_options'>get_options</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__'>_</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='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='id identifier rubyid_load_options'>load_options</span>
<span class='comment'># Setup logger
</span> <span class='id identifier rubyid_create_logger'>create_logger</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
<span class='comment'># Open configuration
</span> <span class='id identifier rubyid_read_configuration'>read_configuration</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
+ <span class='kw'>super</span><span class='lparen'>(</span><span class='id identifier rubyid_working_directory'>working_directory</span><span class='rparen'>)</span>
<span class='kw'>self</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
@@ -626,12 +722,417 @@
<h2>Instance Attribute Details</h2>
<span id=""></span>
<div class="method_details first">
- <h3 class="signature first" id="command-instance_method">
+ <h3 class="signature first" id=":i18n-instance_method">
+ - (<tt>Bovem::I18n</tt>) <strong>:i18n</strong>(:i18n) <span class="extras">(readonly)</span>
+
+
+
+
+
+</h3><div class="docstring">
+ <div class="discussion">
+ <p>Returns A localizer object.</p>
+
+
+ </div>
+</div>
+<div class="tags">
+
+<p class="tag_title">Returns:</p>
+<ul class="return">
+
+ <li>
+
+
+ <span class='type'>(<tt>Bovem::I18n</tt>)</span>
+
+
+
+ —
+ <div class='inline'><p>A localizer object.</p>
+</div>
+
+ </li>
+
+</ul>
+
+</div><table class="source_code">
+ <tr>
+ <td>
+ <pre class="lines">
+
+
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198</pre>
+ </td>
+ <td>
+ <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 23</span>
+
+<span class='kw'>class</span> <span class='const'>Application</span> <span class='op'><</span> <span class='const'>Process</span><span class='op'>::</span><span class='const'>Daemon</span>
+ <span class='comment'># Class for ANY DNS request.
+</span> <span class='const'>ANY_REQUEST</span> <span class='op'>=</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='comment'># List of classes handled in case of DNS request with resource class ANY.
+</span> <span class='const'>ANY_CLASSES</span> <span class='op'>=</span> <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><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span>
+
+ <span class='id identifier rubyid_include'>include</span> <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>Aliases</span>
+ <span class='id identifier rubyid_include'>include</span> <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>Server</span>
+ <span class='id identifier rubyid_include'>include</span> <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>System</span>
+ <span class='id identifier rubyid_include'>include</span> <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>OSX</span>
+
+ <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:config</span>
+ <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:command</span>
+ <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:logger</span>
+ <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:locale</span>
+ <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:i18n</span>
+ <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:server</span>
+
+ <span class='comment'># Creates a new application.
+</span> <span class='comment'>#
+</span> <span class='comment'># @param command [Bovem::Command] The current Bovem command.
+</span> <span class='comment'># @param locale [Symbol] The locale to use for the application.
+</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='comma'>,</span> <span class='id identifier rubyid_locale'>locale</span><span class='rparen'>)</span>
+ <span class='ivar'>@i18n</span> <span class='op'>=</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_locale'>locale</span><span class='comma'>,</span> <span class='label'>root:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>devdnsd</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>path:</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='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='kw'>__FILE__</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/../../locales/</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
+ <span class='ivar'>@locale</span> <span class='op'>=</span> <span class='id identifier rubyid_locale'>locale</span>
+ <span class='ivar'>@command</span> <span class='op'>=</span> <span class='id identifier rubyid_command'>command</span>
+ <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='id identifier rubyid_load_options'>load_options</span>
+
+ <span class='comment'># Setup logger
+</span> <span class='id identifier rubyid_create_logger'>create_logger</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
+
+ <span class='comment'># Open configuration
+</span> <span class='id identifier rubyid_read_configuration'>read_configuration</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
+
+ <span class='kw'>super</span><span class='lparen'>(</span><span class='id identifier rubyid_working_directory'>working_directory</span><span class='rparen'>)</span>
+ <span class='kw'>self</span>
+ <span class='kw'>end</span>
+
+ <span class='comment'># Stops the server.
+</span> <span class='kw'>def</span> <span class='id identifier rubyid_shutdown'>shutdown</span>
+ <span class='id identifier rubyid_server'>server</span><span class='period'>.</span><span class='id identifier rubyid_actors'>actors</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='period'>.</span><span class='id identifier rubyid_links'>links</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:terminate</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_server'>server</span>
+ <span class='kw'>end</span>
+
+ <span class='comment'># Gets the current logger of the application.
+</span> <span class='comment'>#
+</span> <span class='comment'># @param force [Boolean] If to force recreation of the logger.
+</span> <span class='comment'># @return [Logger] The current logger of the application.
+</span> <span class='kw'>def</span> <span class='id identifier rubyid_logger'>logger</span><span class='lparen'>(</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'>@logger</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'>@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='gvar'>$stdout</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='label'>level:</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='label'>formatter:</span> <span class='ivar'>@log_formatter</span><span class='rparen'>)</span>
+ <span class='kw'>end</span>
+
+ <span class='comment'># This method is called when the server starts. By default is a no-op.
+</span> <span class='comment'>#
+</span> <span class='comment'># @return [NilClass] `nil`.
+</span> <span class='kw'>def</span> <span class='id identifier rubyid_on_start'>on_start</span>
+ <span class='kw'>end</span>
+
+ <span class='comment'># This method is called when the server stop.
+</span> <span class='comment'>#
+</span> <span class='comment'># @return [NilClass] `nil`.
+</span> <span class='kw'>def</span> <span class='id identifier rubyid_on_stop'>on_stop</span>
+ <span class='kw'>end</span>
+
+ <span class='comment'># Returns a unique (singleton) instance of the application.
+</span> <span class='comment'>#
+</span> <span class='comment'># @param command [Bovem::Command] The current Bovem command.
+</span> <span class='comment'># @param locale [Symbol] The locale to use for the application.
+</span> <span class='comment'># @param force [Boolean] If to force recreation of the instance.
+</span> <span class='comment'># @return [Application] The unique (singleton) instance of the application.
+</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_locale'>locale</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='comma'>,</span> <span class='id identifier rubyid_locale'>locale</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>
+
+ <span class='comment'># Runs the application in foreground.
+</span> <span class='comment'>#
+</span> <span class='comment'># @see #perform_server
+</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='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>
+
+ <span class='comment'># Stops the application.
+</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='id identifier rubyid_instance'>instance</span><span class='period'>.</span><span class='id identifier rubyid_shutdown'>shutdown</span>
+ <span class='kw'>rescue</span>
+ <span class='const'>Kernel</span><span class='period'>.</span><span class='id identifier rubyid_exit'>exit</span><span class='lparen'>(</span><span class='int'>1</span><span class='rparen'>)</span>
+ <span class='kw'>end</span>
+
+ <span class='comment'># Check if the current implementation supports DevDNSd.
+</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_check_ruby_implementation'>check_ruby_implementation</span>
+ <span class='kw'>if</span> <span class='kw'>defined?</span><span class='lparen'>(</span><span class='const'>JRuby</span><span class='rparen'>)</span>
+ <span class='const'>Kernel</span><span class='period'>.</span><span class='id identifier rubyid_puts'>puts</span><span class='lparen'>(</span><span class='const'>Bovem</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='label'>root:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>devdnsd</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>path:</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='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='kw'>__FILE__</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/../../locales/</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_no_jruby'>no_jruby</span><span class='rparen'>)</span>
+ <span class='const'>Kernel</span><span class='period'>.</span><span class='id identifier rubyid_exit'>exit</span><span class='lparen'>(</span><span class='int'>0</span><span class='rparen'>)</span>
+ <span class='kw'>end</span>
+ <span class='kw'>end</span>
+
+ <span class='id identifier rubyid_private'>private</span>
+
+ <span class='comment'># :nodoc:
+</span> <span class='kw'>def</span> <span class='id identifier rubyid_load_options'>load_options</span>
+ <span class='ivar'>@command</span><span class='period'>.</span><span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_get_options'>get_options</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__'>_</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='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='ivar'>@command</span><span class='period'>.</span><span class='id identifier rubyid_get_options'>get_options</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__'>_</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='rparen'>)</span>
+ <span class='kw'>end</span>
+
+ <span class='comment'># :nodoc:
+</span> <span class='kw'>def</span> <span class='id identifier rubyid_create_logger'>create_logger</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_warn_failure'>warn_failure</span> <span class='op'>=</span> <span class='kw'>false</span>
+ <span class='id identifier rubyid_orig_file'>orig_file</span> <span class='op'>=</span> <span class='id identifier rubyid_file'>file</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_get_real_file'>get_real_file</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>log_file</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</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='kw'>if</span> <span class='id identifier rubyid_file'>file</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>String</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='id identifier rubyid_warn_failure'>warn_failure</span> <span class='op'>=</span> <span class='id identifier rubyid_load_logger'>load_logger</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_absolute_path'>absolute_path</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
+ <span class='kw'>end</span>
+
+ <span class='id identifier rubyid_finalize_create_logger'>finalize_create_logger</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='id identifier rubyid_orig_file'>orig_file</span><span class='comma'>,</span> <span class='id identifier rubyid_warn_failure'>warn_failure</span><span class='rparen'>)</span>
+ <span class='kw'>end</span>
+
+ <span class='comment'># :nodoc:
+</span> <span class='kw'>def</span> <span class='id identifier rubyid_load_logger'>load_logger</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_warn_failure'>warn_failure</span> <span class='op'>=</span> <span class='kw'>false</span>
+
+ <span class='kw'>begin</span>
+ <span class='const'>FileUtils</span><span class='period'>.</span><span class='id identifier rubyid_mkdir_p'>mkdir_p</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='rparen'>)</span><span class='rparen'>)</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='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='label'>level:</span> <span class='op'>::</span><span class='const'>Logger</span><span class='op'>::</span><span class='const'>INFO</span><span class='rparen'>)</span>
+ <span class='kw'>rescue</span>
+ <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>log_file</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>STDOUT</span><span class='tstring_end'>"</span></span>
+ <span class='id identifier rubyid_file'>file</span> <span class='op'>=</span> <span class='gvar'>$stdout</span>
+ <span class='id identifier rubyid_warn_failure'>warn_failure</span> <span class='op'>=</span> <span class='kw'>true</span>
+ <span class='kw'>end</span>
+
+ <span class='lbracket'>[</span><span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='id identifier rubyid_warn_failure'>warn_failure</span><span class='rbracket'>]</span>
+ <span class='kw'>end</span>
+
+ <span class='comment'># :nodoc:
+</span> <span class='kw'>def</span> <span class='id identifier rubyid_finalize_create_logger'>finalize_create_logger</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='id identifier rubyid_orig_file'>orig_file</span><span class='comma'>,</span> <span class='id identifier rubyid_warn_failure'>warn_failure</span><span class='rparen'>)</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='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='label'>level:</span> <span class='op'>::</span><span class='const'>Logger</span><span class='op'>::</span><span class='const'>INFO</span><span class='rparen'>)</span>
+ <span class='ivar'>@logger</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span><span class='lparen'>(</span><span class='id identifier rubyid_replace_markers'>replace_markers</span><span class='lparen'>(</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_logging_failed'>logging_failed</span><span class='lparen'>(</span><span class='id identifier rubyid_orig_file'>orig_file</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='ivar'>@logger</span> <span class='op'>&&</span> <span class='id identifier rubyid_warn_failure'>warn_failure</span>
+ <span class='ivar'>@logger</span>
+ <span class='kw'>end</span>
+
+ <span class='comment'># :nodoc:
+</span> <span class='kw'>def</span> <span class='id identifier rubyid_read_configuration'>read_configuration</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_absolute_path'>absolute_path</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>configuration</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='rparen'>)</span>
+
+ <span class='kw'>begin</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_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='comma'>,</span> <span class='ivar'>@logger</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_ensure_directory_for'>ensure_directory_for</span><span class='lparen'>(</span><span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_log_file'>log_file</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_log_file'>log_file</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>String</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_ensure_directory_for'>ensure_directory_for</span><span class='lparen'>(</span><span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_pid_file'>pid_file</span><span class='rparen'>)</span>
+ <span class='ivar'>@logger</span> <span class='op'>=</span> <span class='id identifier rubyid_logger'>logger</span><span class='lparen'>(</span><span class='kw'>true</span><span class='rparen'>)</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='op'>=></span> <span class='id identifier rubyid_e'>e</span>
+ <span class='id identifier rubyid_log_failed_configuration'>log_failed_configuration</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_e'>e</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_shutdown'>shutdown</span>
+ <span class='kw'>end</span>
+ <span class='kw'>end</span>
+
+ <span class='comment'># :nodoc:
+</span> <span class='kw'>def</span> <span class='id identifier rubyid_ensure_directory_for'>ensure_directory_for</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
+ <span class='const'>FileUtils</span><span class='period'>.</span><span class='id identifier rubyid_mkdir_p'>mkdir_p</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span><span class='rparen'>)</span>
+ <span class='kw'>rescue</span>
+ <span class='ivar'>@logger</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span><span class='lparen'>(</span><span class='id identifier rubyid_replace_markers'>replace_markers</span><span class='lparen'>(</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_invalid_directory'>invalid_directory</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_shutdown'>shutdown</span>
+ <span class='const'>Kernel</span><span class='period'>.</span><span class='id identifier rubyid_exit'>exit</span><span class='lparen'>(</span><span class='int'>1</span><span class='rparen'>)</span>
+ <span class='kw'>end</span>
+
+ <span class='comment'># :nodoc:
+</span> <span class='kw'>def</span> <span class='id identifier rubyid_log_failed_configuration'>log_failed_configuration</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_exception'>exception</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_logger'>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='gvar'>$stderr</span><span class='rparen'>)</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='id identifier rubyid_exception'>exception</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span><span class='rparen'>)</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='id identifier rubyid_replace_markers'>replace_markers</span><span class='lparen'>(</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_application_create_config'>application_create_config</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='rparen'>)</span>
+ <span class='kw'>end</span>
+<span class='kw'>end</span></pre>
+ </td>
+ </tr>
+</table>
+</div>
+
+
+ <span id=""></span>
+ <div class="method_details ">
+ <h3 class="signature " id="command-instance_method">
+
- (<tt>Bovem::Command</tt>) <strong>command</strong> <span class="extras">(readonly)</span>
@@ -667,216 +1168,245 @@
<tr>
<td>
<pre class="lines">
-651
-652
-653
-654
-655
-656
-657
-658
-659
-660
-661
-662
-663
-664
-665
-666
-667
-668
-669
-670
-671
-672
-673
-674
-675
-676
-677
-678
-679
-680
-681
-682
-683
-684
-685
-686
-687
-688
-689
-690
-691
-692
-693
-694
-695
-696
-697
-698
-699
-700
-701
-702
-703
-704
-705
-706
-707
-708
-709
-710
-711
-712
-713
-714
-715
-716
-717
-718
-719
-720
-721
-722
-723
-724
-725
-726
-727
-728
-729
-730
-731
-732
-733
-734
-735
-736
-737
-738
-739
-740
-741
-742
-743
-744
-745
-746
-747
-748
-749
-750
-751
-752
-753
-754
-755
-756
-757
-758
-759
-760
-761
-762
-763
-764
-765
-766
-767
-768
-769
-770
-771
-772
-773
-774
-775
-776
-777
-778
-779
-780
-781
-782
-783
-784
-785
-786
-787
-788
-789
-790
-791
-792
-793
-794
-795
-796
-797
-798
-799
-800
-801
-802
-803
-804
-805
-806
-807
-808
-809</pre>
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 651</span>
+ <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 23</span>
-<span class='kw'>class</span> <span class='const'>Application</span> <span class='op'><</span> <span class='const'>RExec</span><span class='op'>::</span><span class='const'>Daemon</span><span class='op'>::</span><span class='const'>Base</span>
+<span class='kw'>class</span> <span class='const'>Application</span> <span class='op'><</span> <span class='const'>Process</span><span class='op'>::</span><span class='const'>Daemon</span>
<span class='comment'># Class for ANY DNS request.
</span> <span class='const'>ANY_REQUEST</span> <span class='op'>=</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='comment'># List of classes handled in case of DNS request with resource class ANY.
-</span> <span class='const'>ANY_CLASSES</span> <span class='op'>=</span> <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>
+</span> <span class='const'>ANY_CLASSES</span> <span class='op'>=</span> <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><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span>
- <span class='id identifier rubyid_include'>include</span> <span class='const'>Lazier</span><span class='op'>::</span><span class='const'>I18n</span>
- <span class='id identifier rubyid_include'>include</span> <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>ApplicationMethods</span><span class='op'>::</span><span class='const'>System</span>
- <span class='id identifier rubyid_include'>include</span> <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>ApplicationMethods</span><span class='op'>::</span><span class='const'>Aliases</span>
- <span class='id identifier rubyid_include'>include</span> <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>ApplicationMethods</span><span class='op'>::</span><span class='const'>Server</span>
+ <span class='id identifier rubyid_include'>include</span> <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>Aliases</span>
+ <span class='id identifier rubyid_include'>include</span> <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>Server</span>
+ <span class='id identifier rubyid_include'>include</span> <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>System</span>
+ <span class='id identifier rubyid_include'>include</span> <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>OSX</span>
<span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:config</span>
<span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:command</span>
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:logger</span>
<span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:locale</span>
+ <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:i18n</span>
+ <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:server</span>
<span class='comment'># Creates a new application.
</span> <span class='comment'>#
</span> <span class='comment'># @param command [Bovem::Command] The current Bovem command.
</span> <span class='comment'># @param locale [Symbol] The locale to use for the application.
</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='comma'>,</span> <span class='id identifier rubyid_locale'>locale</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_i18n_setup'>i18n_setup</span><span class='lparen'>(</span><span class='symbol'>:devdnsd</span><span class='comma'>,</span> <span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_absolute_path'>absolute_path</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='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='kw'>__FILE__</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/../../locales/</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
- <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span> <span class='op'>=</span> <span class='id identifier rubyid_locale'>locale</span>
-
+ <span class='ivar'>@i18n</span> <span class='op'>=</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_locale'>locale</span><span class='comma'>,</span> <span class='label'>root:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>devdnsd</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>path:</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='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='kw'>__FILE__</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/../../locales/</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
<span class='ivar'>@locale</span> <span class='op'>=</span> <span class='id identifier rubyid_locale'>locale</span>
<span class='ivar'>@command</span> <span class='op'>=</span> <span class='id identifier rubyid_command'>command</span>
- <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='ivar'>@command</span><span class='period'>.</span><span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_get_options'>get_options</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__'>_</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='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='id identifier rubyid_load_options'>load_options</span>
<span class='comment'># Setup logger
</span> <span class='id identifier rubyid_create_logger'>create_logger</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
<span class='comment'># Open configuration
</span> <span class='id identifier rubyid_read_configuration'>read_configuration</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
+ <span class='kw'>super</span><span class='lparen'>(</span><span class='id identifier rubyid_working_directory'>working_directory</span><span class='rparen'>)</span>
<span class='kw'>self</span>
<span class='kw'>end</span>
+ <span class='comment'># Stops the server.
+</span> <span class='kw'>def</span> <span class='id identifier rubyid_shutdown'>shutdown</span>
+ <span class='id identifier rubyid_server'>server</span><span class='period'>.</span><span class='id identifier rubyid_actors'>actors</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='period'>.</span><span class='id identifier rubyid_links'>links</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:terminate</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_server'>server</span>
+ <span class='kw'>end</span>
+
<span class='comment'># Gets the current logger of the application.
</span> <span class='comment'>#
+</span> <span class='comment'># @param force [Boolean] If to force recreation of the logger.
</span> <span class='comment'># @return [Logger] The current logger of the application.
-</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='gvar'>$stdout</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> <span class='kw'>def</span> <span class='id identifier rubyid_logger'>logger</span><span class='lparen'>(</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'>@logger</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'>@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='gvar'>$stdout</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='label'>level:</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='label'>formatter:</span> <span class='ivar'>@log_formatter</span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='comment'># This method is called when the server starts. By default is a no-op.
</span> <span class='comment'>#
</span> <span class='comment'># @return [NilClass] `nil`.
@@ -908,90 +1438,95 @@
<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>
<span class='comment'># Stops the application.
</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='kw'>begin</span>
- <span class='const'>EM</span><span class='period'>.</span><span class='id identifier rubyid_add_timer'>add_timer</span><span class='lparen'>(</span><span class='float'>0.1</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='op'>::</span><span class='const'>EM</span><span class='period'>.</span><span class='id identifier rubyid_stop'>stop</span> <span class='rbrace'>}</span>
- <span class='kw'>rescue</span>
- <span class='kw'>end</span>
+ <span class='id identifier rubyid_instance'>instance</span><span class='period'>.</span><span class='id identifier rubyid_shutdown'>shutdown</span>
+ <span class='kw'>rescue</span>
+ <span class='const'>Kernel</span><span class='period'>.</span><span class='id identifier rubyid_exit'>exit</span><span class='lparen'>(</span><span class='int'>1</span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='comment'># Check if the current implementation supports DevDNSd.
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_check_ruby_implementation'>check_ruby_implementation</span>
- <span class='kw'>if</span> <span class='kw'>defined?</span><span class='lparen'>(</span><span class='const'>JRuby</span><span class='rparen'>)</span> <span class='kw'>then</span>
- <span class='const'>Kernel</span><span class='period'>.</span><span class='id identifier rubyid_puts'>puts</span><span class='lparen'>(</span><span class='const'>Lazier</span><span class='op'>::</span><span class='const'>Localizer</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='symbol'>:devdnsd</span><span class='comma'>,</span> <span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_absolute_path'>absolute_path</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='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='kw'>__FILE__</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/../../locales/</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_no_jruby'>no_jruby</span><span class='rparen'>)</span>
+ <span class='kw'>if</span> <span class='kw'>defined?</span><span class='lparen'>(</span><span class='const'>JRuby</span><span class='rparen'>)</span>
+ <span class='const'>Kernel</span><span class='period'>.</span><span class='id identifier rubyid_puts'>puts</span><span class='lparen'>(</span><span class='const'>Bovem</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='label'>root:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>devdnsd</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>path:</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='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='kw'>__FILE__</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/../../locales/</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_no_jruby'>no_jruby</span><span class='rparen'>)</span>
<span class='const'>Kernel</span><span class='period'>.</span><span class='id identifier rubyid_exit'>exit</span><span class='lparen'>(</span><span class='int'>0</span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span>
<span class='id identifier rubyid_private'>private</span>
- <span class='comment'># Creates a logger.
-</span> <span class='comment'>#
-</span> <span class='comment'># @param options [Hash] The configuration to use.
-</span> <span class='kw'>def</span> <span class='id identifier rubyid_create_logger'>create_logger</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_warn_failure'>warn_failure</span> <span class='op'>=</span> <span class='kw'>false</span>
- <span class='id identifier rubyid_orig_file'>orig_file</span> <span class='op'>=</span> <span class='id identifier rubyid_file'>file</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_get_real_file'>get_real_file</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>log_file</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</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='kw'>if</span> <span class='id identifier rubyid_file'>file</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>String</span><span class='rparen'>)</span> <span class='kw'>then</span>
- <span class='id identifier rubyid_file'>file</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_absolute_path'>absolute_path</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='rparen'>)</span><span class='rparen'>)</span>
+ <span class='comment'># :nodoc:
+</span> <span class='kw'>def</span> <span class='id identifier rubyid_load_options'>load_options</span>
+ <span class='ivar'>@command</span><span class='period'>.</span><span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_get_options'>get_options</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__'>_</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='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='ivar'>@command</span><span class='period'>.</span><span class='id identifier rubyid_get_options'>get_options</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__'>_</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='rparen'>)</span>
+ <span class='kw'>end</span>
- <span class='kw'>begin</span>
- <span class='const'>FileUtils</span><span class='period'>.</span><span class='id identifier rubyid_mkdir_p'>mkdir_p</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='rparen'>)</span><span class='rparen'>)</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='id identifier rubyid_file'>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='kw'>rescue</span>
- <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>log_file</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>STDOUT</span><span class='tstring_end'>"</span></span>
- <span class='id identifier rubyid_file'>file</span> <span class='op'>=</span> <span class='gvar'>$stdout</span>
- <span class='id identifier rubyid_warn_failure'>warn_failure</span> <span class='op'>=</span> <span class='kw'>true</span>
- <span class='kw'>end</span>
- <span class='kw'>end</span>
+ <span class='comment'># :nodoc:
+</span> <span class='kw'>def</span> <span class='id identifier rubyid_create_logger'>create_logger</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_warn_failure'>warn_failure</span> <span class='op'>=</span> <span class='kw'>false</span>
+ <span class='id identifier rubyid_orig_file'>orig_file</span> <span class='op'>=</span> <span class='id identifier rubyid_file'>file</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_get_real_file'>get_real_file</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>log_file</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</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='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='id identifier rubyid_file'>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='ivar'>@logger</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span><span class='lparen'>(</span><span class='id identifier rubyid_replace_markers'>replace_markers</span><span class='lparen'>(</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_logging_failed'>logging_failed</span><span class='lparen'>(</span><span class='id identifier rubyid_orig_file'>orig_file</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='ivar'>@logger</span> <span class='op'>&&</span> <span class='id identifier rubyid_warn_failure'>warn_failure</span>
- <span class='ivar'>@logger</span>
+ <span class='kw'>if</span> <span class='id identifier rubyid_file'>file</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>String</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='id identifier rubyid_warn_failure'>warn_failure</span> <span class='op'>=</span> <span class='id identifier rubyid_load_logger'>load_logger</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_absolute_path'>absolute_path</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
<span class='kw'>end</span>
- <span class='comment'># Reads configuration.
-</span> <span class='comment'>#
-</span> <span class='comment'># @param options [Hash] The configuration to read.
-</span> <span class='kw'>def</span> <span class='id identifier rubyid_read_configuration'>read_configuration</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_absolute_path'>absolute_path</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>configuration</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_finalize_create_logger'>finalize_create_logger</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='id identifier rubyid_orig_file'>orig_file</span><span class='comma'>,</span> <span class='id identifier rubyid_warn_failure'>warn_failure</span><span class='rparen'>)</span>
+ <span class='kw'>end</span>
- <span class='kw'>begin</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_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='comma'>,</span> <span class='ivar'>@logger</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_ensure_directory_for'>ensure_directory_for</span><span class='lparen'>(</span><span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_log_file'>log_file</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_log_file'>log_file</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>String</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_ensure_directory_for'>ensure_directory_for</span><span class='lparen'>(</span><span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_pid_file'>pid_file</span><span class='rparen'>)</span>
+ <span class='comment'># :nodoc:
+</span> <span class='kw'>def</span> <span class='id identifier rubyid_load_logger'>load_logger</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_warn_failure'>warn_failure</span> <span class='op'>=</span> <span class='kw'>false</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='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='op'>=></span> <span class='id identifier rubyid_e'>e</span>
- <span class='id identifier rubyid_log_failed_configuration'>log_failed_configuration</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_e'>e</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='kw'>begin</span>
+ <span class='const'>FileUtils</span><span class='period'>.</span><span class='id identifier rubyid_mkdir_p'>mkdir_p</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='rparen'>)</span><span class='rparen'>)</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='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='label'>level:</span> <span class='op'>::</span><span class='const'>Logger</span><span class='op'>::</span><span class='const'>INFO</span><span class='rparen'>)</span>
+ <span class='kw'>rescue</span>
+ <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>log_file</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>STDOUT</span><span class='tstring_end'>"</span></span>
+ <span class='id identifier rubyid_file'>file</span> <span class='op'>=</span> <span class='gvar'>$stdout</span>
+ <span class='id identifier rubyid_warn_failure'>warn_failure</span> <span class='op'>=</span> <span class='kw'>true</span>
<span class='kw'>end</span>
- <span class='comment'># Creates a folder for a file.
-</span> <span class='comment'>#
-</span> <span class='comment'># @param path [String] The path of the file.
-</span> <span class='kw'>def</span> <span class='id identifier rubyid_ensure_directory_for'>ensure_directory_for</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
- <span class='kw'>begin</span>
- <span class='const'>FileUtils</span><span class='period'>.</span><span class='id identifier rubyid_mkdir_p'>mkdir_p</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span><span class='rparen'>)</span>
- <span class='kw'>rescue</span>
- <span class='ivar'>@logger</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span><span class='lparen'>(</span><span class='id identifier rubyid_replace_markers'>replace_markers</span><span class='lparen'>(</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_invalid_directory'>invalid_directory</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='rparen'>)</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='kw'>end</span>
+ <span class='lbracket'>[</span><span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='id identifier rubyid_warn_failure'>warn_failure</span><span class='rbracket'>]</span>
+ <span class='kw'>end</span>
- <span class='comment'># Logs a failed configuration
-</span> <span class='comment'>#
-</span> <span class='comment'># @param path [String] The path of the invalid file.
-</span> <span class='comment'># @param exception [Exception] The occurred exception.
-</span> <span class='kw'>def</span> <span class='id identifier rubyid_log_failed_configuration'>log_failed_configuration</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_exception'>exception</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_logger'>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='gvar'>$stderr</span><span class='rparen'>)</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='id identifier rubyid_exception'>exception</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span><span class='rparen'>)</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='id identifier rubyid_replace_markers'>replace_markers</span><span class='lparen'>(</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_application_create_config'>application_create_config</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='rparen'>)</span>
+ <span class='comment'># :nodoc:
+</span> <span class='kw'>def</span> <span class='id identifier rubyid_finalize_create_logger'>finalize_create_logger</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='id identifier rubyid_orig_file'>orig_file</span><span class='comma'>,</span> <span class='id identifier rubyid_warn_failure'>warn_failure</span><span class='rparen'>)</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='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='label'>level:</span> <span class='op'>::</span><span class='const'>Logger</span><span class='op'>::</span><span class='const'>INFO</span><span class='rparen'>)</span>
+ <span class='ivar'>@logger</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span><span class='lparen'>(</span><span class='id identifier rubyid_replace_markers'>replace_markers</span><span class='lparen'>(</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_logging_failed'>logging_failed</span><span class='lparen'>(</span><span class='id identifier rubyid_orig_file'>orig_file</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='ivar'>@logger</span> <span class='op'>&&</span> <span class='id identifier rubyid_warn_failure'>warn_failure</span>
+ <span class='ivar'>@logger</span>
+ <span class='kw'>end</span>
+
+ <span class='comment'># :nodoc:
+</span> <span class='kw'>def</span> <span class='id identifier rubyid_read_configuration'>read_configuration</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_absolute_path'>absolute_path</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>configuration</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='rparen'>)</span>
+
+ <span class='kw'>begin</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_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='comma'>,</span> <span class='ivar'>@logger</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_ensure_directory_for'>ensure_directory_for</span><span class='lparen'>(</span><span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_log_file'>log_file</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_log_file'>log_file</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>String</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_ensure_directory_for'>ensure_directory_for</span><span class='lparen'>(</span><span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_pid_file'>pid_file</span><span class='rparen'>)</span>
+ <span class='ivar'>@logger</span> <span class='op'>=</span> <span class='id identifier rubyid_logger'>logger</span><span class='lparen'>(</span><span class='kw'>true</span><span class='rparen'>)</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='op'>=></span> <span class='id identifier rubyid_e'>e</span>
+ <span class='id identifier rubyid_log_failed_configuration'>log_failed_configuration</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_e'>e</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_shutdown'>shutdown</span>
<span class='kw'>end</span>
+ <span class='kw'>end</span>
+
+ <span class='comment'># :nodoc:
+</span> <span class='kw'>def</span> <span class='id identifier rubyid_ensure_directory_for'>ensure_directory_for</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
+ <span class='const'>FileUtils</span><span class='period'>.</span><span class='id identifier rubyid_mkdir_p'>mkdir_p</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span><span class='rparen'>)</span>
+ <span class='kw'>rescue</span>
+ <span class='ivar'>@logger</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span><span class='lparen'>(</span><span class='id identifier rubyid_replace_markers'>replace_markers</span><span class='lparen'>(</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_invalid_directory'>invalid_directory</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_shutdown'>shutdown</span>
+ <span class='const'>Kernel</span><span class='period'>.</span><span class='id identifier rubyid_exit'>exit</span><span class='lparen'>(</span><span class='int'>1</span><span class='rparen'>)</span>
+ <span class='kw'>end</span>
+
+ <span class='comment'># :nodoc:
+</span> <span class='kw'>def</span> <span class='id identifier rubyid_log_failed_configuration'>log_failed_configuration</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_exception'>exception</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_logger'>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='gvar'>$stderr</span><span class='rparen'>)</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='id identifier rubyid_exception'>exception</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span><span class='rparen'>)</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='id identifier rubyid_replace_markers'>replace_markers</span><span class='lparen'>(</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_application_create_config'>application_create_config</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='rparen'>)</span>
+ <span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
@@ -1038,216 +1573,245 @@
<tr>
<td>
<pre class="lines">
-651
-652
-653
-654
-655
-656
-657
-658
-659
-660
-661
-662
-663
-664
-665
-666
-667
-668
-669
-670
-671
-672
-673
-674
-675
-676
-677
-678
-679
-680
-681
-682
-683
-684
-685
-686
-687
-688
-689
-690
-691
-692
-693
-694
-695
-696
-697
-698
-699
-700
-701
-702
-703
-704
-705
-706
-707
-708
-709
-710
-711
-712
-713
-714
-715
-716
-717
-718
-719
-720
-721
-722
-723
-724
-725
-726
-727
-728
-729
-730
-731
-732
-733
-734
-735
-736
-737
-738
-739
-740
-741
-742
-743
-744
-745
-746
-747
-748
-749
-750
-751
-752
-753
-754
-755
-756
-757
-758
-759
-760
-761
-762
-763
-764
-765
-766
-767
-768
-769
-770
-771
-772
-773
-774
-775
-776
-777
-778
-779
-780
-781
-782
-783
-784
-785
-786
-787
-788
-789
-790
-791
-792
-793
-794
-795
-796
-797
-798
-799
-800
-801
-802
-803
-804
-805
-806
-807
-808
-809</pre>
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 651</span>
+ <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 23</span>
-<span class='kw'>class</span> <span class='const'>Application</span> <span class='op'><</span> <span class='const'>RExec</span><span class='op'>::</span><span class='const'>Daemon</span><span class='op'>::</span><span class='const'>Base</span>
+<span class='kw'>class</span> <span class='const'>Application</span> <span class='op'><</span> <span class='const'>Process</span><span class='op'>::</span><span class='const'>Daemon</span>
<span class='comment'># Class for ANY DNS request.
</span> <span class='const'>ANY_REQUEST</span> <span class='op'>=</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='comment'># List of classes handled in case of DNS request with resource class ANY.
-</span> <span class='const'>ANY_CLASSES</span> <span class='op'>=</span> <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>
+</span> <span class='const'>ANY_CLASSES</span> <span class='op'>=</span> <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><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span>
- <span class='id identifier rubyid_include'>include</span> <span class='const'>Lazier</span><span class='op'>::</span><span class='const'>I18n</span>
- <span class='id identifier rubyid_include'>include</span> <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>ApplicationMethods</span><span class='op'>::</span><span class='const'>System</span>
- <span class='id identifier rubyid_include'>include</span> <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>ApplicationMethods</span><span class='op'>::</span><span class='const'>Aliases</span>
- <span class='id identifier rubyid_include'>include</span> <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>ApplicationMethods</span><span class='op'>::</span><span class='const'>Server</span>
+ <span class='id identifier rubyid_include'>include</span> <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>Aliases</span>
+ <span class='id identifier rubyid_include'>include</span> <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>Server</span>
+ <span class='id identifier rubyid_include'>include</span> <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>System</span>
+ <span class='id identifier rubyid_include'>include</span> <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>OSX</span>
<span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:config</span>
<span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:command</span>
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:logger</span>
<span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:locale</span>
+ <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:i18n</span>
+ <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:server</span>
<span class='comment'># Creates a new application.
</span> <span class='comment'>#
</span> <span class='comment'># @param command [Bovem::Command] The current Bovem command.
</span> <span class='comment'># @param locale [Symbol] The locale to use for the application.
</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='comma'>,</span> <span class='id identifier rubyid_locale'>locale</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_i18n_setup'>i18n_setup</span><span class='lparen'>(</span><span class='symbol'>:devdnsd</span><span class='comma'>,</span> <span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_absolute_path'>absolute_path</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='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='kw'>__FILE__</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/../../locales/</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
- <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span> <span class='op'>=</span> <span class='id identifier rubyid_locale'>locale</span>
-
+ <span class='ivar'>@i18n</span> <span class='op'>=</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_locale'>locale</span><span class='comma'>,</span> <span class='label'>root:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>devdnsd</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>path:</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='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='kw'>__FILE__</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/../../locales/</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
<span class='ivar'>@locale</span> <span class='op'>=</span> <span class='id identifier rubyid_locale'>locale</span>
<span class='ivar'>@command</span> <span class='op'>=</span> <span class='id identifier rubyid_command'>command</span>
- <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='ivar'>@command</span><span class='period'>.</span><span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_get_options'>get_options</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__'>_</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='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='id identifier rubyid_load_options'>load_options</span>
<span class='comment'># Setup logger
</span> <span class='id identifier rubyid_create_logger'>create_logger</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
<span class='comment'># Open configuration
</span> <span class='id identifier rubyid_read_configuration'>read_configuration</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
+ <span class='kw'>super</span><span class='lparen'>(</span><span class='id identifier rubyid_working_directory'>working_directory</span><span class='rparen'>)</span>
<span class='kw'>self</span>
<span class='kw'>end</span>
+ <span class='comment'># Stops the server.
+</span> <span class='kw'>def</span> <span class='id identifier rubyid_shutdown'>shutdown</span>
+ <span class='id identifier rubyid_server'>server</span><span class='period'>.</span><span class='id identifier rubyid_actors'>actors</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='period'>.</span><span class='id identifier rubyid_links'>links</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:terminate</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_server'>server</span>
+ <span class='kw'>end</span>
+
<span class='comment'># Gets the current logger of the application.
</span> <span class='comment'>#
+</span> <span class='comment'># @param force [Boolean] If to force recreation of the logger.
</span> <span class='comment'># @return [Logger] The current logger of the application.
-</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='gvar'>$stdout</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> <span class='kw'>def</span> <span class='id identifier rubyid_logger'>logger</span><span class='lparen'>(</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'>@logger</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'>@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='gvar'>$stdout</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='label'>level:</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='label'>formatter:</span> <span class='ivar'>@log_formatter</span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='comment'># This method is called when the server starts. By default is a no-op.
</span> <span class='comment'>#
</span> <span class='comment'># @return [NilClass] `nil`.
@@ -1279,99 +1843,146 @@
<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>
<span class='comment'># Stops the application.
</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='kw'>begin</span>
- <span class='const'>EM</span><span class='period'>.</span><span class='id identifier rubyid_add_timer'>add_timer</span><span class='lparen'>(</span><span class='float'>0.1</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='op'>::</span><span class='const'>EM</span><span class='period'>.</span><span class='id identifier rubyid_stop'>stop</span> <span class='rbrace'>}</span>
- <span class='kw'>rescue</span>
- <span class='kw'>end</span>
+ <span class='id identifier rubyid_instance'>instance</span><span class='period'>.</span><span class='id identifier rubyid_shutdown'>shutdown</span>
+ <span class='kw'>rescue</span>
+ <span class='const'>Kernel</span><span class='period'>.</span><span class='id identifier rubyid_exit'>exit</span><span class='lparen'>(</span><span class='int'>1</span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='comment'># Check if the current implementation supports DevDNSd.
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_check_ruby_implementation'>check_ruby_implementation</span>
- <span class='kw'>if</span> <span class='kw'>defined?</span><span class='lparen'>(</span><span class='const'>JRuby</span><span class='rparen'>)</span> <span class='kw'>then</span>
- <span class='const'>Kernel</span><span class='period'>.</span><span class='id identifier rubyid_puts'>puts</span><span class='lparen'>(</span><span class='const'>Lazier</span><span class='op'>::</span><span class='const'>Localizer</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='symbol'>:devdnsd</span><span class='comma'>,</span> <span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_absolute_path'>absolute_path</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='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='kw'>__FILE__</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/../../locales/</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_no_jruby'>no_jruby</span><span class='rparen'>)</span>
+ <span class='kw'>if</span> <span class='kw'>defined?</span><span class='lparen'>(</span><span class='const'>JRuby</span><span class='rparen'>)</span>
+ <span class='const'>Kernel</span><span class='period'>.</span><span class='id identifier rubyid_puts'>puts</span><span class='lparen'>(</span><span class='const'>Bovem</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='label'>root:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>devdnsd</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>path:</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='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='kw'>__FILE__</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/../../locales/</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_no_jruby'>no_jruby</span><span class='rparen'>)</span>
<span class='const'>Kernel</span><span class='period'>.</span><span class='id identifier rubyid_exit'>exit</span><span class='lparen'>(</span><span class='int'>0</span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span>
<span class='id identifier rubyid_private'>private</span>
- <span class='comment'># Creates a logger.
-</span> <span class='comment'>#
-</span> <span class='comment'># @param options [Hash] The configuration to use.
-</span> <span class='kw'>def</span> <span class='id identifier rubyid_create_logger'>create_logger</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_warn_failure'>warn_failure</span> <span class='op'>=</span> <span class='kw'>false</span>
- <span class='id identifier rubyid_orig_file'>orig_file</span> <span class='op'>=</span> <span class='id identifier rubyid_file'>file</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_get_real_file'>get_real_file</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>log_file</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</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='kw'>if</span> <span class='id identifier rubyid_file'>file</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>String</span><span class='rparen'>)</span> <span class='kw'>then</span>
- <span class='id identifier rubyid_file'>file</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_absolute_path'>absolute_path</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='rparen'>)</span><span class='rparen'>)</span>
+ <span class='comment'># :nodoc:
+</span> <span class='kw'>def</span> <span class='id identifier rubyid_load_options'>load_options</span>
+ <span class='ivar'>@command</span><span class='period'>.</span><span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_get_options'>get_options</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__'>_</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='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='ivar'>@command</span><span class='period'>.</span><span class='id identifier rubyid_get_options'>get_options</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__'>_</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='rparen'>)</span>
+ <span class='kw'>end</span>
- <span class='kw'>begin</span>
- <span class='const'>FileUtils</span><span class='period'>.</span><span class='id identifier rubyid_mkdir_p'>mkdir_p</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='rparen'>)</span><span class='rparen'>)</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='id identifier rubyid_file'>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='kw'>rescue</span>
- <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>log_file</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>STDOUT</span><span class='tstring_end'>"</span></span>
- <span class='id identifier rubyid_file'>file</span> <span class='op'>=</span> <span class='gvar'>$stdout</span>
- <span class='id identifier rubyid_warn_failure'>warn_failure</span> <span class='op'>=</span> <span class='kw'>true</span>
- <span class='kw'>end</span>
- <span class='kw'>end</span>
+ <span class='comment'># :nodoc:
+</span> <span class='kw'>def</span> <span class='id identifier rubyid_create_logger'>create_logger</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_warn_failure'>warn_failure</span> <span class='op'>=</span> <span class='kw'>false</span>
+ <span class='id identifier rubyid_orig_file'>orig_file</span> <span class='op'>=</span> <span class='id identifier rubyid_file'>file</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_get_real_file'>get_real_file</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>log_file</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</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='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='id identifier rubyid_file'>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='ivar'>@logger</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span><span class='lparen'>(</span><span class='id identifier rubyid_replace_markers'>replace_markers</span><span class='lparen'>(</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_logging_failed'>logging_failed</span><span class='lparen'>(</span><span class='id identifier rubyid_orig_file'>orig_file</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='ivar'>@logger</span> <span class='op'>&&</span> <span class='id identifier rubyid_warn_failure'>warn_failure</span>
- <span class='ivar'>@logger</span>
+ <span class='kw'>if</span> <span class='id identifier rubyid_file'>file</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>String</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='id identifier rubyid_warn_failure'>warn_failure</span> <span class='op'>=</span> <span class='id identifier rubyid_load_logger'>load_logger</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_absolute_path'>absolute_path</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
<span class='kw'>end</span>
- <span class='comment'># Reads configuration.
-</span> <span class='comment'>#
-</span> <span class='comment'># @param options [Hash] The configuration to read.
-</span> <span class='kw'>def</span> <span class='id identifier rubyid_read_configuration'>read_configuration</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_absolute_path'>absolute_path</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>configuration</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_finalize_create_logger'>finalize_create_logger</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='id identifier rubyid_orig_file'>orig_file</span><span class='comma'>,</span> <span class='id identifier rubyid_warn_failure'>warn_failure</span><span class='rparen'>)</span>
+ <span class='kw'>end</span>
- <span class='kw'>begin</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_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='comma'>,</span> <span class='ivar'>@logger</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_ensure_directory_for'>ensure_directory_for</span><span class='lparen'>(</span><span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_log_file'>log_file</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_log_file'>log_file</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>String</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_ensure_directory_for'>ensure_directory_for</span><span class='lparen'>(</span><span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_pid_file'>pid_file</span><span class='rparen'>)</span>
+ <span class='comment'># :nodoc:
+</span> <span class='kw'>def</span> <span class='id identifier rubyid_load_logger'>load_logger</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_warn_failure'>warn_failure</span> <span class='op'>=</span> <span class='kw'>false</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='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='op'>=></span> <span class='id identifier rubyid_e'>e</span>
- <span class='id identifier rubyid_log_failed_configuration'>log_failed_configuration</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_e'>e</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='kw'>begin</span>
+ <span class='const'>FileUtils</span><span class='period'>.</span><span class='id identifier rubyid_mkdir_p'>mkdir_p</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='rparen'>)</span><span class='rparen'>)</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='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='label'>level:</span> <span class='op'>::</span><span class='const'>Logger</span><span class='op'>::</span><span class='const'>INFO</span><span class='rparen'>)</span>
+ <span class='kw'>rescue</span>
+ <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>log_file</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>STDOUT</span><span class='tstring_end'>"</span></span>
+ <span class='id identifier rubyid_file'>file</span> <span class='op'>=</span> <span class='gvar'>$stdout</span>
+ <span class='id identifier rubyid_warn_failure'>warn_failure</span> <span class='op'>=</span> <span class='kw'>true</span>
<span class='kw'>end</span>
- <span class='comment'># Creates a folder for a file.
-</span> <span class='comment'>#
-</span> <span class='comment'># @param path [String] The path of the file.
-</span> <span class='kw'>def</span> <span class='id identifier rubyid_ensure_directory_for'>ensure_directory_for</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
- <span class='kw'>begin</span>
- <span class='const'>FileUtils</span><span class='period'>.</span><span class='id identifier rubyid_mkdir_p'>mkdir_p</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span><span class='rparen'>)</span>
- <span class='kw'>rescue</span>
- <span class='ivar'>@logger</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span><span class='lparen'>(</span><span class='id identifier rubyid_replace_markers'>replace_markers</span><span class='lparen'>(</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_invalid_directory'>invalid_directory</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='rparen'>)</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='kw'>end</span>
+ <span class='lbracket'>[</span><span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='id identifier rubyid_warn_failure'>warn_failure</span><span class='rbracket'>]</span>
+ <span class='kw'>end</span>
- <span class='comment'># Logs a failed configuration
-</span> <span class='comment'>#
-</span> <span class='comment'># @param path [String] The path of the invalid file.
-</span> <span class='comment'># @param exception [Exception] The occurred exception.
-</span> <span class='kw'>def</span> <span class='id identifier rubyid_log_failed_configuration'>log_failed_configuration</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_exception'>exception</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_logger'>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='gvar'>$stderr</span><span class='rparen'>)</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='id identifier rubyid_exception'>exception</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span><span class='rparen'>)</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='id identifier rubyid_replace_markers'>replace_markers</span><span class='lparen'>(</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_application_create_config'>application_create_config</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='rparen'>)</span>
+ <span class='comment'># :nodoc:
+</span> <span class='kw'>def</span> <span class='id identifier rubyid_finalize_create_logger'>finalize_create_logger</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='id identifier rubyid_orig_file'>orig_file</span><span class='comma'>,</span> <span class='id identifier rubyid_warn_failure'>warn_failure</span><span class='rparen'>)</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='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='label'>level:</span> <span class='op'>::</span><span class='const'>Logger</span><span class='op'>::</span><span class='const'>INFO</span><span class='rparen'>)</span>
+ <span class='ivar'>@logger</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span><span class='lparen'>(</span><span class='id identifier rubyid_replace_markers'>replace_markers</span><span class='lparen'>(</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_logging_failed'>logging_failed</span><span class='lparen'>(</span><span class='id identifier rubyid_orig_file'>orig_file</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='ivar'>@logger</span> <span class='op'>&&</span> <span class='id identifier rubyid_warn_failure'>warn_failure</span>
+ <span class='ivar'>@logger</span>
+ <span class='kw'>end</span>
+
+ <span class='comment'># :nodoc:
+</span> <span class='kw'>def</span> <span class='id identifier rubyid_read_configuration'>read_configuration</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_absolute_path'>absolute_path</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>configuration</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='rparen'>)</span>
+
+ <span class='kw'>begin</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_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='comma'>,</span> <span class='ivar'>@logger</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_ensure_directory_for'>ensure_directory_for</span><span class='lparen'>(</span><span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_log_file'>log_file</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_log_file'>log_file</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>String</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_ensure_directory_for'>ensure_directory_for</span><span class='lparen'>(</span><span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_pid_file'>pid_file</span><span class='rparen'>)</span>
+ <span class='ivar'>@logger</span> <span class='op'>=</span> <span class='id identifier rubyid_logger'>logger</span><span class='lparen'>(</span><span class='kw'>true</span><span class='rparen'>)</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='op'>=></span> <span class='id identifier rubyid_e'>e</span>
+ <span class='id identifier rubyid_log_failed_configuration'>log_failed_configuration</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_e'>e</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_shutdown'>shutdown</span>
<span class='kw'>end</span>
+ <span class='kw'>end</span>
+
+ <span class='comment'># :nodoc:
+</span> <span class='kw'>def</span> <span class='id identifier rubyid_ensure_directory_for'>ensure_directory_for</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
+ <span class='const'>FileUtils</span><span class='period'>.</span><span class='id identifier rubyid_mkdir_p'>mkdir_p</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span><span class='rparen'>)</span>
+ <span class='kw'>rescue</span>
+ <span class='ivar'>@logger</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span><span class='lparen'>(</span><span class='id identifier rubyid_replace_markers'>replace_markers</span><span class='lparen'>(</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_invalid_directory'>invalid_directory</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_shutdown'>shutdown</span>
+ <span class='const'>Kernel</span><span class='period'>.</span><span class='id identifier rubyid_exit'>exit</span><span class='lparen'>(</span><span class='int'>1</span><span class='rparen'>)</span>
+ <span class='kw'>end</span>
+
+ <span class='comment'># :nodoc:
+</span> <span class='kw'>def</span> <span class='id identifier rubyid_log_failed_configuration'>log_failed_configuration</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_exception'>exception</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_logger'>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='gvar'>$stderr</span><span class='rparen'>)</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='id identifier rubyid_exception'>exception</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span><span class='rparen'>)</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='id identifier rubyid_replace_markers'>replace_markers</span><span class='lparen'>(</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_application_create_config'>application_create_config</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='rparen'>)</span>
+ <span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<span id=""></span>
<div class="method_details ">
+ <h3 class="signature " id="i18n-instance_method">
+
+ - (<tt>Object</tt>) <strong>i18n</strong> <span class="extras">(readonly)</span>
+
+
+
+
+
+</h3><div class="docstring">
+ <div class="discussion">
+ <p>Returns the value of attribute i18n</p>
+
+
+ </div>
+</div>
+<div class="tags">
+
+
+</div><table class="source_code">
+ <tr>
+ <td>
+ <pre class="lines">
+
+
+43
+44
+45</pre>
+ </td>
+ <td>
+ <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 43</span>
+
+<span class='kw'>def</span> <span class='id identifier rubyid_i18n'>i18n</span>
+ <span class='ivar'>@i18n</span>
+<span class='kw'>end</span></pre>
+ </td>
+ </tr>
+</table>
+</div>
+
+
+ <span id=""></span>
+ <div class="method_details ">
<h3 class="signature " id="locale-instance_method">
- (<tt>Symbol|nil</tt>) <strong>locale</strong> <span class="extras">(readonly)</span>
@@ -1409,216 +2020,245 @@
<tr>
<td>
<pre class="lines">
-651
-652
-653
-654
-655
-656
-657
-658
-659
-660
-661
-662
-663
-664
-665
-666
-667
-668
-669
-670
-671
-672
-673
-674
-675
-676
-677
-678
-679
-680
-681
-682
-683
-684
-685
-686
-687
-688
-689
-690
-691
-692
-693
-694
-695
-696
-697
-698
-699
-700
-701
-702
-703
-704
-705
-706
-707
-708
-709
-710
-711
-712
-713
-714
-715
-716
-717
-718
-719
-720
-721
-722
-723
-724
-725
-726
-727
-728
-729
-730
-731
-732
-733
-734
-735
-736
-737
-738
-739
-740
-741
-742
-743
-744
-745
-746
-747
-748
-749
-750
-751
-752
-753
-754
-755
-756
-757
-758
-759
-760
-761
-762
-763
-764
-765
-766
-767
-768
-769
-770
-771
-772
-773
-774
-775
-776
-777
-778
-779
-780
-781
-782
-783
-784
-785
-786
-787
-788
-789
-790
-791
-792
-793
-794
-795
-796
-797
-798
-799
-800
-801
-802
-803
-804
-805
-806
-807
-808
-809</pre>
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 651</span>
+ <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 23</span>
-<span class='kw'>class</span> <span class='const'>Application</span> <span class='op'><</span> <span class='const'>RExec</span><span class='op'>::</span><span class='const'>Daemon</span><span class='op'>::</span><span class='const'>Base</span>
+<span class='kw'>class</span> <span class='const'>Application</span> <span class='op'><</span> <span class='const'>Process</span><span class='op'>::</span><span class='const'>Daemon</span>
<span class='comment'># Class for ANY DNS request.
</span> <span class='const'>ANY_REQUEST</span> <span class='op'>=</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='comment'># List of classes handled in case of DNS request with resource class ANY.
-</span> <span class='const'>ANY_CLASSES</span> <span class='op'>=</span> <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>
+</span> <span class='const'>ANY_CLASSES</span> <span class='op'>=</span> <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><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span>
- <span class='id identifier rubyid_include'>include</span> <span class='const'>Lazier</span><span class='op'>::</span><span class='const'>I18n</span>
- <span class='id identifier rubyid_include'>include</span> <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>ApplicationMethods</span><span class='op'>::</span><span class='const'>System</span>
- <span class='id identifier rubyid_include'>include</span> <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>ApplicationMethods</span><span class='op'>::</span><span class='const'>Aliases</span>
- <span class='id identifier rubyid_include'>include</span> <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>ApplicationMethods</span><span class='op'>::</span><span class='const'>Server</span>
+ <span class='id identifier rubyid_include'>include</span> <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>Aliases</span>
+ <span class='id identifier rubyid_include'>include</span> <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>Server</span>
+ <span class='id identifier rubyid_include'>include</span> <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>System</span>
+ <span class='id identifier rubyid_include'>include</span> <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>OSX</span>
<span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:config</span>
<span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:command</span>
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:logger</span>
<span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:locale</span>
+ <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:i18n</span>
+ <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:server</span>
<span class='comment'># Creates a new application.
</span> <span class='comment'>#
</span> <span class='comment'># @param command [Bovem::Command] The current Bovem command.
</span> <span class='comment'># @param locale [Symbol] The locale to use for the application.
</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='comma'>,</span> <span class='id identifier rubyid_locale'>locale</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_i18n_setup'>i18n_setup</span><span class='lparen'>(</span><span class='symbol'>:devdnsd</span><span class='comma'>,</span> <span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_absolute_path'>absolute_path</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='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='kw'>__FILE__</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/../../locales/</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
- <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span> <span class='op'>=</span> <span class='id identifier rubyid_locale'>locale</span>
-
+ <span class='ivar'>@i18n</span> <span class='op'>=</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_locale'>locale</span><span class='comma'>,</span> <span class='label'>root:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>devdnsd</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>path:</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='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='kw'>__FILE__</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/../../locales/</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
<span class='ivar'>@locale</span> <span class='op'>=</span> <span class='id identifier rubyid_locale'>locale</span>
<span class='ivar'>@command</span> <span class='op'>=</span> <span class='id identifier rubyid_command'>command</span>
- <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='ivar'>@command</span><span class='period'>.</span><span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_get_options'>get_options</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__'>_</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='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='id identifier rubyid_load_options'>load_options</span>
<span class='comment'># Setup logger
</span> <span class='id identifier rubyid_create_logger'>create_logger</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
<span class='comment'># Open configuration
</span> <span class='id identifier rubyid_read_configuration'>read_configuration</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
+ <span class='kw'>super</span><span class='lparen'>(</span><span class='id identifier rubyid_working_directory'>working_directory</span><span class='rparen'>)</span>
<span class='kw'>self</span>
<span class='kw'>end</span>
+ <span class='comment'># Stops the server.
+</span> <span class='kw'>def</span> <span class='id identifier rubyid_shutdown'>shutdown</span>
+ <span class='id identifier rubyid_server'>server</span><span class='period'>.</span><span class='id identifier rubyid_actors'>actors</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='period'>.</span><span class='id identifier rubyid_links'>links</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:terminate</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_server'>server</span>
+ <span class='kw'>end</span>
+
<span class='comment'># Gets the current logger of the application.
</span> <span class='comment'>#
+</span> <span class='comment'># @param force [Boolean] If to force recreation of the logger.
</span> <span class='comment'># @return [Logger] The current logger of the application.
-</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='gvar'>$stdout</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> <span class='kw'>def</span> <span class='id identifier rubyid_logger'>logger</span><span class='lparen'>(</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'>@logger</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'>@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='gvar'>$stdout</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='label'>level:</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='label'>formatter:</span> <span class='ivar'>@log_formatter</span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='comment'># This method is called when the server starts. By default is a no-op.
</span> <span class='comment'>#
</span> <span class='comment'># @return [NilClass] `nil`.
@@ -1650,90 +2290,95 @@
<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>
<span class='comment'># Stops the application.
</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='kw'>begin</span>
- <span class='const'>EM</span><span class='period'>.</span><span class='id identifier rubyid_add_timer'>add_timer</span><span class='lparen'>(</span><span class='float'>0.1</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='op'>::</span><span class='const'>EM</span><span class='period'>.</span><span class='id identifier rubyid_stop'>stop</span> <span class='rbrace'>}</span>
- <span class='kw'>rescue</span>
- <span class='kw'>end</span>
+ <span class='id identifier rubyid_instance'>instance</span><span class='period'>.</span><span class='id identifier rubyid_shutdown'>shutdown</span>
+ <span class='kw'>rescue</span>
+ <span class='const'>Kernel</span><span class='period'>.</span><span class='id identifier rubyid_exit'>exit</span><span class='lparen'>(</span><span class='int'>1</span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='comment'># Check if the current implementation supports DevDNSd.
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_check_ruby_implementation'>check_ruby_implementation</span>
- <span class='kw'>if</span> <span class='kw'>defined?</span><span class='lparen'>(</span><span class='const'>JRuby</span><span class='rparen'>)</span> <span class='kw'>then</span>
- <span class='const'>Kernel</span><span class='period'>.</span><span class='id identifier rubyid_puts'>puts</span><span class='lparen'>(</span><span class='const'>Lazier</span><span class='op'>::</span><span class='const'>Localizer</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='symbol'>:devdnsd</span><span class='comma'>,</span> <span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_absolute_path'>absolute_path</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='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='kw'>__FILE__</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/../../locales/</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_no_jruby'>no_jruby</span><span class='rparen'>)</span>
+ <span class='kw'>if</span> <span class='kw'>defined?</span><span class='lparen'>(</span><span class='const'>JRuby</span><span class='rparen'>)</span>
+ <span class='const'>Kernel</span><span class='period'>.</span><span class='id identifier rubyid_puts'>puts</span><span class='lparen'>(</span><span class='const'>Bovem</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='label'>root:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>devdnsd</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>path:</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='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='kw'>__FILE__</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/../../locales/</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_no_jruby'>no_jruby</span><span class='rparen'>)</span>
<span class='const'>Kernel</span><span class='period'>.</span><span class='id identifier rubyid_exit'>exit</span><span class='lparen'>(</span><span class='int'>0</span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span>
<span class='id identifier rubyid_private'>private</span>
- <span class='comment'># Creates a logger.
-</span> <span class='comment'>#
-</span> <span class='comment'># @param options [Hash] The configuration to use.
-</span> <span class='kw'>def</span> <span class='id identifier rubyid_create_logger'>create_logger</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_warn_failure'>warn_failure</span> <span class='op'>=</span> <span class='kw'>false</span>
- <span class='id identifier rubyid_orig_file'>orig_file</span> <span class='op'>=</span> <span class='id identifier rubyid_file'>file</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_get_real_file'>get_real_file</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>log_file</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</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='kw'>if</span> <span class='id identifier rubyid_file'>file</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>String</span><span class='rparen'>)</span> <span class='kw'>then</span>
- <span class='id identifier rubyid_file'>file</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_absolute_path'>absolute_path</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='rparen'>)</span><span class='rparen'>)</span>
+ <span class='comment'># :nodoc:
+</span> <span class='kw'>def</span> <span class='id identifier rubyid_load_options'>load_options</span>
+ <span class='ivar'>@command</span><span class='period'>.</span><span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_get_options'>get_options</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__'>_</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='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='ivar'>@command</span><span class='period'>.</span><span class='id identifier rubyid_get_options'>get_options</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__'>_</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='rparen'>)</span>
+ <span class='kw'>end</span>
- <span class='kw'>begin</span>
- <span class='const'>FileUtils</span><span class='period'>.</span><span class='id identifier rubyid_mkdir_p'>mkdir_p</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='rparen'>)</span><span class='rparen'>)</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='id identifier rubyid_file'>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='kw'>rescue</span>
- <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>log_file</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>STDOUT</span><span class='tstring_end'>"</span></span>
- <span class='id identifier rubyid_file'>file</span> <span class='op'>=</span> <span class='gvar'>$stdout</span>
- <span class='id identifier rubyid_warn_failure'>warn_failure</span> <span class='op'>=</span> <span class='kw'>true</span>
- <span class='kw'>end</span>
- <span class='kw'>end</span>
+ <span class='comment'># :nodoc:
+</span> <span class='kw'>def</span> <span class='id identifier rubyid_create_logger'>create_logger</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_warn_failure'>warn_failure</span> <span class='op'>=</span> <span class='kw'>false</span>
+ <span class='id identifier rubyid_orig_file'>orig_file</span> <span class='op'>=</span> <span class='id identifier rubyid_file'>file</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_get_real_file'>get_real_file</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>log_file</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</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='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='id identifier rubyid_file'>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='ivar'>@logger</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span><span class='lparen'>(</span><span class='id identifier rubyid_replace_markers'>replace_markers</span><span class='lparen'>(</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_logging_failed'>logging_failed</span><span class='lparen'>(</span><span class='id identifier rubyid_orig_file'>orig_file</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='ivar'>@logger</span> <span class='op'>&&</span> <span class='id identifier rubyid_warn_failure'>warn_failure</span>
- <span class='ivar'>@logger</span>
+ <span class='kw'>if</span> <span class='id identifier rubyid_file'>file</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>String</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='id identifier rubyid_warn_failure'>warn_failure</span> <span class='op'>=</span> <span class='id identifier rubyid_load_logger'>load_logger</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_absolute_path'>absolute_path</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
<span class='kw'>end</span>
- <span class='comment'># Reads configuration.
-</span> <span class='comment'>#
-</span> <span class='comment'># @param options [Hash] The configuration to read.
-</span> <span class='kw'>def</span> <span class='id identifier rubyid_read_configuration'>read_configuration</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_absolute_path'>absolute_path</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>configuration</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_finalize_create_logger'>finalize_create_logger</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='id identifier rubyid_orig_file'>orig_file</span><span class='comma'>,</span> <span class='id identifier rubyid_warn_failure'>warn_failure</span><span class='rparen'>)</span>
+ <span class='kw'>end</span>
- <span class='kw'>begin</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_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='comma'>,</span> <span class='ivar'>@logger</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_ensure_directory_for'>ensure_directory_for</span><span class='lparen'>(</span><span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_log_file'>log_file</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_log_file'>log_file</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>String</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_ensure_directory_for'>ensure_directory_for</span><span class='lparen'>(</span><span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_pid_file'>pid_file</span><span class='rparen'>)</span>
+ <span class='comment'># :nodoc:
+</span> <span class='kw'>def</span> <span class='id identifier rubyid_load_logger'>load_logger</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_warn_failure'>warn_failure</span> <span class='op'>=</span> <span class='kw'>false</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='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='op'>=></span> <span class='id identifier rubyid_e'>e</span>
- <span class='id identifier rubyid_log_failed_configuration'>log_failed_configuration</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_e'>e</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='kw'>begin</span>
+ <span class='const'>FileUtils</span><span class='period'>.</span><span class='id identifier rubyid_mkdir_p'>mkdir_p</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='rparen'>)</span><span class='rparen'>)</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='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='label'>level:</span> <span class='op'>::</span><span class='const'>Logger</span><span class='op'>::</span><span class='const'>INFO</span><span class='rparen'>)</span>
+ <span class='kw'>rescue</span>
+ <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>log_file</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>STDOUT</span><span class='tstring_end'>"</span></span>
+ <span class='id identifier rubyid_file'>file</span> <span class='op'>=</span> <span class='gvar'>$stdout</span>
+ <span class='id identifier rubyid_warn_failure'>warn_failure</span> <span class='op'>=</span> <span class='kw'>true</span>
<span class='kw'>end</span>
- <span class='comment'># Creates a folder for a file.
-</span> <span class='comment'>#
-</span> <span class='comment'># @param path [String] The path of the file.
-</span> <span class='kw'>def</span> <span class='id identifier rubyid_ensure_directory_for'>ensure_directory_for</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
- <span class='kw'>begin</span>
- <span class='const'>FileUtils</span><span class='period'>.</span><span class='id identifier rubyid_mkdir_p'>mkdir_p</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span><span class='rparen'>)</span>
- <span class='kw'>rescue</span>
- <span class='ivar'>@logger</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span><span class='lparen'>(</span><span class='id identifier rubyid_replace_markers'>replace_markers</span><span class='lparen'>(</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_invalid_directory'>invalid_directory</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='rparen'>)</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='kw'>end</span>
+ <span class='lbracket'>[</span><span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='id identifier rubyid_warn_failure'>warn_failure</span><span class='rbracket'>]</span>
+ <span class='kw'>end</span>
- <span class='comment'># Logs a failed configuration
-</span> <span class='comment'>#
-</span> <span class='comment'># @param path [String] The path of the invalid file.
-</span> <span class='comment'># @param exception [Exception] The occurred exception.
-</span> <span class='kw'>def</span> <span class='id identifier rubyid_log_failed_configuration'>log_failed_configuration</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_exception'>exception</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_logger'>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='gvar'>$stderr</span><span class='rparen'>)</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='id identifier rubyid_exception'>exception</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span><span class='rparen'>)</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='id identifier rubyid_replace_markers'>replace_markers</span><span class='lparen'>(</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_application_create_config'>application_create_config</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='rparen'>)</span>
+ <span class='comment'># :nodoc:
+</span> <span class='kw'>def</span> <span class='id identifier rubyid_finalize_create_logger'>finalize_create_logger</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='id identifier rubyid_orig_file'>orig_file</span><span class='comma'>,</span> <span class='id identifier rubyid_warn_failure'>warn_failure</span><span class='rparen'>)</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='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='label'>level:</span> <span class='op'>::</span><span class='const'>Logger</span><span class='op'>::</span><span class='const'>INFO</span><span class='rparen'>)</span>
+ <span class='ivar'>@logger</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span><span class='lparen'>(</span><span class='id identifier rubyid_replace_markers'>replace_markers</span><span class='lparen'>(</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_logging_failed'>logging_failed</span><span class='lparen'>(</span><span class='id identifier rubyid_orig_file'>orig_file</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='ivar'>@logger</span> <span class='op'>&&</span> <span class='id identifier rubyid_warn_failure'>warn_failure</span>
+ <span class='ivar'>@logger</span>
+ <span class='kw'>end</span>
+
+ <span class='comment'># :nodoc:
+</span> <span class='kw'>def</span> <span class='id identifier rubyid_read_configuration'>read_configuration</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_absolute_path'>absolute_path</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>configuration</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='rparen'>)</span>
+
+ <span class='kw'>begin</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_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='comma'>,</span> <span class='ivar'>@logger</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_ensure_directory_for'>ensure_directory_for</span><span class='lparen'>(</span><span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_log_file'>log_file</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_log_file'>log_file</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>String</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_ensure_directory_for'>ensure_directory_for</span><span class='lparen'>(</span><span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_pid_file'>pid_file</span><span class='rparen'>)</span>
+ <span class='ivar'>@logger</span> <span class='op'>=</span> <span class='id identifier rubyid_logger'>logger</span><span class='lparen'>(</span><span class='kw'>true</span><span class='rparen'>)</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='op'>=></span> <span class='id identifier rubyid_e'>e</span>
+ <span class='id identifier rubyid_log_failed_configuration'>log_failed_configuration</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_e'>e</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_shutdown'>shutdown</span>
<span class='kw'>end</span>
+ <span class='kw'>end</span>
+
+ <span class='comment'># :nodoc:
+</span> <span class='kw'>def</span> <span class='id identifier rubyid_ensure_directory_for'>ensure_directory_for</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
+ <span class='const'>FileUtils</span><span class='period'>.</span><span class='id identifier rubyid_mkdir_p'>mkdir_p</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span><span class='rparen'>)</span>
+ <span class='kw'>rescue</span>
+ <span class='ivar'>@logger</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span><span class='lparen'>(</span><span class='id identifier rubyid_replace_markers'>replace_markers</span><span class='lparen'>(</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_invalid_directory'>invalid_directory</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_shutdown'>shutdown</span>
+ <span class='const'>Kernel</span><span class='period'>.</span><span class='id identifier rubyid_exit'>exit</span><span class='lparen'>(</span><span class='int'>1</span><span class='rparen'>)</span>
+ <span class='kw'>end</span>
+
+ <span class='comment'># :nodoc:
+</span> <span class='kw'>def</span> <span class='id identifier rubyid_log_failed_configuration'>log_failed_configuration</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_exception'>exception</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_logger'>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='gvar'>$stderr</span><span class='rparen'>)</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='id identifier rubyid_exception'>exception</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span><span class='rparen'>)</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='id identifier rubyid_replace_markers'>replace_markers</span><span class='lparen'>(</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_application_create_config'>application_create_config</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='rparen'>)</span>
+ <span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
@@ -1741,37 +2386,58 @@
<span id="logger=-instance_method"></span>
<div class="method_details ">
<h3 class="signature " id="logger-instance_method">
- - (<tt>Bovem::Logger</tt>) <strong>logger</strong>
+ - (<tt>Logger</tt>) <strong>logger</strong>(force = false)
</h3><div class="docstring">
<div class="discussion">
- <p>Returns The logger for this application.</p>
+ <p>Gets the current logger of the application.</p>
</div>
</div>
<div class="tags">
+ <p class="tag_title">Parameters:</p>
+<ul class="param">
+ <li>
+
+ <span class='name'>force</span>
+
+
+ <span class='type'>(<tt>Boolean</tt>)</span>
+
+
+ <em class="default">(defaults to: <tt>false</tt>)</em>
+
+
+ —
+ <div class='inline'><p>If to force recreation of the logger.</p>
+</div>
+
+ </li>
+
+</ul>
+
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
- <span class='type'>(<tt>Bovem::Logger</tt>)</span>
+ <span class='type'>(<tt>Logger</tt>)</span>
—
- <div class='inline'><p>The logger for this application.</p>
+ <div class='inline'><p>The current logger of the application.</p>
</div>
</li>
</ul>
@@ -1780,216 +2446,245 @@
<tr>
<td>
<pre class="lines">
-651
-652
-653
-654
-655
-656
-657
-658
-659
-660
-661
-662
-663
-664
-665
-666
-667
-668
-669
-670
-671
-672
-673
-674
-675
-676
-677
-678
-679
-680
-681
-682
-683
-684
-685
-686
-687
-688
-689
-690
-691
-692
-693
-694
-695
-696
-697
-698
-699
-700
-701
-702
-703
-704
-705
-706
-707
-708
-709
-710
-711
-712
-713
-714
-715
-716
-717
-718
-719
-720
-721
-722
-723
-724
-725
-726
-727
-728
-729
-730
-731
-732
-733
-734
-735
-736
-737
-738
-739
-740
-741
-742
-743
-744
-745
-746
-747
-748
-749
-750
-751
-752
-753
-754
-755
-756
-757
-758
-759
-760
-761
-762
-763
-764
-765
-766
-767
-768
-769
-770
-771
-772
-773
-774
-775
-776
-777
-778
-779
-780
-781
-782
-783
-784
-785
-786
-787
-788
-789
-790
-791
-792
-793
-794
-795
-796
-797
-798
-799
-800
-801
-802
-803
-804
-805
-806
-807
-808
-809</pre>
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 651</span>
+ <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 23</span>
-<span class='kw'>class</span> <span class='const'>Application</span> <span class='op'><</span> <span class='const'>RExec</span><span class='op'>::</span><span class='const'>Daemon</span><span class='op'>::</span><span class='const'>Base</span>
+<span class='kw'>class</span> <span class='const'>Application</span> <span class='op'><</span> <span class='const'>Process</span><span class='op'>::</span><span class='const'>Daemon</span>
<span class='comment'># Class for ANY DNS request.
</span> <span class='const'>ANY_REQUEST</span> <span class='op'>=</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='comment'># List of classes handled in case of DNS request with resource class ANY.
-</span> <span class='const'>ANY_CLASSES</span> <span class='op'>=</span> <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>
+</span> <span class='const'>ANY_CLASSES</span> <span class='op'>=</span> <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><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span>
- <span class='id identifier rubyid_include'>include</span> <span class='const'>Lazier</span><span class='op'>::</span><span class='const'>I18n</span>
- <span class='id identifier rubyid_include'>include</span> <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>ApplicationMethods</span><span class='op'>::</span><span class='const'>System</span>
- <span class='id identifier rubyid_include'>include</span> <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>ApplicationMethods</span><span class='op'>::</span><span class='const'>Aliases</span>
- <span class='id identifier rubyid_include'>include</span> <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>ApplicationMethods</span><span class='op'>::</span><span class='const'>Server</span>
+ <span class='id identifier rubyid_include'>include</span> <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>Aliases</span>
+ <span class='id identifier rubyid_include'>include</span> <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>Server</span>
+ <span class='id identifier rubyid_include'>include</span> <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>System</span>
+ <span class='id identifier rubyid_include'>include</span> <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>OSX</span>
<span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:config</span>
<span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:command</span>
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:logger</span>
<span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:locale</span>
+ <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:i18n</span>
+ <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:server</span>
<span class='comment'># Creates a new application.
</span> <span class='comment'>#
</span> <span class='comment'># @param command [Bovem::Command] The current Bovem command.
</span> <span class='comment'># @param locale [Symbol] The locale to use for the application.
</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='comma'>,</span> <span class='id identifier rubyid_locale'>locale</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_i18n_setup'>i18n_setup</span><span class='lparen'>(</span><span class='symbol'>:devdnsd</span><span class='comma'>,</span> <span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_absolute_path'>absolute_path</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='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='kw'>__FILE__</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/../../locales/</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
- <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span> <span class='op'>=</span> <span class='id identifier rubyid_locale'>locale</span>
-
+ <span class='ivar'>@i18n</span> <span class='op'>=</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_locale'>locale</span><span class='comma'>,</span> <span class='label'>root:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>devdnsd</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>path:</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='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='kw'>__FILE__</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/../../locales/</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
<span class='ivar'>@locale</span> <span class='op'>=</span> <span class='id identifier rubyid_locale'>locale</span>
<span class='ivar'>@command</span> <span class='op'>=</span> <span class='id identifier rubyid_command'>command</span>
- <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='ivar'>@command</span><span class='period'>.</span><span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_get_options'>get_options</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__'>_</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='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='id identifier rubyid_load_options'>load_options</span>
<span class='comment'># Setup logger
</span> <span class='id identifier rubyid_create_logger'>create_logger</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
<span class='comment'># Open configuration
</span> <span class='id identifier rubyid_read_configuration'>read_configuration</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
+ <span class='kw'>super</span><span class='lparen'>(</span><span class='id identifier rubyid_working_directory'>working_directory</span><span class='rparen'>)</span>
<span class='kw'>self</span>
<span class='kw'>end</span>
+ <span class='comment'># Stops the server.
+</span> <span class='kw'>def</span> <span class='id identifier rubyid_shutdown'>shutdown</span>
+ <span class='id identifier rubyid_server'>server</span><span class='period'>.</span><span class='id identifier rubyid_actors'>actors</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='period'>.</span><span class='id identifier rubyid_links'>links</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:terminate</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_server'>server</span>
+ <span class='kw'>end</span>
+
<span class='comment'># Gets the current logger of the application.
</span> <span class='comment'>#
+</span> <span class='comment'># @param force [Boolean] If to force recreation of the logger.
</span> <span class='comment'># @return [Logger] The current logger of the application.
-</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='gvar'>$stdout</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> <span class='kw'>def</span> <span class='id identifier rubyid_logger'>logger</span><span class='lparen'>(</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'>@logger</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'>@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='gvar'>$stdout</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='label'>level:</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='label'>formatter:</span> <span class='ivar'>@log_formatter</span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='comment'># This method is called when the server starts. By default is a no-op.
</span> <span class='comment'>#
</span> <span class='comment'># @return [NilClass] `nil`.
@@ -2021,90 +2716,500 @@
<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>
<span class='comment'># Stops the application.
</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='id identifier rubyid_instance'>instance</span><span class='period'>.</span><span class='id identifier rubyid_shutdown'>shutdown</span>
+ <span class='kw'>rescue</span>
+ <span class='const'>Kernel</span><span class='period'>.</span><span class='id identifier rubyid_exit'>exit</span><span class='lparen'>(</span><span class='int'>1</span><span class='rparen'>)</span>
+ <span class='kw'>end</span>
+
+ <span class='comment'># Check if the current implementation supports DevDNSd.
+</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_check_ruby_implementation'>check_ruby_implementation</span>
+ <span class='kw'>if</span> <span class='kw'>defined?</span><span class='lparen'>(</span><span class='const'>JRuby</span><span class='rparen'>)</span>
+ <span class='const'>Kernel</span><span class='period'>.</span><span class='id identifier rubyid_puts'>puts</span><span class='lparen'>(</span><span class='const'>Bovem</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='label'>root:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>devdnsd</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>path:</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='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='kw'>__FILE__</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/../../locales/</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_no_jruby'>no_jruby</span><span class='rparen'>)</span>
+ <span class='const'>Kernel</span><span class='period'>.</span><span class='id identifier rubyid_exit'>exit</span><span class='lparen'>(</span><span class='int'>0</span><span class='rparen'>)</span>
+ <span class='kw'>end</span>
+ <span class='kw'>end</span>
+
+ <span class='id identifier rubyid_private'>private</span>
+
+ <span class='comment'># :nodoc:
+</span> <span class='kw'>def</span> <span class='id identifier rubyid_load_options'>load_options</span>
+ <span class='ivar'>@command</span><span class='period'>.</span><span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_get_options'>get_options</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__'>_</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='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='ivar'>@command</span><span class='period'>.</span><span class='id identifier rubyid_get_options'>get_options</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__'>_</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='rparen'>)</span>
+ <span class='kw'>end</span>
+
+ <span class='comment'># :nodoc:
+</span> <span class='kw'>def</span> <span class='id identifier rubyid_create_logger'>create_logger</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_warn_failure'>warn_failure</span> <span class='op'>=</span> <span class='kw'>false</span>
+ <span class='id identifier rubyid_orig_file'>orig_file</span> <span class='op'>=</span> <span class='id identifier rubyid_file'>file</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_get_real_file'>get_real_file</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>log_file</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</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='kw'>if</span> <span class='id identifier rubyid_file'>file</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>String</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='id identifier rubyid_warn_failure'>warn_failure</span> <span class='op'>=</span> <span class='id identifier rubyid_load_logger'>load_logger</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_absolute_path'>absolute_path</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
+ <span class='kw'>end</span>
+
+ <span class='id identifier rubyid_finalize_create_logger'>finalize_create_logger</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='id identifier rubyid_orig_file'>orig_file</span><span class='comma'>,</span> <span class='id identifier rubyid_warn_failure'>warn_failure</span><span class='rparen'>)</span>
+ <span class='kw'>end</span>
+
+ <span class='comment'># :nodoc:
+</span> <span class='kw'>def</span> <span class='id identifier rubyid_load_logger'>load_logger</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_warn_failure'>warn_failure</span> <span class='op'>=</span> <span class='kw'>false</span>
+
<span class='kw'>begin</span>
- <span class='const'>EM</span><span class='period'>.</span><span class='id identifier rubyid_add_timer'>add_timer</span><span class='lparen'>(</span><span class='float'>0.1</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='op'>::</span><span class='const'>EM</span><span class='period'>.</span><span class='id identifier rubyid_stop'>stop</span> <span class='rbrace'>}</span>
+ <span class='const'>FileUtils</span><span class='period'>.</span><span class='id identifier rubyid_mkdir_p'>mkdir_p</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='rparen'>)</span><span class='rparen'>)</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='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='label'>level:</span> <span class='op'>::</span><span class='const'>Logger</span><span class='op'>::</span><span class='const'>INFO</span><span class='rparen'>)</span>
<span class='kw'>rescue</span>
+ <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>log_file</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>STDOUT</span><span class='tstring_end'>"</span></span>
+ <span class='id identifier rubyid_file'>file</span> <span class='op'>=</span> <span class='gvar'>$stdout</span>
+ <span class='id identifier rubyid_warn_failure'>warn_failure</span> <span class='op'>=</span> <span class='kw'>true</span>
<span class='kw'>end</span>
+
+ <span class='lbracket'>[</span><span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='id identifier rubyid_warn_failure'>warn_failure</span><span class='rbracket'>]</span>
<span class='kw'>end</span>
+ <span class='comment'># :nodoc:
+</span> <span class='kw'>def</span> <span class='id identifier rubyid_finalize_create_logger'>finalize_create_logger</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='id identifier rubyid_orig_file'>orig_file</span><span class='comma'>,</span> <span class='id identifier rubyid_warn_failure'>warn_failure</span><span class='rparen'>)</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='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='label'>level:</span> <span class='op'>::</span><span class='const'>Logger</span><span class='op'>::</span><span class='const'>INFO</span><span class='rparen'>)</span>
+ <span class='ivar'>@logger</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span><span class='lparen'>(</span><span class='id identifier rubyid_replace_markers'>replace_markers</span><span class='lparen'>(</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_logging_failed'>logging_failed</span><span class='lparen'>(</span><span class='id identifier rubyid_orig_file'>orig_file</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='ivar'>@logger</span> <span class='op'>&&</span> <span class='id identifier rubyid_warn_failure'>warn_failure</span>
+ <span class='ivar'>@logger</span>
+ <span class='kw'>end</span>
+
+ <span class='comment'># :nodoc:
+</span> <span class='kw'>def</span> <span class='id identifier rubyid_read_configuration'>read_configuration</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_absolute_path'>absolute_path</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>configuration</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='rparen'>)</span>
+
+ <span class='kw'>begin</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_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='comma'>,</span> <span class='ivar'>@logger</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_ensure_directory_for'>ensure_directory_for</span><span class='lparen'>(</span><span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_log_file'>log_file</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_log_file'>log_file</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>String</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_ensure_directory_for'>ensure_directory_for</span><span class='lparen'>(</span><span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_pid_file'>pid_file</span><span class='rparen'>)</span>
+ <span class='ivar'>@logger</span> <span class='op'>=</span> <span class='id identifier rubyid_logger'>logger</span><span class='lparen'>(</span><span class='kw'>true</span><span class='rparen'>)</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='op'>=></span> <span class='id identifier rubyid_e'>e</span>
+ <span class='id identifier rubyid_log_failed_configuration'>log_failed_configuration</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_e'>e</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_shutdown'>shutdown</span>
+ <span class='kw'>end</span>
+ <span class='kw'>end</span>
+
+ <span class='comment'># :nodoc:
+</span> <span class='kw'>def</span> <span class='id identifier rubyid_ensure_directory_for'>ensure_directory_for</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
+ <span class='const'>FileUtils</span><span class='period'>.</span><span class='id identifier rubyid_mkdir_p'>mkdir_p</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span><span class='rparen'>)</span>
+ <span class='kw'>rescue</span>
+ <span class='ivar'>@logger</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span><span class='lparen'>(</span><span class='id identifier rubyid_replace_markers'>replace_markers</span><span class='lparen'>(</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_invalid_directory'>invalid_directory</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_shutdown'>shutdown</span>
+ <span class='const'>Kernel</span><span class='period'>.</span><span class='id identifier rubyid_exit'>exit</span><span class='lparen'>(</span><span class='int'>1</span><span class='rparen'>)</span>
+ <span class='kw'>end</span>
+
+ <span class='comment'># :nodoc:
+</span> <span class='kw'>def</span> <span class='id identifier rubyid_log_failed_configuration'>log_failed_configuration</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_exception'>exception</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_logger'>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='gvar'>$stderr</span><span class='rparen'>)</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='id identifier rubyid_exception'>exception</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span><span class='rparen'>)</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='id identifier rubyid_replace_markers'>replace_markers</span><span class='lparen'>(</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_application_create_config'>application_create_config</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='rparen'>)</span>
+ <span class='kw'>end</span>
+<span class='kw'>end</span></pre>
+ </td>
+ </tr>
+</table>
+</div>
+
+
+ <span id=""></span>
+ <div class="method_details ">
+ <h3 class="signature " id="server-instance_method">
+
+ - (<tt>RubyDNS::RuleBasedServer</tt>) <strong>server</strong> <span class="extras">(readonly)</span>
+
+
+
+
+
+</h3><div class="docstring">
+ <div class="discussion">
+ <p>Returns The server of this application.</p>
+
+
+ </div>
+</div>
+<div class="tags">
+
+<p class="tag_title">Returns:</p>
+<ul class="return">
+
+ <li>
+
+
+ <span class='type'>(<tt>RubyDNS::RuleBasedServer</tt>)</span>
+
+
+
+ —
+ <div class='inline'><p>The server of this application.</p>
+</div>
+
+ </li>
+
+</ul>
+
+</div><table class="source_code">
+ <tr>
+ <td>
+ <pre class="lines">
+
+
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198</pre>
+ </td>
+ <td>
+ <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 23</span>
+
+<span class='kw'>class</span> <span class='const'>Application</span> <span class='op'><</span> <span class='const'>Process</span><span class='op'>::</span><span class='const'>Daemon</span>
+ <span class='comment'># Class for ANY DNS request.
+</span> <span class='const'>ANY_REQUEST</span> <span class='op'>=</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='comment'># List of classes handled in case of DNS request with resource class ANY.
+</span> <span class='const'>ANY_CLASSES</span> <span class='op'>=</span> <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><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span>
+
+ <span class='id identifier rubyid_include'>include</span> <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>Aliases</span>
+ <span class='id identifier rubyid_include'>include</span> <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>Server</span>
+ <span class='id identifier rubyid_include'>include</span> <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>System</span>
+ <span class='id identifier rubyid_include'>include</span> <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>OSX</span>
+
+ <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:config</span>
+ <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:command</span>
+ <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:logger</span>
+ <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:locale</span>
+ <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:i18n</span>
+ <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:server</span>
+
+ <span class='comment'># Creates a new application.
+</span> <span class='comment'>#
+</span> <span class='comment'># @param command [Bovem::Command] The current Bovem command.
+</span> <span class='comment'># @param locale [Symbol] The locale to use for the application.
+</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='comma'>,</span> <span class='id identifier rubyid_locale'>locale</span><span class='rparen'>)</span>
+ <span class='ivar'>@i18n</span> <span class='op'>=</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_locale'>locale</span><span class='comma'>,</span> <span class='label'>root:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>devdnsd</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>path:</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='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='kw'>__FILE__</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/../../locales/</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
+ <span class='ivar'>@locale</span> <span class='op'>=</span> <span class='id identifier rubyid_locale'>locale</span>
+ <span class='ivar'>@command</span> <span class='op'>=</span> <span class='id identifier rubyid_command'>command</span>
+ <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='id identifier rubyid_load_options'>load_options</span>
+
+ <span class='comment'># Setup logger
+</span> <span class='id identifier rubyid_create_logger'>create_logger</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
+
+ <span class='comment'># Open configuration
+</span> <span class='id identifier rubyid_read_configuration'>read_configuration</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
+
+ <span class='kw'>super</span><span class='lparen'>(</span><span class='id identifier rubyid_working_directory'>working_directory</span><span class='rparen'>)</span>
+ <span class='kw'>self</span>
+ <span class='kw'>end</span>
+
+ <span class='comment'># Stops the server.
+</span> <span class='kw'>def</span> <span class='id identifier rubyid_shutdown'>shutdown</span>
+ <span class='id identifier rubyid_server'>server</span><span class='period'>.</span><span class='id identifier rubyid_actors'>actors</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='period'>.</span><span class='id identifier rubyid_links'>links</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:terminate</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_server'>server</span>
+ <span class='kw'>end</span>
+
+ <span class='comment'># Gets the current logger of the application.
+</span> <span class='comment'>#
+</span> <span class='comment'># @param force [Boolean] If to force recreation of the logger.
+</span> <span class='comment'># @return [Logger] The current logger of the application.
+</span> <span class='kw'>def</span> <span class='id identifier rubyid_logger'>logger</span><span class='lparen'>(</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'>@logger</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'>@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='gvar'>$stdout</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='label'>level:</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='label'>formatter:</span> <span class='ivar'>@log_formatter</span><span class='rparen'>)</span>
+ <span class='kw'>end</span>
+
+ <span class='comment'># This method is called when the server starts. By default is a no-op.
+</span> <span class='comment'>#
+</span> <span class='comment'># @return [NilClass] `nil`.
+</span> <span class='kw'>def</span> <span class='id identifier rubyid_on_start'>on_start</span>
+ <span class='kw'>end</span>
+
+ <span class='comment'># This method is called when the server stop.
+</span> <span class='comment'>#
+</span> <span class='comment'># @return [NilClass] `nil`.
+</span> <span class='kw'>def</span> <span class='id identifier rubyid_on_stop'>on_stop</span>
+ <span class='kw'>end</span>
+
+ <span class='comment'># Returns a unique (singleton) instance of the application.
+</span> <span class='comment'>#
+</span> <span class='comment'># @param command [Bovem::Command] The current Bovem command.
+</span> <span class='comment'># @param locale [Symbol] The locale to use for the application.
+</span> <span class='comment'># @param force [Boolean] If to force recreation of the instance.
+</span> <span class='comment'># @return [Application] The unique (singleton) instance of the application.
+</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_locale'>locale</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='comma'>,</span> <span class='id identifier rubyid_locale'>locale</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>
+
+ <span class='comment'># Runs the application in foreground.
+</span> <span class='comment'>#
+</span> <span class='comment'># @see #perform_server
+</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='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>
+
+ <span class='comment'># Stops the application.
+</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='id identifier rubyid_instance'>instance</span><span class='period'>.</span><span class='id identifier rubyid_shutdown'>shutdown</span>
+ <span class='kw'>rescue</span>
+ <span class='const'>Kernel</span><span class='period'>.</span><span class='id identifier rubyid_exit'>exit</span><span class='lparen'>(</span><span class='int'>1</span><span class='rparen'>)</span>
+ <span class='kw'>end</span>
+
<span class='comment'># Check if the current implementation supports DevDNSd.
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_check_ruby_implementation'>check_ruby_implementation</span>
- <span class='kw'>if</span> <span class='kw'>defined?</span><span class='lparen'>(</span><span class='const'>JRuby</span><span class='rparen'>)</span> <span class='kw'>then</span>
- <span class='const'>Kernel</span><span class='period'>.</span><span class='id identifier rubyid_puts'>puts</span><span class='lparen'>(</span><span class='const'>Lazier</span><span class='op'>::</span><span class='const'>Localizer</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='symbol'>:devdnsd</span><span class='comma'>,</span> <span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_absolute_path'>absolute_path</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='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='kw'>__FILE__</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/../../locales/</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_no_jruby'>no_jruby</span><span class='rparen'>)</span>
+ <span class='kw'>if</span> <span class='kw'>defined?</span><span class='lparen'>(</span><span class='const'>JRuby</span><span class='rparen'>)</span>
+ <span class='const'>Kernel</span><span class='period'>.</span><span class='id identifier rubyid_puts'>puts</span><span class='lparen'>(</span><span class='const'>Bovem</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='label'>root:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>devdnsd</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>path:</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='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='kw'>__FILE__</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/../../locales/</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_no_jruby'>no_jruby</span><span class='rparen'>)</span>
<span class='const'>Kernel</span><span class='period'>.</span><span class='id identifier rubyid_exit'>exit</span><span class='lparen'>(</span><span class='int'>0</span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span>
<span class='id identifier rubyid_private'>private</span>
- <span class='comment'># Creates a logger.
-</span> <span class='comment'>#
-</span> <span class='comment'># @param options [Hash] The configuration to use.
-</span> <span class='kw'>def</span> <span class='id identifier rubyid_create_logger'>create_logger</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_warn_failure'>warn_failure</span> <span class='op'>=</span> <span class='kw'>false</span>
- <span class='id identifier rubyid_orig_file'>orig_file</span> <span class='op'>=</span> <span class='id identifier rubyid_file'>file</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_get_real_file'>get_real_file</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>log_file</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</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='kw'>if</span> <span class='id identifier rubyid_file'>file</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>String</span><span class='rparen'>)</span> <span class='kw'>then</span>
- <span class='id identifier rubyid_file'>file</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_absolute_path'>absolute_path</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='rparen'>)</span><span class='rparen'>)</span>
+ <span class='comment'># :nodoc:
+</span> <span class='kw'>def</span> <span class='id identifier rubyid_load_options'>load_options</span>
+ <span class='ivar'>@command</span><span class='period'>.</span><span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_get_options'>get_options</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__'>_</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='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='ivar'>@command</span><span class='period'>.</span><span class='id identifier rubyid_get_options'>get_options</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__'>_</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='rparen'>)</span>
+ <span class='kw'>end</span>
- <span class='kw'>begin</span>
- <span class='const'>FileUtils</span><span class='period'>.</span><span class='id identifier rubyid_mkdir_p'>mkdir_p</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='rparen'>)</span><span class='rparen'>)</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='id identifier rubyid_file'>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='kw'>rescue</span>
- <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>log_file</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>STDOUT</span><span class='tstring_end'>"</span></span>
- <span class='id identifier rubyid_file'>file</span> <span class='op'>=</span> <span class='gvar'>$stdout</span>
- <span class='id identifier rubyid_warn_failure'>warn_failure</span> <span class='op'>=</span> <span class='kw'>true</span>
- <span class='kw'>end</span>
- <span class='kw'>end</span>
+ <span class='comment'># :nodoc:
+</span> <span class='kw'>def</span> <span class='id identifier rubyid_create_logger'>create_logger</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_warn_failure'>warn_failure</span> <span class='op'>=</span> <span class='kw'>false</span>
+ <span class='id identifier rubyid_orig_file'>orig_file</span> <span class='op'>=</span> <span class='id identifier rubyid_file'>file</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_get_real_file'>get_real_file</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>log_file</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</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='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='id identifier rubyid_file'>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='ivar'>@logger</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span><span class='lparen'>(</span><span class='id identifier rubyid_replace_markers'>replace_markers</span><span class='lparen'>(</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_logging_failed'>logging_failed</span><span class='lparen'>(</span><span class='id identifier rubyid_orig_file'>orig_file</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='ivar'>@logger</span> <span class='op'>&&</span> <span class='id identifier rubyid_warn_failure'>warn_failure</span>
- <span class='ivar'>@logger</span>
+ <span class='kw'>if</span> <span class='id identifier rubyid_file'>file</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>String</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='id identifier rubyid_warn_failure'>warn_failure</span> <span class='op'>=</span> <span class='id identifier rubyid_load_logger'>load_logger</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_absolute_path'>absolute_path</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
<span class='kw'>end</span>
- <span class='comment'># Reads configuration.
-</span> <span class='comment'>#
-</span> <span class='comment'># @param options [Hash] The configuration to read.
-</span> <span class='kw'>def</span> <span class='id identifier rubyid_read_configuration'>read_configuration</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_absolute_path'>absolute_path</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>configuration</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_finalize_create_logger'>finalize_create_logger</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='id identifier rubyid_orig_file'>orig_file</span><span class='comma'>,</span> <span class='id identifier rubyid_warn_failure'>warn_failure</span><span class='rparen'>)</span>
+ <span class='kw'>end</span>
- <span class='kw'>begin</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_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='comma'>,</span> <span class='ivar'>@logger</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_ensure_directory_for'>ensure_directory_for</span><span class='lparen'>(</span><span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_log_file'>log_file</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_log_file'>log_file</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>String</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_ensure_directory_for'>ensure_directory_for</span><span class='lparen'>(</span><span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_pid_file'>pid_file</span><span class='rparen'>)</span>
+ <span class='comment'># :nodoc:
+</span> <span class='kw'>def</span> <span class='id identifier rubyid_load_logger'>load_logger</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_warn_failure'>warn_failure</span> <span class='op'>=</span> <span class='kw'>false</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='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='op'>=></span> <span class='id identifier rubyid_e'>e</span>
- <span class='id identifier rubyid_log_failed_configuration'>log_failed_configuration</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_e'>e</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='kw'>begin</span>
+ <span class='const'>FileUtils</span><span class='period'>.</span><span class='id identifier rubyid_mkdir_p'>mkdir_p</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='rparen'>)</span><span class='rparen'>)</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='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='label'>level:</span> <span class='op'>::</span><span class='const'>Logger</span><span class='op'>::</span><span class='const'>INFO</span><span class='rparen'>)</span>
+ <span class='kw'>rescue</span>
+ <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>log_file</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>STDOUT</span><span class='tstring_end'>"</span></span>
+ <span class='id identifier rubyid_file'>file</span> <span class='op'>=</span> <span class='gvar'>$stdout</span>
+ <span class='id identifier rubyid_warn_failure'>warn_failure</span> <span class='op'>=</span> <span class='kw'>true</span>
<span class='kw'>end</span>
- <span class='comment'># Creates a folder for a file.
-</span> <span class='comment'>#
-</span> <span class='comment'># @param path [String] The path of the file.
-</span> <span class='kw'>def</span> <span class='id identifier rubyid_ensure_directory_for'>ensure_directory_for</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
- <span class='kw'>begin</span>
- <span class='const'>FileUtils</span><span class='period'>.</span><span class='id identifier rubyid_mkdir_p'>mkdir_p</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span><span class='rparen'>)</span>
- <span class='kw'>rescue</span>
- <span class='ivar'>@logger</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span><span class='lparen'>(</span><span class='id identifier rubyid_replace_markers'>replace_markers</span><span class='lparen'>(</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_invalid_directory'>invalid_directory</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='rparen'>)</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='kw'>end</span>
+ <span class='lbracket'>[</span><span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='id identifier rubyid_warn_failure'>warn_failure</span><span class='rbracket'>]</span>
+ <span class='kw'>end</span>
- <span class='comment'># Logs a failed configuration
-</span> <span class='comment'>#
-</span> <span class='comment'># @param path [String] The path of the invalid file.
-</span> <span class='comment'># @param exception [Exception] The occurred exception.
-</span> <span class='kw'>def</span> <span class='id identifier rubyid_log_failed_configuration'>log_failed_configuration</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_exception'>exception</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_logger'>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='gvar'>$stderr</span><span class='rparen'>)</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='id identifier rubyid_exception'>exception</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span><span class='rparen'>)</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='id identifier rubyid_replace_markers'>replace_markers</span><span class='lparen'>(</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_application_create_config'>application_create_config</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='rparen'>)</span>
+ <span class='comment'># :nodoc:
+</span> <span class='kw'>def</span> <span class='id identifier rubyid_finalize_create_logger'>finalize_create_logger</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='id identifier rubyid_orig_file'>orig_file</span><span class='comma'>,</span> <span class='id identifier rubyid_warn_failure'>warn_failure</span><span class='rparen'>)</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='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='label'>level:</span> <span class='op'>::</span><span class='const'>Logger</span><span class='op'>::</span><span class='const'>INFO</span><span class='rparen'>)</span>
+ <span class='ivar'>@logger</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span><span class='lparen'>(</span><span class='id identifier rubyid_replace_markers'>replace_markers</span><span class='lparen'>(</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_logging_failed'>logging_failed</span><span class='lparen'>(</span><span class='id identifier rubyid_orig_file'>orig_file</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='ivar'>@logger</span> <span class='op'>&&</span> <span class='id identifier rubyid_warn_failure'>warn_failure</span>
+ <span class='ivar'>@logger</span>
+ <span class='kw'>end</span>
+
+ <span class='comment'># :nodoc:
+</span> <span class='kw'>def</span> <span class='id identifier rubyid_read_configuration'>read_configuration</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_absolute_path'>absolute_path</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>configuration</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='rparen'>)</span>
+
+ <span class='kw'>begin</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_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='comma'>,</span> <span class='ivar'>@logger</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_ensure_directory_for'>ensure_directory_for</span><span class='lparen'>(</span><span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_log_file'>log_file</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_log_file'>log_file</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>String</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_ensure_directory_for'>ensure_directory_for</span><span class='lparen'>(</span><span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_pid_file'>pid_file</span><span class='rparen'>)</span>
+ <span class='ivar'>@logger</span> <span class='op'>=</span> <span class='id identifier rubyid_logger'>logger</span><span class='lparen'>(</span><span class='kw'>true</span><span class='rparen'>)</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='op'>=></span> <span class='id identifier rubyid_e'>e</span>
+ <span class='id identifier rubyid_log_failed_configuration'>log_failed_configuration</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_e'>e</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_shutdown'>shutdown</span>
<span class='kw'>end</span>
+ <span class='kw'>end</span>
+
+ <span class='comment'># :nodoc:
+</span> <span class='kw'>def</span> <span class='id identifier rubyid_ensure_directory_for'>ensure_directory_for</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
+ <span class='const'>FileUtils</span><span class='period'>.</span><span class='id identifier rubyid_mkdir_p'>mkdir_p</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span><span class='rparen'>)</span>
+ <span class='kw'>rescue</span>
+ <span class='ivar'>@logger</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span><span class='lparen'>(</span><span class='id identifier rubyid_replace_markers'>replace_markers</span><span class='lparen'>(</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_invalid_directory'>invalid_directory</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_shutdown'>shutdown</span>
+ <span class='const'>Kernel</span><span class='period'>.</span><span class='id identifier rubyid_exit'>exit</span><span class='lparen'>(</span><span class='int'>1</span><span class='rparen'>)</span>
+ <span class='kw'>end</span>
+
+ <span class='comment'># :nodoc:
+</span> <span class='kw'>def</span> <span class='id identifier rubyid_log_failed_configuration'>log_failed_configuration</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_exception'>exception</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_logger'>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='gvar'>$stderr</span><span class='rparen'>)</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='id identifier rubyid_exception'>exception</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span><span class='rparen'>)</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='id identifier rubyid_replace_markers'>replace_markers</span><span class='lparen'>(</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_application_create_config'>application_create_config</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='rparen'>)</span>
+ <span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
@@ -2139,23 +3244,23 @@
<tr>
<td>
<pre class="lines">
-736
-737
-738
-739
-740
-741</pre>
+119
+120
+121
+122
+123
+124</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 736</span>
+ <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 119</span>
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_check_ruby_implementation'>check_ruby_implementation</span>
- <span class='kw'>if</span> <span class='kw'>defined?</span><span class='lparen'>(</span><span class='const'>JRuby</span><span class='rparen'>)</span> <span class='kw'>then</span>
- <span class='const'>Kernel</span><span class='period'>.</span><span class='id identifier rubyid_puts'>puts</span><span class='lparen'>(</span><span class='const'>Lazier</span><span class='op'>::</span><span class='const'>Localizer</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='symbol'>:devdnsd</span><span class='comma'>,</span> <span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_absolute_path'>absolute_path</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='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='kw'>__FILE__</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/../../locales/</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_no_jruby'>no_jruby</span><span class='rparen'>)</span>
+ <span class='kw'>if</span> <span class='kw'>defined?</span><span class='lparen'>(</span><span class='const'>JRuby</span><span class='rparen'>)</span>
+ <span class='const'>Kernel</span><span class='period'>.</span><span class='id identifier rubyid_puts'>puts</span><span class='lparen'>(</span><span class='const'>Bovem</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='label'>root:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>devdnsd</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>path:</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='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='kw'>__FILE__</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/../../locales/</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_no_jruby'>no_jruby</span><span class='rparen'>)</span>
<span class='const'>Kernel</span><span class='period'>.</span><span class='id identifier rubyid_exit'>exit</span><span class='lparen'>(</span><span class='int'>0</span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
@@ -2257,18 +3362,18 @@
<tr>
<td>
<pre class="lines">
-714
-715
-716
-717
-718</pre>
+98
+99
+100
+101
+102</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 714</span>
+ <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 98</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_locale'>locale</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='comma'>,</span> <span class='id identifier rubyid_locale'>locale</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_command'>command</span>
<span class='ivar'>@instance</span>
@@ -2301,25 +3406,23 @@
<tr>
<td>
<pre class="lines">
-728
-729
-730
-731
-732
-733</pre>
+112
+113
+114
+115
+116</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 728</span>
+ <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 112</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='kw'>begin</span>
- <span class='const'>EM</span><span class='period'>.</span><span class='id identifier rubyid_add_timer'>add_timer</span><span class='lparen'>(</span><span class='float'>0.1</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='op'>::</span><span class='const'>EM</span><span class='period'>.</span><span class='id identifier rubyid_stop'>stop</span> <span class='rbrace'>}</span>
- <span class='kw'>rescue</span>
- <span class='kw'>end</span>
+ <span class='id identifier rubyid_instance'>instance</span><span class='period'>.</span><span class='id identifier rubyid_shutdown'>shutdown</span>
+<span class='kw'>rescue</span>
+ <span class='const'>Kernel</span><span class='period'>.</span><span class='id identifier rubyid_exit'>exit</span><span class='lparen'>(</span><span class='int'>1</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
@@ -2344,26 +3447,26 @@
<p class="tag_title">See Also:</p>
<ul class="see">
- <li><span class='object_link'><a href="ApplicationMethods/Server.html#perform_server-instance_method" title="DevDNSd::ApplicationMethods::Server#perform_server (method)">DevDNSd::ApplicationMethods::Server#perform_server</a></span></li>
+ <li><span class='object_link'><a href="Server.html#perform_server-instance_method" title="DevDNSd::Server#perform_server (method)">Server#perform_server</a></span></li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
-723
-724
-725</pre>
+107
+108
+109</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 723</span>
+ <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 107</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='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>
</td>
@@ -2376,21 +3479,21 @@
<div id="instance_method_details" class="method_details_list">
<h2>Instance Method Details</h2>
<div class="method_details first">
- <h3 class="signature first" id="get_logger-instance_method">
+ <h3 class="signature first" id="on_start-instance_method">
- - (<tt>Logger</tt>) <strong>get_logger</strong>
+ - (<tt>NilClass</tt>) <strong>on_start</strong>
</h3><div class="docstring">
<div class="discussion">
- <p>Gets the current logger of the application.</p>
+ <p>This method is called when the server starts. By default is a no-op.</p>
</div>
</div>
<div class="tags">
@@ -2399,16 +3502,16 @@
<ul class="return">
<li>
- <span class='type'>(<tt>Logger</tt>)</span>
+ <span class='type'>(<tt>NilClass</tt>)</span>
—
- <div class='inline'><p>The current logger of the application.</p>
+ <div class='inline'><p><code>nil</code>.</p>
</div>
</li>
</ul>
@@ -2417,37 +3520,35 @@
<tr>
<td>
<pre class="lines">
-692
-693
-694</pre>
+83
+84</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 692</span>
+ <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 83</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='gvar'>$stdout</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'>def</span> <span class='id identifier rubyid_on_start'>on_start</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
- <h3 class="signature " id="on_start-instance_method">
+ <h3 class="signature " id="on_stop-instance_method">
- - (<tt>NilClass</tt>) <strong>on_start</strong>
+ - (<tt>NilClass</tt>) <strong>on_stop</strong>
</h3><div class="docstring">
<div class="discussion">
- <p>This method is called when the server starts. By default is a no-op.</p>
+ <p>This method is called when the server stop.</p>
</div>
</div>
<div class="tags">
@@ -2474,72 +3575,57 @@
<tr>
<td>
<pre class="lines">
-699
-700</pre>
+89
+90</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 699</span>
+ <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 89</span>
-<span class='kw'>def</span> <span class='id identifier rubyid_on_start'>on_start</span>
+<span class='kw'>def</span> <span class='id identifier rubyid_on_stop'>on_stop</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
- <h3 class="signature " id="on_stop-instance_method">
+ <h3 class="signature " id="shutdown-instance_method">
- - (<tt>NilClass</tt>) <strong>on_stop</strong>
+ - (<tt>Object</tt>) <strong>shutdown</strong>
</h3><div class="docstring">
<div class="discussion">
- <p>This method is called when the server stop.</p>
+ <p>Stops the server.</p>
</div>
</div>
<div class="tags">
-<p class="tag_title">Returns:</p>
-<ul class="return">
-
- <li>
-
-
- <span class='type'>(<tt>NilClass</tt>)</span>
-
-
-
- —
- <div class='inline'><p><code>nil</code>.</p>
-</div>
-
- </li>
-
-</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
-705
-706</pre>
+67
+68
+69</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 705</span>
+ <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 67</span>
-<span class='kw'>def</span> <span class='id identifier rubyid_on_stop'>on_stop</span>
+<span class='kw'>def</span> <span class='id identifier rubyid_shutdown'>shutdown</span>
+ <span class='id identifier rubyid_server'>server</span><span class='period'>.</span><span class='id identifier rubyid_actors'>actors</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='period'>.</span><span class='id identifier rubyid_links'>links</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:terminate</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_server'>server</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
@@ -2547,12 +3633,12 @@
</div>
</div>
<div id="footer">
- Generated on Sat Mar 29 11:53:14 2014 by
+ Generated on Wed Mar 30 19:23:43 2016 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
- 0.8.7.4 (ruby-2.1.0).
+ 0.8.7.6 (ruby-2.3.0).
</div>
</body>
</html>
\ No newline at end of file