devdnsd 1.1.10 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,21 +1,7 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- coverage
6
- InstalledFiles
7
- lib/bundler/man
8
- pkg
9
- rdoc
10
- spec/reports
11
- test/tmp
12
- test/version_tmp
13
- tmp
14
-
15
- # YARD artifacts
16
- .yardoc
17
- _yardoc
18
- doc/
19
-
20
- # RubyMine
21
- .idea/
1
+ Gemfile.lock
2
+ tester.rb
3
+ coverage/
4
+ pkg/
5
+ utils/
6
+ .idea/
7
+ .yardoc/
data/.yardopts CHANGED
@@ -1 +1 @@
1
- --exclude lib/devdnsd/patches/.+ --exclude utils/ -m markdown
1
+ -m markdown
data/Gemfile.lock CHANGED
@@ -1,18 +1,17 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- devdnsd (1.1.10)
5
- bovem (>= 0.5.0)
6
- gli (~> 1.6.0)
4
+ devdnsd (1.5.0)
5
+ mamertes (~> 1.1.0)
7
6
  rexec (~> 1.4.1)
8
7
  rubydns (~> 0.4.0)
9
8
 
10
9
  GEM
11
10
  remote: http://rubygems.org/
12
11
  specs:
13
- actionpack (3.2.7)
14
- activemodel (= 3.2.7)
15
- activesupport (= 3.2.7)
12
+ actionpack (3.2.8)
13
+ activemodel (= 3.2.8)
14
+ activesupport (= 3.2.8)
16
15
  builder (~> 3.0.0)
17
16
  erubis (~> 2.7.0)
18
17
  journey (~> 1.0.4)
@@ -20,33 +19,35 @@ GEM
20
19
  rack-cache (~> 1.2)
21
20
  rack-test (~> 0.6.1)
22
21
  sprockets (~> 2.1.3)
23
- activemodel (3.2.7)
24
- activesupport (= 3.2.7)
22
+ activemodel (3.2.8)
23
+ activesupport (= 3.2.8)
25
24
  builder (~> 3.0.0)
26
- activesupport (3.2.7)
25
+ activesupport (3.2.8)
27
26
  i18n (~> 0.6)
28
27
  multi_json (~> 1.0)
29
- bovem (0.6.0)
28
+ bovem (1.1.0)
30
29
  lazier (~> 1.0)
31
- rainbow (~> 1.1.0)
30
+ open4 (~> 1.3.0)
32
31
  builder (3.0.0)
33
32
  coderay (1.0.7)
34
33
  diff-lcs (1.1.3)
35
34
  erubis (2.7.0)
36
35
  eventmachine (0.12.10)
37
36
  github-markup (0.7.2)
38
- gli (1.6.0)
39
37
  hike (1.2.1)
40
38
  i18n (0.6.0)
41
39
  journey (1.0.4)
42
- json (1.7.4)
43
- lazier (1.0.1)
40
+ json (1.7.5)
41
+ lazier (1.0.3)
44
42
  actionpack (~> 3.0)
45
43
  json (~> 1.7.0)
46
44
  tzinfo (~> 0.3.0)
45
+ mamertes (1.1.2)
46
+ bovem (~> 1.1.0)
47
47
  method_source (0.8)
48
48
  multi_json (1.3.6)
49
49
  net-dns (0.7.1)
50
+ open4 (1.3.0)
50
51
  pry (0.9.10)
51
52
  coderay (~> 1.0.5)
52
53
  method_source (~> 0.8)
@@ -56,7 +57,6 @@ GEM
56
57
  rack (>= 0.4)
57
58
  rack-test (0.6.1)
58
59
  rack (>= 1.0)
59
- rainbow (1.1.4)
60
60
  rake (0.9.2.2)
61
61
  redcarpet (2.1.1)
62
62
  rexec (1.4.1)
data/README.md CHANGED
@@ -27,7 +27,7 @@ Of course, DevDNSd is inspired by [pow](https://github.com/37signals/pow), but i
27
27
 
28
28
  ## Advanced usage
29
29
 
30
- Just type `devdns help` and you'll see all available options.
30
+ Just type `devdnsd help` and you'll see all available options.
31
31
 
32
32
  ## Configuration
33
33
 
@@ -67,7 +67,7 @@ DevDNSd as a local resolver is tightly coupled with the OSX name resolution syst
67
67
 
68
68
  You can, anyway, run the software as DNS server.
69
69
 
70
- ## Contributing to devdns
70
+ ## Contributing to devdnsd
71
71
 
72
72
  * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
73
73
  * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
  #
3
- # This file is part of the cowtech-extensions gem. Copyright (C) 2011 and above Shogun <shogun_panda@me.com>.
3
+ # This file is part of the devdnsd gem. Copyright (C) 2011 and above Shogun <shogun_panda@me.com>.
4
4
  # Licensed under the MIT license, which can be found at http://www.opensource.org/licenses/mit-license.php.
5
5
  #
6
6
 
@@ -15,4 +15,4 @@ namespace :spec do
15
15
  ENV["DEVDNSD_COVERAGE"] = "TRUE"
16
16
  Rake::Task["spec"].invoke
17
17
  end
18
- end
18
+ end
data/bin/devdnsd CHANGED
@@ -8,70 +8,39 @@
8
8
  require "rubygems"
9
9
  require "devdnsd"
10
10
 
11
- # TODO: Replace GLI with another library.
12
-
13
- include GLI
14
- program_desc("A small DNS server to enable local domain resolution.")
15
- version(DevDNSd::Version::STRING)
16
-
17
- desc("Do not ask any confirmation.")
18
- switch([:f, :force])
19
-
20
- desc("The TLD to handle.")
21
- default_value("dev")
22
- arg_name("TLD")
23
- flag([:t,:tld])
24
-
25
- desc("The port to bind.")
26
- default_value(7771)
27
- arg_name("PORT")
28
- flag([:p,:port])
29
-
30
- desc("The default configuration file.")
31
- default_value("~/.devdnsd_config")
32
- arg_name("FILE")
33
- flag([:c, :config])
34
-
35
- desc("The default log file. Not used if run in foreground.")
36
- default_value("/var/log/devdnsd.log")
37
- arg_name("LOG")
38
- flag([:l, :log])
39
-
40
- desc("The default log level. Valid values are from 0 to 5 where 0 means \"all messages\".")
41
- default_value(1)
42
- arg_name("LEVEL")
43
- flag([:L, :log_level])
44
-
45
- desc("Starts the server.")
46
- command [:s, :start] do |c|
47
- c.desc("Do not daemonize.")
48
- c.switch [:n, :foreground]
49
-
50
- c.action do |globals, locals, args|
51
- DevDNSd::Application.instance(globals, locals, args).action_start()
11
+ Mamertes.App do
12
+ name "DevDNSd"
13
+ description "A small DNS server to enable local domain resolution."
14
+ version DevDNSd::Version::STRING
15
+
16
+ option "configuration", [], {:type => String, :help => "The configuration file to use. Default is \"~/.devdnsd_config\".", :default => "~/.devdnsd_config", :meta => "FILE"}
17
+ option "tld", [], {:type => String, :help => "The TLD to handle. Default is \"dev\".", :default => "dev", :meta => "DOMAIN"}
18
+ option "port", [], {:type => Integer, :help => "The port to bind. Default is 7771", :default => 7771}
19
+ option "log-file", [], {:type => String, :help => "The default log file. Not used if run in foreground. Default is \"/var/log/devdnsd.log\"", :default => "/var/log/devdnsd.log", :meta => "FILE"}
20
+ option "log-level", [:L], {:type => Integer, :help => "The default log level. Valid values are from 0 to 5 where 0 means \"all messages\". Default is 1.", :default => 1, :meta => "LEVEL"}
21
+
22
+ command :start do
23
+ description "Starts the server."
24
+ option "foreground", [:n], {:help => "Do not daemonize."}
25
+ action { |command| DevDNSd::Application.instance(command).action_start() }
52
26
  end
53
- end
54
27
 
55
- desc("Stops the server.")
56
- command [:t, :stop] do |c|
57
- c.action do |globals, locals, args|
58
- DevDNSd::Application.instance(globals, locals, args).action_stop()
28
+ command :stop do
29
+ description "Stops the server."
30
+ action { |command| DevDNSd::Application.instance(command).action_stop() }
59
31
  end
60
- end
61
32
 
62
- desc("Install the server.")
63
- command [:i, :install] do |c|
64
- c.action do |globals, locals, args|
65
- DevDNSd::Application.instance(globals, locals, args).action_install()
33
+ command :install do
34
+ description "Installs the server."
35
+ action { |command| DevDNSd::Application.instance(command).action_install() }
66
36
  end
67
- end
68
37
 
69
- desc("Uninstall the server.")
70
- command [:u, :uninstall] do |c|
71
- c.action do |globals, locals, args|
72
- DevDNSd::Application.instance(globals, locals, args).action_uninstall()
38
+ command :uninstall do
39
+ description "Uninstalls the server."
40
+ action { |command| DevDNSd::Application.instance(command).action_uninstall() }
73
41
  end
74
- end
75
42
 
76
- ARGV << "help" if ARGV.length == 0
77
- exit(GLI.run(ARGV))
43
+ action do |command|
44
+ self.commands["start"].execute(ARGV)
45
+ end
46
+ end
data/devdnsd.gemspec CHANGED
@@ -20,10 +20,8 @@ Gem::Specification.new do |gem|
20
20
  gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
21
21
  gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
22
22
  gem.require_paths = ["lib"]
23
- #gem.platform = Gem::Platform::CURRENT
24
23
 
25
- gem.add_dependency("bovem", ">= 0.5.0")
26
- gem.add_dependency("gli", "~> 1.6.0")
24
+ gem.add_dependency("mamertes", "~> 1.1.0")
27
25
  gem.add_dependency("rubydns", "~> 0.4.0")
28
26
  gem.add_dependency("rexec", "~> 1.4.1")
29
27
 
data/doc/DevDNSd.html ADDED
@@ -0,0 +1,130 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+ <title>
7
+ Module: DevDNSd
8
+
9
+ &mdash; Documentation by YARD 0.8.2.1
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ hasFrames = window.top.frames.main ? true : false;
19
+ relpath = '';
20
+ framesUrl = "frames.html#!" + escape(window.location.href);
21
+ </script>
22
+
23
+
24
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
25
+
26
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
27
+
28
+
29
+ </head>
30
+ <body>
31
+ <div id="header">
32
+ <div id="menu">
33
+
34
+ <a href="_index.html">Index (D)</a> &raquo;
35
+
36
+
37
+ <span class="title">DevDNSd</span>
38
+
39
+
40
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41
+ </div>
42
+
43
+ <div id="search">
44
+
45
+ <a class="full_list_link" id="class_list_link"
46
+ href="class_list.html">
47
+ Class List
48
+ </a>
49
+
50
+ <a class="full_list_link" id="method_list_link"
51
+ href="method_list.html">
52
+ Method List
53
+ </a>
54
+
55
+ <a class="full_list_link" id="file_list_link"
56
+ href="file_list.html">
57
+ File List
58
+ </a>
59
+
60
+ </div>
61
+ <div class="clear"></div>
62
+ </div>
63
+
64
+ <iframe id="search_frame"></iframe>
65
+
66
+ <div id="content"><h1>Module: DevDNSd
67
+
68
+
69
+
70
+ </h1>
71
+
72
+ <dl class="box">
73
+
74
+
75
+
76
+
77
+
78
+
79
+
80
+
81
+ <dt class="r1 last">Defined in:</dt>
82
+ <dd class="r1 last">lib/devdnsd/rule.rb<span class="defines">,<br />
83
+ lib/devdnsd/errors.rb,<br /> lib/devdnsd/version.rb,<br /> lib/devdnsd/application.rb,<br /> lib/devdnsd/configuration.rb</span>
84
+ </dd>
85
+
86
+ </dl>
87
+ <div class="clear"></div>
88
+
89
+ <h2>Overview</h2><div class="docstring">
90
+ <div class="discussion">
91
+ <p>This file is part of the devdnsd gem. Copyright (C) 2012 and above Shogun <shogun_panda@me.com>.
92
+ Licensed under the MIT license, which can be found at <a href="http://www.opensource.org/licenses/mit-license.php">http://www.opensource.org/licenses/mit-license.php</a>.</p>
93
+
94
+
95
+ </div>
96
+ </div>
97
+ <div class="tags">
98
+
99
+
100
+ </div><h2>Defined Under Namespace</h2>
101
+ <p class="children">
102
+
103
+
104
+ <strong class="modules">Modules:</strong> <span class='object_link'><a href="DevDNSd/Errors.html" title="DevDNSd::Errors (module)">Errors</a></span>, <span class='object_link'><a href="DevDNSd/Version.html" title="DevDNSd::Version (module)">Version</a></span>
105
+
106
+
107
+
108
+ <strong class="classes">Classes:</strong> <span class='object_link'><a href="DevDNSd/Application.html" title="DevDNSd::Application (class)">Application</a></span>, <span class='object_link'><a href="DevDNSd/Configuration.html" title="DevDNSd::Configuration (class)">Configuration</a></span>, <span class='object_link'><a href="DevDNSd/Rule.html" title="DevDNSd::Rule (class)">Rule</a></span>
109
+
110
+
111
+ </p>
112
+
113
+
114
+
115
+
116
+
117
+
118
+
119
+
120
+
121
+ </div>
122
+
123
+ <div id="footer">
124
+ Generated on Wed Aug 22 13:48:31 2012 by
125
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
126
+ 0.8.2.1 (ruby-1.9.2).
127
+ </div>
128
+
129
+ </body>
130
+ </html>
@@ -0,0 +1,2415 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+ <title>
7
+ Class: DevDNSd::Application
8
+
9
+ &mdash; Documentation by YARD 0.8.2.1
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ hasFrames = window.top.frames.main ? true : false;
19
+ relpath = '../';
20
+ framesUrl = "../frames.html#!" + escape(window.location.href);
21
+ </script>
22
+
23
+
24
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
25
+
26
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
27
+
28
+
29
+ </head>
30
+ <body>
31
+ <div id="header">
32
+ <div id="menu">
33
+
34
+ <a href="../_index.html">Index (A)</a> &raquo;
35
+ <span class='title'><span class='object_link'><a href="../DevDNSd.html" title="DevDNSd (module)">DevDNSd</a></span></span>
36
+ &raquo;
37
+ <span class="title">Application</span>
38
+
39
+
40
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41
+ </div>
42
+
43
+ <div id="search">
44
+
45
+ <a class="full_list_link" id="class_list_link"
46
+ href="../class_list.html">
47
+ Class List
48
+ </a>
49
+
50
+ <a class="full_list_link" id="method_list_link"
51
+ href="../method_list.html">
52
+ Method List
53
+ </a>
54
+
55
+ <a class="full_list_link" id="file_list_link"
56
+ href="../file_list.html">
57
+ File List
58
+ </a>
59
+
60
+ </div>
61
+ <div class="clear"></div>
62
+ </div>
63
+
64
+ <iframe id="search_frame"></iframe>
65
+
66
+ <div id="content"><h1>Class: DevDNSd::Application
67
+
68
+
69
+
70
+ </h1>
71
+
72
+ <dl class="box">
73
+
74
+ <dt class="r1">Inherits:</dt>
75
+ <dd class="r1">
76
+ <span class="inheritName">RExec::Daemon::Base</span>
77
+
78
+ <ul class="fullTree">
79
+ <li>Object</li>
80
+
81
+ <li class="next">RExec::Daemon::Base</li>
82
+
83
+ <li class="next">DevDNSd::Application</li>
84
+
85
+ </ul>
86
+ <a href="#" class="inheritanceTree">show all</a>
87
+
88
+ </dd>
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+
98
+ <dt class="r2 last">Defined in:</dt>
99
+ <dd class="r2 last">lib/devdnsd/application.rb</dd>
100
+
101
+ </dl>
102
+ <div class="clear"></div>
103
+
104
+ <h2>Overview</h2><div class="docstring">
105
+ <div class="discussion">
106
+ <p>The main DevDNSd application.</p>
107
+
108
+
109
+ </div>
110
+ </div>
111
+ <div class="tags">
112
+
113
+
114
+ </div>
115
+ <h2>Constant Summary</h2>
116
+
117
+ <dl class="constants">
118
+
119
+ <dt id="ANY_REQUEST-constant" class="">ANY_REQUEST =
120
+ <div class="docstring">
121
+ <div class="discussion">
122
+ <p>Class for ANY DNS request.</p>
123
+
124
+
125
+ </div>
126
+ </div>
127
+ <div class="tags">
128
+
129
+
130
+ </div>
131
+ </dt>
132
+ <dd><pre class="code"><span class='const'>Resolv</span><span class='op'>::</span><span class='const'>DNS</span><span class='op'>::</span><span class='const'>Resource</span><span class='op'>::</span><span class='const'>IN</span><span class='op'>::</span><span class='const'>ANY</span></pre></dd>
133
+
134
+ <dt id="ANY_CLASSES-constant" class="">ANY_CLASSES =
135
+ <div class="docstring">
136
+ <div class="discussion">
137
+ <p>List of classes handled in case of DNS request with resource class ANY.</p>
138
+
139
+
140
+ </div>
141
+ </div>
142
+ <div class="tags">
143
+
144
+
145
+ </div>
146
+ </dt>
147
+ <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>
148
+
149
+ </dl>
150
+
151
+
152
+
153
+
154
+
155
+ <h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
156
+ <ul class="summary">
157
+
158
+ <li class="public ">
159
+ <span class="summary_signature">
160
+
161
+ <a href="#command-instance_method" title="#command (instance method)">- (Object) <strong>command</strong> </a>
162
+
163
+
164
+
165
+ </span>
166
+
167
+
168
+
169
+
170
+ <span class="note title readonly">readonly</span>
171
+
172
+
173
+
174
+
175
+
176
+
177
+
178
+
179
+
180
+ <span class="summary_desc"><div class='inline'><p>The Mamertes command.</p>
181
+ </div></span>
182
+
183
+ </li>
184
+
185
+
186
+ <li class="public ">
187
+ <span class="summary_signature">
188
+
189
+ <a href="#config-instance_method" title="#config (instance method)">- (Object) <strong>config</strong> </a>
190
+
191
+
192
+
193
+ </span>
194
+
195
+
196
+
197
+
198
+ <span class="note title readonly">readonly</span>
199
+
200
+
201
+
202
+
203
+
204
+
205
+
206
+
207
+
208
+ <span class="summary_desc"><div class='inline'><p>The <span class='object_link'><a href="Configuration.html" title="DevDNSd::Configuration (class)">Configuration</a></span> of this application.</p>
209
+ </div></span>
210
+
211
+ </li>
212
+
213
+
214
+ <li class="public ">
215
+ <span class="summary_signature">
216
+
217
+ <a href="#logger-instance_method" title="#logger (instance method)">- (Object) <strong>logger</strong> </a>
218
+
219
+
220
+
221
+ </span>
222
+
223
+
224
+
225
+
226
+
227
+
228
+
229
+
230
+
231
+
232
+
233
+
234
+ <span class="summary_desc"><div class='inline'><p>The logger for this application.</p>
235
+ </div></span>
236
+
237
+ </li>
238
+
239
+
240
+ </ul>
241
+
242
+
243
+
244
+
245
+
246
+ <h2>
247
+ Class Method Summary
248
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
249
+ </h2>
250
+
251
+ <ul class="summary">
252
+
253
+ <li class="public ">
254
+ <span class="summary_signature">
255
+
256
+ <a href="#instance-class_method" title="instance (class method)">+ (Application) <strong>instance</strong>(command = nil, force = false) </a>
257
+
258
+
259
+
260
+ </span>
261
+
262
+
263
+
264
+
265
+
266
+
267
+
268
+
269
+
270
+ <span class="summary_desc"><div class='inline'><p>Returns a unique (singleton) instance of the application.</p>
271
+ </div></span>
272
+
273
+ </li>
274
+
275
+
276
+ <li class="public ">
277
+ <span class="summary_signature">
278
+
279
+ <a href="#quit-class_method" title="quit (class method)">+ (Object) <strong>quit</strong> </a>
280
+
281
+
282
+
283
+ </span>
284
+
285
+
286
+
287
+
288
+
289
+
290
+
291
+
292
+
293
+ <span class="summary_desc"><div class='inline'><p>Stops the application.</p>
294
+ </div></span>
295
+
296
+ </li>
297
+
298
+
299
+ <li class="public ">
300
+ <span class="summary_signature">
301
+
302
+ <a href="#run-class_method" title="run (class method)">+ (Object) <strong>run</strong> </a>
303
+
304
+
305
+
306
+ </span>
307
+
308
+
309
+
310
+
311
+
312
+
313
+
314
+
315
+
316
+ <span class="summary_desc"><div class='inline'><p>Runs the application in foreground.</p>
317
+ </div></span>
318
+
319
+ </li>
320
+
321
+
322
+ </ul>
323
+
324
+ <h2>
325
+ Instance Method Summary
326
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
327
+ </h2>
328
+
329
+ <ul class="summary">
330
+
331
+ <li class="public ">
332
+ <span class="summary_signature">
333
+
334
+ <a href="#action_install-instance_method" title="#action_install (instance method)">- (Boolean) <strong>action_install</strong> </a>
335
+
336
+
337
+
338
+ </span>
339
+
340
+
341
+
342
+
343
+
344
+
345
+
346
+
347
+
348
+ <span class="summary_desc"><div class='inline'><p>Installs the server into the system.</p>
349
+ </div></span>
350
+
351
+ </li>
352
+
353
+
354
+ <li class="public ">
355
+ <span class="summary_signature">
356
+
357
+ <a href="#action_start-instance_method" title="#action_start (instance method)">- (Boolean) <strong>action_start</strong> </a>
358
+
359
+
360
+
361
+ </span>
362
+
363
+
364
+
365
+
366
+
367
+
368
+
369
+
370
+
371
+ <span class="summary_desc"><div class='inline'><p>Starts the server in background.</p>
372
+ </div></span>
373
+
374
+ </li>
375
+
376
+
377
+ <li class="public ">
378
+ <span class="summary_signature">
379
+
380
+ <a href="#action_stop-instance_method" title="#action_stop (instance method)">- (Boolean) <strong>action_stop</strong> </a>
381
+
382
+
383
+
384
+ </span>
385
+
386
+
387
+
388
+
389
+
390
+
391
+
392
+
393
+
394
+ <span class="summary_desc"><div class='inline'><p>Stops the server in background.</p>
395
+ </div></span>
396
+
397
+ </li>
398
+
399
+
400
+ <li class="public ">
401
+ <span class="summary_signature">
402
+
403
+ <a href="#action_uninstall-instance_method" title="#action_uninstall (instance method)">- (Boolean) <strong>action_uninstall</strong> </a>
404
+
405
+
406
+
407
+ </span>
408
+
409
+
410
+
411
+
412
+
413
+
414
+
415
+
416
+
417
+ <span class="summary_desc"><div class='inline'><p>Uninstalls the server from the system.</p>
418
+ </div></span>
419
+
420
+ </li>
421
+
422
+
423
+ <li class="public ">
424
+ <span class="summary_signature">
425
+
426
+ <a href="#dns_update-instance_method" title="#dns_update (instance method)">- (Boolean) <strong>dns_update</strong> </a>
427
+
428
+
429
+
430
+ </span>
431
+
432
+
433
+
434
+
435
+
436
+
437
+
438
+
439
+
440
+ <span class="summary_desc"><div class='inline'><p>Updates DNS cache.</p>
441
+ </div></span>
442
+
443
+ </li>
444
+
445
+
446
+ <li class="public ">
447
+ <span class="summary_signature">
448
+
449
+ <a href="#execute_command-instance_method" title="#execute_command (instance method)">- (Boolean) <strong>execute_command</strong>(command) </a>
450
+
451
+
452
+
453
+ </span>
454
+
455
+
456
+
457
+
458
+
459
+
460
+
461
+
462
+
463
+ <span class="summary_desc"><div class='inline'><p>Executes a shell command.</p>
464
+ </div></span>
465
+
466
+ </li>
467
+
468
+
469
+ <li class="public ">
470
+ <span class="summary_signature">
471
+
472
+ <a href="#get_logger-instance_method" title="#get_logger (instance method)">- (Logger) <strong>get_logger</strong> </a>
473
+
474
+
475
+
476
+ </span>
477
+
478
+
479
+
480
+
481
+
482
+
483
+
484
+
485
+
486
+ <span class="summary_desc"><div class='inline'><p>Gets the current logger of the application.</p>
487
+ </div></span>
488
+
489
+ </li>
490
+
491
+
492
+ <li class="public ">
493
+ <span class="summary_signature">
494
+
495
+ <a href="#initialize-instance_method" title="#initialize (instance method)">- (Application) <strong>initialize</strong>(command) </a>
496
+
497
+
498
+
499
+ </span>
500
+
501
+
502
+ <span class="note title constructor">constructor</span>
503
+
504
+
505
+
506
+
507
+
508
+
509
+
510
+
511
+ <span class="summary_desc"><div class='inline'><p>Creates a new application.</p>
512
+ </div></span>
513
+
514
+ </li>
515
+
516
+
517
+ <li class="public ">
518
+ <span class="summary_signature">
519
+
520
+ <a href="#is_osx%3F-instance_method" title="#is_osx? (instance method)">- (Boolean) <strong>is_osx?</strong> </a>
521
+
522
+
523
+
524
+ </span>
525
+
526
+
527
+
528
+
529
+
530
+
531
+
532
+
533
+
534
+ <span class="summary_desc"><div class='inline'><p>Check if we are running on MacOS X.</p>
535
+ </div></span>
536
+
537
+ </li>
538
+
539
+
540
+ <li class="public ">
541
+ <span class="summary_signature">
542
+
543
+ <a href="#launch_agent_path-instance_method" title="#launch_agent_path (instance method)">- (String) <strong>launch_agent_path</strong>(name = &quot;it.cowtech.devdnsd&quot;) </a>
544
+
545
+
546
+
547
+ </span>
548
+
549
+
550
+
551
+
552
+
553
+
554
+
555
+
556
+
557
+ <span class="summary_desc"><div class='inline'><p>Gets the path for the launch agent file.</p>
558
+ </div></span>
559
+
560
+ </li>
561
+
562
+
563
+ <li class="public ">
564
+ <span class="summary_signature">
565
+
566
+ <a href="#on_start-instance_method" title="#on_start (instance method)">- (NilClass) <strong>on_start</strong> </a>
567
+
568
+
569
+
570
+ </span>
571
+
572
+
573
+
574
+
575
+
576
+
577
+
578
+
579
+
580
+ <span class="summary_desc"><div class='inline'><p>This method is called when the server starts.</p>
581
+ </div></span>
582
+
583
+ </li>
584
+
585
+
586
+ <li class="public ">
587
+ <span class="summary_signature">
588
+
589
+ <a href="#on_stop-instance_method" title="#on_stop (instance method)">- (NilClass) <strong>on_stop</strong> </a>
590
+
591
+
592
+
593
+ </span>
594
+
595
+
596
+
597
+
598
+
599
+
600
+
601
+
602
+
603
+ <span class="summary_desc"><div class='inline'><p>This method is called when the server stop.</p>
604
+ </div></span>
605
+
606
+ </li>
607
+
608
+
609
+ <li class="public ">
610
+ <span class="summary_signature">
611
+
612
+ <a href="#perform_server-instance_method" title="#perform_server (instance method)">- (Object) <strong>perform_server</strong> </a>
613
+
614
+
615
+
616
+ </span>
617
+
618
+
619
+
620
+
621
+
622
+
623
+
624
+
625
+
626
+ <span class="summary_desc"><div class='inline'><p>Starts the DNS server.</p>
627
+ </div></span>
628
+
629
+ </li>
630
+
631
+
632
+ <li class="public ">
633
+ <span class="summary_signature">
634
+
635
+ <a href="#process_rule-instance_method" title="#process_rule (instance method)">- (Object) <strong>process_rule</strong>(rule, type, match_data, transaction) </a>
636
+
637
+
638
+
639
+ </span>
640
+
641
+
642
+
643
+
644
+
645
+
646
+
647
+
648
+
649
+ <span class="summary_desc"><div class='inline'><p>Processes a DNS rule.</p>
650
+ </div></span>
651
+
652
+ </li>
653
+
654
+
655
+ <li class="public ">
656
+ <span class="summary_signature">
657
+
658
+ <a href="#resolver_path-instance_method" title="#resolver_path (instance method)">- (String) <strong>resolver_path</strong>(tld = nil) </a>
659
+
660
+
661
+
662
+ </span>
663
+
664
+
665
+
666
+
667
+
668
+
669
+
670
+
671
+
672
+ <span class="summary_desc"><div class='inline'><p>Gets the path for the resolver file.</p>
673
+ </div></span>
674
+
675
+ </li>
676
+
677
+
678
+ </ul>
679
+
680
+
681
+
682
+ <div id="constructor_details" class="method_details_list">
683
+ <h2>Constructor Details</h2>
684
+
685
+ <div class="method_details first">
686
+ <h3 class="signature first" id="initialize-instance_method">
687
+
688
+ - (<tt><span class='object_link'><a href="" title="DevDNSd::Application (class)">Application</a></span></tt>) <strong>initialize</strong>(command)
689
+
690
+
691
+
692
+
693
+
694
+ </h3><div class="docstring">
695
+ <div class="discussion">
696
+ <p>Creates a new application.</p>
697
+
698
+
699
+ </div>
700
+ </div>
701
+ <div class="tags">
702
+ <p class="tag_title">Parameters:</p>
703
+ <ul class="param">
704
+
705
+ <li>
706
+
707
+ <span class='name'>command</span>
708
+
709
+
710
+ <span class='type'>(<tt>Mamertes::Command</tt>)</span>
711
+
712
+
713
+
714
+ &mdash;
715
+ <div class='inline'><p>The current Mamertes command.</p>
716
+ </div>
717
+
718
+ </li>
719
+
720
+ </ul>
721
+
722
+
723
+ </div><table class="source_code">
724
+ <tr>
725
+ <td>
726
+ <pre class="lines">
727
+
728
+
729
+ 29
730
+ 30
731
+ 31
732
+ 32
733
+ 33
734
+ 34
735
+ 35
736
+ 36
737
+ 37
738
+ 38
739
+ 39
740
+ 40
741
+ 41
742
+ 42
743
+ 43
744
+ 44
745
+ 45
746
+ 46
747
+ 47
748
+ 48
749
+ 49
750
+ 50
751
+ 51
752
+ 52
753
+ 53
754
+ 54
755
+ 55
756
+ 56
757
+ 57</pre>
758
+ </td>
759
+ <td>
760
+ <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 29</span>
761
+
762
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_command'>command</span><span class='rparen'>)</span>
763
+ <span class='ivar'>@command</span> <span class='op'>=</span> <span class='id identifier rubyid_command'>command</span>
764
+ <span class='id identifier rubyid_application'>application</span> <span class='op'>=</span> <span class='ivar'>@command</span><span class='period'>.</span><span class='id identifier rubyid_application'>application</span>
765
+
766
+ <span class='comment'># Setup logger
767
+ </span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>Logger</span><span class='period'>.</span><span class='id identifier rubyid_start_time'>start_time</span> <span class='op'>=</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span>
768
+ <span class='ivar'>@logger</span> <span class='op'>=</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>Logger</span><span class='period'>.</span><span class='id identifier rubyid_create'>create</span><span class='lparen'>(</span><span class='const'>Bovem</span><span class='op'>::</span><span class='const'>Logger</span><span class='period'>.</span><span class='id identifier rubyid_get_real_file'>get_real_file</span><span class='lparen'>(</span><span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>log-file</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>Logger</span><span class='period'>.</span><span class='id identifier rubyid_default_file'>default_file</span><span class='comma'>,</span> <span class='const'>Logger</span><span class='op'>::</span><span class='const'>INFO</span><span class='rparen'>)</span>
769
+
770
+ <span class='comment'># Open configuration
771
+ </span> <span class='kw'>begin</span>
772
+ <span class='id identifier rubyid_overrides'>overrides</span> <span class='op'>=</span> <span class='lbrace'>{</span>
773
+ <span class='symbol'>:foreground</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_command'>command</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>start</span><span class='tstring_end'>&quot;</span></span> <span class='op'>?</span> <span class='id identifier rubyid_command'>command</span><span class='period'>.</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>foreground</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_value'>value</span> <span class='op'>:</span> <span class='kw'>false</span><span class='comma'>,</span>
774
+ <span class='symbol'>:log_file</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>log-file</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_value'>value</span><span class='comma'>,</span>
775
+ <span class='symbol'>:log_level</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>log-level</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_value'>value</span><span class='comma'>,</span>
776
+ <span class='symbol'>:tld</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>tld</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_value'>value</span><span class='comma'>,</span>
777
+ <span class='symbol'>:port</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>port</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_value'>value</span>
778
+ <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_reject'>reject</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='id identifier rubyid_v'>v</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='rbrace'>}</span>
779
+
780
+ <span class='ivar'>@config</span> <span class='op'>=</span> <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>Configuration</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>configuration</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='id identifier rubyid_overrides'>overrides</span><span class='comma'>,</span> <span class='ivar'>@logger</span><span class='rparen'>)</span>
781
+
782
+ <span class='ivar'>@logger</span> <span class='op'>=</span> <span class='kw'>nil</span>
783
+ <span class='ivar'>@logger</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_get_logger'>get_logger</span>
784
+ <span class='kw'>rescue</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>Errors</span><span class='op'>::</span><span class='const'>InvalidConfiguration</span><span class='comma'>,</span> <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>Errors</span><span class='op'>::</span><span class='const'>InvalidRule</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_e'>e</span>
785
+ <span class='ivar'>@logger</span> <span class='op'>?</span> <span class='ivar'>@logger</span><span class='period'>.</span><span class='id identifier rubyid_fatal'>fatal</span><span class='lparen'>(</span><span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>Logger</span><span class='period'>.</span><span class='id identifier rubyid_create'>create</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>STDERR</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_fatal'>fatal</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Cannot log to </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_config'>config</span><span class='period'>.</span><span class='id identifier rubyid_log_file'>log_file</span><span class='rbrace'>}</span><span class='tstring_content'>. Exiting...</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
786
+ <span class='id identifier rubyid_raise'>raise</span> <span class='op'>::</span><span class='const'>SystemExit</span>
787
+ <span class='kw'>end</span>
788
+
789
+ <span class='kw'>self</span>
790
+ <span class='kw'>end</span></pre>
791
+ </td>
792
+ </tr>
793
+ </table>
794
+ </div>
795
+
796
+ </div>
797
+
798
+ <div id="instance_attr_details" class="attr_details">
799
+ <h2>Instance Attribute Details</h2>
800
+
801
+
802
+ <span id=""></span>
803
+ <div class="method_details first">
804
+ <h3 class="signature first" id="command-instance_method">
805
+
806
+ - (<tt>Object</tt>) <strong>command</strong> <span class="extras">(readonly)</span>
807
+
808
+
809
+
810
+
811
+
812
+ </h3><div class="docstring">
813
+ <div class="discussion">
814
+ <p>The Mamertes command.</p>
815
+
816
+
817
+ </div>
818
+ </div>
819
+ <div class="tags">
820
+
821
+
822
+ </div><table class="source_code">
823
+ <tr>
824
+ <td>
825
+ <pre class="lines">
826
+
827
+
828
+ 21
829
+ 22
830
+ 23</pre>
831
+ </td>
832
+ <td>
833
+ <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 21</span>
834
+
835
+ <span class='kw'>def</span> <span class='id identifier rubyid_command'>command</span>
836
+ <span class='ivar'>@command</span>
837
+ <span class='kw'>end</span></pre>
838
+ </td>
839
+ </tr>
840
+ </table>
841
+ </div>
842
+
843
+
844
+ <span id=""></span>
845
+ <div class="method_details ">
846
+ <h3 class="signature " id="config-instance_method">
847
+
848
+ - (<tt>Object</tt>) <strong>config</strong> <span class="extras">(readonly)</span>
849
+
850
+
851
+
852
+
853
+
854
+ </h3><div class="docstring">
855
+ <div class="discussion">
856
+ <p>The <span class='object_link'><a href="Configuration.html" title="DevDNSd::Configuration (class)">Configuration</a></span> of this application.</p>
857
+
858
+
859
+ </div>
860
+ </div>
861
+ <div class="tags">
862
+
863
+
864
+ </div><table class="source_code">
865
+ <tr>
866
+ <td>
867
+ <pre class="lines">
868
+
869
+
870
+ 18
871
+ 19
872
+ 20</pre>
873
+ </td>
874
+ <td>
875
+ <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 18</span>
876
+
877
+ <span class='kw'>def</span> <span class='id identifier rubyid_config'>config</span>
878
+ <span class='ivar'>@config</span>
879
+ <span class='kw'>end</span></pre>
880
+ </td>
881
+ </tr>
882
+ </table>
883
+ </div>
884
+
885
+
886
+ <span id="logger=-instance_method"></span>
887
+ <div class="method_details ">
888
+ <h3 class="signature " id="logger-instance_method">
889
+
890
+ - (<tt>Object</tt>) <strong>logger</strong>
891
+
892
+
893
+
894
+
895
+
896
+ </h3><div class="docstring">
897
+ <div class="discussion">
898
+ <p>The logger for this application.</p>
899
+
900
+
901
+ </div>
902
+ </div>
903
+ <div class="tags">
904
+
905
+
906
+ </div><table class="source_code">
907
+ <tr>
908
+ <td>
909
+ <pre class="lines">
910
+
911
+
912
+ 24
913
+ 25
914
+ 26</pre>
915
+ </td>
916
+ <td>
917
+ <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 24</span>
918
+
919
+ <span class='kw'>def</span> <span class='id identifier rubyid_logger'>logger</span>
920
+ <span class='ivar'>@logger</span>
921
+ <span class='kw'>end</span></pre>
922
+ </td>
923
+ </tr>
924
+ </table>
925
+ </div>
926
+
927
+ </div>
928
+
929
+
930
+ <div id="class_method_details" class="method_details_list">
931
+ <h2>Class Method Details</h2>
932
+
933
+
934
+ <div class="method_details first">
935
+ <h3 class="signature first" id="instance-class_method">
936
+
937
+ + (<tt><span class='object_link'><a href="" title="DevDNSd::Application (class)">Application</a></span></tt>) <strong>instance</strong>(command = nil, force = false)
938
+
939
+
940
+
941
+
942
+
943
+ </h3><div class="docstring">
944
+ <div class="discussion">
945
+ <p>Returns a unique (singleton) instance of the application.</p>
946
+
947
+
948
+ </div>
949
+ </div>
950
+ <div class="tags">
951
+ <p class="tag_title">Parameters:</p>
952
+ <ul class="param">
953
+
954
+ <li>
955
+
956
+ <span class='name'>command</span>
957
+
958
+
959
+ <span class='type'>(<tt>Mamertes::Command</tt>)</span>
960
+
961
+
962
+ <em class="default">(defaults to: <tt>nil</tt>)</em>
963
+
964
+
965
+ &mdash;
966
+ <div class='inline'><p>The current Mamertes command.</p>
967
+ </div>
968
+
969
+ </li>
970
+
971
+ <li>
972
+
973
+ <span class='name'>force</span>
974
+
975
+
976
+ <span class='type'>(<tt>Boolean</tt>)</span>
977
+
978
+
979
+ <em class="default">(defaults to: <tt>false</tt>)</em>
980
+
981
+
982
+ &mdash;
983
+ <div class='inline'><p>If to force recreation of the instance.</p>
984
+ </div>
985
+
986
+ </li>
987
+
988
+ </ul>
989
+
990
+ <p class="tag_title">Returns:</p>
991
+ <ul class="return">
992
+
993
+ <li>
994
+
995
+
996
+ <span class='type'>(<tt><span class='object_link'><a href="" title="DevDNSd::Application (class)">Application</a></span></tt>)</span>
997
+
998
+
999
+
1000
+ &mdash;
1001
+ <div class='inline'><p>The unique (singleton) instance of the application.</p>
1002
+ </div>
1003
+
1004
+ </li>
1005
+
1006
+ </ul>
1007
+
1008
+ </div><table class="source_code">
1009
+ <tr>
1010
+ <td>
1011
+ <pre class="lines">
1012
+
1013
+
1014
+ 347
1015
+ 348
1016
+ 349
1017
+ 350
1018
+ 351</pre>
1019
+ </td>
1020
+ <td>
1021
+ <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 347</span>
1022
+
1023
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span><span class='lparen'>(</span><span class='id identifier rubyid_command'>command</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_force'>force</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span>
1024
+ <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>
1025
+ <span class='ivar'>@instance</span> <span class='op'>||=</span> <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>Application</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_command'>command</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_command'>command</span>
1026
+ <span class='ivar'>@instance</span>
1027
+ <span class='kw'>end</span></pre>
1028
+ </td>
1029
+ </tr>
1030
+ </table>
1031
+ </div>
1032
+
1033
+ <div class="method_details ">
1034
+ <h3 class="signature " id="quit-class_method">
1035
+
1036
+ + (<tt>Object</tt>) <strong>quit</strong>
1037
+
1038
+
1039
+
1040
+
1041
+
1042
+ </h3><div class="docstring">
1043
+ <div class="discussion">
1044
+ <p>Stops the application.</p>
1045
+
1046
+
1047
+ </div>
1048
+ </div>
1049
+ <div class="tags">
1050
+
1051
+
1052
+ </div><table class="source_code">
1053
+ <tr>
1054
+ <td>
1055
+ <pre class="lines">
1056
+
1057
+
1058
+ 361
1059
+ 362
1060
+ 363</pre>
1061
+ </td>
1062
+ <td>
1063
+ <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 361</span>
1064
+
1065
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_quit'>quit</span>
1066
+ <span class='op'>::</span><span class='const'>EventMachine</span><span class='period'>.</span><span class='id identifier rubyid_stop'>stop</span>
1067
+ <span class='kw'>end</span></pre>
1068
+ </td>
1069
+ </tr>
1070
+ </table>
1071
+ </div>
1072
+
1073
+ <div class="method_details ">
1074
+ <h3 class="signature " id="run-class_method">
1075
+
1076
+ + (<tt>Object</tt>) <strong>run</strong>
1077
+
1078
+
1079
+
1080
+
1081
+
1082
+ </h3><div class="docstring">
1083
+ <div class="discussion">
1084
+ <p>Runs the application in foreground.</p>
1085
+
1086
+
1087
+ </div>
1088
+ </div>
1089
+ <div class="tags">
1090
+
1091
+
1092
+ <p class="tag_title">See Also:</p>
1093
+ <ul class="see">
1094
+
1095
+ <li><span class='object_link'><a href="#perform_server-instance_method" title="DevDNSd::Application#perform_server (method)">#perform_server</a></span></li>
1096
+
1097
+ </ul>
1098
+
1099
+ </div><table class="source_code">
1100
+ <tr>
1101
+ <td>
1102
+ <pre class="lines">
1103
+
1104
+
1105
+ 356
1106
+ 357
1107
+ 358</pre>
1108
+ </td>
1109
+ <td>
1110
+ <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 356</span>
1111
+
1112
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_run'>run</span>
1113
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span><span class='period'>.</span><span class='id identifier rubyid_perform_server'>perform_server</span>
1114
+ <span class='kw'>end</span></pre>
1115
+ </td>
1116
+ </tr>
1117
+ </table>
1118
+ </div>
1119
+
1120
+ </div>
1121
+
1122
+ <div id="instance_method_details" class="method_details_list">
1123
+ <h2>Instance Method Details</h2>
1124
+
1125
+
1126
+ <div class="method_details first">
1127
+ <h3 class="signature first" id="action_install-instance_method">
1128
+
1129
+ - (<tt>Boolean</tt>) <strong>action_install</strong>
1130
+
1131
+
1132
+
1133
+
1134
+
1135
+ </h3><div class="docstring">
1136
+ <div class="discussion">
1137
+ <p>Installs the server into the system.</p>
1138
+
1139
+
1140
+ </div>
1141
+ </div>
1142
+ <div class="tags">
1143
+
1144
+ <p class="tag_title">Returns:</p>
1145
+ <ul class="return">
1146
+
1147
+ <li>
1148
+
1149
+
1150
+ <span class='type'>(<tt>Boolean</tt>)</span>
1151
+
1152
+
1153
+
1154
+ &mdash;
1155
+ <div class='inline'><p><code>true</code> if action succedeed, <code>false</code> otherwise.</p>
1156
+ </div>
1157
+
1158
+ </li>
1159
+
1160
+ </ul>
1161
+
1162
+ </div><table class="source_code">
1163
+ <tr>
1164
+ <td>
1165
+ <pre class="lines">
1166
+
1167
+
1168
+ 232
1169
+ 233
1170
+ 234
1171
+ 235
1172
+ 236
1173
+ 237
1174
+ 238
1175
+ 239
1176
+ 240
1177
+ 241
1178
+ 242
1179
+ 243
1180
+ 244
1181
+ 245
1182
+ 246
1183
+ 247
1184
+ 248
1185
+ 249
1186
+ 250
1187
+ 251
1188
+ 252
1189
+ 253
1190
+ 254
1191
+ 255
1192
+ 256
1193
+ 257
1194
+ 258
1195
+ 259
1196
+ 260
1197
+ 261
1198
+ 262
1199
+ 263
1200
+ 264
1201
+ 265
1202
+ 266
1203
+ 267
1204
+ 268
1205
+ 269
1206
+ 270
1207
+ 271
1208
+ 272
1209
+ 273
1210
+ 274
1211
+ 275
1212
+ 276
1213
+ 277
1214
+ 278
1215
+ 279
1216
+ 280
1217
+ 281
1218
+ 282
1219
+ 283
1220
+ 284</pre>
1221
+ </td>
1222
+ <td>
1223
+ <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 232</span>
1224
+
1225
+ <span class='kw'>def</span> <span class='id identifier rubyid_action_install'>action_install</span>
1226
+ <span class='id identifier rubyid_logger'>logger</span> <span class='op'>=</span> <span class='id identifier rubyid_get_logger'>get_logger</span>
1227
+
1228
+ <span class='kw'>if</span> <span class='op'>!</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_is_osx?'>is_osx?</span> <span class='kw'>then</span>
1229
+ <span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_fatal'>fatal</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Install DevDNSd as a local resolver is only available on MacOSX.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1230
+ <span class='kw'>return</span> <span class='kw'>false</span>
1231
+ <span class='kw'>end</span>
1232
+
1233
+ <span class='id identifier rubyid_resolver_file'>resolver_file</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_resolver_path'>resolver_path</span>
1234
+ <span class='id identifier rubyid_launch_agent'>launch_agent</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_launch_agent_path'>launch_agent_path</span>
1235
+
1236
+ <span class='comment'># Installs the resolver
1237
+ </span> <span class='kw'>begin</span>
1238
+ <span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Installing the resolver in </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_resolver_file'>resolver_file</span><span class='rbrace'>}</span><span class='tstring_content'> ...</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1239
+
1240
+ <span class='id identifier rubyid_open'>open</span><span class='lparen'>(</span><span class='id identifier rubyid_resolver_file'>resolver_file</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>w</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_f'>f</span><span class='op'>|</span>
1241
+ <span class='id identifier rubyid_f'>f</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>nameserver 127.0.0.1\n</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1242
+ <span class='id identifier rubyid_f'>f</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>port </span><span class='embexpr_beg'>#{</span><span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_port'>port</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1243
+ <span class='id identifier rubyid_f'>f</span><span class='period'>.</span><span class='id identifier rubyid_flush'>flush</span>
1244
+ <span class='rbrace'>}</span>
1245
+ <span class='kw'>rescue</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_e'>e</span>
1246
+ <span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_error'>error</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Cannot create the resolver file.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1247
+ <span class='kw'>return</span> <span class='kw'>false</span>
1248
+ <span class='kw'>end</span>
1249
+
1250
+ <span class='kw'>begin</span>
1251
+ <span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Creating the launch agent in </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_launch_agent'>launch_agent</span><span class='rbrace'>}</span><span class='tstring_content'> ...</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1252
+
1253
+ <span class='id identifier rubyid_args'>args</span> <span class='op'>=</span> <span class='gvar'>$ARGV</span> <span class='op'>?</span> <span class='gvar'>$ARGV</span><span class='lbracket'>[</span><span class='int'>0</span><span class='comma'>,</span> <span class='gvar'>$ARGV</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>-</span> <span class='int'>1</span><span class='rbracket'>]</span> <span class='op'>:</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
1254
+
1255
+ <span class='id identifier rubyid_plist'>plist</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>KeepAlive</span><span class='tstring_end'>&quot;</span></span> <span class='op'>=&gt;</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Label</span><span class='tstring_end'>&quot;</span></span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>it.cowtech.devdnsd</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Program</span><span class='tstring_end'>&quot;</span></span> <span class='op'>=&gt;</span> <span class='lparen'>(</span><span class='op'>::</span><span class='const'>Pathname</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='const'>Dir</span><span class='period'>.</span><span class='id identifier rubyid_pwd'>pwd</span><span class='rparen'>)</span> <span class='op'>+</span> <span class='gvar'>$0</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>ProgramArguments</span><span class='tstring_end'>&quot;</span></span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>RunAtLoad</span><span class='tstring_end'>&quot;</span></span> <span class='op'>=&gt;</span> <span class='kw'>true</span><span class='rbrace'>}</span>
1256
+ <span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_open'>open</span><span class='lparen'>(</span><span class='id identifier rubyid_launch_agent'>launch_agent</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>w</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_f'>f</span><span class='op'>|</span>
1257
+ <span class='id identifier rubyid_f'>f</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='id identifier rubyid_plist'>plist</span><span class='period'>.</span><span class='id identifier rubyid_to_json'>to_json</span><span class='rparen'>)</span>
1258
+ <span class='id identifier rubyid_f'>f</span><span class='period'>.</span><span class='id identifier rubyid_flush'>flush</span>
1259
+ <span class='rbrace'>}</span>
1260
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_execute_command'>execute_command</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>plutil -convert binary1 \&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_launch_agent'>launch_agent</span><span class='rbrace'>}</span><span class='tstring_content'>\&quot;</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1261
+ <span class='kw'>rescue</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_e'>e</span>
1262
+ <span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_error'>error</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Cannot create the launch agent.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1263
+ <span class='kw'>return</span> <span class='kw'>false</span>
1264
+ <span class='kw'>end</span>
1265
+
1266
+ <span class='kw'>begin</span>
1267
+ <span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Loading the launch agent ...</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1268
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_execute_command'>execute_command</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>launchctl load -w \&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_launch_agent'>launch_agent</span><span class='rbrace'>}</span><span class='tstring_content'>\&quot; &gt; /dev/null 2&gt;&amp;1</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1269
+ <span class='kw'>rescue</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_e'>e</span>
1270
+ <span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_error'>error</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Cannot load the launch agent.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1271
+ <span class='kw'>return</span> <span class='kw'>false</span>
1272
+ <span class='kw'>end</span>
1273
+
1274
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_dns_update'>dns_update</span>
1275
+
1276
+ <span class='kw'>true</span>
1277
+ <span class='kw'>end</span></pre>
1278
+ </td>
1279
+ </tr>
1280
+ </table>
1281
+ </div>
1282
+
1283
+ <div class="method_details ">
1284
+ <h3 class="signature " id="action_start-instance_method">
1285
+
1286
+ - (<tt>Boolean</tt>) <strong>action_start</strong>
1287
+
1288
+
1289
+
1290
+
1291
+
1292
+ </h3><div class="docstring">
1293
+ <div class="discussion">
1294
+ <p>Starts the server in background.</p>
1295
+
1296
+
1297
+ </div>
1298
+ </div>
1299
+ <div class="tags">
1300
+
1301
+ <p class="tag_title">Returns:</p>
1302
+ <ul class="return">
1303
+
1304
+ <li>
1305
+
1306
+
1307
+ <span class='type'>(<tt>Boolean</tt>)</span>
1308
+
1309
+
1310
+
1311
+ &mdash;
1312
+ <div class='inline'><p><code>true</code> if action succedeed, <code>false</code> otherwise.</p>
1313
+ </div>
1314
+
1315
+ </li>
1316
+
1317
+ </ul>
1318
+
1319
+ </div><table class="source_code">
1320
+ <tr>
1321
+ <td>
1322
+ <pre class="lines">
1323
+
1324
+
1325
+ 206
1326
+ 207
1327
+ 208
1328
+ 209
1329
+ 210
1330
+ 211
1331
+ 212
1332
+ 213
1333
+ 214
1334
+ 215
1335
+ 216
1336
+ 217
1337
+ 218</pre>
1338
+ </td>
1339
+ <td>
1340
+ <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 206</span>
1341
+
1342
+ <span class='kw'>def</span> <span class='id identifier rubyid_action_start'>action_start</span>
1343
+ <span class='id identifier rubyid_logger'>logger</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_get_logger'>get_logger</span>
1344
+
1345
+ <span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Starting DevDNSd ...</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1346
+
1347
+ <span class='kw'>if</span> <span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_foreground'>foreground</span> <span class='kw'>then</span>
1348
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_perform_server'>perform_server</span>
1349
+ <span class='kw'>else</span>
1350
+ <span class='const'>RExec</span><span class='op'>::</span><span class='const'>Daemon</span><span class='op'>::</span><span class='const'>Controller</span><span class='period'>.</span><span class='id identifier rubyid_start'>start</span><span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='rparen'>)</span>
1351
+ <span class='kw'>end</span>
1352
+
1353
+ <span class='kw'>true</span>
1354
+ <span class='kw'>end</span></pre>
1355
+ </td>
1356
+ </tr>
1357
+ </table>
1358
+ </div>
1359
+
1360
+ <div class="method_details ">
1361
+ <h3 class="signature " id="action_stop-instance_method">
1362
+
1363
+ - (<tt>Boolean</tt>) <strong>action_stop</strong>
1364
+
1365
+
1366
+
1367
+
1368
+
1369
+ </h3><div class="docstring">
1370
+ <div class="discussion">
1371
+ <p>Stops the server in background.</p>
1372
+
1373
+
1374
+ </div>
1375
+ </div>
1376
+ <div class="tags">
1377
+
1378
+ <p class="tag_title">Returns:</p>
1379
+ <ul class="return">
1380
+
1381
+ <li>
1382
+
1383
+
1384
+ <span class='type'>(<tt>Boolean</tt>)</span>
1385
+
1386
+
1387
+
1388
+ &mdash;
1389
+ <div class='inline'><p><code>true</code> if action succedeed, <code>false</code> otherwise.</p>
1390
+ </div>
1391
+
1392
+ </li>
1393
+
1394
+ </ul>
1395
+
1396
+ </div><table class="source_code">
1397
+ <tr>
1398
+ <td>
1399
+ <pre class="lines">
1400
+
1401
+
1402
+ 223
1403
+ 224
1404
+ 225
1405
+ 226
1406
+ 227</pre>
1407
+ </td>
1408
+ <td>
1409
+ <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 223</span>
1410
+
1411
+ <span class='kw'>def</span> <span class='id identifier rubyid_action_stop'>action_stop</span>
1412
+ <span class='const'>RExec</span><span class='op'>::</span><span class='const'>Daemon</span><span class='op'>::</span><span class='const'>Controller</span><span class='period'>.</span><span class='id identifier rubyid_stop'>stop</span><span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='rparen'>)</span>
1413
+
1414
+ <span class='kw'>true</span>
1415
+ <span class='kw'>end</span></pre>
1416
+ </td>
1417
+ </tr>
1418
+ </table>
1419
+ </div>
1420
+
1421
+ <div class="method_details ">
1422
+ <h3 class="signature " id="action_uninstall-instance_method">
1423
+
1424
+ - (<tt>Boolean</tt>) <strong>action_uninstall</strong>
1425
+
1426
+
1427
+
1428
+
1429
+
1430
+ </h3><div class="docstring">
1431
+ <div class="discussion">
1432
+ <p>Uninstalls the server from the system.</p>
1433
+
1434
+
1435
+ </div>
1436
+ </div>
1437
+ <div class="tags">
1438
+
1439
+ <p class="tag_title">Returns:</p>
1440
+ <ul class="return">
1441
+
1442
+ <li>
1443
+
1444
+
1445
+ <span class='type'>(<tt>Boolean</tt>)</span>
1446
+
1447
+
1448
+
1449
+ &mdash;
1450
+ <div class='inline'><p><code>true</code> if action succedeed, <code>false</code> otherwise.</p>
1451
+ </div>
1452
+
1453
+ </li>
1454
+
1455
+ </ul>
1456
+
1457
+ </div><table class="source_code">
1458
+ <tr>
1459
+ <td>
1460
+ <pre class="lines">
1461
+
1462
+
1463
+ 289
1464
+ 290
1465
+ 291
1466
+ 292
1467
+ 293
1468
+ 294
1469
+ 295
1470
+ 296
1471
+ 297
1472
+ 298
1473
+ 299
1474
+ 300
1475
+ 301
1476
+ 302
1477
+ 303
1478
+ 304
1479
+ 305
1480
+ 306
1481
+ 307
1482
+ 308
1483
+ 309
1484
+ 310
1485
+ 311
1486
+ 312
1487
+ 313
1488
+ 314
1489
+ 315
1490
+ 316
1491
+ 317
1492
+ 318
1493
+ 319
1494
+ 320
1495
+ 321
1496
+ 322
1497
+ 323
1498
+ 324
1499
+ 325
1500
+ 326
1501
+ 327
1502
+ 328</pre>
1503
+ </td>
1504
+ <td>
1505
+ <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 289</span>
1506
+
1507
+ <span class='kw'>def</span> <span class='id identifier rubyid_action_uninstall'>action_uninstall</span>
1508
+ <span class='id identifier rubyid_logger'>logger</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_get_logger'>get_logger</span>
1509
+
1510
+ <span class='kw'>if</span> <span class='op'>!</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_is_osx?'>is_osx?</span> <span class='kw'>then</span>
1511
+ <span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_fatal'>fatal</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Install DevDNSd as a local resolver is only available on MacOSX.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1512
+ <span class='kw'>return</span> <span class='kw'>false</span>
1513
+ <span class='kw'>end</span>
1514
+
1515
+ <span class='id identifier rubyid_resolver_file'>resolver_file</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_resolver_path'>resolver_path</span>
1516
+ <span class='id identifier rubyid_launch_agent'>launch_agent</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_launch_agent_path'>launch_agent_path</span>
1517
+
1518
+ <span class='comment'># Remove the resolver
1519
+ </span> <span class='kw'>begin</span>
1520
+ <span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Deleting the resolver </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_resolver_file'>resolver_file</span><span class='rbrace'>}</span><span class='tstring_content'> ...</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1521
+ <span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_resolver_file'>resolver_file</span><span class='rparen'>)</span>
1522
+ <span class='kw'>rescue</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_e'>e</span>
1523
+ <span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Cannot delete the resolver file.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1524
+ <span class='kw'>return</span> <span class='kw'>false</span>
1525
+ <span class='kw'>end</span>
1526
+
1527
+ <span class='comment'># Unload the launch agent.
1528
+ </span> <span class='kw'>begin</span>
1529
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_execute_command'>execute_command</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>launchctl unload -w \&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_launch_agent'>launch_agent</span><span class='rbrace'>}</span><span class='tstring_content'>\&quot; &gt; /dev/null 2&gt;&amp;1</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1530
+ <span class='kw'>rescue</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_e'>e</span>
1531
+ <span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Cannot unload the launch agent.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1532
+ <span class='kw'>end</span>
1533
+
1534
+ <span class='comment'># Delete the launch agent.
1535
+ </span> <span class='kw'>begin</span>
1536
+ <span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Deleting the launch agent </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_launch_agent'>launch_agent</span><span class='rbrace'>}</span><span class='tstring_content'> ...</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1537
+ <span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_launch_agent'>launch_agent</span><span class='rparen'>)</span>
1538
+ <span class='kw'>rescue</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_e'>e</span>
1539
+ <span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Cannot delete the launch agent.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1540
+ <span class='kw'>return</span> <span class='kw'>false</span>
1541
+ <span class='kw'>end</span>
1542
+
1543
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_dns_update'>dns_update</span>
1544
+
1545
+ <span class='kw'>true</span>
1546
+ <span class='kw'>end</span></pre>
1547
+ </td>
1548
+ </tr>
1549
+ </table>
1550
+ </div>
1551
+
1552
+ <div class="method_details ">
1553
+ <h3 class="signature " id="dns_update-instance_method">
1554
+
1555
+ - (<tt>Boolean</tt>) <strong>dns_update</strong>
1556
+
1557
+
1558
+
1559
+
1560
+
1561
+ </h3><div class="docstring">
1562
+ <div class="discussion">
1563
+ <p>Updates DNS cache.</p>
1564
+
1565
+
1566
+ </div>
1567
+ </div>
1568
+ <div class="tags">
1569
+
1570
+ <p class="tag_title">Returns:</p>
1571
+ <ul class="return">
1572
+
1573
+ <li>
1574
+
1575
+
1576
+ <span class='type'>(<tt>Boolean</tt>)</span>
1577
+
1578
+
1579
+
1580
+ &mdash;
1581
+ <div class='inline'><p><code>true</code> if command succeeded, <code>false</code> otherwise.</p>
1582
+ </div>
1583
+
1584
+ </li>
1585
+
1586
+ </ul>
1587
+
1588
+ </div><table class="source_code">
1589
+ <tr>
1590
+ <td>
1591
+ <pre class="lines">
1592
+
1593
+
1594
+ 102
1595
+ 103
1596
+ 104
1597
+ 105</pre>
1598
+ </td>
1599
+ <td>
1600
+ <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 102</span>
1601
+
1602
+ <span class='kw'>def</span> <span class='id identifier rubyid_dns_update'>dns_update</span>
1603
+ <span class='ivar'>@logger</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Flushing DNS cache and resolvers ...</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1604
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_execute_command'>execute_command</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>dscacheutil -flushcache</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1605
+ <span class='kw'>end</span></pre>
1606
+ </td>
1607
+ </tr>
1608
+ </table>
1609
+ </div>
1610
+
1611
+ <div class="method_details ">
1612
+ <h3 class="signature " id="execute_command-instance_method">
1613
+
1614
+ - (<tt>Boolean</tt>) <strong>execute_command</strong>(command)
1615
+
1616
+
1617
+
1618
+
1619
+
1620
+ </h3><div class="docstring">
1621
+ <div class="discussion">
1622
+ <p>Executes a shell command.</p>
1623
+
1624
+
1625
+ </div>
1626
+ </div>
1627
+ <div class="tags">
1628
+ <p class="tag_title">Parameters:</p>
1629
+ <ul class="param">
1630
+
1631
+ <li>
1632
+
1633
+ <span class='name'>command</span>
1634
+
1635
+
1636
+ <span class='type'>(<tt>String</tt>)</span>
1637
+
1638
+
1639
+
1640
+ &mdash;
1641
+ <div class='inline'><p>The command to execute.</p>
1642
+ </div>
1643
+
1644
+ </li>
1645
+
1646
+ </ul>
1647
+
1648
+ <p class="tag_title">Returns:</p>
1649
+ <ul class="return">
1650
+
1651
+ <li>
1652
+
1653
+
1654
+ <span class='type'>(<tt>Boolean</tt>)</span>
1655
+
1656
+
1657
+
1658
+ &mdash;
1659
+ <div class='inline'><p><code>true</code> if command succeeded, <code>false</code> otherwise.</p>
1660
+ </div>
1661
+
1662
+ </li>
1663
+
1664
+ </ul>
1665
+
1666
+ </div><table class="source_code">
1667
+ <tr>
1668
+ <td>
1669
+ <pre class="lines">
1670
+
1671
+
1672
+ 95
1673
+ 96
1674
+ 97</pre>
1675
+ </td>
1676
+ <td>
1677
+ <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 95</span>
1678
+
1679
+ <span class='kw'>def</span> <span class='id identifier rubyid_execute_command'>execute_command</span><span class='lparen'>(</span><span class='id identifier rubyid_command'>command</span><span class='rparen'>)</span>
1680
+ <span class='id identifier rubyid_system'>system</span><span class='lparen'>(</span><span class='id identifier rubyid_command'>command</span><span class='rparen'>)</span>
1681
+ <span class='kw'>end</span></pre>
1682
+ </td>
1683
+ </tr>
1684
+ </table>
1685
+ </div>
1686
+
1687
+ <div class="method_details ">
1688
+ <h3 class="signature " id="get_logger-instance_method">
1689
+
1690
+ - (<tt>Logger</tt>) <strong>get_logger</strong>
1691
+
1692
+
1693
+
1694
+
1695
+
1696
+ </h3><div class="docstring">
1697
+ <div class="discussion">
1698
+ <p>Gets the current logger of the application.</p>
1699
+
1700
+
1701
+ </div>
1702
+ </div>
1703
+ <div class="tags">
1704
+
1705
+ <p class="tag_title">Returns:</p>
1706
+ <ul class="return">
1707
+
1708
+ <li>
1709
+
1710
+
1711
+ <span class='type'>(<tt>Logger</tt>)</span>
1712
+
1713
+
1714
+
1715
+ &mdash;
1716
+ <div class='inline'><p>The current logger of the application.</p>
1717
+ </div>
1718
+
1719
+ </li>
1720
+
1721
+ </ul>
1722
+
1723
+ </div><table class="source_code">
1724
+ <tr>
1725
+ <td>
1726
+ <pre class="lines">
1727
+
1728
+
1729
+ 70
1730
+ 71
1731
+ 72</pre>
1732
+ </td>
1733
+ <td>
1734
+ <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 70</span>
1735
+
1736
+ <span class='kw'>def</span> <span class='id identifier rubyid_get_logger'>get_logger</span>
1737
+ <span class='ivar'>@logger</span> <span class='op'>||=</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>Logger</span><span class='period'>.</span><span class='id identifier rubyid_create'>create</span><span class='lparen'>(</span><span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_foreground'>foreground</span> <span class='op'>?</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>Logger</span><span class='period'>.</span><span class='id identifier rubyid_default_file'>default_file</span> <span class='op'>:</span> <span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_log_file'>log_file</span><span class='comma'>,</span> <span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_log_level'>log_level</span><span class='comma'>,</span> <span class='ivar'>@log_formatter</span><span class='rparen'>)</span>
1738
+ <span class='kw'>end</span></pre>
1739
+ </td>
1740
+ </tr>
1741
+ </table>
1742
+ </div>
1743
+
1744
+ <div class="method_details ">
1745
+ <h3 class="signature " id="is_osx?-instance_method">
1746
+
1747
+ - (<tt>Boolean</tt>) <strong>is_osx?</strong>
1748
+
1749
+
1750
+
1751
+
1752
+
1753
+ </h3><div class="docstring">
1754
+ <div class="discussion">
1755
+ <p>Check if we are running on MacOS X.
1756
+ System services are only available on that platform.</p>
1757
+
1758
+
1759
+ </div>
1760
+ </div>
1761
+ <div class="tags">
1762
+
1763
+ <p class="tag_title">Returns:</p>
1764
+ <ul class="return">
1765
+
1766
+ <li>
1767
+
1768
+
1769
+ <span class='type'>(<tt>Boolean</tt>)</span>
1770
+
1771
+
1772
+
1773
+ &mdash;
1774
+ <div class='inline'><p><code>true</code> if the current platform is MacOS X, <code>false</code> otherwise.</p>
1775
+ </div>
1776
+
1777
+ </li>
1778
+
1779
+ </ul>
1780
+
1781
+ </div><table class="source_code">
1782
+ <tr>
1783
+ <td>
1784
+ <pre class="lines">
1785
+
1786
+
1787
+ 63
1788
+ 64
1789
+ 65</pre>
1790
+ </td>
1791
+ <td>
1792
+ <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 63</span>
1793
+
1794
+ <span class='kw'>def</span> <span class='id identifier rubyid_is_osx?'>is_osx?</span>
1795
+ <span class='op'>::</span><span class='const'>Config</span><span class='op'>::</span><span class='const'>CONFIG</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>host_os</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=~</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^darwin</span><span class='regexp_end'>/</span></span>
1796
+ <span class='kw'>end</span></pre>
1797
+ </td>
1798
+ </tr>
1799
+ </table>
1800
+ </div>
1801
+
1802
+ <div class="method_details ">
1803
+ <h3 class="signature " id="launch_agent_path-instance_method">
1804
+
1805
+ - (<tt>String</tt>) <strong>launch_agent_path</strong>(name = &quot;it.cowtech.devdnsd&quot;)
1806
+
1807
+
1808
+
1809
+
1810
+
1811
+ </h3><div class="docstring">
1812
+ <div class="discussion">
1813
+ <p>Gets the path for the launch agent file.</p>
1814
+
1815
+
1816
+ </div>
1817
+ </div>
1818
+ <div class="tags">
1819
+ <p class="tag_title">Parameters:</p>
1820
+ <ul class="param">
1821
+
1822
+ <li>
1823
+
1824
+ <span class='name'>name</span>
1825
+
1826
+
1827
+ <span class='type'>(<tt>String</tt>)</span>
1828
+
1829
+
1830
+ <em class="default">(defaults to: <tt>&quot;it.cowtech.devdnsd&quot;</tt>)</em>
1831
+
1832
+
1833
+ &mdash;
1834
+ <div class='inline'><p>The base name for the agent.</p>
1835
+ </div>
1836
+
1837
+ </li>
1838
+
1839
+ </ul>
1840
+
1841
+ <p class="tag_title">Returns:</p>
1842
+ <ul class="return">
1843
+
1844
+ <li>
1845
+
1846
+
1847
+ <span class='type'>(<tt>String</tt>)</span>
1848
+
1849
+
1850
+
1851
+ &mdash;
1852
+ <div class='inline'><p>The path for the launch agent file.</p>
1853
+ </div>
1854
+
1855
+ </li>
1856
+
1857
+ </ul>
1858
+
1859
+ </div><table class="source_code">
1860
+ <tr>
1861
+ <td>
1862
+ <pre class="lines">
1863
+
1864
+
1865
+ 87
1866
+ 88
1867
+ 89</pre>
1868
+ </td>
1869
+ <td>
1870
+ <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 87</span>
1871
+
1872
+ <span class='kw'>def</span> <span class='id identifier rubyid_launch_agent_path'>launch_agent_path</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>it.cowtech.devdnsd</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1873
+ <span class='const'>ENV</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>HOME</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/Library/LaunchAgents/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_name'>name</span><span class='rbrace'>}</span><span class='tstring_content'>.plist</span><span class='tstring_end'>&quot;</span></span>
1874
+ <span class='kw'>end</span></pre>
1875
+ </td>
1876
+ </tr>
1877
+ </table>
1878
+ </div>
1879
+
1880
+ <div class="method_details ">
1881
+ <h3 class="signature " id="on_start-instance_method">
1882
+
1883
+ - (<tt>NilClass</tt>) <strong>on_start</strong>
1884
+
1885
+
1886
+
1887
+
1888
+
1889
+ </h3><div class="docstring">
1890
+ <div class="discussion">
1891
+ <p>This method is called when the server starts. By default is a no-op.</p>
1892
+
1893
+
1894
+ </div>
1895
+ </div>
1896
+ <div class="tags">
1897
+
1898
+ <p class="tag_title">Returns:</p>
1899
+ <ul class="return">
1900
+
1901
+ <li>
1902
+
1903
+
1904
+ <span class='type'>(<tt>NilClass</tt>)</span>
1905
+
1906
+
1907
+
1908
+ &mdash;
1909
+ <div class='inline'><p><code>nil</code>.</p>
1910
+ </div>
1911
+
1912
+ </li>
1913
+
1914
+ </ul>
1915
+
1916
+ </div><table class="source_code">
1917
+ <tr>
1918
+ <td>
1919
+ <pre class="lines">
1920
+
1921
+
1922
+ 333
1923
+ 334</pre>
1924
+ </td>
1925
+ <td>
1926
+ <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 333</span>
1927
+
1928
+ <span class='kw'>def</span> <span class='id identifier rubyid_on_start'>on_start</span>
1929
+ <span class='kw'>end</span></pre>
1930
+ </td>
1931
+ </tr>
1932
+ </table>
1933
+ </div>
1934
+
1935
+ <div class="method_details ">
1936
+ <h3 class="signature " id="on_stop-instance_method">
1937
+
1938
+ - (<tt>NilClass</tt>) <strong>on_stop</strong>
1939
+
1940
+
1941
+
1942
+
1943
+
1944
+ </h3><div class="docstring">
1945
+ <div class="discussion">
1946
+ <p>This method is called when the server stop.</p>
1947
+
1948
+
1949
+ </div>
1950
+ </div>
1951
+ <div class="tags">
1952
+
1953
+ <p class="tag_title">Returns:</p>
1954
+ <ul class="return">
1955
+
1956
+ <li>
1957
+
1958
+
1959
+ <span class='type'>(<tt>NilClass</tt>)</span>
1960
+
1961
+
1962
+
1963
+ &mdash;
1964
+ <div class='inline'><p><code>nil</code>.</p>
1965
+ </div>
1966
+
1967
+ </li>
1968
+
1969
+ </ul>
1970
+
1971
+ </div><table class="source_code">
1972
+ <tr>
1973
+ <td>
1974
+ <pre class="lines">
1975
+
1976
+
1977
+ 339
1978
+ 340</pre>
1979
+ </td>
1980
+ <td>
1981
+ <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 339</span>
1982
+
1983
+ <span class='kw'>def</span> <span class='id identifier rubyid_on_stop'>on_stop</span>
1984
+ <span class='kw'>end</span></pre>
1985
+ </td>
1986
+ </tr>
1987
+ </table>
1988
+ </div>
1989
+
1990
+ <div class="method_details ">
1991
+ <h3 class="signature " id="perform_server-instance_method">
1992
+
1993
+ - (<tt>Object</tt>) <strong>perform_server</strong>
1994
+
1995
+
1996
+
1997
+
1998
+
1999
+ </h3><div class="docstring">
2000
+ <div class="discussion">
2001
+ <p>Starts the DNS server.</p>
2002
+
2003
+
2004
+ </div>
2005
+ </div>
2006
+ <div class="tags">
2007
+
2008
+ <p class="tag_title">Returns:</p>
2009
+ <ul class="return">
2010
+
2011
+ <li>
2012
+
2013
+
2014
+ <span class='type'>(<tt>Object</tt>)</span>
2015
+
2016
+
2017
+
2018
+ &mdash;
2019
+ <div class='inline'><p>The result of stop callbacks.</p>
2020
+ </div>
2021
+
2022
+ </li>
2023
+
2024
+ </ul>
2025
+
2026
+ </div><table class="source_code">
2027
+ <tr>
2028
+ <td>
2029
+ <pre class="lines">
2030
+
2031
+
2032
+ 110
2033
+ 111
2034
+ 112
2035
+ 113
2036
+ 114
2037
+ 115
2038
+ 116
2039
+ 117
2040
+ 118
2041
+ 119
2042
+ 120
2043
+ 121
2044
+ 122
2045
+ 123
2046
+ 124
2047
+ 125
2048
+ 126
2049
+ 127
2050
+ 128
2051
+ 129
2052
+ 130
2053
+ 131
2054
+ 132
2055
+ 133
2056
+ 134
2057
+ 135
2058
+ 136
2059
+ 137
2060
+ 138
2061
+ 139
2062
+ 140
2063
+ 141
2064
+ 142
2065
+ 143
2066
+ 144
2067
+ 145
2068
+ 146
2069
+ 147
2070
+ 148
2071
+ 149</pre>
2072
+ </td>
2073
+ <td>
2074
+ <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 110</span>
2075
+
2076
+ <span class='kw'>def</span> <span class='id identifier rubyid_perform_server'>perform_server</span>
2077
+ <span class='const'>RubyDNS</span><span class='op'>::</span><span class='id identifier rubyid_run_server'>run_server</span><span class='lparen'>(</span><span class='symbol'>:listen</span> <span class='op'>=&gt;</span> <span class='lbracket'>[</span><span class='lbracket'>[</span><span class='symbol'>:udp</span><span class='comma'>,</span> <span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_address'>address</span><span class='comma'>,</span> <span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_port'>port</span><span class='period'>.</span><span class='id identifier rubyid_to_integer'>to_integer</span><span class='rbracket'>]</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='kw'>do</span>
2078
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_logger'>logger</span> <span class='op'>=</span> <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>Application</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span><span class='period'>.</span><span class='id identifier rubyid_logger'>logger</span>
2079
+
2080
+ <span class='id identifier rubyid_match'>match</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>.+</span><span class='regexp_end'>/</span></span><span class='comma'>,</span> <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>Application</span><span class='op'>::</span><span class='const'>ANY_CLASSES</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_match_data'>match_data</span><span class='comma'>,</span> <span class='id identifier rubyid_transaction'>transaction</span><span class='op'>|</span>
2081
+ <span class='id identifier rubyid_transaction'>transaction</span><span class='period'>.</span><span class='id identifier rubyid_append_question!'>append_question!</span>
2082
+
2083
+ <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>Application</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span><span class='period'>.</span><span class='id identifier rubyid_config'>config</span><span class='period'>.</span><span class='id identifier rubyid_rules'>rules</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_rule'>rule</span><span class='op'>|</span>
2084
+ <span class='kw'>begin</span>
2085
+ <span class='comment'># Get the subset of handled class that is valid for the rule
2086
+ </span> <span class='id identifier rubyid_resource_classes'>resource_classes</span> <span class='op'>=</span> <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>Application</span><span class='op'>::</span><span class='const'>ANY_CLASSES</span> <span class='op'>&amp;</span> <span class='id identifier rubyid_rule'>rule</span><span class='period'>.</span><span class='id identifier rubyid_resource_class'>resource_class</span><span class='period'>.</span><span class='id identifier rubyid_ensure_array'>ensure_array</span>
2087
+ <span class='id identifier rubyid_resource_classes'>resource_classes</span> <span class='op'>=</span> <span class='id identifier rubyid_resource_classes'>resource_classes</span> <span class='op'>&amp;</span> <span class='lbracket'>[</span><span class='id identifier rubyid_transaction'>transaction</span><span class='period'>.</span><span class='id identifier rubyid_resource_class'>resource_class</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_transaction'>transaction</span><span class='period'>.</span><span class='id identifier rubyid_resource_class'>resource_class</span> <span class='op'>!=</span> <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>Application</span><span class='op'>::</span><span class='const'>ANY_REQUEST</span>
2088
+
2089
+ <span class='kw'>if</span> <span class='id identifier rubyid_resource_classes'>resource_classes</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='kw'>then</span>
2090
+ <span class='id identifier rubyid_resource_classes'>resource_classes</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_resource_class'>resource_class</span><span class='op'>|</span> <span class='comment'># Now for every class
2091
+ </span> <span class='id identifier rubyid_matches'>matches</span> <span class='op'>=</span> <span class='id identifier rubyid_rule'>rule</span><span class='period'>.</span><span class='id identifier rubyid_match_host'>match_host</span><span class='lparen'>(</span><span class='id identifier rubyid_match_data'>match_data</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='rparen'>)</span>
2092
+ <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>Application</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span><span class='period'>.</span><span class='id identifier rubyid_process_rule'>process_rule</span><span class='lparen'>(</span><span class='id identifier rubyid_rule'>rule</span><span class='comma'>,</span> <span class='id identifier rubyid_resource_class'>resource_class</span><span class='comma'>,</span> <span class='id identifier rubyid_rule'>rule</span><span class='period'>.</span><span class='id identifier rubyid_is_regexp?'>is_regexp?</span> <span class='op'>?</span> <span class='id identifier rubyid_matches'>matches</span> <span class='op'>:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_transaction'>transaction</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_matches'>matches</span>
2093
+ <span class='kw'>end</span>
2094
+ <span class='kw'>end</span>
2095
+ <span class='kw'>rescue</span> <span class='op'>::</span><span class='const'>Exception</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_e'>e</span>
2096
+ <span class='id identifier rubyid_raise'>raise</span> <span class='id identifier rubyid_e'>e</span>
2097
+ <span class='kw'>end</span>
2098
+ <span class='kw'>end</span>
2099
+ <span class='kw'>end</span>
2100
+
2101
+ <span class='comment'># Default DNS handler
2102
+ </span> <span class='id identifier rubyid_otherwise'>otherwise</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_transaction'>transaction</span><span class='op'>|</span>
2103
+ <span class='id identifier rubyid_transaction'>transaction</span><span class='period'>.</span><span class='id identifier rubyid_failure!'>failure!</span><span class='lparen'>(</span><span class='symbol'>:NXDomain</span><span class='rparen'>)</span>
2104
+ <span class='kw'>end</span>
2105
+
2106
+ <span class='comment'># Attach event handlers
2107
+ </span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_on'>on</span><span class='lparen'>(</span><span class='symbol'>:start</span><span class='rparen'>)</span> <span class='kw'>do</span>
2108
+ <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>Application</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span><span class='period'>.</span><span class='id identifier rubyid_on_start'>on_start</span>
2109
+ <span class='kw'>end</span>
2110
+
2111
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_on'>on</span><span class='lparen'>(</span><span class='symbol'>:stop</span><span class='rparen'>)</span> <span class='kw'>do</span>
2112
+ <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>Application</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span><span class='period'>.</span><span class='id identifier rubyid_on_stop'>on_stop</span>
2113
+ <span class='kw'>end</span>
2114
+ <span class='kw'>end</span>
2115
+ <span class='kw'>end</span></pre>
2116
+ </td>
2117
+ </tr>
2118
+ </table>
2119
+ </div>
2120
+
2121
+ <div class="method_details ">
2122
+ <h3 class="signature " id="process_rule-instance_method">
2123
+
2124
+ - (<tt>Object</tt>) <strong>process_rule</strong>(rule, type, match_data, transaction)
2125
+
2126
+
2127
+
2128
+
2129
+
2130
+ </h3><div class="docstring">
2131
+ <div class="discussion">
2132
+ <p>Processes a DNS rule.</p>
2133
+
2134
+
2135
+ </div>
2136
+ </div>
2137
+ <div class="tags">
2138
+ <p class="tag_title">Parameters:</p>
2139
+ <ul class="param">
2140
+
2141
+ <li>
2142
+
2143
+ <span class='name'>rule</span>
2144
+
2145
+
2146
+ <span class='type'>(<tt><span class='object_link'><a href="Rule.html" title="DevDNSd::Rule (class)">Rule</a></span></tt>)</span>
2147
+
2148
+
2149
+
2150
+ &mdash;
2151
+ <div class='inline'><p>The rule to process.</p>
2152
+ </div>
2153
+
2154
+ </li>
2155
+
2156
+ <li>
2157
+
2158
+ <span class='name'>type</span>
2159
+
2160
+
2161
+ <span class='type'>(<tt>Class</tt>)</span>
2162
+
2163
+
2164
+
2165
+ &mdash;
2166
+ <div class='inline'><p>The type of request.</p>
2167
+ </div>
2168
+
2169
+ </li>
2170
+
2171
+ <li>
2172
+
2173
+ <span class='name'>match_data</span>
2174
+
2175
+
2176
+ <span class='type'>(<tt>MatchData|nil</tt>)</span>
2177
+
2178
+
2179
+
2180
+ &mdash;
2181
+ <div class='inline'><p>If the rule pattern was a Regexp, then this holds the match data, otherwise <code>nil</code> is passed.</p>
2182
+ </div>
2183
+
2184
+ </li>
2185
+
2186
+ <li>
2187
+
2188
+ <span class='name'>transaction</span>
2189
+
2190
+
2191
+ <span class='type'>(<tt>Transaction</tt>)</span>
2192
+
2193
+
2194
+
2195
+ &mdash;
2196
+ <div class='inline'><p>The current DNS transaction (<a href="http://rubydoc.info/gems/rubydns/RubyDNS/Transaction">http://rubydoc.info/gems/rubydns/RubyDNS/Transaction</a>).</p>
2197
+ </div>
2198
+
2199
+ </li>
2200
+
2201
+ </ul>
2202
+
2203
+ <p class="tag_title">Returns:</p>
2204
+ <ul class="return">
2205
+
2206
+ <li>
2207
+
2208
+
2209
+ <span class='type'></span>
2210
+
2211
+
2212
+
2213
+
2214
+ <div class='inline'><p>A reply for the request if matched, otherwise <code>false</code> or <code>nil</code>.</p>
2215
+ </div>
2216
+
2217
+ </li>
2218
+
2219
+ </ul>
2220
+
2221
+ </div><table class="source_code">
2222
+ <tr>
2223
+ <td>
2224
+ <pre class="lines">
2225
+
2226
+
2227
+ 158
2228
+ 159
2229
+ 160
2230
+ 161
2231
+ 162
2232
+ 163
2233
+ 164
2234
+ 165
2235
+ 166
2236
+ 167
2237
+ 168
2238
+ 169
2239
+ 170
2240
+ 171
2241
+ 172
2242
+ 173
2243
+ 174
2244
+ 175
2245
+ 176
2246
+ 177
2247
+ 178
2248
+ 179
2249
+ 180
2250
+ 181
2251
+ 182
2252
+ 183
2253
+ 184
2254
+ 185
2255
+ 186
2256
+ 187
2257
+ 188
2258
+ 189
2259
+ 190
2260
+ 191
2261
+ 192
2262
+ 193
2263
+ 194
2264
+ 195
2265
+ 196
2266
+ 197
2267
+ 198
2268
+ 199
2269
+ 200
2270
+ 201</pre>
2271
+ </td>
2272
+ <td>
2273
+ <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 158</span>
2274
+
2275
+ <span class='kw'>def</span> <span class='id identifier rubyid_process_rule'>process_rule</span><span class='lparen'>(</span><span class='id identifier rubyid_rule'>rule</span><span class='comma'>,</span> <span class='id identifier rubyid_type'>type</span><span class='comma'>,</span> <span class='id identifier rubyid_match_data'>match_data</span><span class='comma'>,</span> <span class='id identifier rubyid_transaction'>transaction</span><span class='rparen'>)</span>
2276
+ <span class='id identifier rubyid_is_regex'>is_regex</span> <span class='op'>=</span> <span class='id identifier rubyid_rule'>rule</span><span class='period'>.</span><span class='id identifier rubyid_match'>match</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Regexp</span><span class='rparen'>)</span>
2277
+ <span class='id identifier rubyid_type'>type</span> <span class='op'>=</span> <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>Rule</span><span class='period'>.</span><span class='id identifier rubyid_resource_class_to_symbol'>resource_class_to_symbol</span><span class='lparen'>(</span><span class='id identifier rubyid_type'>type</span><span class='rparen'>)</span>
2278
+
2279
+ <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>Application</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span><span class='period'>.</span><span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_debug'>debug</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Found match on </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_rule'>rule</span><span class='period'>.</span><span class='id identifier rubyid_match'>match</span><span class='rbrace'>}</span><span class='tstring_content'> with type </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type'>type</span><span class='rbrace'>}</span><span class='tstring_content'>.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
2280
+
2281
+ <span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_rule'>rule</span><span class='period'>.</span><span class='id identifier rubyid_block'>block</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='kw'>then</span>
2282
+ <span class='id identifier rubyid_reply'>reply</span> <span class='op'>=</span> <span class='id identifier rubyid_rule'>rule</span><span class='period'>.</span><span class='id identifier rubyid_block'>block</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_match_data'>match_data</span><span class='comma'>,</span> <span class='id identifier rubyid_type'>type</span><span class='comma'>,</span> <span class='id identifier rubyid_transaction'>transaction</span><span class='rparen'>)</span>
2283
+ <span class='kw'>else</span>
2284
+ <span class='id identifier rubyid_reply'>reply</span> <span class='op'>=</span> <span class='id identifier rubyid_rule'>rule</span><span class='period'>.</span><span class='id identifier rubyid_reply'>reply</span>
2285
+ <span class='kw'>end</span>
2286
+
2287
+ <span class='kw'>if</span> <span class='id identifier rubyid_is_regex'>is_regex</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_reply'>reply</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_match_data'>match_data</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span> <span class='kw'>then</span>
2288
+ <span class='id identifier rubyid_reply'>reply</span> <span class='op'>=</span> <span class='id identifier rubyid_match_data'>match_data</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='id identifier rubyid_rule'>rule</span><span class='period'>.</span><span class='id identifier rubyid_match'>match</span><span class='comma'>,</span> <span class='id identifier rubyid_reply'>reply</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>$</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\\</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
2289
+ <span class='kw'>end</span>
2290
+
2291
+ <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>Application</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span><span class='period'>.</span><span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_debug'>debug</span><span class='lparen'>(</span><span class='id identifier rubyid_reply'>reply</span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Reply is </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_reply'>reply</span><span class='rbrace'>}</span><span class='tstring_content'> with type </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type'>type</span><span class='rbrace'>}</span><span class='tstring_content'>.</span><span class='tstring_end'>&quot;</span></span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>No reply found.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
2292
+
2293
+ <span class='kw'>if</span> <span class='id identifier rubyid_reply'>reply</span> <span class='kw'>then</span>
2294
+ <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='id identifier rubyid_rule'>rule</span><span class='period'>.</span><span class='id identifier rubyid_options'>options</span>
2295
+
2296
+ <span class='id identifier rubyid_final_reply'>final_reply</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
2297
+
2298
+ <span class='kw'>case</span> <span class='id identifier rubyid_type'>type</span>
2299
+ <span class='kw'>when</span> <span class='symbol'>:MX</span>
2300
+ <span class='id identifier rubyid_preference'>preference</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:preference</span><span class='rparen'>)</span>
2301
+ <span class='id identifier rubyid_preference'>preference</span> <span class='op'>=</span> <span class='id identifier rubyid_preference'>preference</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>?</span> <span class='int'>10</span> <span class='op'>:</span> <span class='id identifier rubyid_preference'>preference</span><span class='period'>.</span><span class='id identifier rubyid_to_integer'>to_integer</span><span class='lparen'>(</span><span class='int'>10</span><span class='rparen'>)</span>
2302
+ <span class='id identifier rubyid_final_reply'>final_reply</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_preference'>preference</span>
2303
+ <span class='kw'>end</span>
2304
+
2305
+ <span class='kw'>if</span> <span class='lbracket'>[</span><span class='symbol'>:A</span><span class='comma'>,</span> <span class='symbol'>:AAAA</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_type'>type</span><span class='rparen'>)</span> <span class='kw'>then</span>
2306
+ <span class='id identifier rubyid_final_reply'>final_reply</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_reply'>reply</span>
2307
+ <span class='kw'>else</span>
2308
+ <span class='id identifier rubyid_final_reply'>final_reply</span> <span class='op'>&lt;&lt;</span> <span class='const'>Resolv</span><span class='op'>::</span><span class='const'>DNS</span><span class='op'>::</span><span class='const'>Name</span><span class='period'>.</span><span class='id identifier rubyid_create'>create</span><span class='lparen'>(</span><span class='id identifier rubyid_reply'>reply</span><span class='rparen'>)</span>
2309
+ <span class='kw'>end</span>
2310
+
2311
+ <span class='id identifier rubyid_final_reply'>final_reply</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='lbrace'>{</span><span class='symbol'>:resource_class</span> <span class='op'>=&gt;</span> <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>Rule</span><span class='period'>.</span><span class='id identifier rubyid_symbol_to_resource_class'>symbol_to_resource_class</span><span class='lparen'>(</span><span class='id identifier rubyid_type'>type</span><span class='rparen'>)</span><span class='rbrace'>}</span><span class='rparen'>)</span>
2312
+ <span class='id identifier rubyid_transaction'>transaction</span><span class='period'>.</span><span class='id identifier rubyid_respond!'>respond!</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_final_reply'>final_reply</span><span class='rparen'>)</span>
2313
+ <span class='kw'>elsif</span> <span class='id identifier rubyid_reply'>reply</span> <span class='op'>==</span> <span class='kw'>false</span> <span class='kw'>then</span>
2314
+ <span class='kw'>false</span>
2315
+ <span class='kw'>else</span>
2316
+ <span class='id identifier rubyid_reply'>reply</span>
2317
+ <span class='kw'>end</span>
2318
+ <span class='kw'>end</span></pre>
2319
+ </td>
2320
+ </tr>
2321
+ </table>
2322
+ </div>
2323
+
2324
+ <div class="method_details ">
2325
+ <h3 class="signature " id="resolver_path-instance_method">
2326
+
2327
+ - (<tt>String</tt>) <strong>resolver_path</strong>(tld = nil)
2328
+
2329
+
2330
+
2331
+
2332
+
2333
+ </h3><div class="docstring">
2334
+ <div class="discussion">
2335
+ <p>Gets the path for the resolver file.</p>
2336
+
2337
+
2338
+ </div>
2339
+ </div>
2340
+ <div class="tags">
2341
+ <p class="tag_title">Parameters:</p>
2342
+ <ul class="param">
2343
+
2344
+ <li>
2345
+
2346
+ <span class='name'>tld</span>
2347
+
2348
+
2349
+ <span class='type'>(<tt>String</tt>)</span>
2350
+
2351
+
2352
+ <em class="default">(defaults to: <tt>nil</tt>)</em>
2353
+
2354
+
2355
+ &mdash;
2356
+ <div class='inline'><p>The TLD to manage.</p>
2357
+ </div>
2358
+
2359
+ </li>
2360
+
2361
+ </ul>
2362
+
2363
+ <p class="tag_title">Returns:</p>
2364
+ <ul class="return">
2365
+
2366
+ <li>
2367
+
2368
+
2369
+ <span class='type'>(<tt>String</tt>)</span>
2370
+
2371
+
2372
+
2373
+ &mdash;
2374
+ <div class='inline'><p>The path for the resolver file.</p>
2375
+ </div>
2376
+
2377
+ </li>
2378
+
2379
+ </ul>
2380
+
2381
+ </div><table class="source_code">
2382
+ <tr>
2383
+ <td>
2384
+ <pre class="lines">
2385
+
2386
+
2387
+ 78
2388
+ 79
2389
+ 80
2390
+ 81</pre>
2391
+ </td>
2392
+ <td>
2393
+ <pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 78</span>
2394
+
2395
+ <span class='kw'>def</span> <span class='id identifier rubyid_resolver_path'>resolver_path</span><span class='lparen'>(</span><span class='id identifier rubyid_tld'>tld</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
2396
+ <span class='id identifier rubyid_tld'>tld</span> <span class='op'>||=</span> <span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_tld'>tld</span>
2397
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/etc/resolver/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_tld'>tld</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span>
2398
+ <span class='kw'>end</span></pre>
2399
+ </td>
2400
+ </tr>
2401
+ </table>
2402
+ </div>
2403
+
2404
+ </div>
2405
+
2406
+ </div>
2407
+
2408
+ <div id="footer">
2409
+ Generated on Wed Aug 22 13:48:32 2012 by
2410
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
2411
+ 0.8.2.1 (ruby-1.9.2).
2412
+ </div>
2413
+
2414
+ </body>
2415
+ </html>