bind9mgr 0.2.7 → 0.2.8

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -8,3 +8,12 @@
8
8
 
9
9
  * don't fail if there is missing zone db files
10
10
  * specs update
11
+
12
+ === 0.2.7 / 2011-09-16
13
+
14
+ * bugfix release
15
+
16
+ === 0.2.8 / 2011-09-17
17
+
18
+ * Bind9mgr::NamedConf#load_one( zone_name ) method added
19
+ * specs update
data/lib/bind9mgr.rb CHANGED
@@ -6,7 +6,7 @@ require File.join( File.dirname(__FILE__), 'resource_record' )
6
6
  require File.join( File.dirname(__FILE__), 'parser' )
7
7
 
8
8
  module Bind9mgr
9
- VERSION = '0.2.7'
9
+ VERSION = '0.2.8'
10
10
 
11
11
  ZONES_BIND_SUBDIR = 'primary'
12
12
 
data/lib/named_conf.rb CHANGED
@@ -32,6 +32,16 @@ module Bind9mgr
32
32
  parse File.read( @file ) if File.exists?(@file)
33
33
  end
34
34
 
35
+ # Load just one zone and return it
36
+ def load_one( zone_name )
37
+ raise ArgumentError, "Zone name expected to be a string" unless zone_name.kind_of? String
38
+ load
39
+ if zone = zones.find{ |z| z.name == zone_name }
40
+ zone.load
41
+ end
42
+ zone
43
+ end
44
+
35
45
  def load_with_zones
36
46
  load
37
47
  zones.each{ |z| z.load}
data/lib/zone.rb CHANGED
@@ -49,7 +49,6 @@ module Bind9mgr
49
49
 
50
50
  def load
51
51
  raise ArgumentError, "file not specified" unless @file
52
-
53
52
 
54
53
  # TODO what should we do if there is no db file?
55
54
  # raise ArgumentError, "File: #{file} not found." unless File.exists?( @file )
@@ -181,6 +181,21 @@ alias1 IN CNAME ns
181
181
  pending "should automatically make dir for zone db files"
182
182
  pending "should have methods to edit SOA values"
183
183
 
184
+ it "should have method to load just one zone" do
185
+ @nc.should respond_to :load_one
186
+ end
187
+
188
+ it "should load one zone on load_one call" do
189
+ Bind9mgr::Zone.any_instance.should_receive(:load).once
190
+ zone = @nc.load_one 'cloud.ru'
191
+ end
192
+
193
+ it "should return loadl zone on load_one call" do
194
+ zone = @nc.load_one 'cloud.ru'
195
+ zone.should be_kind_of Bind9mgr::Zone
196
+ zone.records.count.should > 0
197
+ end
198
+
184
199
  it "'load!' should raise error if named conf file is missing" do
185
200
  @nc.file = "missing.file"
186
201
  expect{ @nc.load! }.to raise_error
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bind9mgr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.2.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,12 +9,12 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-09-16 00:00:00.000000000 +04:00
12
+ date: 2011-09-17 00:00:00.000000000 +04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: hoe
17
- requirement: &13259340 !ruby/object:Gem::Requirement
17
+ requirement: &14356860 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ~>
@@ -22,7 +22,7 @@ dependencies:
22
22
  version: '2.12'
23
23
  type: :development
24
24
  prerelease: false
25
- version_requirements: *13259340
25
+ version_requirements: *14356860
26
26
  description: This gem contains some classes to manage bind9 zone files
27
27
  email:
28
28
  - mikhail@mad-box.ru