domain_name 0.5.6 → 0.5.7

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -1,31 +1,50 @@
1
1
  require 'bundler/gem_tasks'
2
+ require 'uri'
2
3
 
3
- require 'rake/testtask'
4
- Rake::TestTask.new(:test) do |test|
5
- test.libs << 'lib' << 'test'
6
- test.pattern = 'test/**/test_*.rb'
7
- test.verbose = true
8
- end
4
+ ETLD_DATA_URI = URI('http://mxr.mozilla.org/mozilla-central/source/netwerk/dns/effective_tld_names.dat?raw=1')
5
+ ETLD_DATA_FILE = 'data/effective_tld_names.dat'
6
+ ETLD_DATA_RB = 'lib/domain_name/etld_data.rb'
9
7
 
10
8
  task :default => :test
11
9
 
12
- task :test => 'lib/domain_name/etld_data.rb'
10
+ task :test => ETLD_DATA_RB
13
11
 
14
- etld_dat = 'data/effective_tld_names.dat'
12
+ file ETLD_DATA_RB => [
13
+ ETLD_DATA_FILE,
14
+ ETLD_DATA_RB + '.erb',
15
+ 'tool/gen_etld_data.rb'
16
+ ] do
17
+ ruby 'tool/gen_etld_data.rb'
18
+ end
15
19
 
16
- file etld_dat do
20
+ task :etld_data do
17
21
  require 'open-uri'
18
- File.open(etld_dat, 'w') { |dat|
19
- dat.print URI('http://mxr.mozilla.org/mozilla-central/source/netwerk/dns/effective_tld_names.dat?raw=1').read
20
- }
22
+ require 'time'
23
+
24
+ begin
25
+ load File.join('.', ETLD_DATA_RB)
26
+
27
+ data = ETLD_DATA_URI.read(
28
+ 'If-Modified-Since' => Time.parse(DomainName::ETLD_DATA_DATE).rfc2822
29
+ )
30
+ puts 'eTLD database is modified.'
31
+ File.write(ETLD_DATA_FILE, data)
32
+ File.utime Time.now, data.last_modified, ETLD_DATA_FILE
33
+ Rake::Task[ETLD_DATA_RB].execute
34
+ rescue OpenURI::HTTPError => e
35
+ if e.io.status.first == '304' # Not Modified
36
+ puts 'eTLD database is up-to-date.'
37
+ else
38
+ raise
39
+ end
40
+ end
21
41
  end
22
42
 
23
- file 'lib/domain_name/etld_data.rb' => [
24
- etld_dat,
25
- 'lib/domain_name/etld_data.rb.erb',
26
- 'tool/gen_etld_data.rb'
27
- ] do
28
- ruby 'tool/gen_etld_data.rb'
43
+ require 'rake/testtask'
44
+ Rake::TestTask.new(:test) do |test|
45
+ test.libs << 'lib' << 'test'
46
+ test.pattern = 'test/**/test_*.rb'
47
+ test.verbose = true
29
48
  end
30
49
 
31
50
  require 'rdoc/task'
@@ -5367,6 +5367,7 @@ belau.pw
5367
5367
 
5368
5368
  // py : http://www.nic.py/pautas.html#seccion_9
5369
5369
  // Confirmed by registry 2012-10-03
5370
+ py
5370
5371
  com.py
5371
5372
  coop.py
5372
5373
  edu.py
@@ -5374,8 +5375,6 @@ gov.py
5374
5375
  mil.py
5375
5376
  net.py
5376
5377
  org.py
5377
- !nic.py
5378
- !una.py
5379
5378
 
5380
5379
  // qa : http://domains.qa/en/
5381
5380
  qa
@@ -1,4 +1,6 @@
1
1
  class DomainName
2
+ ETLD_DATA_DATE = '2012-12-21T00:00:53Z'
3
+
2
4
  ETLD_DATA = {
3
5
  "ac" => 0,
4
6
  "com.ac" => 0,
@@ -4835,7 +4837,7 @@ class DomainName
4835
4837
  "ed.pw" => 0,
4836
4838
  "go.pw" => 0,
4837
4839
  "belau.pw" => 0,
4838
- "py" => 1,
4840
+ "py" => 0,
4839
4841
  "com.py" => 0,
4840
4842
  "coop.py" => 0,
4841
4843
  "edu.py" => 0,
@@ -4843,8 +4845,6 @@ class DomainName
4843
4845
  "mil.py" => 0,
4844
4846
  "net.py" => 0,
4845
4847
  "org.py" => 0,
4846
- "nic.py" => 1,
4847
- "una.py" => 1,
4848
4848
  "qa" => 0,
4849
4849
  "com.qa" => 0,
4850
4850
  "edu.qa" => 0,
@@ -1,4 +1,6 @@
1
1
  class DomainName
2
+ ETLD_DATA_DATE = '<%= etld_data_date.utc.strftime('%Y-%m-%dT%H:%M:%SZ') %>'
3
+
2
4
  ETLD_DATA = {
3
5
  <% etld_data.each_pair { |key, value| %> <%= key.inspect %> => <%= value.inspect %>,
4
6
  <% } %> }
@@ -1,3 +1,3 @@
1
1
  class DomainName
2
- VERSION = "0.5.6"
2
+ VERSION = "0.5.7"
3
3
  end
@@ -14,6 +14,8 @@ def main
14
14
  erb_file = dir + 'etld_data.rb.erb'
15
15
  rb_file = dir + 'etld_data.rb'
16
16
 
17
+ etld_data_date = File.mtime(dat_file)
18
+
17
19
  File.open(dat_file, 'r:utf-8') { |dat|
18
20
  etld_data = parse(dat)
19
21
  File.open(rb_file, 'w:utf-8') { |rb|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: domain_name
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.6
4
+ version: 0.5.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-06 00:00:00.000000000 Z
12
+ date: 2013-01-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: unf
16
- requirement: &70222883246680 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: 0.0.3
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70222883246680
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 0.0.3
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: shoulda
27
- requirement: &70222883245300 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ! '>='
@@ -32,10 +37,15 @@ dependencies:
32
37
  version: '0'
33
38
  type: :development
34
39
  prerelease: false
35
- version_requirements: *70222883245300
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
36
46
  - !ruby/object:Gem::Dependency
37
47
  name: bundler
38
- requirement: &70222883243800 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
39
49
  none: false
40
50
  requirements:
41
51
  - - ~>
@@ -43,10 +53,15 @@ dependencies:
43
53
  version: 1.2.0
44
54
  type: :development
45
55
  prerelease: false
46
- version_requirements: *70222883243800
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 1.2.0
47
62
  - !ruby/object:Gem::Dependency
48
63
  name: rdoc
49
- requirement: &70222883242920 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
50
65
  none: false
51
66
  requirements:
52
67
  - - ! '>='
@@ -54,7 +69,12 @@ dependencies:
54
69
  version: 2.4.2
55
70
  type: :development
56
71
  prerelease: false
57
- version_requirements: *70222883242920
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: 2.4.2
58
78
  description: ! 'This is a Domain Name manipulation library for Ruby.
59
79
 
60
80
 
@@ -109,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
109
129
  version: '0'
110
130
  requirements: []
111
131
  rubyforge_project:
112
- rubygems_version: 1.8.15
132
+ rubygems_version: 1.8.24
113
133
  signing_key:
114
134
  specification_version: 3
115
135
  summary: Domain Name manipulation library for Ruby