bind9mgr 0.3.19 → 0.3.20

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +7 -0
  2. data/lib/bind9mgr.rb +1 -1
  3. data/lib/zone.rb +14 -5
  4. data/spec/zone_spec.rb +4 -0
  5. metadata +17 -37
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5e6676cda9641fe24894d669edc034bc94b1fb8f
4
+ data.tar.gz: fb50b0700647050e082f8758a9dcb8a673f19f5f
5
+ SHA512:
6
+ metadata.gz: 3e08996b3298969b0c62ea655beac4c2e5bf841220960b63c3fae127efc25bfea2d9a84f1a2c593579f91855c7457c83f8d18693a6875a47e9328e1e9bbeacf0
7
+ data.tar.gz: d1e3d45bc87a69e5b67604f3dc5606b1496bca31bff7c4e3d36e7033e325982333dfbd4f83567d7b873c2e69c2037283d0ebee4b4d4b166c0e4869488ed95233
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.3.19'
9
+ VERSION = '0.3.20'
10
10
 
11
11
  ZONES_BIND_SUBDIR = 'primary'
12
12
 
data/lib/zone.rb CHANGED
@@ -155,16 +155,25 @@ zone "#{name}" {
155
155
 
156
156
  def ensure_rr record
157
157
  raise ArgumentError, "record expected to be Bind9mgr::ResourceRecord" unless record.kind_of? ResourceRecord
158
- max_rr_cnt = (record.type == 'NS' ? 2 : 1)
159
- cnt = @records.select{ |rr| (rr.owner == record.owner) && (rr.type == record.type) }.count
160
- raise RuntimeError, "Multiple rr with same owner+type detected. zone:#{@origin}" if cnt > max_rr_cnt
161
- return false if cnt == max_rr_cnt
158
+ current_record = @records.find{ |rr| (rr.owner == record.owner) && (rr.type == record.type) && (rr.rdata == record.rdata) }
159
+ return false if current_record
162
160
  @records.push record
163
161
  true
164
162
  end
165
163
 
166
164
  def self.domain_name_syntax_valid( string )
167
- ! string.match(/^([\w\d\-]{2,}\.)+(\w{2,})\.?$/).nil?
165
+ # ! string.match(/^([\w\d\-]{2,}\.)+(\w{2,})\.?$/).nil?
166
+ # ! string.match(/^(((xn--)?[a-z0-9](-?[a-z0-9]+)*\.)+((xn--[a-z0-9](-?[a-z0-9]+)*)|([a-z]{2,})))?$/).nil?
167
+ # ! string.match(/^(([^\W_]+\.)*xn--)?[^\W_]+([-.][^\W_]+)*\.[a-z]{2,6}\.?$/).nil?
168
+
169
+ # TODO Постараться выразить в одном регулярном выражении
170
+ if string.match(/^xn--/)
171
+ ! string.match(/^xn--([a-z0-9](-?[a-z0-9]+)){2,}*\.((xn--[a-z0-9](-?[a-z0-9]+)*)|([a-z]{2,}))?\.?$/).nil?
172
+ elsif string.match(/(com|net|org|biz|me|pro)$/)
173
+ ! string.match(/^([\w\d\-]+\.)+(\w{2,})\.?$/).nil?
174
+ else
175
+ ! string.match(/^([\w\d\-]{2,}\.)+(\w{2,})\.?$/).nil?
176
+ end
168
177
  end
169
178
 
170
179
  def valid?
data/spec/zone_spec.rb CHANGED
@@ -86,6 +86,10 @@ alias1 IN CNAME ns
86
86
  Bind9mgr::Zone.domain_name_syntax_valid( "11qweqwe.ru" ).should be_true
87
87
  Bind9mgr::Zone.domain_name_syntax_valid( "q.r" ).should be_false
88
88
  Bind9mgr::Zone.domain_name_syntax_valid( "q.11" ).should be_false
89
+ Bind9mgr::Zone.domain_name_syntax_valid( "q.me" ).should be_true
90
+ Bind9mgr::Zone.domain_name_syntax_valid( "xn--d1acufc.xn--p1ai" ).should be_true # домен.рф в punycode
91
+ Bind9mgr::Zone.domain_name_syntax_valid( "xn--d1acufc.xn--p1ai." ).should be_true
92
+ Bind9mgr::Zone.domain_name_syntax_valid( "xn--l1a.xn--p1ai" ).should be_false # м.рф в punycode
89
93
  end
90
94
 
91
95
  it "should validate domain name" do
metadata CHANGED
@@ -1,48 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bind9mgr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.19
5
- prerelease:
4
+ version: 0.3.20
6
5
  platform: ruby
7
6
  authors:
8
7
  - Mikhail Barablin
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-09-20 00:00:00.000000000 Z
11
+ date: 2015-02-27 00:00:00.000000000 Z
13
12
  dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: rdoc
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ~>
20
- - !ruby/object:Gem::Version
21
- version: '3.10'
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: '3.10'
30
13
  - !ruby/object:Gem::Dependency
31
14
  name: hoe
32
15
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
16
  requirements:
35
- - - ~>
17
+ - - "~>"
36
18
  - !ruby/object:Gem::Version
37
- version: '3.5'
19
+ version: '2.12'
38
20
  type: :development
39
21
  prerelease: false
40
22
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
23
  requirements:
43
- - - ~>
24
+ - - "~>"
44
25
  - !ruby/object:Gem::Version
45
- version: '3.5'
26
+ version: '2.12'
46
27
  description: This gem contains some classes to manage bind9 zone files
47
28
  email:
48
29
  - mikhail@mad-box.ru
@@ -54,7 +35,8 @@ extra_rdoc_files:
54
35
  - Manifest.txt
55
36
  - README.txt
56
37
  files:
57
- - .autotest
38
+ - ".autotest"
39
+ - ".gemtest"
58
40
  - History.txt
59
41
  - Manifest.txt
60
42
  - README.txt
@@ -62,39 +44,37 @@ files:
62
44
  - bin/bind9mgr
63
45
  - lib/bind9mgr.rb
64
46
  - lib/named_conf.rb
65
- - lib/zone.rb
66
47
  - lib/parser.rb
67
48
  - lib/resource_record.rb
49
+ - lib/zone.rb
68
50
  - spec/named_conf_spec.rb
69
- - spec/zone_spec.rb
70
- - spec/spec_helper.rb
71
51
  - spec/parser_spec.rb
72
52
  - spec/resource_record_spec.rb
73
- - .gemtest
53
+ - spec/spec_helper.rb
54
+ - spec/zone_spec.rb
74
55
  homepage: https://github.com/madbox/bind9mgr
75
56
  licenses: []
57
+ metadata: {}
76
58
  post_install_message:
77
59
  rdoc_options:
78
- - --main
60
+ - "--main"
79
61
  - README.txt
80
62
  require_paths:
81
63
  - lib
82
64
  required_ruby_version: !ruby/object:Gem::Requirement
83
- none: false
84
65
  requirements:
85
- - - ! '>='
66
+ - - ">="
86
67
  - !ruby/object:Gem::Version
87
68
  version: '0'
88
69
  required_rubygems_version: !ruby/object:Gem::Requirement
89
- none: false
90
70
  requirements:
91
- - - ! '>='
71
+ - - ">="
92
72
  - !ruby/object:Gem::Version
93
73
  version: '0'
94
74
  requirements: []
95
75
  rubyforge_project: bind9mgr
96
- rubygems_version: 1.8.24
76
+ rubygems_version: 2.4.4
97
77
  signing_key:
98
- specification_version: 3
78
+ specification_version: 4
99
79
  summary: This gem contains some classes to manage bind9 zone files
100
80
  test_files: []