dns_guru 0.1 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/Rakefile +1 -1
  2. data/init.rb +17 -2
  3. data/rails/init.rb +17 -2
  4. metadata +1 -1
data/Rakefile CHANGED
@@ -23,7 +23,7 @@ PKG_FILES = FileList[
23
23
 
24
24
  spec = Gem::Specification.new do |s|
25
25
  s.name = "dns_guru"
26
- s.version = "0.1"
26
+ s.version = "0.1.1"
27
27
  s.author = "Dns Guru"
28
28
  s.email = "ken.miller@gmail.com"
29
29
  s.homepage = "http://github.com/kemiller/dns_guru"
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
- config_file = File.join(File.dirname(__FILE__), "../../../config/hosts.rb")
8
- DnsGuru.init(config_file)
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
- config_file = File.join(File.dirname(__FILE__), "../../../config/hosts.rb")
8
- DnsGuru.init(config_file)
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dns_guru
3
3
  version: !ruby/object:Gem::Version
4
- version: "0.1"
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dns Guru