domain_name 0.5.3 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
- #
2
+ #--
3
3
  # punycode.rb - PunyCode encoder for the Domain Name library
4
4
  #
5
5
  # Copyright (C) 2011, 2012 Akinori MUSHA, All rights reserved.
@@ -46,6 +46,7 @@
46
46
  # Srikanth Veeramachaneni (VeriSign)
47
47
  # Nagesh Chigurupati (Verisign)
48
48
  # Praveen Srinivasan(Verisign)
49
+ #++
49
50
 
50
51
  class DomainName
51
52
  module Punycode
@@ -0,0 +1,3 @@
1
+ class DomainName
2
+ VERSION = "0.5.4"
3
+ end
@@ -78,13 +78,15 @@ class TestDomainName < Test::Unit::TestCase
78
78
  ['test.ac.jp', 'test.ac.jp', true, 'jp', true],
79
79
  ['www.test.ac.jp', 'test.ac.jp', true, 'jp', true],
80
80
  ['kyoto.jp', nil, false, 'jp', true],
81
- ['c.kyoto.jp', nil, false, 'jp', true],
82
- ['b.c.kyoto.jp', 'b.c.kyoto.jp', true, 'jp', true],
83
- ['a.b.c.kyoto.jp', 'b.c.kyoto.jp', true, 'jp', true],
84
- ['pref.kyoto.jp', 'pref.kyoto.jp', true, 'jp', true], # Exception rule
85
- ['www.pref.kyoto.jp', 'pref.kyoto.jp', true, 'jp', true], # Exception rule.
86
- ['city.kyoto.jp', 'city.kyoto.jp', true, 'jp', true], # Exception rule.
87
- ['www.city.kyoto.jp', 'city.kyoto.jp', true, 'jp', true], # Exception rule.
81
+ ['test.kyoto.jp', 'test.kyoto.jp', true, 'jp', true],
82
+ ['ide.kyoto.jp', nil, false, 'jp', true],
83
+ ['b.ide.kyoto.jp', 'b.ide.kyoto.jp', true, 'jp', true],
84
+ ['a.b.ide.kyoto.jp', 'b.ide.kyoto.jp', true, 'jp', true],
85
+ ['c.kobe.jp', nil, false, 'jp', true],
86
+ ['b.c.kobe.jp', 'b.c.kobe.jp', true, 'jp', true],
87
+ ['a.b.c.kobe.jp', 'b.c.kobe.jp', true, 'jp', true],
88
+ ['city.kobe.jp', 'city.kobe.jp', true, 'jp', true],
89
+ ['www.city.kobe.jp', 'city.kobe.jp', true, 'jp', true],
88
90
  # TLD with a wildcard rule and exceptions.
89
91
  ['om', nil, false, 'om', true],
90
92
  ['test.om', nil, false, 'om', true],
@@ -104,10 +106,10 @@ class TestDomainName < Test::Unit::TestCase
104
106
  ['www.test.k12.ak.us', 'test.k12.ak.us', true, 'us', true],
105
107
  ].each { |hostname, domain, canonical, tld, canonical_tld|
106
108
  dn = DomainName.new(hostname)
107
- assert_equal(domain, dn.domain)
108
- assert_equal(canonical, dn.canonical?)
109
- assert_equal(tld, dn.tld)
110
- assert_equal(canonical_tld, dn.canonical_tld?)
109
+ assert_equal(domain, dn.domain, hostname + ':domain')
110
+ assert_equal(canonical, dn.canonical?, hostname + ':canoninal?')
111
+ assert_equal(tld, dn.tld, hostname + ':tld')
112
+ assert_equal(canonical_tld, dn.canonical_tld?, hostname + ':canoninal_tld?')
111
113
  }
112
114
  end
113
115
 
@@ -159,34 +161,34 @@ class TestDomainName < Test::Unit::TestCase
159
161
 
160
162
  should "check cookie domain correctly" do
161
163
  [
162
- ['b.kyoto.jp', 'jp', false],
163
- ['b.kyoto.jp', 'kyoto.jp', false],
164
- ['b.kyoto.jp', 'b.kyoto.jp', false],
165
- ['b.kyoto.jp', 'a.b.kyoto.jp', false],
164
+ ['b.sapporo.jp', 'jp', false],
165
+ ['b.sapporo.jp', 'sapporo.jp', false],
166
+ ['b.sapporo.jp', 'b.sapporo.jp', false],
167
+ ['b.sapporo.jp', 'a.b.sapporo.jp', false],
166
168
 
167
- ['b.c.kyoto.jp', 'jp', false],
168
- ['b.c.kyoto.jp', 'kyoto.jp', false],
169
- ['b.c.kyoto.jp', 'c.kyoto.jp', false],
170
- ['b.c.kyoto.jp', 'b.c.kyoto.jp', true],
171
- ['b.c.kyoto.jp', 'a.b.c.kyoto.jp', false],
169
+ ['b.c.sapporo.jp', 'jp', false],
170
+ ['b.c.sapporo.jp', 'sapporo.jp', false],
171
+ ['b.c.sapporo.jp', 'c.sapporo.jp', false],
172
+ ['b.c.sapporo.jp', 'b.c.sapporo.jp', true],
173
+ ['b.c.sapporo.jp', 'a.b.c.sapporo.jp', false],
172
174
 
173
- ['b.c.d.kyoto.jp', 'jp', false],
174
- ['b.c.d.kyoto.jp', 'kyoto.jp', false],
175
- ['b.c.d.kyoto.jp', 'd.kyoto.jp', false],
176
- ['b.c.d.kyoto.jp', 'c.d.kyoto.jp', true],
177
- ['b.c.d.kyoto.jp', 'b.c.d.kyoto.jp', true],
178
- ['b.c.d.kyoto.jp', 'a.b.c.d.kyoto.jp', false],
175
+ ['b.c.d.sapporo.jp', 'jp', false],
176
+ ['b.c.d.sapporo.jp', 'sapporo.jp', false],
177
+ ['b.c.d.sapporo.jp', 'd.sapporo.jp', false],
178
+ ['b.c.d.sapporo.jp', 'c.d.sapporo.jp', true],
179
+ ['b.c.d.sapporo.jp', 'b.c.d.sapporo.jp', true],
180
+ ['b.c.d.sapporo.jp', 'a.b.c.d.sapporo.jp', false],
179
181
 
180
- ['pref.kyoto.jp', 'jp', false],
181
- ['pref.kyoto.jp', 'kyoto.jp', false],
182
- ['pref.kyoto.jp', 'pref.kyoto.jp', true],
183
- ['pref.kyoto.jp', 'a.pref.kyoto.jp', false],
182
+ ['city.sapporo.jp', 'jp', false],
183
+ ['city.sapporo.jp', 'sapporo.jp', false],
184
+ ['city.sapporo.jp', 'city.sapporo.jp', true],
185
+ ['city.sapporo.jp', 'a.city.sapporo.jp', false],
184
186
 
185
- ['b.pref.kyoto.jp', 'jp', false],
186
- ['b.pref.kyoto.jp', 'kyoto.jp', false],
187
- ['b.pref.kyoto.jp', 'pref.kyoto.jp', true],
188
- ['b.pref.kyoto.jp', 'b.pref.kyoto.jp', true],
189
- ['b.pref.kyoto.jp', 'a.b.pref.kyoto.jp', false],
187
+ ['b.city.sapporo.jp', 'jp', false],
188
+ ['b.city.sapporo.jp', 'sapporo.jp', false],
189
+ ['b.city.sapporo.jp', 'city.sapporo.jp', true],
190
+ ['b.city.sapporo.jp', 'b.city.sapporo.jp', true],
191
+ ['b.city.sapporo.jp', 'a.b.city.sapporo.jp', false],
190
192
  ].each { |host, domain, expected|
191
193
  dn = DomainName(host)
192
194
  assert_equal(expected, dn.cookie_domain?(domain))
@@ -197,18 +199,14 @@ class TestDomainName < Test::Unit::TestCase
197
199
 
198
200
  should "parse IPv4 addresseses" do
199
201
  a = '192.168.10.20'
200
- b = '192.168.010.020'
201
- dn = DomainName(b)
202
+ dn = DomainName(a)
202
203
  assert_equal(a, dn.hostname)
203
204
  assert_equal(true, dn.ipaddr?)
204
205
  assert_equal(IPAddr.new(a), dn.ipaddr)
205
206
  assert_equal(true, dn.cookie_domain?(a))
206
- assert_equal(true, dn.cookie_domain?(b))
207
207
  assert_equal(true, dn.cookie_domain?(dn))
208
208
  assert_equal(false, dn.cookie_domain?('168.10.20'))
209
- assert_equal(false, dn.cookie_domain?('168.010.020'))
210
209
  assert_equal(false, dn.cookie_domain?('20'))
211
- assert_equal(false, dn.cookie_domain?('020'))
212
210
  end
213
211
 
214
212
  should "parse IPv6 addresseses" do
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.3
4
+ version: 0.5.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-06 00:00:00.000000000 Z
12
+ date: 2012-09-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: unf
@@ -50,7 +50,7 @@ dependencies:
50
50
  requirements:
51
51
  - - ~>
52
52
  - !ruby/object:Gem::Version
53
- version: 1.1.0
53
+ version: 1.2.0
54
54
  type: :development
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
@@ -58,23 +58,7 @@ dependencies:
58
58
  requirements:
59
59
  - - ~>
60
60
  - !ruby/object:Gem::Version
61
- version: 1.1.0
62
- - !ruby/object:Gem::Dependency
63
- name: jeweler
64
- requirement: !ruby/object:Gem::Requirement
65
- none: false
66
- requirements:
67
- - - ~>
68
- - !ruby/object:Gem::Version
69
- version: 1.6.4
70
- type: :development
71
- prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
- requirements:
75
- - - ~>
76
- - !ruby/object:Gem::Version
77
- version: 1.6.4
61
+ version: 1.2.0
78
62
  - !ruby/object:Gem::Dependency
79
63
  name: rdoc
80
64
  requirement: !ruby/object:Gem::Requirement
@@ -99,7 +83,8 @@ description: ! 'This is a Domain Name manipulation library for Ruby.
99
83
  Suffix List.
100
84
 
101
85
  '
102
- email: knu@idaemons.org
86
+ email:
87
+ - knu@idaemons.org
103
88
  executables: []
104
89
  extensions: []
105
90
  extra_rdoc_files:
@@ -107,22 +92,23 @@ extra_rdoc_files:
107
92
  - README.md
108
93
  files:
109
94
  - .document
95
+ - .gitignore
110
96
  - Gemfile
111
97
  - LICENSE.txt
112
98
  - README.md
113
99
  - Rakefile
114
- - VERSION
115
100
  - data/effective_tld_names.dat
116
101
  - domain_name.gemspec
117
102
  - lib/domain_name.rb
118
103
  - lib/domain_name/etld_data.rb
119
104
  - lib/domain_name/etld_data.rb.erb
120
105
  - lib/domain_name/punycode.rb
106
+ - lib/domain_name/version.rb
121
107
  - test/helper.rb
122
108
  - test/test_domain_name-punycode.rb
123
109
  - test/test_domain_name.rb
124
110
  - tool/gen_etld_data.rb
125
- homepage: http://github.com/knu/ruby-domain_name
111
+ homepage: https://github.com/knu/ruby-domain_name
126
112
  licenses:
127
113
  - BSD + MPL 1.1/GPL 2.0/LGPL 2.1
128
114
  post_install_message:
@@ -135,9 +121,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
135
121
  - - ! '>='
136
122
  - !ruby/object:Gem::Version
137
123
  version: '0'
138
- segments:
139
- - 0
140
- hash: -1258501941076469497
141
124
  required_rubygems_version: !ruby/object:Gem::Requirement
142
125
  none: false
143
126
  requirements:
@@ -146,8 +129,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
146
129
  version: '0'
147
130
  requirements: []
148
131
  rubyforge_project:
149
- rubygems_version: 1.8.21
132
+ rubygems_version: 1.8.24
150
133
  signing_key:
151
134
  specification_version: 3
152
135
  summary: Domain Name manipulation library for Ruby
153
- test_files: []
136
+ test_files:
137
+ - test/helper.rb
138
+ - test/test_domain_name-punycode.rb
139
+ - test/test_domain_name.rb
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.5.3