dns_guru 0.1 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/init.rb +17 -2
- data/rails/init.rb +17 -2
- metadata +1 -1
data/Rakefile
CHANGED
data/init.rb
CHANGED
@@ -4,8 +4,23 @@ require 'dns_guru'
|
|
4
4
|
require 'rack'
|
5
5
|
require 'action_controller/test_process'
|
6
6
|
|
7
|
-
|
8
|
-
|
7
|
+
begin
|
8
|
+
config_files = [
|
9
|
+
File.join(File.dirname(__FILE__), "..","..","..","config","hosts.rb"),
|
10
|
+
File.join(File.dirname(__FILE__), "..","..","..","..","config","hosts.rb")
|
11
|
+
]
|
12
|
+
if const_defined?(:Rails)
|
13
|
+
config_files << File.join(Rails.root, "config","hosts.rb")
|
14
|
+
end
|
15
|
+
config_files.detect do |config_file|
|
16
|
+
if File.exists?(config_file)
|
17
|
+
DnsGuru.init(config_file)
|
18
|
+
true
|
19
|
+
end
|
20
|
+
end
|
21
|
+
rescue Exception => e
|
22
|
+
puts "Could not load dns_guru config file (hosts.rb): #{e}"
|
23
|
+
end
|
9
24
|
|
10
25
|
class Rack::Request
|
11
26
|
include DnsGuru::RequestMixin
|
data/rails/init.rb
CHANGED
@@ -4,8 +4,23 @@ require 'dns_guru'
|
|
4
4
|
require 'rack'
|
5
5
|
require 'action_controller/test_process'
|
6
6
|
|
7
|
-
|
8
|
-
|
7
|
+
begin
|
8
|
+
config_files = [
|
9
|
+
File.join(File.dirname(__FILE__), "..","..","..","config","hosts.rb"),
|
10
|
+
File.join(File.dirname(__FILE__), "..","..","..","..","config","hosts.rb")
|
11
|
+
]
|
12
|
+
if const_defined?(:Rails)
|
13
|
+
config_files << File.join(Rails.root, "config","hosts.rb")
|
14
|
+
end
|
15
|
+
config_files.detect do |config_file|
|
16
|
+
if File.exists?(config_file)
|
17
|
+
DnsGuru.init(config_file)
|
18
|
+
true
|
19
|
+
end
|
20
|
+
end
|
21
|
+
rescue Exception => e
|
22
|
+
puts "Could not load dns_guru config file (hosts.rb): #{e}"
|
23
|
+
end
|
9
24
|
|
10
25
|
class Rack::Request
|
11
26
|
include DnsGuru::RequestMixin
|