barnyard_dns 0.0.1

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.
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in barnyard_dns.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Jon Gillies
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,29 @@
1
+ # BarnyardDns
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'barnyard_dns'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install barnyard_dns
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
@@ -0,0 +1,26 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "barnyard_dns/version"
4
+
5
+ Gem::Specification.new do |gem|
6
+ gem.name = "barnyard_dns"
7
+ gem.version = BarnyardDns::VERSION
8
+ gem.authors = ["Jon Gillies"]
9
+ gem.email = %w(supercoder@gmail.com)
10
+ gem.description = %q{This gem provides access to the DNS objects for use with BarnyardHarvester.}
11
+ gem.summary = %q{Please check the README.md for more information.}
12
+ gem.homepage = "https://github.com/jongillies/barnyard/tree/master/barnyard_dns"
13
+
14
+ gem.rubyforge_project = "barnyard_dns"
15
+
16
+ gem.files = `git ls-files`.split("\n")
17
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ gem.require_paths = %w(lib)
20
+
21
+ # specify any dependencies here; for example:
22
+ gem.add_development_dependency "rspec"
23
+ gem.add_runtime_dependency "barnyard_harvester"
24
+ gem.add_runtime_dependency "dnsruby"
25
+
26
+ end
@@ -0,0 +1,51 @@
1
+ require "barnyard_dns/version"
2
+
3
+ require "barnyard_harvester"
4
+ require "json"
5
+ require "dnsruby"
6
+
7
+ module BarnyardDns
8
+
9
+ class DnsObject
10
+
11
+ attr_reader :synchronizer, :began_at, :ended_at
12
+
13
+ def initialize(args)
14
+
15
+ @began_at = Time.now
16
+
17
+ @debug = args.fetch(:debug) { false }
18
+ @log = args.fetch(:logger) { Logger.new(STDOUT) }
19
+
20
+ @zone = args.fetch(:zone) { raise "You must provide the :zone to transfer." }
21
+
22
+ @log.debug JSON.pretty_generate(args)
23
+
24
+ @synchronizer = BarnyardHarvester::Sync.new(args)
25
+
26
+ @synchronizer.run do
27
+
28
+ zt = Dnsruby::ZoneTransfer.new
29
+ zt.transfer_type = Dnsruby::Types.AXFR
30
+ zone = zt.transfer(@zone)
31
+
32
+ next if zone.nil?
33
+
34
+ zone.each do |rec|
35
+
36
+ @synchronizer.process rec.name, rec
37
+
38
+ end
39
+
40
+ end
41
+
42
+ @log.info @synchronizer.stats
43
+
44
+ end
45
+
46
+ @ended_at = Time.now
47
+
48
+ end
49
+
50
+ end
51
+
@@ -0,0 +1,3 @@
1
+ module BarnyardDns
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,33 @@
1
+ require "barnyard_dns"
2
+ require "logger"
3
+
4
+ describe BarnyardDns do
5
+
6
+ it "all should work" do
7
+
8
+ my_logger = Logger.new(STDOUT)
9
+ my_logger.level = Logger::INFO
10
+
11
+ REDIS_SETTINGS = {
12
+ :host => "localhost",
13
+ :port => 6379,
14
+ }
15
+
16
+ RABBITMQ_SETTINGS = {
17
+ :host => "localhost"
18
+ # :port => 6163
19
+ }
20
+
21
+ BarnyardDns::DnsObject.new(
22
+ zone: "example.com",
23
+ crop_number: 2,
24
+ logger: my_logger,
25
+ redis_settings: REDIS_SETTINGS,
26
+ rabbitmq_settings: RABBITMQ_SETTINGS,
27
+ backend: :redis,
28
+ queueing: :rabbitmq,
29
+ debug: true)
30
+
31
+ end
32
+
33
+ end
metadata ADDED
@@ -0,0 +1,88 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: barnyard_dns
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Jon Gillies
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-12-06 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rspec
16
+ requirement: &70311978644540 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: *70311978644540
25
+ - !ruby/object:Gem::Dependency
26
+ name: barnyard_harvester
27
+ requirement: &70311978641760 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *70311978641760
36
+ - !ruby/object:Gem::Dependency
37
+ name: dnsruby
38
+ requirement: &70311978640240 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :runtime
45
+ prerelease: false
46
+ version_requirements: *70311978640240
47
+ description: This gem provides access to the DNS objects for use with BarnyardHarvester.
48
+ email:
49
+ - supercoder@gmail.com
50
+ executables: []
51
+ extensions: []
52
+ extra_rdoc_files: []
53
+ files:
54
+ - .gitignore
55
+ - Gemfile
56
+ - LICENSE
57
+ - README.md
58
+ - Rakefile
59
+ - barnyard_dns.gemspec
60
+ - lib/barnyard_dns.rb
61
+ - lib/barnyard_dns/version.rb
62
+ - spec/dns_spec.rb
63
+ homepage: https://github.com/jongillies/barnyard/tree/master/barnyard_dns
64
+ licenses: []
65
+ post_install_message:
66
+ rdoc_options: []
67
+ require_paths:
68
+ - lib
69
+ required_ruby_version: !ruby/object:Gem::Requirement
70
+ none: false
71
+ requirements:
72
+ - - ! '>='
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ required_rubygems_version: !ruby/object:Gem::Requirement
76
+ none: false
77
+ requirements:
78
+ - - ! '>='
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ requirements: []
82
+ rubyforge_project: barnyard_dns
83
+ rubygems_version: 1.8.11
84
+ signing_key:
85
+ specification_version: 3
86
+ summary: Please check the README.md for more information.
87
+ test_files:
88
+ - spec/dns_spec.rb