devdnsd 2.2.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.travis-gemfile +6 -4
- data/.travis.yml +1 -1
- data/Gemfile +6 -5
- data/README.md +1 -0
- data/devdnsd.gemspec +2 -2
- data/doc/DevDNSd.html +3 -3
- data/doc/DevDNSd/Application.html +57 -57
- data/doc/DevDNSd/ApplicationMethods.html +3 -3
- data/doc/DevDNSd/ApplicationMethods/Server.html +16 -16
- data/doc/DevDNSd/ApplicationMethods/System.html +10 -10
- data/doc/DevDNSd/ApplicationMethods/System/ClassMethods.html +6 -6
- data/doc/DevDNSd/Configuration.html +10 -12
- data/doc/DevDNSd/Errors.html +3 -3
- data/doc/DevDNSd/Errors/InvalidRule.html +3 -3
- data/doc/DevDNSd/Rule.html +37 -37
- data/doc/DevDNSd/Version.html +4 -4
- data/doc/_index.html +4 -4
- data/doc/class_list.html +1 -0
- data/doc/file.README.html +5 -4
- data/doc/file_list.html +2 -1
- data/doc/frames.html +1 -1
- data/doc/index.html +5 -4
- data/doc/js/full_list.js +5 -5
- data/doc/method_list.html +1 -0
- data/doc/top-level-namespace.html +3 -3
- data/lib/devdnsd/application.rb +33 -34
- data/lib/devdnsd/configuration.rb +6 -7
- data/lib/devdnsd/rule.rb +6 -6
- data/lib/devdnsd/version.rb +1 -1
- data/spec/coverage_helper.rb +3 -0
- data/spec/devdnsd/application_spec.rb +149 -134
- metadata +7 -7
data/doc/DevDNSd/Version.html
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<title>
|
|
7
7
|
Module: DevDNSd::Version
|
|
8
8
|
|
|
9
|
-
— Documentation by YARD 0.8.6
|
|
9
|
+
— Documentation by YARD 0.8.6.2
|
|
10
10
|
|
|
11
11
|
</title>
|
|
12
12
|
|
|
@@ -134,7 +134,7 @@
|
|
|
134
134
|
|
|
135
135
|
</div>
|
|
136
136
|
</dt>
|
|
137
|
-
<dd><pre class="code"><span class='int'>
|
|
137
|
+
<dd><pre class="code"><span class='int'>3</span></pre></dd>
|
|
138
138
|
|
|
139
139
|
<dt id="PATCH-constant" class="">PATCH =
|
|
140
140
|
<div class="docstring">
|
|
@@ -180,9 +180,9 @@
|
|
|
180
180
|
</div>
|
|
181
181
|
|
|
182
182
|
<div id="footer">
|
|
183
|
-
Generated on
|
|
183
|
+
Generated on Sun Jul 14 18:03:53 2013 by
|
|
184
184
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
185
|
-
0.8.6 (ruby-1.9.3).
|
|
185
|
+
0.8.6.2 (ruby-1.9.3).
|
|
186
186
|
</div>
|
|
187
187
|
|
|
188
188
|
</body>
|
data/doc/_index.html
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<head>
|
|
5
5
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
6
6
|
<title>
|
|
7
|
-
Documentation by YARD 0.8.6
|
|
7
|
+
Documentation by YARD 0.8.6.2
|
|
8
8
|
|
|
9
9
|
</title>
|
|
10
10
|
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
|
|
57
57
|
<iframe id="search_frame"></iframe>
|
|
58
58
|
|
|
59
|
-
<div id="content"><h1 class="noborder title">Documentation by YARD 0.8.6</h1>
|
|
59
|
+
<div id="content"><h1 class="noborder title">Documentation by YARD 0.8.6.2</h1>
|
|
60
60
|
<div id="listing">
|
|
61
61
|
<h1 class="alphaindex">Alphabetic Index</h1>
|
|
62
62
|
|
|
@@ -230,9 +230,9 @@
|
|
|
230
230
|
</div>
|
|
231
231
|
|
|
232
232
|
<div id="footer">
|
|
233
|
-
Generated on
|
|
233
|
+
Generated on Sun Jul 14 18:03:53 2013 by
|
|
234
234
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
235
|
-
0.8.6 (ruby-1.9.3).
|
|
235
|
+
0.8.6.2 (ruby-1.9.3).
|
|
236
236
|
</div>
|
|
237
237
|
|
|
238
238
|
</body>
|
data/doc/class_list.html
CHANGED
data/doc/file.README.html
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<title>
|
|
7
7
|
File: README
|
|
8
8
|
|
|
9
|
-
— Documentation by YARD 0.8.6
|
|
9
|
+
— Documentation by YARD 0.8.6.2
|
|
10
10
|
|
|
11
11
|
</title>
|
|
12
12
|
|
|
@@ -66,7 +66,8 @@
|
|
|
66
66
|
<p><a href="http://badge.fury.io/rb/devdnsd"><img src="https://badge.fury.io/rb/devdnsd.png" alt="Gem Version" /></a>
|
|
67
67
|
<a href="https://gemnasium.com/ShogunPanda/devdnsd"><img src="https://gemnasium.com/ShogunPanda/devdnsd.png?travis" alt="Dependency Status" /></a>
|
|
68
68
|
<a href="http://travis-ci.org/ShogunPanda/devdnsd"><img src="https://secure.travis-ci.org/ShogunPanda/devdnsd.png?branch=master" alt="Build Status" /></a>
|
|
69
|
-
<a href="https://codeclimate.com/github/ShogunPanda/devdnsd"><img src="https://codeclimate.com/github/ShogunPanda/devdnsd.png" alt="Code Climate" /></a
|
|
69
|
+
<a href="https://codeclimate.com/github/ShogunPanda/devdnsd"><img src="https://codeclimate.com/github/ShogunPanda/devdnsd.png" alt="Code Climate" /></a>
|
|
70
|
+
<a href="https://coveralls.io/r/ShogunPanda/devdnsd"><img src="https://coveralls.io/repos/ShogunPanda/devdnsd/badge.png" alt="Coverage Status" /></a></p>
|
|
70
71
|
|
|
71
72
|
<p>A small DNS server to enable local .dev domain resolution.</p>
|
|
72
73
|
|
|
@@ -162,9 +163,9 @@ This argument is ignored if you pass the block, as it assumes that the second ar
|
|
|
162
163
|
</div></div>
|
|
163
164
|
|
|
164
165
|
<div id="footer">
|
|
165
|
-
Generated on
|
|
166
|
+
Generated on Sun Jul 14 18:03:53 2013 by
|
|
166
167
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
167
|
-
0.8.6 (ruby-1.9.3).
|
|
168
|
+
0.8.6.2 (ruby-1.9.3).
|
|
168
169
|
</div>
|
|
169
170
|
|
|
170
171
|
</body>
|
data/doc/file_list.html
CHANGED
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
<script type="text/javascript" charset="utf-8" src="js/full_list.js"></script>
|
|
16
16
|
|
|
17
17
|
|
|
18
|
+
<title>File List</title>
|
|
18
19
|
<base id="base_target" target="_parent" />
|
|
19
20
|
</head>
|
|
20
21
|
<body>
|
|
@@ -46,7 +47,7 @@
|
|
|
46
47
|
<ul id="full_list" class="file">
|
|
47
48
|
|
|
48
49
|
|
|
49
|
-
<li class="r1"><a href="index.html" title="README">README</a></li>
|
|
50
|
+
<li class="r1"><span class="object_link"><a href="index.html" title="README">README</a></a></li>
|
|
50
51
|
|
|
51
52
|
|
|
52
53
|
</ul>
|
data/doc/frames.html
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
5
5
|
<head>
|
|
6
6
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
|
7
|
-
<title>Documentation by YARD 0.8.6</title>
|
|
7
|
+
<title>Documentation by YARD 0.8.6.2</title>
|
|
8
8
|
</head>
|
|
9
9
|
<script type="text/javascript" charset="utf-8">
|
|
10
10
|
window.onload = function() {
|
data/doc/index.html
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<title>
|
|
7
7
|
File: README
|
|
8
8
|
|
|
9
|
-
— Documentation by YARD 0.8.6
|
|
9
|
+
— Documentation by YARD 0.8.6.2
|
|
10
10
|
|
|
11
11
|
</title>
|
|
12
12
|
|
|
@@ -66,7 +66,8 @@
|
|
|
66
66
|
<p><a href="http://badge.fury.io/rb/devdnsd"><img src="https://badge.fury.io/rb/devdnsd.png" alt="Gem Version" /></a>
|
|
67
67
|
<a href="https://gemnasium.com/ShogunPanda/devdnsd"><img src="https://gemnasium.com/ShogunPanda/devdnsd.png?travis" alt="Dependency Status" /></a>
|
|
68
68
|
<a href="http://travis-ci.org/ShogunPanda/devdnsd"><img src="https://secure.travis-ci.org/ShogunPanda/devdnsd.png?branch=master" alt="Build Status" /></a>
|
|
69
|
-
<a href="https://codeclimate.com/github/ShogunPanda/devdnsd"><img src="https://codeclimate.com/github/ShogunPanda/devdnsd.png" alt="Code Climate" /></a
|
|
69
|
+
<a href="https://codeclimate.com/github/ShogunPanda/devdnsd"><img src="https://codeclimate.com/github/ShogunPanda/devdnsd.png" alt="Code Climate" /></a>
|
|
70
|
+
<a href="https://coveralls.io/r/ShogunPanda/devdnsd"><img src="https://coveralls.io/repos/ShogunPanda/devdnsd/badge.png" alt="Coverage Status" /></a></p>
|
|
70
71
|
|
|
71
72
|
<p>A small DNS server to enable local .dev domain resolution.</p>
|
|
72
73
|
|
|
@@ -162,9 +163,9 @@ This argument is ignored if you pass the block, as it assumes that the second ar
|
|
|
162
163
|
</div></div>
|
|
163
164
|
|
|
164
165
|
<div id="footer">
|
|
165
|
-
Generated on
|
|
166
|
+
Generated on Sun Jul 14 18:03:53 2013 by
|
|
166
167
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
167
|
-
0.8.6 (ruby-1.9.3).
|
|
168
|
+
0.8.6.2 (ruby-1.9.3).
|
|
168
169
|
</div>
|
|
169
170
|
|
|
170
171
|
</body>
|
data/doc/js/full_list.js
CHANGED
|
@@ -111,11 +111,11 @@ clicked = null;
|
|
|
111
111
|
function linkList() {
|
|
112
112
|
$('#full_list li, #full_list li a:last').click(function(evt) {
|
|
113
113
|
if ($(this).hasClass('toggle')) return true;
|
|
114
|
-
if ($(this).find('.object_link a').length === 0) {
|
|
115
|
-
$(this).children('a.toggle').click();
|
|
116
|
-
return false;
|
|
117
|
-
}
|
|
118
114
|
if (this.tagName.toLowerCase() == "li") {
|
|
115
|
+
if ($(this).find('.object_link a').length === 0) {
|
|
116
|
+
$(this).children('a.toggle').click();
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
119
|
var toggle = $(this).children('a.toggle');
|
|
120
120
|
if (toggle.size() > 0 && evt.pageX < toggle.offset().left) {
|
|
121
121
|
toggle.click();
|
|
@@ -125,7 +125,7 @@ function linkList() {
|
|
|
125
125
|
if (clicked) clicked.removeClass('clicked');
|
|
126
126
|
var win = window.top.frames.main ? window.top.frames.main : window.parent;
|
|
127
127
|
if (this.tagName.toLowerCase() == "a") {
|
|
128
|
-
clicked = $(this).
|
|
128
|
+
clicked = $(this).parents('li').addClass('clicked');
|
|
129
129
|
win.location = this.href;
|
|
130
130
|
}
|
|
131
131
|
else {
|
data/doc/method_list.html
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<title>
|
|
7
7
|
Top Level Namespace
|
|
8
8
|
|
|
9
|
-
— Documentation by YARD 0.8.6
|
|
9
|
+
— Documentation by YARD 0.8.6.2
|
|
10
10
|
|
|
11
11
|
</title>
|
|
12
12
|
|
|
@@ -103,9 +103,9 @@
|
|
|
103
103
|
</div>
|
|
104
104
|
|
|
105
105
|
<div id="footer">
|
|
106
|
-
Generated on
|
|
106
|
+
Generated on Sun Jul 14 18:03:53 2013 by
|
|
107
107
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
108
|
-
0.8.6 (ruby-1.9.3).
|
|
108
|
+
0.8.6.2 (ruby-1.9.3).
|
|
109
109
|
</div>
|
|
110
110
|
|
|
111
111
|
</body>
|
data/lib/devdnsd/application.rb
CHANGED
|
@@ -18,21 +18,21 @@ module DevDNSd
|
|
|
18
18
|
#
|
|
19
19
|
# @return [String] The name of the daemon.
|
|
20
20
|
def daemon_name
|
|
21
|
-
File.basename(
|
|
21
|
+
File.basename(instance.config.pid_file, ".pid")
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
# Returns the standard location of the PID file.
|
|
25
25
|
#
|
|
26
26
|
# @return [String] The standard location of the PID file.
|
|
27
27
|
def pid_directory
|
|
28
|
-
File.dirname(
|
|
28
|
+
File.dirname(instance.config.pid_file)
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
# Returns the complete path of the PID file.
|
|
32
32
|
#
|
|
33
33
|
# @return [String] The complete path of the PID file.
|
|
34
34
|
def pid_fn
|
|
35
|
-
|
|
35
|
+
instance.config.pid_file
|
|
36
36
|
end
|
|
37
37
|
end
|
|
38
38
|
|
|
@@ -65,8 +65,8 @@ module DevDNSd
|
|
|
65
65
|
#
|
|
66
66
|
# @return [Boolean] `true` if command succeeded, `false` otherwise.
|
|
67
67
|
def dns_update
|
|
68
|
-
@logger.info(
|
|
69
|
-
|
|
68
|
+
@logger.info(i18n.dns_update)
|
|
69
|
+
execute_command("dscacheutil -flushcache")
|
|
70
70
|
end
|
|
71
71
|
|
|
72
72
|
# Checks if we are running on MacOS X.
|
|
@@ -82,14 +82,14 @@ module DevDNSd
|
|
|
82
82
|
#
|
|
83
83
|
# @return [Boolean] `true` if action succeeded, `false` otherwise.
|
|
84
84
|
def action_start
|
|
85
|
-
|
|
85
|
+
get_logger.info(i18n.starting)
|
|
86
86
|
|
|
87
87
|
if !Process.respond_to?(:fork) then
|
|
88
|
-
|
|
88
|
+
logger.warn(i18n.no_fork)
|
|
89
89
|
@config.foreground = true
|
|
90
90
|
end
|
|
91
91
|
|
|
92
|
-
@config.foreground ?
|
|
92
|
+
@config.foreground ? perform_server : RExec::Daemon::Controller.start(self.class)
|
|
93
93
|
true
|
|
94
94
|
end
|
|
95
95
|
|
|
@@ -105,14 +105,14 @@ module DevDNSd
|
|
|
105
105
|
#
|
|
106
106
|
# @return [Boolean] `true` if action succeeded, `false` otherwise.
|
|
107
107
|
def action_install
|
|
108
|
-
manage_installation(
|
|
108
|
+
manage_installation(launch_agent_path, resolver_path, :create_resolver, :create_agent, :load_agent)
|
|
109
109
|
end
|
|
110
110
|
|
|
111
111
|
# Uninstalls the application from the autolaunch.
|
|
112
112
|
#
|
|
113
113
|
# @return [Boolean] `true` if action succeeded, `false` otherwise.
|
|
114
114
|
def action_uninstall
|
|
115
|
-
manage_installation(
|
|
115
|
+
manage_installation(launch_agent_path, resolver_path, :delete_resolver, :unload_agent, :delete_agent)
|
|
116
116
|
end
|
|
117
117
|
|
|
118
118
|
private
|
|
@@ -129,7 +129,7 @@ module DevDNSd
|
|
|
129
129
|
rv = send(first_operation, launch_agent, resolver_path) if rv
|
|
130
130
|
rv = send(second_operation, launch_agent, resolver_path) if rv
|
|
131
131
|
rv = send(third_operation, launch_agent, resolver_path) if rv
|
|
132
|
-
|
|
132
|
+
dns_update
|
|
133
133
|
rv
|
|
134
134
|
end
|
|
135
135
|
|
|
@@ -141,11 +141,11 @@ module DevDNSd
|
|
|
141
141
|
# @return [Boolean] `true` if the file have been deleted, `false` otherwise.
|
|
142
142
|
def delete_file(file, before_message, error_message)
|
|
143
143
|
begin
|
|
144
|
-
|
|
144
|
+
logger.info(i18n.send(before_message, file))
|
|
145
145
|
::File.delete(file)
|
|
146
146
|
true
|
|
147
|
-
rescue
|
|
148
|
-
|
|
147
|
+
rescue
|
|
148
|
+
logger.warn(i18n.send(error_message))
|
|
149
149
|
false
|
|
150
150
|
end
|
|
151
151
|
end
|
|
@@ -155,8 +155,8 @@ module DevDNSd
|
|
|
155
155
|
# @return [Boolean] `true` if the agent is enabled, `false` otherwise.
|
|
156
156
|
def check_agent_available
|
|
157
157
|
rv = true
|
|
158
|
-
if !
|
|
159
|
-
logger.fatal(
|
|
158
|
+
if !is_osx? then
|
|
159
|
+
logger.fatal(i18n.no_agent)
|
|
160
160
|
rv = false
|
|
161
161
|
end
|
|
162
162
|
|
|
@@ -169,11 +169,11 @@ module DevDNSd
|
|
|
169
169
|
# @return [Boolean] `true` if operation succeeded, `false` otherwise.
|
|
170
170
|
def create_resolver(_, resolver_path)
|
|
171
171
|
begin
|
|
172
|
-
|
|
172
|
+
logger.info(i18n.resolver_creating(resolver_path))
|
|
173
173
|
write_resolver(resolver_path)
|
|
174
174
|
true
|
|
175
175
|
rescue
|
|
176
|
-
|
|
176
|
+
logger.error(i18n.resolver_creating_error)
|
|
177
177
|
false
|
|
178
178
|
end
|
|
179
179
|
end
|
|
@@ -203,17 +203,16 @@ module DevDNSd
|
|
|
203
203
|
# @return [Boolean] `true` if operation succeeded, `false` otherwise.
|
|
204
204
|
def create_agent(launch_agent, _)
|
|
205
205
|
begin
|
|
206
|
-
|
|
206
|
+
logger.info(i18n.agent_creating(launch_agent))
|
|
207
207
|
write_agent(launch_agent)
|
|
208
|
-
|
|
208
|
+
execute_command("plutil -convert binary1 \"#{launch_agent}\"")
|
|
209
209
|
true
|
|
210
210
|
rescue
|
|
211
|
-
|
|
211
|
+
logger.error(i18n.agent_creating_error)
|
|
212
212
|
false
|
|
213
213
|
end
|
|
214
214
|
end
|
|
215
215
|
|
|
216
|
-
|
|
217
216
|
# Writes a OSX system agent.
|
|
218
217
|
#
|
|
219
218
|
# @param launch_agent [String] The agent path.
|
|
@@ -258,11 +257,11 @@ module DevDNSd
|
|
|
258
257
|
# @return [Boolean] `true` if operation succeeded, `false` otherwise.
|
|
259
258
|
def toggle_agent(launch_agent, operation, info_message, error_message, error_level)
|
|
260
259
|
begin
|
|
261
|
-
|
|
262
|
-
|
|
260
|
+
logger.info(i18n.send(info_message, launch_agent))
|
|
261
|
+
execute_command("launchctl #{operation} -w \"#{launch_agent}\" > /dev/null 2>&1")
|
|
263
262
|
true
|
|
264
263
|
rescue
|
|
265
|
-
|
|
264
|
+
logger.send(error_level, i18n.send(error_message))
|
|
266
265
|
false
|
|
267
266
|
end
|
|
268
267
|
end
|
|
@@ -285,8 +284,8 @@ module DevDNSd
|
|
|
285
284
|
|
|
286
285
|
# Default DNS handler and event handlers
|
|
287
286
|
otherwise { |transaction| transaction.failure!(:NXDomain) }
|
|
288
|
-
|
|
289
|
-
|
|
287
|
+
on(:start) { application.on_start }
|
|
288
|
+
on(:stop) { application.on_stop }
|
|
290
289
|
end
|
|
291
290
|
end
|
|
292
291
|
|
|
@@ -298,7 +297,7 @@ module DevDNSd
|
|
|
298
297
|
# @param transaction [RubyDNS::Transaction] The current DNS transaction (http://rubydoc.info/gems/rubydns/RubyDNS/Transaction).
|
|
299
298
|
def process_rule(rule, type, match_data, transaction)
|
|
300
299
|
reply, type = perform_process_rule(rule, type, match_data, transaction)
|
|
301
|
-
|
|
300
|
+
logger.debug(reply ? i18n.reply(reply, type) : i18n.no_reply)
|
|
302
301
|
|
|
303
302
|
if reply then
|
|
304
303
|
transaction.respond!(*finalize_reply(reply, rule, type))
|
|
@@ -322,7 +321,7 @@ module DevDNSd
|
|
|
322
321
|
if resource_classes.present? then
|
|
323
322
|
resource_classes.each do |resource_class| # Now for every class
|
|
324
323
|
matches = rule.match_host(match_data[0])
|
|
325
|
-
|
|
324
|
+
process_rule(rule, resource_class, rule.is_regexp? ? matches : nil, transaction) if matches
|
|
326
325
|
end
|
|
327
326
|
end
|
|
328
327
|
end
|
|
@@ -340,7 +339,7 @@ module DevDNSd
|
|
|
340
339
|
reply = !rule.block.nil? ? rule.block.call(match_data, type, transaction) : rule.reply
|
|
341
340
|
reply = match_data[0].gsub(rule.match, reply.gsub("$", "\\")) if rule.match.is_a?(::Regexp) && reply && match_data[0]
|
|
342
341
|
|
|
343
|
-
|
|
342
|
+
logger.debug(i18n.match(rule.match, type))
|
|
344
343
|
[reply, type]
|
|
345
344
|
end
|
|
346
345
|
|
|
@@ -390,7 +389,7 @@ module DevDNSd
|
|
|
390
389
|
# @param command [Mamertes::Command] The current Mamertes command.
|
|
391
390
|
# @param locale [Symbol] The locale to use for the application.
|
|
392
391
|
def initialize(command, locale)
|
|
393
|
-
|
|
392
|
+
i18n_setup(:devdnsd, ::File.absolute_path(::Pathname.new(::File.dirname(__FILE__)).to_s + "/../../locales/"))
|
|
394
393
|
self.i18n = locale
|
|
395
394
|
|
|
396
395
|
@locale = locale
|
|
@@ -442,7 +441,7 @@ module DevDNSd
|
|
|
442
441
|
#
|
|
443
442
|
# @see #perform_server
|
|
444
443
|
def self.run
|
|
445
|
-
|
|
444
|
+
instance.perform_server
|
|
446
445
|
end
|
|
447
446
|
|
|
448
447
|
# Stops the application.
|
|
@@ -466,9 +465,9 @@ module DevDNSd
|
|
|
466
465
|
begin
|
|
467
466
|
@config = DevDNSd::Configuration.new(options["configuration"], options, @logger)
|
|
468
467
|
@logger = nil
|
|
469
|
-
@logger =
|
|
468
|
+
@logger = get_logger
|
|
470
469
|
rescue Bovem::Errors::InvalidConfiguration => e
|
|
471
|
-
@logger ? @logger.fatal(e.message) : Bovem::Logger.create("STDERR").fatal(
|
|
470
|
+
@logger ? @logger.fatal(e.message) : Bovem::Logger.create("STDERR").fatal(i18n.logging_failed(log_file))
|
|
472
471
|
raise ::SystemExit
|
|
473
472
|
end
|
|
474
473
|
end
|
|
@@ -47,13 +47,13 @@ module DevDNSd
|
|
|
47
47
|
super(file, overrides, logger)
|
|
48
48
|
|
|
49
49
|
# Make sure some arguments are of correct type
|
|
50
|
-
self.log_file = $stdout if
|
|
51
|
-
self.log_file = $stderr if
|
|
52
|
-
self.port =
|
|
53
|
-
self.log_level =
|
|
50
|
+
self.log_file = $stdout if log_file == "STDOUT"
|
|
51
|
+
self.log_file = $stderr if log_file == "STDERR"
|
|
52
|
+
self.port = port.to_integer
|
|
53
|
+
self.log_level = log_level.to_integer
|
|
54
54
|
|
|
55
55
|
# Add a default rule
|
|
56
|
-
|
|
56
|
+
add_rule(/.+/, "127.0.0.1") if rules.blank?
|
|
57
57
|
end
|
|
58
58
|
|
|
59
59
|
# Adds a rule to the configuration.
|
|
@@ -63,8 +63,7 @@ module DevDNSd
|
|
|
63
63
|
# @return [Array] The current set of rule.
|
|
64
64
|
# @see Rule.create
|
|
65
65
|
def add_rule(*args, &block)
|
|
66
|
-
|
|
67
|
-
@rules << DevDNSd::Rule.create(*args, &block)
|
|
66
|
+
rules << DevDNSd::Rule.create(*args, &block)
|
|
68
67
|
end
|
|
69
68
|
end
|
|
70
69
|
end
|