splicer 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.
- data/.gitignore +17 -0
- data/.rspec +2 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +28 -0
- data/Rakefile +10 -0
- data/lib/splicer/errors.rb +8 -0
- data/lib/splicer/provider.rb +11 -0
- data/lib/splicer/records/a_record.rb +17 -0
- data/lib/splicer/records/aaaa_record.rb +17 -0
- data/lib/splicer/records/cname_record.rb +17 -0
- data/lib/splicer/records/mx_record.rb +19 -0
- data/lib/splicer/records/ns_record.rb +17 -0
- data/lib/splicer/records/ptr_record.rb +17 -0
- data/lib/splicer/records/record.rb +16 -0
- data/lib/splicer/records/spf_record.rb +17 -0
- data/lib/splicer/records/srv_record.rb +23 -0
- data/lib/splicer/records/txt_record.rb +17 -0
- data/lib/splicer/records.rb +15 -0
- data/lib/splicer/version.rb +3 -0
- data/lib/splicer/zone.rb +27 -0
- data/lib/splicer.rb +63 -0
- data/spec/spec_helper.rb +6 -0
- data/spec/splicer/records/a_record_spec.rb +16 -0
- data/spec/splicer/records/aaaa_record_spec.rb +16 -0
- data/spec/splicer/records/cname_record_spec.rb +15 -0
- data/spec/splicer/records/mx_record_spec.rb +17 -0
- data/spec/splicer/records/ns_record_spec.rb +15 -0
- data/spec/splicer/records/ptr_record_spec.rb +15 -0
- data/spec/splicer/records/record_spec.rb +13 -0
- data/spec/splicer/records/spf_record_spec.rb +15 -0
- data/spec/splicer/records/srv_record_spec.rb +21 -0
- data/spec/splicer/records/txt_record_spec.rb +15 -0
- data/spec/splicer/zone_spec.rb +35 -0
- data/spec/splicer_spec.rb +31 -0
- data/splicer.gemspec +24 -0
- metadata +151 -0
data/.gitignore
ADDED
data/.rspec
ADDED
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
splice
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.9.3
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Matthew Johnston
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# Splicer
|
2
|
+
|
3
|
+
Allows for interactions with multiple DNS' through one abstract API. You can use
|
4
|
+
this to talk to one or more DNS providers if you choose.
|
5
|
+
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
gem 'splicer'
|
12
|
+
|
13
|
+
|
14
|
+
## Configuring
|
15
|
+
|
16
|
+
TODO: Write this
|
17
|
+
|
18
|
+
|
19
|
+
## Using
|
20
|
+
|
21
|
+
TODO: Write this
|
22
|
+
|
23
|
+
|
24
|
+
## Contributions
|
25
|
+
|
26
|
+
Any and all contributions are welcome. Be sure to create a feature branch and
|
27
|
+
send pull requests. Always, always, run `rspec spec` or `rake` to ensure that
|
28
|
+
all tests are passing.
|
data/Rakefile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
module Splicer
|
2
|
+
module Records
|
3
|
+
|
4
|
+
class ARecord < Record
|
5
|
+
attr_accessor :ip
|
6
|
+
|
7
|
+
# @param [String] name the relative name
|
8
|
+
# @param [String] ip the IPv4
|
9
|
+
# @param [Integer] ttl the TTL in seconds
|
10
|
+
def initialize(name, ip, ttl=300)
|
11
|
+
super(name, ttl)
|
12
|
+
@ip = ip
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Splicer
|
2
|
+
module Records
|
3
|
+
|
4
|
+
class AAAARecord < Record
|
5
|
+
attr_accessor :ip
|
6
|
+
|
7
|
+
# @param [String] name the relative name
|
8
|
+
# @param [String] ip the IPv6 address
|
9
|
+
# @param [Integer] ttl the TTL in seconds
|
10
|
+
def initialize(name, ip, ttl=300)
|
11
|
+
super(name, ttl)
|
12
|
+
@ip = ip
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Splicer
|
2
|
+
module Records
|
3
|
+
|
4
|
+
class CNAMERecord < Record
|
5
|
+
attr_accessor :cname
|
6
|
+
|
7
|
+
# @param [String] name the relative name
|
8
|
+
# @param [String] cname the alias (fqdn)
|
9
|
+
# @param [Integer] ttl the TTL in seconds
|
10
|
+
def initialize(name, cname, ttl=300)
|
11
|
+
super(name, ttl)
|
12
|
+
@cname = cname
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Splicer
|
2
|
+
module Records
|
3
|
+
|
4
|
+
class MXRecord < Record
|
5
|
+
attr_accessor :exchanger, :priority
|
6
|
+
|
7
|
+
# @param [String] name the relative name
|
8
|
+
# @param [String] exchanger the mail exchanger(fqdn)
|
9
|
+
# @param [Integer] priority the priority
|
10
|
+
# @param [Integer] ttl the TTL in seconds
|
11
|
+
def initialize(name, exchanger, priority=0, ttl=300)
|
12
|
+
super(name, ttl)
|
13
|
+
@exchanger = exchanger
|
14
|
+
@priority = priority
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Splicer
|
2
|
+
module Records
|
3
|
+
|
4
|
+
class NSRecord < Record
|
5
|
+
attr_accessor :server
|
6
|
+
|
7
|
+
# @param [String] name relative name
|
8
|
+
# @param [String] server name server (fqdn)
|
9
|
+
# @param [Integer] ttl TTL in seconds
|
10
|
+
def initialize(name, server, ttl=300)
|
11
|
+
super(name, ttl)
|
12
|
+
@server = server
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Splicer
|
2
|
+
module Records
|
3
|
+
|
4
|
+
class PTRRecord < Record
|
5
|
+
attr_accessor :host
|
6
|
+
|
7
|
+
# @param [String] name the relative name
|
8
|
+
# @param [String] host the host name (fqdn)
|
9
|
+
# @param [Integer] ttl the TTL in seconds
|
10
|
+
def initialize(name, host, ttl=300)
|
11
|
+
super(name, ttl)
|
12
|
+
@host = host
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Splicer
|
2
|
+
module Records
|
3
|
+
|
4
|
+
class Record
|
5
|
+
attr_accessor :name, :ttl
|
6
|
+
|
7
|
+
# @param [String] name the relative name
|
8
|
+
# @param [Integer] ttl the TTL in seconds
|
9
|
+
def initialize(name, ttl)
|
10
|
+
@name = name
|
11
|
+
@ttl = ttl
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Splicer
|
2
|
+
module Records
|
3
|
+
|
4
|
+
class SPFRecord < Record
|
5
|
+
attr_accessor :text
|
6
|
+
|
7
|
+
# @param [String] name the relative name
|
8
|
+
# @param [String] text the text
|
9
|
+
# @param [Integer] ttl the TTL in seconds
|
10
|
+
def initialize(name, text, ttl=300)
|
11
|
+
super(name, ttl)
|
12
|
+
@text = text
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Splicer
|
2
|
+
module Records
|
3
|
+
|
4
|
+
class SRVRecord < Record
|
5
|
+
attr_accessor :target, :port, :priority, :weight
|
6
|
+
|
7
|
+
# @param [String] name the relative name
|
8
|
+
# @param [String] target the host name(fqdn)
|
9
|
+
# @param [Integer] port the port number
|
10
|
+
# @param [String] priority the priority
|
11
|
+
# @param [Integer] weight the weight
|
12
|
+
# @param [Integer] ttl the TTL in seconds
|
13
|
+
def initialize(name, target, port, priority=0, weight=0, ttl=300)
|
14
|
+
super(name, ttl)
|
15
|
+
@target = target
|
16
|
+
@port = port
|
17
|
+
@priority = priority
|
18
|
+
@weight = weight
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Splicer
|
2
|
+
module Records
|
3
|
+
|
4
|
+
class TXTRecord < Record
|
5
|
+
attr_accessor :text
|
6
|
+
|
7
|
+
# @param [String] name the relative name
|
8
|
+
# @param [String] text the text
|
9
|
+
# @param [Integer] ttl the TTL in seconds
|
10
|
+
def initialize(name, text, ttl=300)
|
11
|
+
super(name, ttl)
|
12
|
+
@text = text
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Splicer
|
2
|
+
module Records
|
3
|
+
end
|
4
|
+
end
|
5
|
+
|
6
|
+
require 'splicer/records/record'
|
7
|
+
require 'splicer/records/a_record'
|
8
|
+
require 'splicer/records/aaaa_record'
|
9
|
+
require 'splicer/records/cname_record'
|
10
|
+
require 'splicer/records/mx_record'
|
11
|
+
require 'splicer/records/ns_record'
|
12
|
+
require 'splicer/records/ptr_record'
|
13
|
+
require 'splicer/records/spf_record'
|
14
|
+
require 'splicer/records/srv_record'
|
15
|
+
require 'splicer/records/txt_record'
|
data/lib/splicer/zone.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
module Splicer
|
2
|
+
|
3
|
+
class Zone
|
4
|
+
attr_accessor :name
|
5
|
+
|
6
|
+
attr_reader :records
|
7
|
+
|
8
|
+
# @param [String] name the name of the zone
|
9
|
+
def initialize(name)
|
10
|
+
@name = name
|
11
|
+
@records = Array.new
|
12
|
+
end
|
13
|
+
|
14
|
+
# Adds a single record to this zone
|
15
|
+
# @return [void]
|
16
|
+
def add_record(record)
|
17
|
+
@records.push(record)
|
18
|
+
end
|
19
|
+
|
20
|
+
# Adds a set of records to this zone
|
21
|
+
# @return [void]
|
22
|
+
def add_records(records)
|
23
|
+
@records.concat(records)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
data/lib/splicer.rb
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'splicer/version'
|
2
|
+
require 'splicer/errors'
|
3
|
+
require 'splicer/records'
|
4
|
+
require 'splicer/zone'
|
5
|
+
require 'splicer/provider'
|
6
|
+
|
7
|
+
# Splicer is a simple DNS data structure that allows you to publish changes to
|
8
|
+
# one or more dns services if desired.
|
9
|
+
#
|
10
|
+
# This was constructed with the need for a way to transition from one dns host
|
11
|
+
# to another and allow for a failover solution should your primary provider go
|
12
|
+
# down.
|
13
|
+
#
|
14
|
+
# Note: You will still have to manually point your name servers over to the new
|
15
|
+
# provider.
|
16
|
+
#
|
17
|
+
# == Available Providers
|
18
|
+
#
|
19
|
+
# * splicer-dynect
|
20
|
+
# * splicer-dns_made_easy
|
21
|
+
#
|
22
|
+
# == Example Configureation
|
23
|
+
#
|
24
|
+
# Splicer.configure do |config|
|
25
|
+
# config.add_provider Splicer::Dynect('company','user','password')
|
26
|
+
# config.add_provider Splicer::DNSMadeEasy('user','password')
|
27
|
+
# end
|
28
|
+
#
|
29
|
+
# @see Splicer::Provider for more information
|
30
|
+
#
|
31
|
+
# @author Matthew A. Johnston <warmwaffles@gmail.com>
|
32
|
+
module Splicer
|
33
|
+
class << self
|
34
|
+
# All of the available providers
|
35
|
+
@@providers = {}
|
36
|
+
|
37
|
+
# Configure Splicer
|
38
|
+
def configure
|
39
|
+
yield self
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
# Add a DNS provider to your
|
44
|
+
#
|
45
|
+
# @raise [ArgumentError]
|
46
|
+
# @param [Splicer::Provider] provider the provider you want to add
|
47
|
+
# @return [Splicer::Provider]
|
48
|
+
def self.register(provider)
|
49
|
+
providers[provider.name] = provider
|
50
|
+
end
|
51
|
+
|
52
|
+
# Get a provider from the providers hash. If the provider is not found `nil`
|
53
|
+
# will be returned
|
54
|
+
#
|
55
|
+
# @return [Splicer::Provider]
|
56
|
+
def self.provider(name)
|
57
|
+
providers[name]
|
58
|
+
end
|
59
|
+
|
60
|
+
def self.providers
|
61
|
+
@@providers ||= {}
|
62
|
+
end
|
63
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Splicer::Records::ARecord do
|
4
|
+
let(:ip) { '127.0.0.1' }
|
5
|
+
let(:record) { Splicer::Records::ARecord.new('test', ip, 300) }
|
6
|
+
|
7
|
+
describe 'fields' do
|
8
|
+
subject { record }
|
9
|
+
it { should respond_to :name }
|
10
|
+
it { should respond_to :name= }
|
11
|
+
it { should respond_to :ip }
|
12
|
+
it { should respond_to :ip= }
|
13
|
+
it { should respond_to :ttl }
|
14
|
+
it { should respond_to :ttl= }
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Splicer::Records::AAAARecord do
|
4
|
+
let(:ip) { '2607:f0d0:1002:0051:0000:0000:0000:0004' }
|
5
|
+
let(:record) { Splicer::Records::ARecord.new('test', ip, 300) }
|
6
|
+
|
7
|
+
describe 'fields' do
|
8
|
+
subject { record }
|
9
|
+
it { should respond_to :name }
|
10
|
+
it { should respond_to :name= }
|
11
|
+
it { should respond_to :ip }
|
12
|
+
it { should respond_to :ip= }
|
13
|
+
it { should respond_to :ttl }
|
14
|
+
it { should respond_to :ttl= }
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Splicer::Records::CNAMERecord do
|
4
|
+
let(:record) { Splicer::Records::CNAMERecord.new('test', 'example.com', 300) }
|
5
|
+
|
6
|
+
describe 'fields' do
|
7
|
+
subject { record }
|
8
|
+
it { should respond_to :name }
|
9
|
+
it { should respond_to :name= }
|
10
|
+
it { should respond_to :cname }
|
11
|
+
it { should respond_to :cname= }
|
12
|
+
it { should respond_to :ttl }
|
13
|
+
it { should respond_to :ttl= }
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Splicer::Records::MXRecord do
|
4
|
+
let(:record) { Splicer::Records::MXRecord.new('example.com', "mx.another.com", 10, 300) }
|
5
|
+
|
6
|
+
describe 'fields' do
|
7
|
+
subject { record }
|
8
|
+
it { should respond_to :name }
|
9
|
+
it { should respond_to :name= }
|
10
|
+
it { should respond_to :exchanger }
|
11
|
+
it { should respond_to :exchanger= }
|
12
|
+
it { should respond_to :priority }
|
13
|
+
it { should respond_to :priority= }
|
14
|
+
it { should respond_to :ttl }
|
15
|
+
it { should respond_to :ttl= }
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Splicer::Records::NSRecord do
|
4
|
+
let(:record) { Splicer::Records::NSRecord.new('test', 'ns1.dns.com', 300) }
|
5
|
+
|
6
|
+
describe 'fields' do
|
7
|
+
subject { record }
|
8
|
+
it { should respond_to :name }
|
9
|
+
it { should respond_to :name= }
|
10
|
+
it { should respond_to :server }
|
11
|
+
it { should respond_to :server= }
|
12
|
+
it { should respond_to :ttl }
|
13
|
+
it { should respond_to :ttl= }
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Splicer::Records::PTRRecord do
|
4
|
+
let(:record) { Splicer::Records::PTRRecord.new('test', 'server.example.com', 300) }
|
5
|
+
|
6
|
+
describe 'fields' do
|
7
|
+
subject { record }
|
8
|
+
it { should respond_to :name }
|
9
|
+
it { should respond_to :name= }
|
10
|
+
it { should respond_to :host }
|
11
|
+
it { should respond_to :host= }
|
12
|
+
it { should respond_to :ttl }
|
13
|
+
it { should respond_to :ttl= }
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Splicer::Records::Record do
|
4
|
+
let(:record) { Splicer::Records::Record.new('test', 300) }
|
5
|
+
|
6
|
+
describe 'fields' do
|
7
|
+
subject { record }
|
8
|
+
it { should respond_to :name }
|
9
|
+
it { should respond_to :name= }
|
10
|
+
it { should respond_to :ttl }
|
11
|
+
it { should respond_to :ttl= }
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Splicer::Records::SPFRecord do
|
4
|
+
let(:record) { Splicer::Records::SPFRecord.new('example.com', 'v=spf1 a mx include:_spf.google.com ~all', 300) }
|
5
|
+
|
6
|
+
describe 'fields' do
|
7
|
+
subject { record }
|
8
|
+
it { should respond_to :name }
|
9
|
+
it { should respond_to :name= }
|
10
|
+
it { should respond_to :text }
|
11
|
+
it { should respond_to :text= }
|
12
|
+
it { should respond_to :ttl }
|
13
|
+
it { should respond_to :ttl= }
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Splicer::Records::SRVRecord do
|
4
|
+
let(:record) { Splicer::Records::SRVRecord.new("_sip._tcp", "sipserver.example.com", 5060, 1, 1, 300) }
|
5
|
+
|
6
|
+
describe 'fields' do
|
7
|
+
subject { record }
|
8
|
+
it { should respond_to :name }
|
9
|
+
it { should respond_to :name= }
|
10
|
+
it { should respond_to :target }
|
11
|
+
it { should respond_to :target= }
|
12
|
+
it { should respond_to :port }
|
13
|
+
it { should respond_to :port= }
|
14
|
+
it { should respond_to :priority }
|
15
|
+
it { should respond_to :priority= }
|
16
|
+
it { should respond_to :weight }
|
17
|
+
it { should respond_to :weight= }
|
18
|
+
it { should respond_to :ttl }
|
19
|
+
it { should respond_to :ttl= }
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Splicer::Records::TXTRecord do
|
4
|
+
let(:record) { Splicer::Records::TXTRecord.new('example.com', 'google-site-verification=vEj1ZcGtXeM_UEjnCqQEhxPSqkS9IQ4PBFuh48FP8o4', 300) }
|
5
|
+
|
6
|
+
describe 'fields' do
|
7
|
+
subject { record }
|
8
|
+
it { should respond_to :name }
|
9
|
+
it { should respond_to :name= }
|
10
|
+
it { should respond_to :text }
|
11
|
+
it { should respond_to :text= }
|
12
|
+
it { should respond_to :ttl }
|
13
|
+
it { should respond_to :ttl= }
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Splicer::Zone do
|
4
|
+
let(:zone) { Splicer::Zone.new('example.com') }
|
5
|
+
|
6
|
+
describe 'fields' do
|
7
|
+
subject { zone }
|
8
|
+
it { should respond_to :name }
|
9
|
+
it { should respond_to :name= }
|
10
|
+
it { should respond_to :records }
|
11
|
+
end
|
12
|
+
describe '#initialize' do
|
13
|
+
subject { zone }
|
14
|
+
its(:name) { should eq('example.com') }
|
15
|
+
its(:records) { should eq([]) }
|
16
|
+
end
|
17
|
+
|
18
|
+
describe '#add_record' do
|
19
|
+
let(:record) { double('ARecord') }
|
20
|
+
|
21
|
+
it "should add the record" do
|
22
|
+
expect { zone.add_record(record) }.to change(zone.records, :count).by(1)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe '#add_records' do
|
27
|
+
let(:cname_record) { double('CNAMERecord') }
|
28
|
+
let(:a_record) { double('ARecord') }
|
29
|
+
|
30
|
+
it "should add the records" do
|
31
|
+
expect { zone.add_records([a_record, cname_record]) }.to change(zone.records, :count).by(2)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Splicer do
|
4
|
+
let(:provider) { double('Splicer::Provider', name: 'someone') }
|
5
|
+
let(:another) { double('Splicer::Provider', name: 'another') }
|
6
|
+
|
7
|
+
describe '.configure' do
|
8
|
+
it "should accept a block" do
|
9
|
+
expect {
|
10
|
+
Splicer.configure do |config|
|
11
|
+
end
|
12
|
+
}.to_not raise_error(StandardError)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
describe '.register' do
|
17
|
+
it "should register a provider" do
|
18
|
+
Splicer.register(provider)
|
19
|
+
expect(Splicer.providers.count).to eq(1)
|
20
|
+
end
|
21
|
+
it "should register more than one provider" do
|
22
|
+
Splicer.register(provider)
|
23
|
+
Splicer.register(another)
|
24
|
+
expect(Splicer.providers.count).to eq(2)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe '.provider' do
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
data/splicer.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'splicer/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "splicer"
|
8
|
+
spec.version = Splicer::VERSION
|
9
|
+
spec.authors = ["Matthew Johnston"]
|
10
|
+
spec.email = ["warmwaffles@gmail.com"]
|
11
|
+
spec.description = %q{Splicer allows communication with one or more dns providers}
|
12
|
+
spec.summary = %q{Splicer allows communication with one or more dns providers}
|
13
|
+
spec.homepage = "https://github.com/warmwaffles/splice"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_development_dependency "rspec"
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,151 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: splicer
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Matthew Johnston
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-05-06 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bundler
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '1.3'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.3'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rake
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rspec
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
description: Splicer allows communication with one or more dns providers
|
63
|
+
email:
|
64
|
+
- warmwaffles@gmail.com
|
65
|
+
executables: []
|
66
|
+
extensions: []
|
67
|
+
extra_rdoc_files: []
|
68
|
+
files:
|
69
|
+
- .gitignore
|
70
|
+
- .rspec
|
71
|
+
- .ruby-gemset
|
72
|
+
- .ruby-version
|
73
|
+
- Gemfile
|
74
|
+
- LICENSE.txt
|
75
|
+
- README.md
|
76
|
+
- Rakefile
|
77
|
+
- lib/splicer.rb
|
78
|
+
- lib/splicer/errors.rb
|
79
|
+
- lib/splicer/provider.rb
|
80
|
+
- lib/splicer/records.rb
|
81
|
+
- lib/splicer/records/a_record.rb
|
82
|
+
- lib/splicer/records/aaaa_record.rb
|
83
|
+
- lib/splicer/records/cname_record.rb
|
84
|
+
- lib/splicer/records/mx_record.rb
|
85
|
+
- lib/splicer/records/ns_record.rb
|
86
|
+
- lib/splicer/records/ptr_record.rb
|
87
|
+
- lib/splicer/records/record.rb
|
88
|
+
- lib/splicer/records/spf_record.rb
|
89
|
+
- lib/splicer/records/srv_record.rb
|
90
|
+
- lib/splicer/records/txt_record.rb
|
91
|
+
- lib/splicer/version.rb
|
92
|
+
- lib/splicer/zone.rb
|
93
|
+
- spec/spec_helper.rb
|
94
|
+
- spec/splicer/records/a_record_spec.rb
|
95
|
+
- spec/splicer/records/aaaa_record_spec.rb
|
96
|
+
- spec/splicer/records/cname_record_spec.rb
|
97
|
+
- spec/splicer/records/mx_record_spec.rb
|
98
|
+
- spec/splicer/records/ns_record_spec.rb
|
99
|
+
- spec/splicer/records/ptr_record_spec.rb
|
100
|
+
- spec/splicer/records/record_spec.rb
|
101
|
+
- spec/splicer/records/spf_record_spec.rb
|
102
|
+
- spec/splicer/records/srv_record_spec.rb
|
103
|
+
- spec/splicer/records/txt_record_spec.rb
|
104
|
+
- spec/splicer/zone_spec.rb
|
105
|
+
- spec/splicer_spec.rb
|
106
|
+
- splicer.gemspec
|
107
|
+
homepage: https://github.com/warmwaffles/splice
|
108
|
+
licenses:
|
109
|
+
- MIT
|
110
|
+
post_install_message:
|
111
|
+
rdoc_options: []
|
112
|
+
require_paths:
|
113
|
+
- lib
|
114
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
115
|
+
none: false
|
116
|
+
requirements:
|
117
|
+
- - ! '>='
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '0'
|
120
|
+
segments:
|
121
|
+
- 0
|
122
|
+
hash: -20106687361328625
|
123
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
124
|
+
none: false
|
125
|
+
requirements:
|
126
|
+
- - ! '>='
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: '0'
|
129
|
+
segments:
|
130
|
+
- 0
|
131
|
+
hash: -20106687361328625
|
132
|
+
requirements: []
|
133
|
+
rubyforge_project:
|
134
|
+
rubygems_version: 1.8.25
|
135
|
+
signing_key:
|
136
|
+
specification_version: 3
|
137
|
+
summary: Splicer allows communication with one or more dns providers
|
138
|
+
test_files:
|
139
|
+
- spec/spec_helper.rb
|
140
|
+
- spec/splicer/records/a_record_spec.rb
|
141
|
+
- spec/splicer/records/aaaa_record_spec.rb
|
142
|
+
- spec/splicer/records/cname_record_spec.rb
|
143
|
+
- spec/splicer/records/mx_record_spec.rb
|
144
|
+
- spec/splicer/records/ns_record_spec.rb
|
145
|
+
- spec/splicer/records/ptr_record_spec.rb
|
146
|
+
- spec/splicer/records/record_spec.rb
|
147
|
+
- spec/splicer/records/spf_record_spec.rb
|
148
|
+
- spec/splicer/records/srv_record_spec.rb
|
149
|
+
- spec/splicer/records/txt_record_spec.rb
|
150
|
+
- spec/splicer/zone_spec.rb
|
151
|
+
- spec/splicer_spec.rb
|