domainatrix 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +4 -0
- data/lib/domainatrix.rb +1 -1
- data/lib/domainatrix/domain_parser.rb +17 -8
- data/lib/domainatrix/url.rb +8 -8
- data/lib/effective_tld_names.dat +2769 -263
- data/spec/domainatrix/domain_parser_spec.rb +4 -4
- data/spec/domainatrix_spec.rb +37 -0
- metadata +46 -39
@@ -20,7 +20,7 @@ describe "domain parser" do
|
|
20
20
|
|
21
21
|
it "creates lower levels of the tree" do
|
22
22
|
@domain_parser.public_suffixes["jp"].should have_key("ac")
|
23
|
-
@domain_parser.public_suffixes["jp"]["
|
23
|
+
@domain_parser.public_suffixes["jp"]["kawasaki"].should have_key("*")
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
@@ -51,7 +51,7 @@ describe "domain parser" do
|
|
51
51
|
@domain_parser.parse("http://pauldix.net")[:public_suffix].should == "net"
|
52
52
|
@domain_parser.parse("http://pauldix.co.uk")[:public_suffix].should == "co.uk"
|
53
53
|
@domain_parser.parse("http://pauldix.com.kg")[:public_suffix].should == "com.kg"
|
54
|
-
@domain_parser.parse("http://pauldix.com.
|
54
|
+
@domain_parser.parse("http://pauldix.com.kawasaki.jp")[:public_suffix].should == "com.kawasaki.jp"
|
55
55
|
end
|
56
56
|
|
57
57
|
it "should have the domain" do
|
@@ -60,7 +60,7 @@ describe "domain parser" do
|
|
60
60
|
@domain_parser.parse("http://pauldix.co.uk")[:domain].should == "pauldix"
|
61
61
|
@domain_parser.parse("http://foo.pauldix.co.uk")[:domain].should == "pauldix"
|
62
62
|
@domain_parser.parse("http://pauldix.com.kg")[:domain].should == "pauldix"
|
63
|
-
@domain_parser.parse("http://pauldix.com.
|
63
|
+
@domain_parser.parse("http://pauldix.com.kawasaki.jp")[:domain].should == "pauldix"
|
64
64
|
end
|
65
65
|
|
66
66
|
it "should have subdomains" do
|
@@ -68,4 +68,4 @@ describe "domain parser" do
|
|
68
68
|
@domain_parser.parse("http://bar.foo.pauldix.co.uk")[:subdomain].should == "bar.foo"
|
69
69
|
end
|
70
70
|
end
|
71
|
-
end
|
71
|
+
end
|
data/spec/domainatrix_spec.rb
CHANGED
@@ -13,4 +13,41 @@ describe "domainatrix" do
|
|
13
13
|
Domainatrix.parse("http://foo.bar.pauldix.net").canonical.should == "net.pauldix.bar.foo"
|
14
14
|
Domainatrix.parse("http://pauldix.co.uk").canonical.should == "uk.co.pauldix"
|
15
15
|
end
|
16
|
+
|
17
|
+
context 'localhost with a port' do
|
18
|
+
subject { Domainatrix.parse('localhost:3000') }
|
19
|
+
its(:scheme) { should == 'http' }
|
20
|
+
its(:host) { should == 'localhost' }
|
21
|
+
its(:url) { should == 'http://localhost:3000' }
|
22
|
+
its(:public_suffix) { should == '' }
|
23
|
+
its(:domain) { should == 'localhost' }
|
24
|
+
its(:subdomain) { should == '' }
|
25
|
+
its(:path) { should == '' }
|
26
|
+
its(:domain_with_tld) { should == 'localhost' }
|
27
|
+
end
|
28
|
+
|
29
|
+
context 'without a scheme' do
|
30
|
+
subject { Domainatrix.parse('www.pauldix.net') }
|
31
|
+
its(:scheme) { should == 'http' }
|
32
|
+
its(:host) { should == 'www.pauldix.net' }
|
33
|
+
its(:url) { should == 'http://www.pauldix.net' }
|
34
|
+
its(:public_suffix) { should == 'net' }
|
35
|
+
its(:domain) { should == 'pauldix' }
|
36
|
+
its(:subdomain) { should == 'www' }
|
37
|
+
its(:path) { should == '' }
|
38
|
+
its(:domain_with_tld) { should == 'pauldix.net' }
|
39
|
+
end
|
40
|
+
|
41
|
+
context 'with a blank url' do
|
42
|
+
subject { Domainatrix.parse(nil) }
|
43
|
+
its(:scheme) { should == '' }
|
44
|
+
its(:host) { should == '' }
|
45
|
+
its(:url) { should == '' }
|
46
|
+
its(:public_suffix) { should == '' }
|
47
|
+
its(:domain) { should == '' }
|
48
|
+
its(:subdomain) { should == '' }
|
49
|
+
its(:path) { should == '' }
|
50
|
+
its(:domain_with_tld) { should == '' }
|
51
|
+
end
|
52
|
+
|
16
53
|
end
|
metadata
CHANGED
@@ -1,75 +1,82 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: domainatrix
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.11
|
4
5
|
prerelease:
|
5
|
-
version: 0.0.10
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Paul Dix
|
9
|
+
- Brian John
|
9
10
|
autorequire:
|
10
11
|
bindir: bin
|
11
12
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
dependencies:
|
16
|
-
- !ruby/object:Gem::Dependency
|
13
|
+
date: 2012-09-22 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
17
16
|
name: addressable
|
18
|
-
|
19
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
17
|
+
requirement: &70104750767700 !ruby/object:Gem::Requirement
|
20
18
|
none: false
|
21
|
-
requirements:
|
22
|
-
- -
|
23
|
-
- !ruby/object:Gem::Version
|
24
|
-
version:
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '0'
|
25
23
|
type: :runtime
|
26
|
-
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: *70104750767700
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: rspec
|
28
|
+
requirement: &70104750767080 !ruby/object:Gem::Requirement
|
29
|
+
none: false
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: *70104750767080
|
27
37
|
description:
|
28
|
-
email:
|
38
|
+
email:
|
39
|
+
- paul@pauldix.net
|
40
|
+
- brian@brianjohn.com
|
29
41
|
executables: []
|
30
|
-
|
31
42
|
extensions: []
|
32
|
-
|
33
43
|
extra_rdoc_files: []
|
34
|
-
|
35
|
-
files:
|
44
|
+
files:
|
36
45
|
- lib/domainatrix.rb
|
37
46
|
- lib/effective_tld_names.dat
|
38
47
|
- lib/domainatrix/domain_parser.rb
|
39
48
|
- lib/domainatrix/url.rb
|
49
|
+
- CHANGELOG.md
|
40
50
|
- README.textile
|
41
51
|
- spec/spec.opts
|
42
52
|
- spec/spec_helper.rb
|
43
53
|
- spec/domainatrix_spec.rb
|
44
54
|
- spec/domainatrix/domain_parser_spec.rb
|
45
55
|
- spec/domainatrix/url_spec.rb
|
46
|
-
has_rdoc: true
|
47
56
|
homepage: http://github.com/pauldix/domainatrix
|
48
57
|
licenses: []
|
49
|
-
|
50
58
|
post_install_message:
|
51
59
|
rdoc_options: []
|
52
|
-
|
53
|
-
require_paths:
|
60
|
+
require_paths:
|
54
61
|
- lib
|
55
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
62
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
56
63
|
none: false
|
57
|
-
requirements:
|
58
|
-
- -
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
version:
|
61
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ! '>='
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
68
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
62
69
|
none: false
|
63
|
-
requirements:
|
64
|
-
- -
|
65
|
-
- !ruby/object:Gem::Version
|
66
|
-
version:
|
70
|
+
requirements:
|
71
|
+
- - ! '>='
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
67
74
|
requirements: []
|
68
|
-
|
69
75
|
rubyforge_project:
|
70
|
-
rubygems_version: 1.
|
76
|
+
rubygems_version: 1.8.17
|
71
77
|
signing_key:
|
72
78
|
specification_version: 2
|
73
|
-
summary: A cruel mistress that uses the public suffix domain list to dominate URLs
|
79
|
+
summary: A cruel mistress that uses the public suffix domain list to dominate URLs
|
80
|
+
by canonicalizing, finding the public suffix, and breaking them into their domain
|
81
|
+
parts.
|
74
82
|
test_files: []
|
75
|
-
|